Skip to content

Commit

Permalink
fix #1326 : Added limits for group name and desc and a message
Browse files Browse the repository at this point in the history
  • Loading branch information
MV88 committed Jan 24, 2017
1 parent 1cf334b commit 3d39baf
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 1 deletion.
18 changes: 17 additions & 1 deletion web/client/components/manager/users/GroupDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const GroupDialog = React.createClass({
closeGlyph: React.PropTypes.string,
style: React.PropTypes.object,
buttonSize: React.PropTypes.string,
descLimit: React.PropTypes.number,
inputStyle: React.PropTypes.object
},
getDefaultProps() {
Expand All @@ -56,6 +57,7 @@ const GroupDialog = React.createClass({
options: {},
useModal: true,
closeGlyph: "",
descLimit: 255,
style: {},
buttonSize: "large",
includeCloseButton: true,
Expand All @@ -82,11 +84,13 @@ const GroupDialog = React.createClass({
style={this.props.inputStyle}
label={<Message msgId="usergroups.groupName"/> }
onChange={this.handleChange}
maxLength={255}
value={this.props.group && this.props.group.groupName}/>
<Input type="textarea"
ref="description"
key="description"
name="description"
maxLength={255}
readOnly={this.props.group && this.props.group.id}
style={this.props.inputStyle}
label={<Message msgId="usergroups.groupDescription"/>}
Expand Down Expand Up @@ -187,15 +191,17 @@ const GroupDialog = React.createClass({
style={assign({}, this.props.style, {display: this.props.show ? "block" : "none"})}
>
<span role="header">
<span className="user-panel-title">{(this.props.group && this.props.group.groupName) || <Message msgId="usergroups.newGroup" />}</span>
<button onClick={this.props.onClose} className="login-panel-close close">
{this.props.closeGlyph ? <Glyphicon glyph={this.props.closeGlyph}/> : <span>×</span>}
</button>
<span className="user-panel-title">{(this.props.group && this.props.group.groupName) || <Message msgId="usergroups.newGroup" />}</span>
</span>
<div role="body">
<Tabs defaultActiveKey={1} key="tab-panel">
<Tab eventKey={1} title={<Button className="square-button" bsSize={this.props.buttonSize} bsStyle="primary"><Glyphicon glyph="1-group"/></Button>} >
{this.renderGeneral()}
{this.checkNameLenght()}
{this.checkDescLenght()}
</Tab>
<Tab eventKey={2} title={<Button className="square-button" bsSize={this.props.buttonSize} bsStyle="primary"><Glyphicon glyph="1-group-add"/></Button>} >
{this.renderMembersTab()}
Expand All @@ -208,6 +214,16 @@ const GroupDialog = React.createClass({
</div>
</Dialog>);
},
checkNameLenght() {
return this.props.group && this.props.group.groupName && this.props.group.groupName.length === 255 ? (<div className="alert alert-warning">
<Message msgId="usergroups.nameLimit"/>
</div>) : null;
},
checkDescLenght() {
return this.props.group && this.props.group.description && this.props.group.description.length === 255 ? (<div className="alert alert-warning">
<Message msgId="usergroups.descLimit"/>
</div>) : null;
},
isSaving() {
return this.props.group && this.props.group.status === "saving";
},
Expand Down
5 changes: 5 additions & 0 deletions web/client/components/manager/users/style/userdialog.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@
.group-edit-dialog .user-thumb .user-status {
display: none;
}

.user-edit-dialog .modal-header, .group-edit-dialog .modal-header {
text-overflow: ellipsis;
overflow: hidden;
}
2 changes: 2 additions & 0 deletions web/client/translations/data.de-DE
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@
"usergroups": {
"searchGroups": "Search Groups...",
"groups": "Groups",
"nameLimit": "The name is limited to 255 characters.",
"descLimit": "The description is limited to 255 characters.",
"editGroup": "Edit Group",
"deleteGroup": "Delete Group",
"removeUser": "Remove User",
Expand Down
2 changes: 2 additions & 0 deletions web/client/translations/data.en-US
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@
"usergroups": {
"searchGroups": "Search Groups...",
"groups": "Groups",
"nameLimit": "The name is limited to 255 characters.",
"descLimit": "The description is limited to 255 characters.",
"editGroup": "Edit Group",
"deleteGroup": "Delete Group",
"removeUser": "Remove User",
Expand Down
2 changes: 2 additions & 0 deletions web/client/translations/data.fr-FR
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,8 @@
"usergroups": {
"searchGroups": "rechercher des groupes...",
"groups": "Groupes",
"nameLimit": "Le nom est limité à 255 caractères.",
"descLimit": "La description est limité à 255 caractères.",
"editGroup": "Modifier",
"deleteGroup": "Supprimer",
"removeUser": "supprimer l'utilisateur",
Expand Down
2 changes: 2 additions & 0 deletions web/client/translations/data.it-IT
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,8 @@
},
"usergroups": {
"searchGroups": "Cerca gruppi...",
"nameLimit": "La massima lunghezza del nome del gruppo è prevista in 255 caratteri.",
"descLimit": "La massima lunghezza della descrizione del gruppo è prevista in 255 caratteri.",
"groups": "Gruppi",
"editGroup": "Modifica Gruppo",
"deleteGroup": "Rimuovi Gruppo",
Expand Down

0 comments on commit 3d39baf

Please sign in to comment.