1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 23:20:51 +00:00

add ABOUT_DIALOG_CUSTOM_HTML (#4734)

Co-authored-by: lian <lian@seafile.com>
This commit is contained in:
lian
2020-12-02 21:31:17 +08:00
committed by GitHub
parent 248fe2e1f0
commit 06b55feae6
4 changed files with 35 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Modal, ModalBody } from 'reactstrap';
import { gettext, lang, mediaUrl, logoPath, logoWidth, logoHeight, siteTitle, seafileVersion, additionalAboutDialogLinks } from '../../utils/constants';
import { gettext, lang, mediaUrl, logoPath, logoWidth, logoHeight, siteTitle, seafileVersion, additionalAboutDialogLinks, aboutDialogCustomHtml } from '../../utils/constants';
const propTypes = {
onCloseAboutDialog: PropTypes.func.isRequired,
@@ -24,8 +24,19 @@ class AboutDialog extends React.Component {
}
render() {
let href = lang === lang == 'zh-cn' ? 'http://seafile.com/about/' : 'http://seafile.com/en/about/';
if (aboutDialogCustomHtml) {
return (
<Modal isOpen={true} toggle={this.toggle}>
<ModalBody>
<button type="button" className="close" onClick={this.toggle}><span aria-hidden="true">×</span></button>
<div className="about-content" dangerouslySetInnerHTML={{__html: aboutDialogCustomHtml}}></div>
</ModalBody>
</Modal>
);
} else {
return (
<Modal isOpen={true} toggle={this.toggle}>
<ModalBody>
@@ -41,6 +52,7 @@ class AboutDialog extends React.Component {
);
}
}
}
AboutDialog.propTypes = propTypes;

View File

@@ -48,6 +48,7 @@ export const shareLinkPasswordMinLength = window.app.pageOptions.shareLinkPasswo
export const shareLinkExpireDaysMin = window.app.pageOptions.shareLinkExpireDaysMin;
export const shareLinkExpireDaysMax = window.app.pageOptions.shareLinkExpireDaysMax;
export const sideNavFooterCustomHtml = window.app.pageOptions.sideNavFooterCustomHtml;
export const aboutDialogCustomHtml = window.app.pageOptions.aboutDialogCustomHtml;
export const shareLinkExpireDaysDefault = window.app.pageOptions.shareLinkExpireDaysDefault;
export const uploadLinkExpireDaysMin = window.app.pageOptions.uploadLinkExpireDaysMin;
export const uploadLinkExpireDaysMax = window.app.pageOptions.uploadLinkExpireDaysMax;

View File

@@ -52,6 +52,11 @@ try:
except ImportError:
SIDE_NAV_FOOTER_CUSTOM_HTML = ''
try:
from seahub.settings import ABOUT_DIALOG_CUSTOM_HTML
except ImportError:
ABOUT_DIALOG_CUSTOM_HTML = ''
def base(request):
"""
@@ -144,6 +149,7 @@ def base(request):
'privacy_policy_link': PRIVACY_POLICY_LINK,
'terms_of_service_link': TERMS_OF_SERVICE_LINK,
'side_nav_footer_custom_html': SIDE_NAV_FOOTER_CUSTOM_HTML,
'about_dialog_custom_html': ABOUT_DIALOG_CUSTOM_HTML,
}
if request.user.is_staff:
@@ -152,6 +158,7 @@ def base(request):
return result
def debug(request):
"""
Returns context variables helpful for debugging.

View File

@@ -92,6 +92,7 @@
enableRepoSnapshotLabel: {% if enable_repo_snapshot_label %} true {% else %} false {% endif %},
shareLinkPasswordMinLength: {{ share_link_password_min_length }},
sideNavFooterCustomHtml: "{{ side_nav_footer_custom_html|safe|escapejs }}",
aboutDialogCustomHtml: "{{ about_dialog_custom_html|safe|escapejs }}",
maxFileName: "{{ max_file_name }}",
canPublishRepo: {% if user.permissions.can_publish_repo %} true {% else %} false {% endif %},
enableEncryptedLibrary: {% if enable_encrypted_library %} true {% else %} false {% endif %},