From 9e83cbd8e96dd814fee1f7c6539370d253724850 Mon Sep 17 00:00:00 2001 From: Joris Tirado Date: Fri, 5 Jan 2018 15:18:20 -0800 Subject: [PATCH] UI-2988: Expose `repeats` prop from group callflow (#42) --- i18n/en-US.json | 5 ++-- submodules/groups/groups.js | 55 +++++++++++++++++++++++++++++-------- views/groups-name.html | 8 +++++- 3 files changed, 54 insertions(+), 14 deletions(-) diff --git a/i18n/en-US.json b/i18n/en-US.json index eebf277..fb6c7cd 100644 --- a/i18n/en-US.json +++ b/i18n/en-US.json @@ -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", diff --git a/submodules/groups/groups.js b/submodules/groups/groups.js index 2a45fc3..fb2b81a 100644 --- a/submodules/groups/groups.js +++ b/submodules/groups/groups.js @@ -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); }); }, diff --git a/views/groups-name.html b/views/groups-name.html index 216a872..16ed070 100644 --- a/views/groups-name.html +++ b/views/groups-name.html @@ -3,7 +3,13 @@
- + +
+
+
+ +
+