diff --git a/app.js b/app.js index 9811722..5527469 100644 --- a/app.js +++ b/app.js @@ -61,18 +61,22 @@ define(function(require){ var self = this, container = parent.find('.right-content'); - parent.find('.category').on('click', function() { + parent.find('.left-menu').on('click', '.category:not(.loading)', function() { // Get the ID of the submodule to render var $this = $(this), args = { - parent: container + parent: container, + callback: function() { + parent.find('.category').removeClass('loading'); + } }, id = $this.attr('id'); // Display the category we clicked as active parent .find('.category') - .removeClass('active'); + .removeClass('active') + .addClass('loading'); $this.toggleClass('active'); // Empty the main container and then render the submodule content diff --git a/submodules/callLogs/callLogs.js b/submodules/callLogs/callLogs.js index d4c5c91..304abcc 100644 --- a/submodules/callLogs/callLogs.js +++ b/submodules/callLogs/callLogs.js @@ -13,10 +13,10 @@ define(function(require){ callLogsRender: function(args) { var self = this; - self.callLogsRenderContent(args.parent); + self.callLogsRenderContent(args.parent, args.fromDate, args.toDate, args.type, args.callback); }, - callLogsRenderContent: function(parent, fromDate, toDate, type) { + callLogsRenderContent: function(parent, fromDate, toDate, type, callback) { var self = this, template, defaultDateRange = 1, @@ -78,6 +78,8 @@ define(function(require){ parent .empty() .append(template); + + callback && callback(); }); }, diff --git a/submodules/devices/devices.js b/submodules/devices/devices.js index 2504270..7568e9e 100644 --- a/submodules/devices/devices.js +++ b/submodules/devices/devices.js @@ -28,7 +28,8 @@ define(function(require){ var self = this, args = pArgs || {}, parent = args.parent || $('.right-content'), - _deviceId = args.deviceId || ''; + _deviceId = args.deviceId || '', + callback = args.callback; self.devicesGetData(function(data) { var dataTemplate = self.devicesFormatListData(data), @@ -60,6 +61,8 @@ define(function(require){ } else { parent.find('.no-devices-row').css('display', 'none'); } + + callback && callback(); }); }, diff --git a/submodules/featureCodes/featureCodes.js b/submodules/featureCodes/featureCodes.js index 2bbfbb6..f199912 100644 --- a/submodules/featureCodes/featureCodes.js +++ b/submodules/featureCodes/featureCodes.js @@ -54,7 +54,8 @@ define(function(require){ featureCodesRender: function(args) { var self = this, - parent = args.parent || $('.right-content'); + parent = args.parent || $('.right-content'), + callback = args.callback; self.featureCodesLoadData(function(featureCodesData) { var template = $(monster.template(self, 'featureCodes-layout', { featureCodes: self.featureCodesFormatData(featureCodesData) })); @@ -68,6 +69,8 @@ define(function(require){ parent .empty() .append(template); + + callback && callback(); }); }, diff --git a/submodules/groups/groups.js b/submodules/groups/groups.js index f137089..f9049f3 100644 --- a/submodules/groups/groups.js +++ b/submodules/groups/groups.js @@ -21,6 +21,7 @@ define(function(require){ args = args || {}, parent = args.parent || $('.right-content'), _groupId = args.groupId, + callback = args.callback, noGroup = true; self.groupsRemoveOverlay(); @@ -68,6 +69,8 @@ define(function(require){ parent.find('.grid-row.title').css('display', 'block'); parent.find('.no-groups-row').css('display', 'none'); } + + callback && callback(); } }); }, diff --git a/submodules/myOffice/myOffice.js b/submodules/myOffice/myOffice.js index 6fe3167..cffd4b0 100644 --- a/submodules/myOffice/myOffice.js +++ b/submodules/myOffice/myOffice.js @@ -28,7 +28,8 @@ define(function(require){ /* My Office */ myOfficeRender: function(args) { var self = this, - parent = args.parent || $('.right-content'); + parent = args.parent || $('.right-content'), + callback = args.callback; self.myOfficeLoadData(function(myOfficeData) { var dataTemplate = { @@ -112,6 +113,8 @@ define(function(require){ parent .empty() .append(template); + + callback && callback(); }); }, diff --git a/submodules/numbers/numbers.js b/submodules/numbers/numbers.js index 677ffa1..a542643 100644 --- a/submodules/numbers/numbers.js +++ b/submodules/numbers/numbers.js @@ -13,11 +13,13 @@ define(function(require){ numbersRender: function(args){ var self = this, - parent = args.parent || $('#ws_content'); + parent = args.parent || $('#ws_content'), + callback = args.callback; monster.pub('common.numbers.render', { container: parent, - viewType: 'pbx' + viewType: 'pbx', + callbackAfterRender: callback }); } }; diff --git a/submodules/strategy/strategy.js b/submodules/strategy/strategy.js index 8c4edbc..d745655 100644 --- a/submodules/strategy/strategy.js +++ b/submodules/strategy/strategy.js @@ -150,6 +150,7 @@ define(function(require){ args = args || {}, parent = args.parent || $('.right-content'), openElement = args.openElement, + callback = args.callback, templateData = {}, template; @@ -224,6 +225,8 @@ define(function(require){ }); } } + + callback && callback(); } ); diff --git a/submodules/users/users.js b/submodules/users/users.js index 48745d7..4aac704 100644 --- a/submodules/users/users.js +++ b/submodules/users/users.js @@ -33,7 +33,8 @@ define(function(require){ args = args || {}, parent = args.parent || $('.right-content'), _userId = args.userId, - _openedTab = args.openedTab; + _openedTab = args.openedTab, + callback = args.callback; self.usersRemoveOverlay(); @@ -82,6 +83,8 @@ define(function(require){ args.callback && args.callback(); } + + callback && callback(); }); }, diff --git a/submodules/vmboxes/vmboxes.js b/submodules/vmboxes/vmboxes.js index d7b49c1..223ac17 100644 --- a/submodules/vmboxes/vmboxes.js +++ b/submodules/vmboxes/vmboxes.js @@ -19,7 +19,8 @@ define(function(require){ var self = this, args = args || {}, parent = args.parent || $('.right-content'), - _voicemailId = args.voicemailId || ''; + _voicemailId = args.voicemailId || '', + callback = args.callback; self.vmboxesGetData(function(data) { var dataTemplate = self.vmboxesFormatListData(data), @@ -51,6 +52,8 @@ define(function(require){ } else { parent.find('.no-vmboxes-row').css('display', 'none'); } + + callback && callback(); }); },