Remove constants from initializers

This commit is contained in:
Robin Ward 2014-09-11 17:40:38 -04:00
parent 9b5f506339
commit e1826e3025
5 changed files with 18 additions and 9 deletions

View File

@ -11,7 +11,8 @@ export default {
app.DiscoveryParentCategoryRoute = buildCategoryRoute('latest');
app.DiscoveryCategoryNoneRoute = buildCategoryRoute('latest', {no_subcategories: true});
Discourse.Site.currentProp('filters').forEach(function(filter) {
var site = container.lookup('site:main');
site.get('filters').forEach(function(filter) {
app["Discovery" + filter.capitalize() + "Controller"] = DiscoverySortableController.extend();
app["Discovery" + filter.capitalize() + "Route"] = buildTopicRoute(filter);
app["Discovery" + filter.capitalize() + "CategoryRoute"] = buildCategoryRoute(filter);
@ -29,7 +30,7 @@ export default {
Discourse.DiscoveryTopCategoryRoute = buildCategoryRoute('top');
Discourse.DiscoveryTopCategoryNoneRoute = buildCategoryRoute('top', {no_subcategories: true});
Discourse.Site.currentProp('periods').forEach(function(period) {
site.get('periods').forEach(function(period) {
app["DiscoveryTop" + period.capitalize() + "Controller"] = DiscoverySortableController.extend();
app["DiscoveryTop" + period.capitalize() + "Route"] = buildTopicRoute('top/' + period);
app["DiscoveryTop" + period.capitalize() + "CategoryRoute"] = buildCategoryRoute('top/' + period);

View File

@ -5,11 +5,12 @@ export default {
name: "read-only",
after: "message-bus",
initialize: function () {
initialize: function (container) {
if (!Discourse.MessageBus) { return; }
var site = container.lookup('site:main');
Discourse.MessageBus.subscribe("/site/read-only", function (enabled) {
Discourse.Site.currentProp('isReadOnly', enabled);
site.currentProp('isReadOnly', enabled);
});
}
};

View File

@ -1,5 +1,7 @@
export default {
name: "register-discourse-location",
after: 'inject-objects',
initialize: function(container, application) {
application.register('location:discourse-location', Ember.DiscourseLocation);
}

View File

@ -4,11 +4,15 @@
export default {
name: "subscribe-user-notifications",
after: 'message-bus',
initialize: function() {
initialize: function(container) {
var user = Discourse.User.current();
var site = container.lookup('site:main'),
siteSettings = container.lookup('site-settings:main');
if (user) {
var bus = Discourse.MessageBus;
bus.callbackInterval = Discourse.SiteSettings.polling_interval;
bus.callbackInterval = siteSettings.polling_interval;
bus.enableLongPolling = true;
bus.baseUrl = Discourse.getURL("/");
@ -30,7 +34,6 @@ export default {
}), user.notification_channel_position);
bus.subscribe("/categories", function(data){
var site = Discourse.Site.current();
_.each(data.categories,function(c){
site.updateCategory(c);
});

View File

@ -1,8 +1,10 @@
export default {
name: 'verbose-localization',
initialize: function() {
after: 'inject-objects',
if(Discourse.SiteSettings.verbose_localization){
initialize: function(container) {
var siteSettings = container.lookup('site-settings:main');
if (siteSettings.verbose_localization) {
I18n.enable_verbose_localization();
}
}