diff --git a/frontend/src/components/dialog/change-repo-password-dialog.js b/frontend/src/components/dialog/change-repo-password-dialog.js index 3a3fc9cc53..144b7c3c56 100644 --- a/frontend/src/components/dialog/change-repo-password-dialog.js +++ b/frontend/src/components/dialog/change-repo-password-dialog.js @@ -5,6 +5,7 @@ import { gettext, repoPasswordMinLength } from '../../utils/constants'; import { Utils } from '../../utils/utils'; import { seafileAPI } from '../../utils/seafile-api'; import toaster from '../toast'; +import StyledTitle from '../styled-title'; const propTypes = { repoID: PropTypes.string.isRequired, @@ -98,7 +99,9 @@ class ChangeRepoPasswordDialog extends React.Component { return ( - + + {gettext("Change Password of Library")}{' '} +
diff --git a/frontend/src/components/dialog/lib-sub-folder-permission-dialog.js b/frontend/src/components/dialog/lib-sub-folder-permission-dialog.js index 58f1fec1d2..aba412da88 100644 --- a/frontend/src/components/dialog/lib-sub-folder-permission-dialog.js +++ b/frontend/src/components/dialog/lib-sub-folder-permission-dialog.js @@ -3,6 +3,7 @@ import PropTypes from 'prop-types'; import { Modal, ModalHeader, ModalBody, TabContent, TabPane, Nav, NavItem, NavLink } from 'reactstrap'; import { gettext } from '../../utils/constants'; import { Utils } from '../../utils/utils'; +import StyledTitle from '../styled-title'; import LibSubFolderSetUserPermissionDialog from './lib-sub-folder-set-user-permission-dialog'; import LibSubFolderSetGroupPermissionDialog from './lib-sub-folder-set-group-permission-dialog'; import '../../css/share-link-dialog.css'; @@ -32,7 +33,7 @@ class LibSubFolderPermissionDialog extends React.Component { } renderContent = () => { - let activeTab = this.state.activeTab; + const activeTab = this.state.activeTab; return ( @@ -64,14 +65,28 @@ class LibSubFolderPermissionDialog extends React.Component { ); } - render() { + renderHeader = () => { const { repoName, folderName } = this.props; + if (repoName) { + return ( + + {gettext('Folder Permission')} + + ); + } + return ( + + {gettext('Set')}{' '}{gettext('permission')} + + ); + } + render() { return (
- + {this.renderHeader()} {this.renderContent()} diff --git a/frontend/src/components/dialog/transfer-dialog.js b/frontend/src/components/dialog/transfer-dialog.js index 4f5395e253..bf13d60b79 100644 --- a/frontend/src/components/dialog/transfer-dialog.js +++ b/frontend/src/components/dialog/transfer-dialog.js @@ -8,6 +8,7 @@ import { gettext, isPro } from '../../utils/constants'; import { Utils } from '../../utils/utils'; import toaster from '../toast'; import UserSelect from '../user-select'; +import StyledTitle from '../styled-title/index.js'; const propTypes = { itemName: PropTypes.string.isRequired, @@ -61,10 +62,6 @@ class TransferDialog extends React.Component { render() { const itemName = this.props.itemName; - const innerSpan = '' + itemName +''; - let msg = gettext('Transfer Library {library_name}'); - let message = msg.replace('{library_name}', innerSpan); - let canTransferToDept = true; if (this.props.canTransferToDept != undefined) { canTransferToDept = this.props.canTransferToDept; @@ -72,7 +69,7 @@ class TransferDialog extends React.Component { return ( -
+ {gettext('Transfer Library')}{' '} {this.state.transferToUser ? diff --git a/frontend/src/components/dialog/upload-remind-dialog.js b/frontend/src/components/dialog/upload-remind-dialog.js index 28c4cd1299..8f16ed6312 100644 --- a/frontend/src/components/dialog/upload-remind-dialog.js +++ b/frontend/src/components/dialog/upload-remind-dialog.js @@ -28,12 +28,16 @@ class UploadRemindDialog extends React.Component { } render() { - - let title = gettext('Replace file {filename}?'); - title = title.replace('{filename}', '' + this.props.currentResumableFile.fileName + ''); + const { fileName } = this.props.currentResumableFile; + const titlePrefix = gettext('Replace file'); return ( -
+ +
+ {titlePrefix}{' '} + {fileName}? +
+

{gettext('A file with the same name already exists in this folder.')}

{gettext('Replacing it will overwrite its content.')}

diff --git a/frontend/src/components/styled-title/index.js b/frontend/src/components/styled-title/index.js new file mode 100644 index 0000000000..e8f7b44dc7 --- /dev/null +++ b/frontend/src/components/styled-title/index.js @@ -0,0 +1,26 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +const propTypes = { + title: PropTypes.string.isRequired, + className: PropTypes.string, +}; + +class StyledTitle extends React.Component { + + static defaultProps = { + className: '', + } + + render() { + const { title } = this.props; + const className = `op-target ellipsis ellipsis-op-target ${className}` + return ( + {title}{' '} + ); + } +} + +StyledTitle.propTypes = propTypes; + +export default StyledTitle; diff --git a/frontend/src/repo-folder-trash.js b/frontend/src/repo-folder-trash.js index 69656154d9..aaab2dc605 100644 --- a/frontend/src/repo-folder-trash.js +++ b/frontend/src/repo-folder-trash.js @@ -10,6 +10,7 @@ import ModalPortal from './components/modal-portal'; import toaster from './components/toast'; import CommonToolbar from './components/toolbar/common-toolbar'; import CleanTrash from './components/dialog/clean-trash'; +import StyledTitle from './components/styled-title'; import './css/toolbar.css'; import './css/search.css'; @@ -192,7 +193,9 @@ class RepoFolderTrash extends React.Component {
-

+

+ {gettext('Trash')} +

diff --git a/frontend/src/repo-history.js b/frontend/src/repo-history.js index f0778a56f7..4f624b50c7 100644 --- a/frontend/src/repo-history.js +++ b/frontend/src/repo-history.js @@ -11,6 +11,7 @@ import ModalPortal from './components/modal-portal'; import CommonToolbar from './components/toolbar/common-toolbar'; import CommitDetails from './components/dialog/commit-details'; import UpdateRepoCommitLabels from './components/dialog/edit-repo-commit-labels'; +import StyledTitle from './components/styled-title'; import './css/toolbar.css'; import './css/search.css'; @@ -104,7 +105,9 @@ class RepoHistory extends React.Component {
-

+

+ {gettext('Modification History')} +

diff --git a/frontend/src/repo-snapshot.js b/frontend/src/repo-snapshot.js index 642d1ff568..04a304a0fc 100644 --- a/frontend/src/repo-snapshot.js +++ b/frontend/src/repo-snapshot.js @@ -9,6 +9,7 @@ import ModalPortal from './components/modal-portal'; import toaster from './components/toast'; import CommonToolbar from './components/toolbar/common-toolbar'; import ConfirmRestoreRepo from './components/dialog/confirm-restore-repo'; +import StyledTitle from './components/styled-title'; import './css/toolbar.css'; import './css/search.css'; @@ -139,7 +140,10 @@ class RepoSnapshot extends React.Component {
-

(${commitTime})`}}>

+

+ {gettext('Snapshot')}{' '} + (${commitTime}) +

diff --git a/frontend/src/utils/utils.js b/frontend/src/utils/utils.js index 307f36786e..4b595ea163 100644 --- a/frontend/src/utils/utils.js +++ b/frontend/src/utils/utils.js @@ -231,15 +231,6 @@ export const Utils = { .innerHTML; }, - generateDialogTitle: function(title, operationTarget) { - /* - * @param title: gettext('...{placeholder}...') - */ - const targetStr = this.HTMLescape(operationTarget); - const str = `${targetStr}`; - return title.replace('{placeholder}', str); - }, - getFileName: function(filePath) { let lastIndex = filePath.lastIndexOf('/'); return filePath.slice(lastIndex+1);