diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2013-03-28 16:39:15 +0100 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2013-05-06 16:22:20 +0200 |
commit | cc92060e35e04c78443aeba4901b90843f5d831e (patch) | |
tree | 00cc493dee17125a4416e5408f26d6730aeff8bd /install/ui/src | |
parent | c0007704e8e8bea785dde410647c79501527eb72 (diff) | |
download | freeipa-cc92060e35e04c78443aeba4901b90843f5d831e.tar.gz freeipa-cc92060e35e04c78443aeba4901b90843f5d831e.tar.xz freeipa-cc92060e35e04c78443aeba4901b90843f5d831e.zip |
Use dojo/on instead of dojo/topic for facet-xxx events'
https://fedorahosted.org/freeipa/ticket/3236
Diffstat (limited to 'install/ui/src')
-rw-r--r-- | install/ui/src/freeipa/Application_controller.js | 8 | ||||
-rw-r--r-- | install/ui/src/freeipa/facet.js | 7 | ||||
-rw-r--r-- | install/ui/src/freeipa/navigation/Router.js | 14 |
3 files changed, 14 insertions, 15 deletions
diff --git a/install/ui/src/freeipa/Application_controller.js b/install/ui/src/freeipa/Application_controller.js index d9f3129c8..8ce853e73 100644 --- a/install/ui/src/freeipa/Application_controller.js +++ b/install/ui/src/freeipa/Application_controller.js @@ -71,11 +71,10 @@ define(['dojo/_base/declare', on(this.app_widget, 'logout-click', lang.hitch(this, this.on_logout)); on(this.menu, 'selected', lang.hitch(this, this.on_menu_select)); - topic.subscribe('facet-show', lang.hitch(this, this.on_facet_show)); - topic.subscribe('facet-change', lang.hitch(this, this.on_facet_change)); - topic.subscribe('facet-change-canceled', lang.hitch(this, this.on_facet_canceled)); + on(this.router, 'facet-show', lang.hitch(this, this.on_facet_show)); + on(this.router, 'facet-change', lang.hitch(this, this.on_facet_change)); + on(this.router, 'facet-change-canceled', lang.hitch(this, this.on_facet_canceled)); topic.subscribe('phase-error', lang.hitch(this, this.on_phase_error)); - topic.subscribe('facet-state-change', lang.hitch(this, this.on_facet_state_changed)); this.app_widget.render(); }, @@ -223,6 +222,7 @@ define(['dojo/_base/declare', if (!facet.container) { facet.container_node = this.app_widget.content_node; + on(facet, 'facet-state-change', lang.hitch(this, this.on_facet_state_changed)); } if (this.current_facet) { this.current_facet.hide(); diff --git a/install/ui/src/freeipa/facet.js b/install/ui/src/freeipa/facet.js index e1f68dbfc..ac062f9f1 100644 --- a/install/ui/src/freeipa/facet.js +++ b/install/ui/src/freeipa/facet.js @@ -24,7 +24,6 @@ define([ 'dojo/_base/declare', 'dojo/_base/lang', - 'dojo/topic', 'dojo/dom-construct', 'dojo/on', 'dojo/Stateful', @@ -35,7 +34,7 @@ define([ './dialog', './field', './widget' - ], function(declare, lang, topic, construct, on, Stateful, Evented, + ], function(declare, lang, construct, on, Stateful, Evented, IPA, $, navigation) { /** @@ -101,7 +100,7 @@ IPA.facet = function(spec, no_init) { spec.state = spec.state || {}; $.extend(spec.state, { factory: IPA.state }); - var that = {}; + var that = new Evented(); that.entity = IPA.get_entity(spec.entity); @@ -321,7 +320,7 @@ IPA.facet = function(spec, no_init) { }; that._notify_state_change = function(state) { - topic.publish('facet-state-change', { + that.emit('facet-state-change', { facet: that, state: state }); diff --git a/install/ui/src/freeipa/navigation/Router.js b/install/ui/src/freeipa/navigation/Router.js index 21f3e93fc..ae29ee177 100644 --- a/install/ui/src/freeipa/navigation/Router.js +++ b/install/ui/src/freeipa/navigation/Router.js @@ -19,16 +19,16 @@ */ define(['dojo/_base/declare', - 'dojo/router', 'dojo/_base/lang', 'dojo/_base/array', + 'dojo/Evented', 'dojo/io-query', - 'dojo/topic', + 'dojo/router', '../entities', '../facets', '../ipa' //TODO: remove dependancy ], - function(declare, router, lang, array, ioquery, topic, entities, facets, IPA) { + function(declare, lang, array, Evented, ioquery, router, entities, facets, IPA) { /** * Class navigation @@ -38,7 +38,7 @@ define(['dojo/_base/declare', * displayed facet. This change can be canceled in 'facet-change' * event handler. */ - var navigation = declare(null, { + var navigation = declare([Evented], { /** * Holds references to register route handlers. @@ -212,9 +212,9 @@ define(['dojo/_base/declare', navigate_to_hash: function(hash, facet) { this.canceled = false; - topic.publish('facet-change', { facet: facet, hash: hash }); + this.emit('facet-change', { facet: facet, hash: hash }); if (this.canceled) { - topic.publish('facet-change-canceled', { facet: facet, hash : hash }); + this.emit('facet-change-canceled', { facet: facet, hash : hash }); return false; } this.update_hash(hash, false); @@ -288,7 +288,7 @@ define(['dojo/_base/declare', */ show_facet: function(facet) { - topic.publish('facet-show', { + this.emit('facet-show', { facet: facet }); }, |