Removed bindings to `Discourse.site`

This commit is contained in:
Robin Ward 2013-05-24 11:22:17 -04:00
parent 56764f817b
commit 69bb70fbd3
26 changed files with 82 additions and 72 deletions

View File

@ -73,11 +73,14 @@ Discourse = Ember.Application.createWithMixins({
user.set('unread_notifications', data.unread_notifications); user.set('unread_notifications', data.unread_notifications);
user.set('unread_private_messages', data.unread_private_messages); user.set('unread_private_messages', data.unread_private_messages);
}), user.notification_channel_position); }), user.notification_channel_position);
bus.subscribe("/categories", function(data){ bus.subscribe("/categories", function(data){
Discourse.get('site').set('categories', data.categories.map(function(c){ var site = Discourse.Site.instance();
return Discourse.Category.create(c); data.categories.each(function(c){
})); site.updateCategory(c)
});
}); });
} }
}.observes('currentUser'), }.observes('currentUser'),

View File

@ -27,6 +27,10 @@ Discourse.ComposerController = Discourse.Controller.extend({
if (c) return c.appendText(text); if (c) return c.appendText(text);
}, },
categories: function() {
return Discourse.Category.list();
}.property(),
save: function(force) { save: function(force) {
var composer, var composer,
_this = this, _this = this,

View File

@ -14,7 +14,11 @@ Discourse.HeaderController = Discourse.Controller.extend({
var topic = this.get('topic'); var topic = this.get('topic');
if (topic) topic.toggleStar(); if (topic) topic.toggleStar();
return false; return false;
} },
categories: function() {
return Discourse.Category.list();
}.property()
}); });

View File

