diff --git a/Gruntfile.js b/Gruntfile.js index bf9e0eb..122e069 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -55,6 +55,7 @@ module.exports = function(grunt) { // mixins 'js/mixins/PeriodsMixin.js', + 'js/mixins/ContentReadyTriggerableMixin.js', // controllers 'js/controllers/ApplicationController.js', diff --git a/src/js/controllers/BridgeDetailController.js b/src/js/controllers/BridgeDetailController.js index c95fee7..b1687c3 100644 --- a/src/js/controllers/BridgeDetailController.js +++ b/src/js/controllers/BridgeDetailController.js @@ -1,5 +1,7 @@ /*global $, GLOBE, Em */ GLOBE.BridgeDetailController = Em.ObjectController.extend( + Em.Evented, + GLOBE.ContentReadyTriggerableMixin, GLOBE.PeriodsMixin, { bandwidthData: {}, weightData: {}, diff --git a/src/js/controllers/RelayDetailController.js b/src/js/controllers/RelayDetailController.js index 64e5f3a..e409de6 100644 --- a/src/js/controllers/RelayDetailController.js +++ b/src/js/controllers/RelayDetailController.js @@ -1,5 +1,7 @@ /*global $, GLOBE, Em */ GLOBE.RelayDetailController = Em.ObjectController.extend( + Em.Evented, + GLOBE.ContentReadyTriggerableMixin, GLOBE.PeriodsMixin, { bandwidthData: {}, weightData: {}, diff --git a/src/js/mixins/ContentReadyTriggerableMixin.js b/src/js/mixins/ContentReadyTriggerableMixin.js new file mode 100644 index 0000000..c06f8d0 --- /dev/null +++ b/src/js/mixins/ContentReadyTriggerableMixin.js @@ -0,0 +1,11 @@ +/*global $, GLOBE, Em */ +GLOBE.ContentReadyTriggerableMixin = Em.Mixin.create({ + /** + * Function that is called if the controller content is changed. + */ + contentChanged: function(){ + Em.run.scheduleOnce('afterRender', this, function(){ + this.trigger('content-ready'); + }); + }.observes('content') +}); \ No newline at end of file