Remove deprecation notices for Discourse.banner

This commit is contained in:
Robin Ward 2014-09-11 17:01:35 -04:00
parent f322b500a7
commit cedc409461
7 changed files with 29 additions and 42 deletions

View file

@ -2,14 +2,16 @@ export default {
name: "banner", name: "banner",
after: "message-bus", after: "message-bus",
initialize: function () { initialize: function (container) {
var banner = Em.Object.create(PreloadStore.get("banner")); var banner = Em.Object.create(PreloadStore.get("banner")),
Discourse.set("banner", banner); site = container.lookup('site:main');
site.set("banner", banner);
if (!Discourse.MessageBus) { return; } if (!Discourse.MessageBus) { return; }
Discourse.MessageBus.subscribe("/site/banner", function (banner) { Discourse.MessageBus.subscribe("/site/banner", function (banner) {
Discourse.set("banner", Em.Object.create(banner)); site.set("banner", Em.Object.create(banner));
}); });
} }
}; };

View file

@ -1,33 +0,0 @@
export default {
name: "inject-objects",
initialize: function(container, application) {
// Inject appEvents everywhere
var appEvents = Ember.Object.createWithMixins(Ember.Evented);
application.register('app-events:main', appEvents, { instantiate: false });
application.inject('controller', 'appEvents', 'app-events:main');
application.inject('component', 'appEvents', 'app-events:main');
application.inject('route', 'appEvents', 'app-events:main');
application.inject('view', 'appEvents', 'app-events:main');
application.inject('model', 'appEvents', 'app-events:main');
Discourse.URL.appEvents = appEvents;
// Inject Discourse.Site to avoid using Discourse.Site.current()
var site = Discourse.Site.current();
application.register('site:main', site, { instantiate: false });
application.inject('controller', 'site', 'site:main');
application.inject('component', 'site', 'site:main');
application.inject('route', 'site', 'site:main');
application.inject('view', 'site', 'site:main');
application.inject('model', 'site', 'site:main');
// Inject Discourse.SiteSettings to avoid using Discourse.SiteSettings globals
application.register('site-settings:main', Discourse.SiteSettings, { instantiate: false });
application.inject('controller', 'siteSettings', 'site-settings:main');
application.inject('component', 'siteSettings', 'site-settings:main');
application.inject('route', 'siteSettings', 'site-settings:main');
application.inject('view', 'siteSettings', 'site-settings:main');
application.inject('model', 'siteSettings', 'site-settings:main');
}
};

View file

@ -1,6 +1,8 @@
export default { export default {
name: "inject-app-events", name: "inject-objects",
initialize: function(container, application) { initialize: function(container, application) {
// Inject appEvents everywhere
var appEvents = Ember.Object.createWithMixins(Ember.Evented); var appEvents = Ember.Object.createWithMixins(Ember.Evented);
application.register('app-events:main', appEvents, { instantiate: false }); application.register('app-events:main', appEvents, { instantiate: false });
@ -9,7 +11,23 @@ export default {
application.inject('route', 'appEvents', 'app-events:main'); application.inject('route', 'appEvents', 'app-events:main');
application.inject('view', 'appEvents', 'app-events:main'); application.inject('view', 'appEvents', 'app-events:main');
application.inject('model', 'appEvents', 'app-events:main'); application.inject('model', 'appEvents', 'app-events:main');
Discourse.URL.appEvents = appEvents; Discourse.URL.appEvents = appEvents;
// Inject Discourse.Site to avoid using Discourse.Site.current()
var site = Discourse.Site.current();
application.register('site:main', site, { instantiate: false });
application.inject('controller', 'site', 'site:main');
application.inject('component', 'site', 'site:main');
application.inject('route', 'site', 'site:main');
application.inject('view', 'site', 'site:main');
application.inject('model', 'site', 'site:main');
// Inject Discourse.SiteSettings to avoid using Discourse.SiteSettings globals
application.register('site-settings:main', Discourse.SiteSettings, { instantiate: false });
application.inject('controller', 'siteSettings', 'site-settings:main');
application.inject('component', 'siteSettings', 'site-settings:main');
application.inject('route', 'siteSettings', 'site-settings:main');
application.inject('view', 'siteSettings', 'site-settings:main');
application.inject('model', 'siteSettings', 'site-settings:main');
} }
}; };

View file

@ -3,6 +3,7 @@
**/ **/
export default { export default {
name: "message-bus", name: "message-bus",
after: 'inject-objects',
initialize: function() { initialize: function() {

View file

@ -56,7 +56,6 @@ export default function(filter, extras) {
}); });
this.openTopicDraft(model); this.openTopicDraft(model);
this.controllerFor('navigation/default').set('canCreateTopic', model.get('can_create_topic')); this.controllerFor('navigation/default').set('canCreateTopic', model.get('can_create_topic'));
}, },

View file

@ -1,7 +1,7 @@
<div class='container'> <div class='container'>
{{custom-html "top"}} {{custom-html "top"}}
{{global-notice}} {{global-notice}}
{{discourse-banner user=currentUser banner=Discourse.banner}} {{discourse-banner user=currentUser banner=site.banner}}
</div> </div>
<div class='list-controls'> <div class='list-controls'>

View file

@ -1,7 +1,7 @@
<div class='container'> <div class='container'>
{{custom-html "top"}} {{custom-html "top"}}
{{global-notice}} {{global-notice}}
{{discourse-banner user=currentUser banner=Discourse.banner overlay=view.hasScrolled}} {{discourse-banner user=currentUser banner=site.banner overlay=view.hasScrolled}}
</div> </div>
{{#if postStream.loaded}} {{#if postStream.loaded}}