diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-10-02 15:51:15 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-10-14 10:28:59 +0200 |
commit | 15b2160babc5c35ede960b7d0e133acbec8c6c51 (patch) | |
tree | 6475ad0602bbe4d6dae895aae43d331726ab8c33 /server/sonar-web/src/main/js/apps/permission-templates/permission-template-defaults.js | |
parent | e51e9c9eb0145ea5e9d40453554c456585b79936 (diff) | |
download | sonarqube-15b2160babc5c35ede960b7d0e133acbec8c6c51.tar.gz sonarqube-15b2160babc5c35ede960b7d0e133acbec8c6c51.zip |
improve the web build system, introduce gulp and browserify
Diffstat (limited to 'server/sonar-web/src/main/js/apps/permission-templates/permission-template-defaults.js')
-rw-r--r-- | server/sonar-web/src/main/js/apps/permission-templates/permission-template-defaults.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/permission-template-defaults.js b/server/sonar-web/src/main/js/apps/permission-templates/permission-template-defaults.js new file mode 100644 index 00000000000..39b9ec52021 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/permission-templates/permission-template-defaults.js @@ -0,0 +1,39 @@ +import _ from 'underscore'; +import React from 'react'; +import QualifierIcon from '../../components/shared/qualifier-icon'; + +export default React.createClass({ + propTypes: { + permissionTemplate: React.PropTypes.object.isRequired, + topQualifiers: React.PropTypes.array.isRequired + }, + + renderIfSingleTopQualifier() { + return ( + <ul className="list-inline nowrap spacer-bottom"> + <li>Default</li> + </ul> + ); + }, + + renderIfMultipleTopQualifiers() { + let defaults = this.props.permissionTemplate.defaultFor.map(qualifier => { + return <li key={qualifier}><QualifierIcon qualifier={qualifier}/> {window.t('qualifier', qualifier)}</li>; + }); + return ( + <ul className="list-inline nowrap spacer-bottom"> + <li>Default for</li> + {defaults} + </ul> + ); + }, + + render() { + if (_.size(this.props.permissionTemplate.defaultFor) === 0) { + return null; + } + return this.props.topQualifiers.length === 1 ? + this.renderIfSingleTopQualifier() : + this.renderIfMultipleTopQualifiers(); + } +}); |