From 06b55feae6388e4b2f80385f35c0fd1cd578216b Mon Sep 17 00:00:00 2001 From: lian Date: Wed, 2 Dec 2020 21:31:17 +0800 Subject: [PATCH] add ABOUT_DIALOG_CUSTOM_HTML (#4734) Co-authored-by: lian --- .../src/components/dialog/about-dialog.js | 40 ++++++++++++------- frontend/src/utils/constants.js | 1 + seahub/base/context_processors.py | 7 ++++ seahub/templates/base_for_react.html | 1 + 4 files changed, 35 insertions(+), 14 deletions(-) diff --git a/frontend/src/components/dialog/about-dialog.js b/frontend/src/components/dialog/about-dialog.js index 5b64f44da5..da68b584d2 100644 --- a/frontend/src/components/dialog/about-dialog.js +++ b/frontend/src/components/dialog/about-dialog.js @@ -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,21 +24,33 @@ class AboutDialog extends React.Component { } render() { + let href = lang === lang == 'zh-cn' ? 'http://seafile.com/about/' : 'http://seafile.com/en/about/'; - return ( - - - -
-

logo

-

{gettext('Server Version: ')}{seafileVersion}
© 2020 {gettext('Seafile')}

-

{this.renderExternalAboutLinks()}

-

{gettext('About Us')}

-
-
-
- ); + if (aboutDialogCustomHtml) { + return ( + + + +
+
+
+ ); + } else { + return ( + + + +
+

logo

+

{gettext('Server Version: ')}{seafileVersion}
© 2020 {gettext('Seafile')}

+

{this.renderExternalAboutLinks()}

+

{gettext('About Us')}

+
+
+
+ ); + } } } diff --git a/frontend/src/utils/constants.js b/frontend/src/utils/constants.js index 47c9514aa4..4532b512d0 100644 --- a/frontend/src/utils/constants.js +++ b/frontend/src/utils/constants.js @@ -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; diff --git a/seahub/base/context_processors.py b/seahub/base/context_processors.py index 915094b80f..c79d589bb5 100644 --- a/seahub/base/context_processors.py +++ b/seahub/base/context_processors.py @@ -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. diff --git a/seahub/templates/base_for_react.html b/seahub/templates/base_for_react.html index 99e50371ae..2bdb907330 100644 --- a/seahub/templates/base_for_react.html +++ b/seahub/templates/base_for_react.html @@ -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 %},