Skip to content

Commit

Permalink
UI-1855: On Groups management, hide e911 feature when disabled on the…
Browse files Browse the repository at this point in the history
… account
  • Loading branch information
joristirado committed Dec 4, 2015
1 parent 934944d commit 95ccaf4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 23 deletions.
52 changes: 31 additions & 21 deletions submodules/groups/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,9 @@ define(function(require){

self.groupsGetNumbersData(groupId, function(data) {
self.groupsFormatNumbersData(data, function(data) {
template = $(monster.template(self, 'groups-numbers', data));
template = $(monster.template(self, 'groups-numbers', $.extend(true, {}, data, {
isE911Enabled: monster.util.isNumberFeatureEnabled('e911')
})));

self.groupsBindNumbers(template, data);

Expand Down Expand Up @@ -1038,28 +1040,30 @@ define(function(require){
}
});

template.on('click', '.e911-number', function() {
var e911Cell = $(this).parents('.item-row').first(),
phoneNumber = e911Cell.data('id');
if (monster.util.isNumberFeatureEnabled('e911')) {
template.on('click', '.e911-number', function() {
var e911Cell = $(this).parents('.item-row').first(),
phoneNumber = e911Cell.data('id');

if(phoneNumber) {
var args = {
phoneNumber: phoneNumber,
callbacks: {
success: function(data) {
if(!($.isEmptyObject(data.data.dash_e911))) {
e911Cell.find('.features i.feature-dash_e911').addClass('active');
}
else {
e911Cell.find('.features i.feature-dash_e911').removeClass('active');
if(phoneNumber) {
var args = {
phoneNumber: phoneNumber,
callbacks: {
success: function(data) {
if(!($.isEmptyObject(data.data.dash_e911))) {
e911Cell.find('.features i.feature-dash_e911').addClass('active');
}
else {
e911Cell.find('.features i.feature-dash_e911').removeClass('active');
}
}
}
}
};
};

monster.pub('common.e911.renderPopup', args);
}
});
monster.pub('common.e911.renderPopup', args);
}
});
}

template.on('click', '.callerId-number', function() {
var cnamCell = $(this).parents('.item-row').first(),
Expand Down Expand Up @@ -1130,7 +1134,10 @@ define(function(require){

template
.find('.list-assigned-items')
.append($(monster.template(self, 'groups-numbersItemRow', { number: val })));
.append($(monster.template(self, 'groups-numbersItemRow', {
isE911Enabled: monster.util.isNumberFeatureEnabled('e911'),
number: val
})));

extraSpareNumbers = _.without(extraSpareNumbers, val.phoneNumber);
});
Expand Down Expand Up @@ -1159,7 +1166,10 @@ define(function(require){
number.viewFeatures = $.extend(true, {}, features);
number.phoneNumber = number.id;

var rowTemplate = monster.template(self, 'groups-numbersItemRow', { number: number });
var rowTemplate = monster.template(self, 'groups-numbersItemRow', {
isE911Enabled: monster.util.isNumberFeatureEnabled('e911'),
number: number
});

monster.ui.tooltips(rowTemplate);

Expand Down
4 changes: 3 additions & 1 deletion views/groups-numbers.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
<ul class="dropdown-menu">
{{#unless isLocal}}
<li><a class="callerId-number" href="#"><i class="fa fa-user"></i>{{ ../../i18n.callerId }}</a></li>
<li><a class="e911-number" href="#"><i class="fa fa-ambulance"></i>{{ ../../i18n.e911 }}</a></li>
{{#if ../../isE911Enabled}}
<li><a class="e911-number" href="#"><i class="fa fa-ambulance"></i>{{ ../../../i18n.e911 }}</a></li>
{{/if}}
{{/unless}}
<li><a class="prepend-number" href="#"><i class="fa fa-file-text-o"></i>{{ ../i18n.numberPrepend }}</a></li>
</ul>
Expand Down
4 changes: 3 additions & 1 deletion views/groups-numbersItemRow.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<ul class="dropdown-menu">
{{#unless number.isLocal}}
<li><a class="callerId-number" href="#"><i class="fa fa-user"></i>{{ i18n.callerId }}</a></li>
<li><a class="e911-number" href="#"><i class="fa fa-ambulance"></i>{{ i18n.e911 }}</a></li>
{{#if isE911Enabled}}
<li><a class="e911-number" href="#"><i class="fa fa-ambulance"></i>{{ i18n.e911 }}</a></li>
{{/if}}
{{/unless}}
<li><a class="prepend-number" href="#"><i class="fa fa-file-text-o"></i>{{ i18n.numberPrepend }}</a></li>
</ul>
Expand Down

0 comments on commit 95ccaf4

Please sign in to comment.