Add HomepageUrl and Description to app.

This commit is contained in:
Yang Luo 2021-03-06 21:50:48 +08:00
parent 45ec95b859
commit 5e04b8c726
3 changed files with 39 additions and 1 deletions

View File

@ -26,6 +26,8 @@ type Application struct {
DisplayName string `xorm:"varchar(100)" json:"displayName"` DisplayName string `xorm:"varchar(100)" json:"displayName"`
Logo string `xorm:"varchar(100)" json:"logo"` Logo string `xorm:"varchar(100)" json:"logo"`
HomepageUrl string `xorm:"varchar(100)" json:"homepageUrl"`
Description string `xorm:"varchar(100)" json:"description"`
Organization string `xorm:"varchar(100)" json:"organization"` Organization string `xorm:"varchar(100)" json:"organization"`
EnablePassword bool `json:"enablePassword"` EnablePassword bool `json:"enablePassword"`
Providers []string `xorm:"varchar(100)" json:"providers"` Providers []string `xorm:"varchar(100)" json:"providers"`

View File

@ -142,6 +142,26 @@ class ApplicationEditPage extends React.Component {
</Row> </Row>
</Col> </Col>
</Row> </Row>
<Row style={{marginTop: '20px'}} >
<Col style={{marginTop: '5px'}} span={2}>
{i18next.t("general:Homepage URL")}:
</Col>
<Col span={22} >
<Input prefix={<LinkOutlined/>} value={this.state.application.homepageUrl} onChange={e => {
this.updateApplicationField('homepageUrl', e.target.value);
}} />
</Col>
</Row>
<Row style={{marginTop: '20px'}} >
<Col style={{marginTop: '5px'}} span={2}>
{i18next.t("general:Description")}:
</Col>
<Col span={22} >
<Input value={this.state.application.description} onChange={e => {
this.updateApplicationField('description', e.target.value);
}} />
</Col>
</Row>
<Row style={{marginTop: '20px'}} > <Row style={{marginTop: '20px'}} >
<Col style={{marginTop: '5px'}} span={2}> <Col style={{marginTop: '5px'}} span={2}>
{i18next.t("general:Organization")}: {i18next.t("general:Organization")}:

View File

@ -149,6 +149,20 @@ class Face extends React.Component {
); );
} }
renderLogo(application) {
if (application.homepageUrl !== "") {
return (
<a target="_blank" href={application.homepageUrl}>
<img width={250} src={application.logo} alt={application.displayName} style={{marginBottom: '30px'}}/>
</a>
)
} else {
return (
<img width={250} src={application.logo} alt={application.displayName} style={{marginBottom: '30px'}}/>
);
}
}
render() { render() {
const application = this.getApplicationObj(); const application = this.getApplicationObj();
if (application === null) { if (application === null) {
@ -159,7 +173,9 @@ class Face extends React.Component {
<Row> <Row>
<Col span={24} style={{display: "flex", justifyContent: "center"}} > <Col span={24} style={{display: "flex", justifyContent: "center"}} >
<div style={{marginTop: "80px", textAlign: "center"}}> <div style={{marginTop: "80px", textAlign: "center"}}>
<img width={250} src={application.logo} alt={application.displayName} style={{marginBottom: '30px'}}/> {
this.renderLogo(application)
}
{ {
this.renderForm(application) this.renderForm(application)
} }