@ -8,21 +8,17 @@
**/ **/
Discourse.ListController = Discourse.Controller.extend({ Discourse.ListController = Discourse.Controller.extend({
currentUserBinding: 'Discourse.currentUser', currentUserBinding: 'Discourse.currentUser',
categoriesBinding: 'Discourse.site.categories',
categoryBinding: 'topicList.category', categoryBinding: 'topicList.category',
canCreateCategory: false, canCreateCategory: false,
canCreateTopic: false, canCreateTopic: false,
needs: ['composer', 'modal', 'listTopics'], needs: ['composer', 'modal', 'listTopics'],
availableNavItems: function() { availableNavItems: function() {
var hasCategories, loggedOn, summary; var summary = this.get('filterSummary');
summary = this.get('filterSummary'); var loggedOn = !!Discourse.get('currentUser');
loggedOn = !!Discourse.get('currentUser');
hasCategories = !!this.get('categories');
return Discourse.SiteSettings.top_menu.split("|").map(function(i) { return Discourse.SiteSettings.top_menu.split("|").map(function(i) {
return Discourse.NavItem.fromText(i, { return Discourse.NavItem.fromText(i, {
loggedOn: loggedOn, loggedOn: loggedOn,
hasCategories: hasCategories,
countSummary: summary countSummary: summary
}); });
}).filter(function(i) { }).filter(function(i) {

View File

@ -29,6 +29,9 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
return (this.get('selectedPostsCount') > 0); return (this.get('selectedPostsCount') > 0);
}.property('selectedPostsCount'), }.property('selectedPostsCount'),
categories: function() {
return Discourse.Category.list();
}.property(),
canSelectAll: Em.computed.not('allPostsSelected'), canSelectAll: Em.computed.not('allPostsSelected'),

View File

@ -13,9 +13,9 @@ Discourse.Archetype = Discourse.Model.extend({
return this.get('options').length > 0; return this.get('options').length > 0;
}).property('options.@each'), }).property('options.@each'),
isDefault: (function() { isDefault: function() {
return this.get('id') === Discourse.get('site.default_archetype'); return this.get('id') === Discourse.Site.instance().get('default_archetype');
}).property('id') }.property('id')
}); });

View File

@ -70,6 +70,11 @@ Discourse.Category = Discourse.Model.extend({
}); });
Discourse.Category.reopenClass({ Discourse.Category.reopenClass({
list: function() {
return Discourse.Site.instance().get('categories');
},
findBySlugOrId: function(slugOrId) { findBySlugOrId: function(slugOrId) {
return Discourse.ajax("/categories/" + slugOrId + ".json").then(function (result) { return Discourse.ajax("/categories/" + slugOrId + ".json").then(function (result) {
return Discourse.Category.create(result.category); return Discourse.Category.create(result.category);

View File

@ -22,15 +22,18 @@ EDIT = 'edit';
REPLY_AS_NEW_TOPIC_KEY = "reply_as_new_topic"; REPLY_AS_NEW_TOPIC_KEY = "reply_as_new_topic";
Discourse.Composer = Discourse.Model.extend({ Discourse.Composer = Discourse.Model.extend({
archetypesBinding: 'Discourse.site.archetypes',
init: function() { init: function() {
this._super(); this._super();
var val = Discourse.KeyValueStore.get('composer.showPreview') || 'true'; var val = Discourse.KeyValueStore.get('composer.showPreview') || 'true';
this.set('showPreview', val === 'true'); this.set('showPreview', val === 'true');
this.set('archetypeId', Discourse.get('site.default_archetype')); this.set('archetypeId', Discourse.Site.instance().get('default_archetype'));
}, },
archetypes: function() {
return Discourse.Site.instance().get('archetypes');
}.property(),
creatingTopic: function() { creatingTopic: function() {
return this.get('action') === CREATE_TOPIC; return this.get('action') === CREATE_TOPIC;
}.property('action'), }.property('action'),
@ -238,7 +241,7 @@ Discourse.Composer = Discourse.Model.extend({
} }
this.set('categoryName', opts.categoryName || this.get('topic.category.name')); this.set('categoryName', opts.categoryName || this.get('topic.category.name'));
this.set('archetypeId', opts.archetypeId || Discourse.get('site.default_archetype')); this.set('archetypeId', opts.archetypeId || Discourse.Site.instance().get('default_archetype'));
this.set('metaData', opts.metaData ? Em.Object.create(opts.metaData) : null); this.set('metaData', opts.metaData ? Em.Object.create(opts.metaData) : null);
this.set('reply', opts.reply || this.get("reply") || ""); this.set('reply', opts.reply || this.get("reply") || "");
if (opts.postId) { if (opts.postId) {
@ -354,7 +357,7 @@ Discourse.Composer = Discourse.Model.extend({
user_id: currentUser.get('id'), user_id: currentUser.get('id'),
metaData: this.get('metaData'), metaData: this.get('metaData'),
archetype: this.get('archetypeId'), archetype: this.get('archetypeId'),
post_type: Discourse.get('site.post_types.regular'), post_type: Discourse.Site.instance().get('post_types.regular'),
target_usernames: this.get('targetUsernames'), target_usernames: this.get('targetUsernames'),
actions_summary: Em.A(), actions_summary: Em.A(),
moderator: currentUser.get('moderator'), moderator: currentUser.get('moderator'),

View File

@ -34,7 +34,7 @@ Discourse.NavItem.reopenClass({
testName = name.split("/")[0]; testName = name.split("/")[0];
if (!opts.loggedOn && !validAnon.contains(testName)) return null; if (!opts.loggedOn && !validAnon.contains(testName)) return null;
if (!opts.hasCategories && testName === "categories") return null; if (!Discourse.Category.list() && testName === "categories") return null;
if (!validNavNames.contains(testName)) return null; if (!validNavNames.contains(testName)) return null;
opts = { opts = {

View File

@ -19,8 +19,7 @@ Discourse.Notification = Discourse.Model.extend({
}.property(), }.property(),
rendered: function() { rendered: function() {
var notificationName; var notificationName = Discourse.Site.instance().get('notificationLookup')[this.notification_type];
notificationName = Discourse.get('site.notificationLookup')[this.notification_type];
return Em.String.i18n("notifications." + notificationName, { return Em.String.i18n("notifications." + notificationName, {
username: this.data.display_username, username: this.data.display_username,
link: "<a href='" + (this.get('url')) + "'>" + this.data.topic_title + "</a>" link: "<a href='" + (this.get('url')) + "'>" + this.data.topic_title + "</a>"

View File

@ -124,11 +124,11 @@ Discourse.Post = Discourse.Model.extend({
flagsAvailable: function() { flagsAvailable: function() {
var _this = this; var _this = this;
var flags = Discourse.get('site.flagTypes').filter(function(item) { var flags = Discourse.Site.instance().get('flagTypes').filter(function(item) {
return _this.get("actionByName." + (item.get('name_key')) + ".can_act"); return _this.get("actionByName." + (item.get('name_key')) + ".can_act");
}); });
return flags; return flags;
}.property('Discourse.site.flagTypes', 'actions_summary.@each.can_act'), }.property('actions_summary.@each.can_act'),
actionsHistory: function() { actionsHistory: function() {
if (!this.present('actions_summary')) return null; if (!this.present('actions_summary')) return null;
@ -153,7 +153,7 @@ Discourse.Post = Discourse.Model.extend({
} }
}).then(function(result) { }).then(function(result) {
// If we received a category update, update it // If we received a category update, update it
if (result.category) Discourse.get('site').updateCategory(result.category); if (result.category) Discourse.Site.instance().updateCategory(result.category);
if (complete) complete(Discourse.Post.create(result.post)); if (complete) complete(Discourse.Post.create(result.post));
}, function(result) { }, function(result) {
// Post failed to update // Post failed to update
@ -220,7 +220,7 @@ Discourse.Post = Discourse.Model.extend({
obj.actions_summary.each(function(a) { obj.actions_summary.each(function(a) {
var actionSummary; var actionSummary;
a.post = post; a.post = post;
a.actionType = Discourse.get("site").postActionTypeById(a.id); a.actionType = Discourse.Site.instance().postActionTypeById(a.id);
actionSummary = Discourse.ActionSummary.create(a); actionSummary = Discourse.ActionSummary.create(a);
post.get('actions_summary').pushObject(actionSummary); post.get('actions_summary').pushObject(actionSummary);
lookup.set(a.actionType.get('name_key'), actionSummary); lookup.set(a.actionType.get('name_key'), actionSummary);
@ -278,10 +278,9 @@ Discourse.Post.reopenClass({
if (result.actions_summary) { if (result.actions_summary) {
lookup = Em.Object.create(); lookup = Em.Object.create();
result.actions_summary = result.actions_summary.map(function(a) { result.actions_summary = result.actions_summary.map(function(a) {
var actionSummary;
a.post = result; a.post = result;
a.actionType = Discourse.get("site").postActionTypeById(a.id); a.actionType = Discourse.Site.instance().postActionTypeById(a.id);
actionSummary = Discourse.ActionSummary.create(a); var actionSummary = Discourse.ActionSummary.create(a);
lookup.set(a.actionType.get('name_key'), actionSummary); lookup.set(a.actionType.get('name_key'), actionSummary);
return actionSummary; return actionSummary;
}); });
@ -290,8 +289,7 @@ Discourse.Post.reopenClass({
}, },
create: function(obj, topic) { create: function(obj, topic) {
var result; var result = this._super(obj);
result = this._super(obj);
this.createActionSummary(result); this.createActionSummary(result);
if (obj.reply_to_user) { if (obj.reply_to_user) {
result.set('reply_to_user', Discourse.User.create(obj.reply_to_user)); result.set('reply_to_user', Discourse.User.create(obj.reply_to_user));

View File

@ -8,21 +8,17 @@
**/ **/
Discourse.Site = Discourse.Model.extend({ Discourse.Site = Discourse.Model.extend({
notificationLookup: (function() { notificationLookup: function() {
var result; var result = [];
result = [];
Object.keys(this.get('notification_types'), function(k, v) { Object.keys(this.get('notification_types'), function(k, v) {
result[v] = k; result[v] = k;
}); });
return result; return result;
}).property('notification_types'), }.property('notification_types'),
flagTypes: function() { flagTypes: function() {
var postActionTypes; var postActionTypes = this.get('post_action_types');
postActionTypes = this.get('post_action_types'); if (!postActionTypes) return [];
if (!postActionTypes) {
return [];
}
return postActionTypes.filterProperty('is_flag', true); return postActionTypes.filterProperty('is_flag', true);
}.property('post_action_types.@each'), }.property('post_action_types.@each'),

View File

@ -7,12 +7,11 @@
@module Discourse @module Discourse
**/ **/
Discourse.Topic = Discourse.Model.extend({ Discourse.Topic = Discourse.Model.extend({
categoriesBinding: 'Discourse.site.categories',
fewParticipants: (function() { fewParticipants: function() {
if (!this.present('participants')) return null; if (!this.present('participants')) return null;
return this.get('participants').slice(0, 3); return this.get('participants').slice(0, 3);
}).property('participants'), }.property('participants'),
canConvertToRegular: (function() { canConvertToRegular: (function() {
var a = this.get('archetype'); var a = this.get('archetype');
@ -31,10 +30,8 @@ Discourse.Topic = Discourse.Model.extend({
}, },
category: function() { category: function() {
if (this.get('categories')) { return Discourse.Category.list().findProperty('name', this.get('categoryName'));
return this.get('categories').findProperty('name', this.get('categoryName')); }.property('categoryName'),
}
}.property('categoryName', 'categories'),
shareUrl: function(){ shareUrl: function(){
var user = Discourse.get('currentUser'); var user = Discourse.get('currentUser');
@ -130,9 +127,9 @@ Discourse.Topic = Discourse.Model.extend({
return null; return null;
}.property('views'), }.property('views'),
archetypeObject: (function() { archetypeObject: function() {
return Discourse.get('site.archetypes').findProperty('id', this.get('archetype')); return Discourse.Site.instance().get('archetypes').findProperty('id', this.get('archetype'));
}).property('archetype'), }.property('archetype'),
isPrivateMessage: (function() { isPrivateMessage: (function() {
return this.get('archetype') === 'private_message'; return this.get('archetype') === 'private_message';
@ -220,6 +217,7 @@ Discourse.Topic = Discourse.Model.extend({
// If loading the topic succeeded... // If loading the topic succeeded...
var afterTopicLoaded = function(result) { var afterTopicLoaded = function(result) {
var closestPostNumber, lastPost, postDiff; var closestPostNumber, lastPost, postDiff;
// Update the slug if different // Update the slug if different
@ -246,6 +244,7 @@ Discourse.Topic = Discourse.Model.extend({
if (result.suggested_topics) { if (result.suggested_topics) {
topic.set('suggested_topics', Em.A()); topic.set('suggested_topics', Em.A());
} }
topic.mergeAttributes(result, { suggested_topics: Discourse.Topic }); topic.mergeAttributes(result, { suggested_topics: Discourse.Topic });
topic.set('posts', Em.A()); topic.set('posts', Em.A());
if (opts.trackVisit && result.draft && result.draft.length > 0) { if (opts.trackVisit && result.draft && result.draft.length > 0) {
@ -261,17 +260,18 @@ Discourse.Topic = Discourse.Model.extend({
// Okay this is weird, but let's store the length of the next post when there // Okay this is weird, but let's store the length of the next post when there
lastPost = null; lastPost = null;
result.posts.each(function(p) { result.posts.each(function(p) {
var post;
p.scrollToAfterInsert = opts.nearPost; p.scrollToAfterInsert = opts.nearPost;
post = Discourse.Post.create(p); var post = Discourse.Post.create(p);
post.set('topic', topic); post.set('topic', topic);
topic.get('posts').pushObject(post); topic.get('posts').pushObject(post);
lastPost = post; lastPost = post;
}); });
topic.set('loaded', true); topic.set('loaded', true);
} }
var errorLoadingTopic = function(result) { var errorLoadingTopic = function(result) {
topic.set('errorLoading', true); topic.set('errorLoading', true);
// If the result was 404 the post is not found // If the result was 404 the post is not found

View File

@ -92,7 +92,7 @@ Discourse.User = Discourse.Model.extend({
@type {Integer} @type {Integer}
**/ **/
trustLevel: function() { trustLevel: function() {
return Discourse.get('site.trust_levels').findProperty('id', this.get('trust_level')); return Discourse.Site.instance().get('trust_levels').findProperty('id', this.get('trust_level'));
}.property('trust_level'), }.property('trust_level'),
/** /**

View File

@ -8,8 +8,7 @@
**/ **/
Discourse.ApplicationRoute = Discourse.Route.extend({ Discourse.ApplicationRoute = Discourse.Route.extend({
setupController: function(controller) { setupController: function(controller) {
Discourse.set('site', Discourse.Site.instance()); //Discourse.set('site', Discourse.Site.instance());
var currentUser = PreloadStore.get('currentUser'); var currentUser = PreloadStore.get('currentUser');
if (currentUser) { if (currentUser) {
Discourse.set('currentUser', Discourse.User.create(currentUser)); Discourse.set('currentUser', Discourse.User.create(currentUser));

View File

@ -9,10 +9,9 @@
Discourse.ListCategoryRoute = Discourse.FilteredListRoute.extend({ Discourse.ListCategoryRoute = Discourse.FilteredListRoute.extend({
model: function(params) { model: function(params) {
var categories = Discourse.Site.instance().get('categories'); var categories = Discourse.Category.list();
var slug = Em.get(params, 'slug'); var slug = Em.get(params, 'slug');
var category = categories.findProperty('slug', Em.get(params, 'slug')) var category = categories.findProperty('slug', Em.get(params, 'slug'))
// In case the slug didn't work, try to find it by id instead. // In case the slug didn't work, try to find it by id instead.

View File

@ -34,7 +34,7 @@
{{/if}} {{/if}}
{{textField value=content.title tabindex="2" id="reply-title" maxlength="255" class="span8" placeholderKey="composer.title_placeholder"}} {{textField value=content.title tabindex="2" id="reply-title" maxlength="255" class="span8" placeholderKey="composer.title_placeholder"}}
{{#unless content.creatingPrivateMessage}} {{#unless content.creatingPrivateMessage}}
{{view Discourse.ComboboxViewCategory valueAttribute="name" contentBinding="Discourse.site.categories" valueBinding="content.categoryName"}} {{view Discourse.ComboboxViewCategory valueAttribute="name" contentBinding="categories" valueBinding="content.categoryName"}}
{{#if content.archetype.hasOptions}} {{#if content.archetype.hasOptions}}
<button class='btn' {{action showOptions}}>{{i18n topic.options}}</button> <button class='btn' {{action showOptions}}>{{i18n topic.options}}</button>
{{/if}} {{/if}}

View File

@ -77,12 +77,12 @@
{{#titledLinkTo "list.latest" titleKey="filters.latest.help"}}{{i18n filters.latest.title}}{{/titledLinkTo}} {{#titledLinkTo "list.latest" titleKey="filters.latest.help"}}{{i18n filters.latest.title}}{{/titledLinkTo}}
</li> </li>
<li>{{#linkTo 'faq'}}{{i18n faq}}{{/linkTo}}</li> <li>{{#linkTo 'faq'}}{{i18n faq}}{{/linkTo}}</li>
{{#if view.categories}} {{#if categories}}
<li class='heading' title="{{i18n filters.categories.help}}"> <li class='heading' title="{{i18n filters.categories.help}}">
{{#linkTo "list.categories"}}{{i18n filters.categories.title}}{{/linkTo}} {{#linkTo "list.categories"}}{{i18n filters.categories.title}}{{/linkTo}}
</li> </li>
{{#each view.categories}} {{#each categories}}
<li class='category'> <li class='category'>
{{categoryLink this}} {{categoryLink this}}
<b>{{unbound topic_count}}</b></a> <b>{{unbound topic_count}}</b></a>

View File

@ -10,7 +10,7 @@
{{/if}} {{/if}}
{{#if view.editingTopic}} {{#if view.editingTopic}}
<input id='edit-title' type='text' {{bindAttr value="view.topic.title"}} autofocus> <input id='edit-title' type='text' {{bindAttr value="view.topic.title"}} autofocus>
{{view Discourse.ComboboxViewCategory valueAttribute="name" contentBinding="Discourse.site.categories" sourceBinding="view.topic.categoryName"}} {{view Discourse.ComboboxViewCategory valueAttribute="name" contentBinding="categories" sourceBinding="view.topic.categoryName"}}
<button class='btn btn-primary btn-small' {{action finishedEdit target="view"}}><i class='icon-ok'></i></button> <button class='btn btn-primary btn-small' {{action finishedEdit target="view"}}><i class='icon-ok'></i></button>
<button class='btn btn-small' {{action cancelEdit target="view"}}><i class='icon-remove'></i></button> <button class='btn btn-small' {{action cancelEdit target="view"}}><i class='icon-remove'></i></button>
{{else}} {{else}}

View File

@ -11,9 +11,7 @@ Discourse.HeaderView = Discourse.View.extend({
classNames: ['d-header', 'clearfix'], classNames: ['d-header', 'clearfix'],
classNameBindings: ['editingTopic'], classNameBindings: ['editingTopic'],
templateName: 'header', templateName: 'header',
siteBinding: 'Discourse.site',
currentUserBinding: 'Discourse.currentUser', currentUserBinding: 'Discourse.currentUser',
categoriesBinding: 'site.categories',
topicBinding: 'Discourse.router.topicController.content', topicBinding: 'Discourse.router.topicController.content',
showDropdown: function($target) { showDropdown: function($target) {

View File

@ -9,7 +9,6 @@
Discourse.ListView = Discourse.View.extend({ Discourse.ListView = Discourse.View.extend({
templateName: 'list/list', templateName: 'list/list',
composeViewBinding: Ember.Binding.oneWay('Discourse.composeView'), composeViewBinding: Ember.Binding.oneWay('Discourse.composeView'),
categoriesBinding: 'Discourse.site.categories',
// The window has been scrolled // The window has been scrolled
scrolled: function(e) { scrolled: function(e) {
@ -18,7 +17,7 @@ Discourse.ListView = Discourse.View.extend({
return currentView ? typeof currentView.scrolled === "function" ? currentView.scrolled(e) : void 0 : void 0; return currentView ? typeof currentView.scrolled === "function" ? currentView.scrolled(e) : void 0 : void 0;
}, },
createTopicText: (function() { createTopicText: function() {
if (this.get('controller.category.name')) { if (this.get('controller.category.name')) {
return Em.String.i18n("topic.create_in", { return Em.String.i18n("topic.create_in", {
categoryName: this.get('controller.category.name') categoryName: this.get('controller.category.name')
@ -26,7 +25,7 @@ Discourse.ListView = Discourse.View.extend({
} else { } else {
return Em.String.i18n("topic.create"); return Em.String.i18n("topic.create");
} }
}).property('controller.category.name') }.property('controller.category.name')
}); });

View File

@ -56,15 +56,16 @@ Discourse.EditCategoryView = Discourse.ModalBodyView.extend({
// background colors are available as a pipe-separated string // background colors are available as a pipe-separated string
backgroundColors: function() { backgroundColors: function() {
return Discourse.SiteSettings.category_colors.split("|").map(function(i) { return i.toUpperCase(); }).concat( return Discourse.SiteSettings.category_colors.split("|").map(function(i) { return i.toUpperCase(); }).concat(
Discourse.site.categories.map(function(c) { return c.color.toUpperCase(); }) ).uniq(); categories.map(function(c) { return c.color.toUpperCase(); }) ).uniq();
}.property('Discourse.SiteSettings.category_colors'), }.property('Discourse.SiteSettings.category_colors'),
usedBackgroundColors: function() { usedBackgroundColors: function() {
return Discourse.site.categories.map(function(c) { var categories = Discourse.Category.list();
return categories.map(function(c) {
// If editing a category, don't include its color: // If editing a category, don't include its color:
return (this.get('category.id') && this.get('category.color').toUpperCase() === c.color.toUpperCase()) ? null : c.color.toUpperCase(); return (this.get('category.id') && this.get('category.color').toUpperCase() === c.color.toUpperCase()) ? null : c.color.toUpperCase();
}, this).compact(); }, this).compact();
}.property('Discourse.site.categories', 'category.id', 'category.color'), }.property('category.id', 'category.color'),
title: function() { title: function() {
if (this.get('category.id')) return Em.String.i18n("category.edit_long"); if (this.get('category.id')) return Em.String.i18n("category.edit_long");
@ -97,7 +98,7 @@ Discourse.EditCategoryView = Discourse.ModalBodyView.extend({
// We need the topic_count to be correct, so get the most up-to-date info about this category from the server. // We need the topic_count to be correct, so get the most up-to-date info about this category from the server.
Discourse.Category.findBySlugOrId( this.get('category.slug') || this.get('category.id') ).then( function(cat) { Discourse.Category.findBySlugOrId( this.get('category.slug') || this.get('category.id') ).then( function(cat) {
categoryView.set('category', cat); categoryView.set('category', cat);
Discourse.get('site').updateCategory(cat); Discourse.Site.instance().updateCategory(cat);
categoryView.set('id', categoryView.get('category.slug')); categoryView.set('id', categoryView.get('category.slug'));
categoryView.set('loading', false); categoryView.set('loading', false);
}); });

View File

@ -47,7 +47,7 @@ Discourse.FlagView = Discourse.ModalBodyView.extend({
var action = this.get('selected'); var action = this.get('selected');
var postAction = this.get('post.actionByName.' + (action.get('name_key'))); var postAction = this.get('post.actionByName.' + (action.get('name_key')));
var actionType = Discourse.get('site').postActionTypeById(this.get('postActionTypeId')); var actionType = Discourse.Site.instance().postActionTypeById(this.get('postActionTypeId'));
if (postAction) { if (postAction) {
postAction.act({ postAction.act({
message: action.get('message') message: action.get('message')

View File

@ -8,11 +8,15 @@
**/ **/
Discourse.LoginView = Discourse.ModalBodyView.extend({ Discourse.LoginView = Discourse.ModalBodyView.extend({
templateName: 'modal/login', templateName: 'modal/login',
siteBinding: 'Discourse.site',
title: Em.String.i18n('login.title'), title: Em.String.i18n('login.title'),
authenticate: null, authenticate: null,
loggingIn: false, loggingIn: false,
site: function() {
return Discourse.Site.instance();
}.property(),
showView: function(view) { showView: function(view) {
return this.get('controller').show(view); return this.get('controller').show(view);
}, },

View File

@ -29,7 +29,7 @@ Discourse.PostView = Discourse.View.extend({
}.property('parentView'), }.property('parentView'),
postTypeClass: function() { postTypeClass: function() {
return this.get('post.post_type') === Discourse.get('site.post_types.moderator_action') ? 'moderator' : 'regular'; return this.get('post.post_type') === Discourse.Site.instance().get('post_types.moderator_action') ? 'moderator' : 'regular';
}.property('post.post_type'), }.property('post.post_type'),
// If the cooked content changed, add the quote controls // If the cooked content changed, add the quote controls

View File

@ -12,7 +12,6 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
topicBinding: 'controller.content', topicBinding: 'controller.content',
userFiltersBinding: 'controller.userFilters', userFiltersBinding: 'controller.userFilters',
classNameBindings: ['controller.multiSelect:multi-select', 'topic.archetype', 'topic.category.secure:secure_category'], classNameBindings: ['controller.multiSelect:multi-select', 'topic.archetype', 'topic.category.secure:secure_category'],
siteBinding: 'Discourse.site',
progressPosition: 1, progressPosition: 1,
menuVisible: true, menuVisible: true,
SHORT_POST: 1200, SHORT_POST: 1200,