Browse Source

UI-2988: Expose `repeats` prop from group callflow (#42)

4.3
Joris Tirado 8 years ago
committed by GitHub
parent
commit
9e83cbd8e9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 54 additions and 14 deletions
  1. +3
    -2
      i18n/en-US.json
  2. +44
    -11
      submodules/groups/groups.js
  3. +7
    -1
      views/groups-name.html

+ 3
- 2
i18n/en-US.json View File

@ -39,7 +39,8 @@
"findExtension": "Find one"
},
"groupDeleted": "You successfully deleted {{name}}'s Group",
"name": "Group Name",
"name": "Name",
"repeats": "Dialing repeats",
"noAssignedExtensions": "There are currently no extension assigned to this group.",
"noExtension": "None",
"noFeatures": "None",
@ -59,7 +60,7 @@
"maxDurationTooltip": "Click this box to change the maximum duration for your ring group. You must enter a number between 30 and 999.",
"title": "Total Groups",
"titleGrid": {
"groups": "Group Name",
"groups": "Group Settings",
"members": "Members",
"extensions": "Extension",
"phoneNumbers": "Phone Numbers",


+ 44
- 11
submodules/groups/groups.js View File

@ -403,7 +403,7 @@ define(function(require) {
var self = this;
if (type === 'name') {
self.groupsGetNameTemplate(groupId, callbackAfterData);
self.groupsGetSettingsTemplate(groupId, callbackAfterData);
} else if (type === 'numbers') {
self.groupsGetNumbersTemplate(groupId, callbackAfterData);
} else if (type === 'extensions') {
@ -427,13 +427,13 @@ define(function(require) {
});
},
groupsGetNameTemplate: function(groupId, callback) {
groupsGetSettingsTemplate: function(groupId, callback) {
var self = this;
self.groupsGetNameData(groupId, function(data) {
self.groupsGetSettingsData(groupId, function(data) {
var template = $(monster.template(self, 'groups-name', data));
self.groupsBindName(template, data);
self.groupsBindSettings(template, data);
callback && callback(template, data);
});
@ -964,11 +964,22 @@ define(function(require) {
});
},
groupsBindName: function(template, data) {
groupsBindSettings: function(template, data) {
var self = this,
nameForm = template.find('#form-name');
monster.ui.validate(nameForm);
monster.ui.validate(nameForm, {
rules: {
'group.name': {
required: true
},
'callflow.flow.data.repeats': {
required: true,
digits: true,
min: 0
}
}
});
template.find('.save-group').on('click', function() {
if (monster.ui.valid(nameForm)) {
@ -978,8 +989,19 @@ define(function(require) {
data = $.extend(true, {}, data, formData);
self.groupsUpdate(data, function(data) {
self.groupsRender({ groupId: data.id });
monster.parallel([
function(callback) {
self.groupsUpdate(data.group, function(data) {
callback(null);
});
},
function(callback) {
self.groupsUpdateCallflow(data.callflow, function(data) {
callback(null);
});
}
], function(err, results) {
self.groupsRender({ groupId: data.group.id });
});
}
});
@ -1422,11 +1444,22 @@ define(function(require) {
});
},
groupsGetNameData: function(groupId, callback) {
groupsGetSettingsData: function(groupId, globalCallback) {
var self = this;
self.groupsGetGroup(groupId, function(data) {
callback && callback(data);
monster.parallel({
group: function(callback) {
self.groupsGetGroup(groupId, function(data) {
callback(null, data);
});
},
callflow: function(callback) {
self.groupsGetBaseRingGroup(groupId, function(data) {
callback(null, data);
});
}
}, function(err, results) {
globalCallback && globalCallback(results);
});
},


+ 7
- 1
views/groups-name.html View File

@ -3,7 +3,13 @@
<div class="control-group">
<label class="control-label" for="inputName">{{ i18n.groups.name }}</label>
<div class="controls">
<input required type="text" name="name" id="inputName" placeholder="" value="{{name}}"></input>
<input type="text" name="group.name" id="inputName" placeholder="" value="{{group.name}}"></input>
</div>
</div>
<div class="control-group">
<label for="repeats" class="control-label">{{ i18n.groups.repeats }}</label>
<div class="controls">
<input type="number" name="callflow.flow.data.repeats" id="repeats" value="{{callflow.flow.data.repeats}}">
</div>
</div>
</form>


Loading…
Cancel
Save