From 5b7dd7e3517ba3cc55c838d128e285d6dbd826af Mon Sep 17 00:00:00 2001 From: Maxime Roux Date: Fri, 4 Sep 2015 13:39:05 -0700 Subject: [PATCH] UI-1215: Added a default media to groups that do not have next action (added on creation or when turning off the next action feature) --- submodules/groups/groups.js | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/submodules/groups/groups.js b/submodules/groups/groups.js index b1a953d..f137089 100644 --- a/submodules/groups/groups.js +++ b/submodules/groups/groups.js @@ -267,8 +267,8 @@ define(function(require){ monster.ui.validate(groupForm); groupTemplate.find('#create_group').on('click', function() { - var formattedData = self.groupsCreationMergeData(data, groupTemplate); if(monster.ui.valid(groupForm)) { + var formattedData = self.groupsCreationMergeData(data, groupTemplate); self.groupsCreate(formattedData, function(data) { popup.dialog('close').remove(); @@ -353,7 +353,15 @@ define(function(require){ name: formData.name + ' Ring Group', flow: { module: 'callflow', - children: {}, + children: { + '_': { + module: 'play', + children: {}, + data: { + id: 'system_media/vm-not_available_no_voicemail' + } + } + }, data: { id: '' } @@ -769,6 +777,10 @@ define(function(require){ var newCallflow = $.extend(true, {}, data.callflow), callflowNode = monster.util.findCallflowNode(newCallflow, 'callflow'); + if(_.isArray(callflowNode)) { + callflowNode = callflowNode[0]; + } + callflowNode.children = {}; if(enabled) { callflowNode.children['_'] = { @@ -776,6 +788,14 @@ define(function(require){ module: selectedOption.data('module'), data: { id: selectedOption.val() } } + } else { + callflowNode.children['_'] = { + module: 'play', + children: {}, + data: { + id: 'system_media/vm-not_available_no_voicemail' + } + }; } self.groupsUpdateCallflow(newCallflow, function(updatedCallflow) { self.groupsUpdate(data.group, function(updatedGroup) { @@ -1928,16 +1948,6 @@ define(function(require){ ringGroup.flow.data.endpoints = endpoints; ringGroup.flow.data.timeout = self.groupsComputeTimeout(endpoints); - // if(extraNode) { - // flow.children['_'] = { - // data: { - // id: extraNode.id - // }, - // module: extraNode.module, - // children: {} - // } - // } - self.groupsUpdateCallflow(ringGroup, function(data) { callback && callback(null, data); });