-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7818cdb
commit 08a489e
Showing
23 changed files
with
1,525 additions
and
217 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
frontend/src/components/select-editor/share-link-scope-editor.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import SelectEditor from './select-editor'; | ||
import { gettext, isEmailConfigured } from '../../utils/constants'; | ||
|
||
const propTypes = { | ||
isTextMode: PropTypes.bool.isRequired, | ||
isEditIconShow: PropTypes.bool.isRequired, | ||
currentScope: PropTypes.string.isRequired, | ||
onScopeChanged: PropTypes.func.isRequired | ||
}; | ||
|
||
class ShareLinkScopeEditor extends React.Component { | ||
|
||
translateScope = (scope) => { | ||
if (scope === 'all_users') { | ||
return gettext('Anyone with the link'); | ||
} | ||
|
||
if (scope === 'specific_users') { | ||
return gettext('Specific users in the team'); | ||
} | ||
|
||
if (scope === 'specific_emails') { | ||
return gettext('Specific people with email address'); | ||
} | ||
}; | ||
|
||
|
||
render() { | ||
let scopeOptions = ['all_users', 'specific_users']; | ||
if (isEmailConfigured) { | ||
scopeOptions.push('specific_emails'); | ||
} | ||
return ( | ||
<SelectEditor | ||
isTextMode={this.props.isTextMode} | ||
isEditIconShow={this.props.isEditIconShow} | ||
options={scopeOptions} | ||
currentOption={this.props.currentScope} | ||
onOptionChanged={this.props.onScopeChanged} | ||
translateOption={this.translateScope} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
ShareLinkScopeEditor.propTypes = propTypes; | ||
|
||
export default ShareLinkScopeEditor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.