parent
761cc688b4
commit
fab36e6cf7
|
@ -7,10 +7,10 @@ export default Ember.Controller.extend(BufferedContent, {
|
|||
saving: false,
|
||||
savingStatus: '',
|
||||
|
||||
badgeTypes: Em.computed.alias('adminBadges.badgeTypes'),
|
||||
badgeGroupings: Em.computed.alias('adminBadges.badgeGroupings'),
|
||||
badgeTriggers: Em.computed.alias('adminBadges.badgeTriggers'),
|
||||
protectedSystemFields: Em.computed.alias('adminBadges.protectedSystemFields'),
|
||||
badgeTypes: Ember.computed.alias('adminBadges.badgeTypes'),
|
||||
badgeGroupings: Ember.computed.alias('adminBadges.badgeGroupings'),
|
||||
badgeTriggers: Ember.computed.alias('adminBadges.badgeTriggers'),
|
||||
protectedSystemFields: Ember.computed.alias('adminBadges.protectedSystemFields'),
|
||||
|
||||
readOnly: Ember.computed.alias('buffered.system'),
|
||||
showDisplayName: propertyNotEqual('name', 'displayName'),
|
||||
|
|
|
@ -33,7 +33,7 @@ export default Ember.Controller.extend(activeSections, {
|
|||
return !this.get('model.changed') || this.get('model.isSaving');
|
||||
}.property('model.changed', 'model.isSaving'),
|
||||
|
||||
needs: ['adminCustomizeCssHtml'],
|
||||
adminCustomizeCssHtml: Ember.inject.controller(),
|
||||
|
||||
undoPreviewUrl: url('/?preview-style='),
|
||||
defaultStyleUrl: url('/?preview-style=default'),
|
||||
|
@ -44,13 +44,12 @@ export default Ember.Controller.extend(activeSections, {
|
|||
},
|
||||
|
||||
destroy() {
|
||||
const self = this;
|
||||
return bootbox.confirm(I18n.t("admin.customize.delete_confirm"), I18n.t("no_value"), I18n.t("yes_value"), function(result) {
|
||||
return bootbox.confirm(I18n.t("admin.customize.delete_confirm"), I18n.t("no_value"), I18n.t("yes_value"), result => {
|
||||
if (result) {
|
||||
const model = self.get('model');
|
||||
model.destroyRecord().then(function() {
|
||||
self.get('controllers.adminCustomizeCssHtml').get('model').removeObject(model);
|
||||
self.transitionToRoute('adminCustomizeCssHtml');
|
||||
const model = this.get('model');
|
||||
model.destroyRecord().then(() => {
|
||||
this.get('adminCustomizeCssHtml').get('model').removeObject(model);
|
||||
this.transitionToRoute('adminCustomizeCssHtml');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -11,6 +11,6 @@ export default Ember.Controller.extend({
|
|||
} else {
|
||||
return [];
|
||||
}
|
||||
}.property('controllers.adminSiteSettings.content', 'categoryNameKey')
|
||||
}.property('adminSiteSettings.content', 'categoryNameKey')
|
||||
|
||||
});
|
||||
|
|
|
@ -4,10 +4,10 @@ import computed from 'ember-addons/ember-computed-decorators';
|
|||
import InputValidation from 'discourse/models/input-validation';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['adminWebHooks'],
|
||||
eventTypes: Em.computed.alias('controllers.adminWebHooks.eventTypes'),
|
||||
defaultEventTypes: Em.computed.alias('controllers.adminWebHooks.defaultEventTypes'),
|
||||
contentTypes: Em.computed.alias('controllers.adminWebHooks.contentTypes'),
|
||||
adminWebHooks: Ember.inject.controller(),
|
||||
eventTypes: Ember.computed.alias('adminWebHooks.eventTypes'),
|
||||
defaultEventTypes: Ember.computed.alias('adminWebHooks.defaultEventTypes'),
|
||||
contentTypes: Ember.computed.alias('adminWebHooks.contentTypes'),
|
||||
|
||||
@computed('model.isSaving', 'saved', 'saveButtonDisabled')
|
||||
savingStatus(isSaving, saved, saveButtonDisabled) {
|
||||
|
@ -68,7 +68,7 @@ export default Ember.Controller.extend({
|
|||
const saveWebHook = () => {
|
||||
return model.save().then(() => {
|
||||
this.set('saved', true);
|
||||
this.get('controllers.adminWebHooks').get('model').addObject(model);
|
||||
this.get('adminWebHooks').get('model').addObject(model);
|
||||
}).catch(popupAjaxError);
|
||||
};
|
||||
|
||||
|
@ -88,7 +88,7 @@ export default Ember.Controller.extend({
|
|||
if (result) {
|
||||
const model = this.get('model');
|
||||
model.destroyRecord().then(() => {
|
||||
this.get('controllers.adminWebHooks').get('model').removeObject(model);
|
||||
this.get('adminWebHooks').get('model').removeObject(model);
|
||||
this.transitionToRoute('adminWebHooks');
|
||||
}).catch(popupAjaxError);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
import { escapeExpression } from 'discourse/lib/utilities';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['modal'],
|
||||
|
||||
sample: Em.computed.alias('model.sample'),
|
||||
errors: Em.computed.alias('model.errors'),
|
||||
count: Em.computed.alias('model.grant_count'),
|
||||
sample: Ember.computed.alias('model.sample'),
|
||||
errors: Ember.computed.alias('model.errors'),
|
||||
count: Ember.computed.alias('model.grant_count'),
|
||||
|
||||
count_warning: function() {
|
||||
if (this.get('count') <= 10) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { ajax } from 'discourse/lib/ajax';
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['modal'],
|
||||
|
||||
modelChanged: function(){
|
||||
const model = this.get('model');
|
||||
|
|
|
@ -2,31 +2,27 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
|||
import Backup from 'admin/models/backup';
|
||||
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
needs: ["adminBackupsLogs"],
|
||||
adminBackupsLogs: Ember.inject.controller(),
|
||||
|
||||
_startBackup: function (withUploads) {
|
||||
var self = this;
|
||||
Discourse.User.currentProp("hideReadOnlyAlert", true);
|
||||
Backup.start(withUploads).then(function() {
|
||||
self.get("controllers.adminBackupsLogs").clear();
|
||||
self.send("backupStarted");
|
||||
_startBackup(withUploads) {
|
||||
this.currentUser.set('hideReadOnlyAlert', true);
|
||||
Backup.start(withUploads).then(() => {
|
||||
this.get("adminBackupsLogs.logs").clear();
|
||||
this.send("backupStarted");
|
||||
});
|
||||
},
|
||||
|
||||
actions: {
|
||||
|
||||
startBackup: function () {
|
||||
startBackup() {
|
||||
this._startBackup();
|
||||
},
|
||||
|
||||
startBackupWithoutUpload: function () {
|
||||
startBackupWithoutUpload() {
|
||||
this._startBackup(false);
|
||||
},
|
||||
|
||||
cancel: function () {
|
||||
cancel() {
|
||||
this.send("closeModal");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -13,7 +13,6 @@ function updateState(state, opts) {
|
|||
|
||||
post.update(args).then(() => {
|
||||
this.sendAction('removePost', post);
|
||||
// this.get('controllers.queued-posts.model').removeObject(post);
|
||||
}).catch(popupAjaxError);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ export default Ember.Controller.extend({
|
|||
queryParams: ['username'],
|
||||
noMoreBadges: false,
|
||||
userBadges: null,
|
||||
needs: ["application"],
|
||||
application: Ember.inject.controller(),
|
||||
|
||||
@computed('username')
|
||||
user(username) {
|
||||
|
@ -55,7 +55,7 @@ export default Ember.Controller.extend({
|
|||
|
||||
@observes('canLoadMore')
|
||||
_showFooter() {
|
||||
this.set("controllers.application.showFooter", !this.get("canLoadMore"));
|
||||
this.set("application.showFooter", !this.get("canLoadMore"));
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -4,9 +4,7 @@ import DiscourseURL from 'discourse/lib/url';
|
|||
|
||||
// Modal related to changing the ownership of posts
|
||||
export default Ember.Controller.extend(SelectedPostsCount, ModalFunctionality, {
|
||||
needs: ['topic'],
|
||||
|
||||
topicController: Em.computed.alias('controllers.topic'),
|
||||
topicController: Ember.inject.controller('topic'),
|
||||
selectedPosts: Em.computed.alias('topicController.selectedPosts'),
|
||||
saving: false,
|
||||
new_user: null,
|
||||
|
|
|
@ -4,9 +4,8 @@ import DiscourseURL from 'discourse/lib/url';
|
|||
|
||||
// Modal related to changing the timestamp of posts
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
needs: ['topic'],
|
||||
|
||||
topicController: Em.computed.alias('controllers.topic'),
|
||||
topicController: Ember.inject.controller('topic'),
|
||||
saving: false,
|
||||
date: '',
|
||||
time: '',
|
||||
|
|
|
@ -51,7 +51,9 @@ export function addPopupMenuOptionsCallback(callback) {
|
|||
}
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['modal', 'topic', 'application'],
|
||||
topicController: Ember.inject.controller('topic'),
|
||||
application: Ember.inject.controller(),
|
||||
|
||||
replyAsNewTopicDraft: Em.computed.equal('model.draftKey', Composer.REPLY_AS_NEW_TOPIC_KEY),
|
||||
checkedMessages: false,
|
||||
messageCount: null,
|
||||
|
@ -102,7 +104,7 @@ export default Ember.Controller.extend({
|
|||
}
|
||||
}),
|
||||
|
||||
topicModel: Ember.computed.alias('controllers.topic.model'),
|
||||
topicModel: Ember.computed.alias('topicController.model'),
|
||||
|
||||
@computed('model.canEditTitle', 'model.creatingPrivateMessage')
|
||||
canEditTags(canEditTitle, creatingPrivateMessage) {
|
||||
|
@ -484,7 +486,7 @@ export default Ember.Controller.extend({
|
|||
self.appEvents.one('composer:will-open', () => bootbox.alert(error));
|
||||
});
|
||||
|
||||
if (this.get('controllers.application.currentRouteName').split('.')[0] === 'topic' &&
|
||||
if (this.get('application.currentRouteName').split('.')[0] === 'topic' &&
|
||||
composer.get('topic.id') === this.get('topicModel.id')) {
|
||||
staged = composer.get('stagedPost');
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import { emailValid } from 'discourse/lib/utilities';
|
|||
import InputValidation from 'discourse/models/input-validation';
|
||||
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
needs: ['login'],
|
||||
login: Ember.inject.controller(),
|
||||
|
||||
uniqueUsernameValidation: null,
|
||||
globalNicknameExists: false,
|
||||
|
@ -345,7 +345,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
|
||||
actions: {
|
||||
externalLogin(provider) {
|
||||
this.get('controllers.login').send('externalLogin', provider);
|
||||
this.get('login').send('externalLogin', provider);
|
||||
},
|
||||
|
||||
createAccount() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Just add query params here to have them automatically passed to topic list filters.
|
||||
export var queryParams = {
|
||||
export const queryParams = {
|
||||
order: { replace: true, refreshModel: true },
|
||||
ascending: { replace: true, refreshModel: true },
|
||||
status: { replace: true, refreshModel: true },
|
||||
|
@ -10,12 +10,12 @@ export var queryParams = {
|
|||
};
|
||||
|
||||
// Basic controller options
|
||||
var controllerOpts = {
|
||||
needs: ['discovery/topics'],
|
||||
const controllerOpts = {
|
||||
discoveryTopics: Ember.inject.controller('discovery/topics'),
|
||||
queryParams: Object.keys(queryParams),
|
||||
};
|
||||
|
||||
// Aliases for the values
|
||||
controllerOpts.queryParams.forEach(p => controllerOpts[p] = Em.computed.alias(`controllers.discovery/topics.${p}`));
|
||||
controllerOpts.queryParams.forEach(p => controllerOpts[p] = Ember.computed.alias(`discoveryTopics.${p}`));
|
||||
|
||||
export default Ember.Controller.extend(controllerOpts);
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
import DiscourseURL from 'discourse/lib/url';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['navigation/category', 'discovery/topics', 'application'],
|
||||
discoveryTopics: Ember.inject.controller('discovery/topics'),
|
||||
navigationCategory: Ember.inject.controller('navigation/category'),
|
||||
application: Ember.inject.controller(),
|
||||
|
||||
loading: false,
|
||||
|
||||
category: Em.computed.alias('controllers.navigation/category.category'),
|
||||
noSubcategories: Em.computed.alias('controllers.navigation/category.noSubcategories'),
|
||||
category: Em.computed.alias('navigationCategory.category'),
|
||||
noSubcategories: Em.computed.alias('navigationCategory.noSubcategories'),
|
||||
|
||||
loadedAllItems: Em.computed.not("controllers.discovery/topics.model.canLoadMore"),
|
||||
loadedAllItems: Em.computed.not("discoveryTopics.model.canLoadMore"),
|
||||
|
||||
_showFooter: function() {
|
||||
this.set("controllers.application.showFooter", this.get("loadedAllItems"));
|
||||
this.set("application.showFooter", this.get("loadedAllItems"));
|
||||
}.observes("loadedAllItems"),
|
||||
|
||||
showMoreUrl(period) {
|
||||
|
|
|
@ -2,7 +2,7 @@ import computed from 'ember-addons/ember-computed-decorators';
|
|||
import DiscoveryController from 'discourse/controllers/discovery';
|
||||
|
||||
export default DiscoveryController.extend({
|
||||
needs: ['modal', 'discovery'],
|
||||
discovery: Ember.inject.controller(),
|
||||
|
||||
// this makes sure the composer isn't scoping to a specific category
|
||||
category: null,
|
||||
|
|
|
@ -5,13 +5,14 @@ import { endWith } from 'discourse/lib/computed';
|
|||
import showModal from 'discourse/lib/show-modal';
|
||||
|
||||
const controllerOpts = {
|
||||
needs: ['discovery'],
|
||||
discovery: Ember.inject.controller(),
|
||||
discoveryTopics: Ember.inject.controller('discovery/topics'),
|
||||
|
||||
period: null,
|
||||
|
||||
canStar: Em.computed.alias('controllers.discovery/topics.currentUser.id'),
|
||||
showTopicPostBadges: Em.computed.not('controllers.discovery/topics.new'),
|
||||
|
||||
redirectedReason: Em.computed.alias('currentUser.redirected_to_top.reason'),
|
||||
canStar: Ember.computed.alias('currentUser.id'),
|
||||
showTopicPostBadges: Ember.computed.not('discoveryTopics.new'),
|
||||
redirectedReason: Ember.computed.alias('currentUser.redirected_to_top.reason'),
|
||||
|
||||
order: 'default',
|
||||
ascending: false,
|
||||
|
@ -46,12 +47,12 @@ const controllerOpts = {
|
|||
this.setProperties({ order: "default", ascending: false });
|
||||
|
||||
// Don't refresh if we're still loading
|
||||
if (this.get('controllers.discovery.loading')) { return; }
|
||||
if (this.get('discovery.loading')) { return; }
|
||||
|
||||
// If we `send('loading')` here, due to returning true it bubbles up to the
|
||||
// router and ember throws an error due to missing `handlerInfos`.
|
||||
// Lesson learned: Don't call `loading` yourself.
|
||||
this.set('controllers.discovery.loading', true);
|
||||
this.set('discovery.loading', true);
|
||||
|
||||
this.store.findFiltered('topicList', {filter}).then(list => {
|
||||
const TopicList = require('discourse/models/topic-list').default;
|
||||
|
|
|
@ -20,9 +20,9 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
|
||||
changeSize: function() {
|
||||
if (!Ember.isEmpty(this.get('model.description'))) {
|
||||
this.set('controllers.modal.modalClass', 'edit-category-modal full');
|
||||
this.set('modal.modalClass', 'edit-category-modal full');
|
||||
} else {
|
||||
this.set('controllers.modal.modalClass', 'edit-category-modal small');
|
||||
this.set('modal.modalClass', 'edit-category-modal small');
|
||||
}
|
||||
}.observes('model.description'),
|
||||
|
||||
|
@ -34,7 +34,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
}.property('model.id', 'model.name'),
|
||||
|
||||
titleChanged: function() {
|
||||
this.set('controllers.modal.title', this.get('title'));
|
||||
this.set('modal.title', this.get('title'));
|
||||
}.observes('title'),
|
||||
|
||||
disabled: function() {
|
||||
|
|
|
@ -5,7 +5,7 @@ import computed from 'ember-addons/ember-computed-decorators';
|
|||
import InputValidation from 'discourse/models/input-validation';
|
||||
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
needs: ["topic"],
|
||||
topicController: Ember.inject.controller('topic'),
|
||||
|
||||
loading: true,
|
||||
pinnedInCategoryCount: 0,
|
||||
|
@ -106,7 +106,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
},
|
||||
|
||||
_forwardAction(name) {
|
||||
this.get("controllers.topic").send(name);
|
||||
this.get("topicController").send(name);
|
||||
this.send("closeModal");
|
||||
},
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ const SortOrders = [
|
|||
];
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
needs: ["application"],
|
||||
application: Ember.inject.controller(),
|
||||
bulkSelectEnabled: null,
|
||||
|
||||
loading: Em.computed.not("model"),
|
||||
|
@ -131,7 +131,7 @@ export default Ember.Controller.extend({
|
|||
|
||||
@observes('loading')
|
||||
_showFooter() {
|
||||
this.set("controllers.application.showFooter", !this.get("loading"));
|
||||
this.set("application.showFooter", !this.get("loading"));
|
||||
},
|
||||
|
||||
@computed('hasResults')
|
||||
|
|
|
@ -2,7 +2,7 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
|||
import { emailValid } from 'discourse/lib/utilities';
|
||||
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
needs: ['user-invited-show'],
|
||||
userInvitedShow: Ember.inject.controller('user-invited-show'),
|
||||
|
||||
// If this isn't defined, it will proxy to the user model on the preferences
|
||||
// page which is wrong.
|
||||
|
@ -169,7 +169,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
if (this.get('disabled')) { return; }
|
||||
|
||||
const groupNames = this.get('model.groupNames'),
|
||||
userInvitedController = this.get('controllers.user-invited-show'),
|
||||
userInvitedController = this.get('userInvitedShow'),
|
||||
model = this.get('model');
|
||||
|
||||
model.setProperties({ saving: true, error: false });
|
||||
|
@ -215,7 +215,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
if (this.get('disabled')) { return; }
|
||||
|
||||
const groupNames = this.get('model.groupNames'),
|
||||
userInvitedController = this.get('controllers.user-invited-show'),
|
||||
userInvitedController = this.get('userInvitedShow'),
|
||||
model = this.get('model');
|
||||
|
||||
var topicId = null;
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
needs: ['modal'],
|
||||
|
||||
onShow: function() {
|
||||
this.set('controllers.modal.modalClass', 'keyboard-shortcuts-modal');
|
||||
onShow() {
|
||||
this.set('modal.modalClass', 'keyboard-shortcuts-modal');
|
||||
}
|
||||
});
|
||||
|
|
|
@ -11,13 +11,17 @@ const AuthErrors =
|
|||
'not_allowed_from_ip_address'];
|
||||
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
needs: ['modal', 'createAccount', 'forgotPassword', 'application'],
|
||||
|
||||
createAccount: Ember.inject.controller(),
|
||||
forgotPassword: Ember.inject.controller(),
|
||||
application: Ember.inject.controller(),
|
||||
|
||||
authenticate: null,
|
||||
loggingIn: false,
|
||||
loggedIn: false,
|
||||
|
||||
canLoginLocal: setting('enable_local_logins'),
|
||||
loginRequired: Em.computed.alias('controllers.application.loginRequired'),
|
||||
loginRequired: Em.computed.alias('application.loginRequired'),
|
||||
|
||||
resetForm: function() {
|
||||
this.set('authenticate', null);
|
||||
|
@ -37,7 +41,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
loginDisabled: Em.computed.or('loggingIn', 'loggedIn'),
|
||||
|
||||
showSignupLink: function() {
|
||||
return this.get('controllers.application.canSignUp') &&
|
||||
return this.get('application.canSignUp') &&
|
||||
!this.get('loggingIn') &&
|
||||
Ember.isEmpty(this.get('authenticate'));
|
||||
}.property('loggingIn', 'authenticate'),
|
||||
|
@ -160,7 +164,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
},
|
||||
|
||||
createAccount: function() {
|
||||
const createAccountController = this.get('controllers.createAccount');
|
||||
const createAccountController = this.get('createAccount');
|
||||
if (createAccountController) {
|
||||
createAccountController.resetForm();
|
||||
const loginName = this.get('loginName');
|
||||
|
@ -174,7 +178,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
},
|
||||
|
||||
forgotPassword: function() {
|
||||
const forgotPasswordController = this.get('controllers.forgotPassword');
|
||||
const forgotPasswordController = this.get('forgotPassword');
|
||||
if (forgotPasswordController) { forgotPasswordController.set("accountEmailOrUsername", this.get("loginName")); }
|
||||
this.send("showForgotPassword");
|
||||
}
|
||||
|
@ -229,7 +233,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
return;
|
||||
}
|
||||
|
||||
const createAccountController = this.get('controllers.createAccount');
|
||||
const createAccountController = this.get('createAccount');
|
||||
createAccountController.setProperties({
|
||||
accountEmail: options.email,
|
||||
accountUsername: options.username,
|
||||
|
|
|
@ -5,12 +5,11 @@ import DiscourseURL from 'discourse/lib/url';
|
|||
|
||||
// Modal related to merging of topics
|
||||
export default Ember.Controller.extend(SelectedPostsCount, ModalFunctionality, {
|
||||
needs: ['topic'],
|
||||
topicController: Ember.inject.controller('topic'),
|
||||
|
||||
saving: false,
|
||||
selectedTopicId: null,
|
||||
|
||||
topicController: Em.computed.alias('controllers.topic'),
|
||||
selectedPosts: Em.computed.alias('topicController.selectedPosts'),
|
||||
selectedReplies: Em.computed.alias('topicController.selectedReplies'),
|
||||
allPostsSelected: Em.computed.alias('topicController.allPostsSelected'),
|
||||
|
@ -26,7 +25,7 @@ export default Ember.Controller.extend(SelectedPostsCount, ModalFunctionality, {
|
|||
}.property('saving'),
|
||||
|
||||
onShow() {
|
||||
this.set('controllers.modal.modalClass', 'split-modal');
|
||||
this.set('modal.modalClass', 'split-modal');
|
||||
},
|
||||
|
||||
actions: {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['discovery', 'discovery/topics'],
|
||||
discovery: Ember.inject.controller(),
|
||||
discoveryTopics: Ember.inject.controller('discovery/topics'),
|
||||
|
||||
@computed()
|
||||
categories() {
|
||||
|
|
|
@ -3,13 +3,14 @@ import computed from 'ember-addons/ember-computed-decorators';
|
|||
import { selectedText } from 'discourse/lib/utilities';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['topic', 'composer'],
|
||||
topic: Ember.inject.controller(),
|
||||
composer: Ember.inject.controller(),
|
||||
|
||||
@computed('buffer', 'postId')
|
||||
post(buffer, postId) {
|
||||
if (!postId || Ember.isEmpty(buffer)) { return null; }
|
||||
|
||||
const postStream = this.get('controllers.topic.model.postStream');
|
||||
const postStream = this.get('topic.model.postStream');
|
||||
const post = postStream.findLoadedPost(postId);
|
||||
|
||||
return post;
|
||||
|
@ -22,7 +23,7 @@ export default Ember.Controller.extend({
|
|||
if (!this.currentUser) return;
|
||||
|
||||
// don't display the "quote-reply" button if we can't reply
|
||||
const topicDetails = this.get('controllers.topic.model.details');
|
||||
const topicDetails = this.get('topic.model.details');
|
||||
if (!(topicDetails.get('can_reply_as_new_topic') || topicDetails.get('can_create_post'))) {
|
||||
return;
|
||||
}
|
||||
|
@ -106,7 +107,7 @@ export default Ember.Controller.extend({
|
|||
|
||||
// defer load if needed, if in an expanded replies section
|
||||
if (!post) {
|
||||
const postStream = this.get('controllers.topic.model.postStream');
|
||||
const postStream = this.get('topic.model.postStream');
|
||||
return postStream.loadPost(postId).then(p => {
|
||||
this.set('post', p);
|
||||
return this.quoteText();
|
||||
|
@ -114,12 +115,12 @@ export default Ember.Controller.extend({
|
|||
}
|
||||
|
||||
// If we can't create a post, delegate to reply as new topic
|
||||
if (!this.get('controllers.topic.model.details.can_create_post')) {
|
||||
this.get('controllers.topic').send('replyAsNewTopic', post);
|
||||
if (!this.get('topic.model.details.can_create_post')) {
|
||||
this.get('topic').send('replyAsNewTopic', post);
|
||||
return;
|
||||
}
|
||||
|
||||
const composerController = this.get('controllers.composer');
|
||||
const composerController = this.get('composer');
|
||||
const composerOpts = {
|
||||
action: Composer.REPLY,
|
||||
draftKey: post.get('topic.draft_key')
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
needs: ['modal'],
|
||||
|
||||
showGoogleSearch: function() {
|
||||
return !Discourse.SiteSettings.login_required;
|
||||
}.property()
|
||||
|
|
|
@ -3,10 +3,10 @@ import { longDateNoYear } from 'discourse/lib/formatter';
|
|||
import computed from 'ember-addons/ember-computed-decorators';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['topic'],
|
||||
topic: Ember.inject.controller(),
|
||||
|
||||
title: Ember.computed.alias('controllers.topic.model.title'),
|
||||
canReplyAsNewTopic: Ember.computed.alias('controllers.topic.model.details.can_reply_as_new_topic'),
|
||||
title: Ember.computed.alias('topic.model.title'),
|
||||
canReplyAsNewTopic: Ember.computed.alias('topic.model.details.can_reply_as_new_topic'),
|
||||
|
||||
@computed('type', 'postNumber')
|
||||
shareTitle(type, postNumber) {
|
||||
|
@ -31,7 +31,7 @@ export default Ember.Controller.extend({
|
|||
},
|
||||
|
||||
replyAsNewTopic() {
|
||||
const topicController = this.get("controllers.topic");
|
||||
const topicController = this.get("topic");
|
||||
const postStream = topicController.get("model.postStream");
|
||||
const postId = this.get("postId") || postStream.findPostIdForPostNumber(1);
|
||||
const post = postStream.findLoadedPost(postId);
|
||||
|
|
|
@ -6,12 +6,11 @@ import DiscourseURL from 'discourse/lib/url';
|
|||
|
||||
// Modal related to auto closing of topics
|
||||
export default Ember.Controller.extend(SelectedPostsCount, ModalFunctionality, {
|
||||
needs: ['topic'],
|
||||
topicName: null,
|
||||
saving: false,
|
||||
categoryId: null,
|
||||
|
||||
topicController: Em.computed.alias('controllers.topic'),
|
||||
topicController: Ember.inject.controller('topic'),
|
||||
selectedPosts: Em.computed.alias('topicController.selectedPosts'),
|
||||
selectedReplies: Em.computed.alias('topicController.selectedReplies'),
|
||||
allPostsSelected: Em.computed.alias('topicController.allPostsSelected'),
|
||||
|
@ -28,7 +27,7 @@ export default Ember.Controller.extend(SelectedPostsCount, ModalFunctionality, {
|
|||
|
||||
onShow() {
|
||||
this.setProperties({
|
||||
'controllers.modal.modalClass': 'split-modal',
|
||||
'modal.modalClass': 'split-modal',
|
||||
saving: false,
|
||||
categoryId: null,
|
||||
topicName: ''
|
||||
|
|
|
@ -2,13 +2,13 @@ import { ajax } from 'discourse/lib/ajax';
|
|||
import computed from 'ember-addons/ember-computed-decorators';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['application'],
|
||||
application: Ember.inject.controller(),
|
||||
|
||||
showLoginButton: Em.computed.equal("model.path", "login"),
|
||||
|
||||
@computed("model.path")
|
||||
showSignupButton() {
|
||||
return this.get("model.path") === "login" && this.get('controllers.application.canSignUp');
|
||||
return this.get("model.path") === "login" && this.get('application.canSignUp');
|
||||
},
|
||||
|
||||
actions: {
|
||||
|
|
|
@ -40,7 +40,7 @@ if (customNavItemHref) {
|
|||
|
||||
|
||||
export default Ember.Controller.extend(BulkTopicSelection, {
|
||||
needs: ["application"],
|
||||
application: Ember.inject.controller(),
|
||||
|
||||
tag: null,
|
||||
additionalTags: null,
|
||||
|
@ -81,7 +81,7 @@ export default Ember.Controller.extend(BulkTopicSelection, {
|
|||
},
|
||||
|
||||
_showFooter: function() {
|
||||
this.set("controllers.application.showFooter", !this.get("list.canLoadMore"));
|
||||
this.set("application.showFooter", !this.get("list.canLoadMore"));
|
||||
}.observes("list.canLoadMore"),
|
||||
|
||||
footerMessage: function() {
|
||||
|
|
|
@ -24,7 +24,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
emptyTags: Ember.computed.empty('tags'),
|
||||
|
||||
onShow() {
|
||||
this.set('controllers.modal.modalClass', 'topic-bulk-actions-modal small');
|
||||
this.set('modal.modalClass', 'topic-bulk-actions-modal small');
|
||||
|
||||
const buttonRows = [];
|
||||
let row = [];
|
||||
|
@ -86,7 +86,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
|
||||
showChangeCategory() {
|
||||
this.send('changeBulkTemplate', 'modal/bulk_change_category');
|
||||
this.set('controllers.modal.modalClass', 'topic-bulk-actions-modal full');
|
||||
this.set('modal.modalClass', 'topic-bulk-actions-modal full');
|
||||
},
|
||||
|
||||
showNotificationLevel() {
|
||||
|
|
|
@ -11,7 +11,10 @@ import { categoryBadgeHTML } from 'discourse/helpers/category-link';
|
|||
import Post from 'discourse/models/post';
|
||||
|
||||
export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
||||
needs: ['modal', 'composer', 'quote-button', 'application'],
|
||||
composer: Ember.inject.controller(),
|
||||
quoteButton: Ember.inject.controller('quote-button'),
|
||||
application: Ember.inject.controller(),
|
||||
|
||||
multiSelect: false,
|
||||
allPostsSelected: false,
|
||||
editingTopic: false,
|
||||
|
@ -282,8 +285,8 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
|||
|
||||
// Post related methods
|
||||
replyToPost(post) {
|
||||
const composerController = this.get('controllers.composer'),
|
||||
quoteController = this.get('controllers.quote-button'),
|
||||
const composerController = this.get('composer'),
|
||||
quoteController = this.get('quoteButton'),
|
||||
quotedText = Quote.build(quoteController.get('post'), quoteController.get('buffer')),
|
||||
topic = post ? post.get('topic') : this.get('model');
|
||||
|
||||
|
@ -380,7 +383,7 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
|||
return false;
|
||||
}
|
||||
|
||||
const composer = this.get('controllers.composer'),
|
||||
const composer = this.get('composer'),
|
||||
composerModel = composer.get('model'),
|
||||
opts = {
|
||||
post: post,
|
||||
|
@ -602,8 +605,8 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
|||
},
|
||||
|
||||
replyAsNewTopic(post) {
|
||||
const composerController = this.get('controllers.composer');
|
||||
const quoteController = this.get('controllers.quote-button');
|
||||
const composerController = this.get('composer');
|
||||
const quoteController = this.get('quoteButton');
|
||||
post = post || quoteController.get('post');
|
||||
const quotedText = Quote.build(post, quoteController.get('buffer'));
|
||||
|
||||
|
@ -905,7 +908,7 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
|||
|
||||
_showFooter: function() {
|
||||
const showFooter = this.get("model.postStream.loaded") && this.get("model.postStream.loadedAllPosts");
|
||||
this.set("controllers.application.showFooter", showFooter);
|
||||
this.set("application.showFooter", showFooter);
|
||||
}.observes("model.postStream.{loaded,loadedAllPosts}")
|
||||
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
|||
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
notReady: Em.computed.not('ready'),
|
||||
needs: ['adminCustomizeCssHtml'],
|
||||
adminCustomizeCssHtml: Ember.inject.controller(),
|
||||
|
||||
ready: function() {
|
||||
try {
|
||||
|
@ -22,7 +22,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
delete object.id;
|
||||
delete object.key;
|
||||
|
||||
const controller = this.get('controllers.adminCustomizeCssHtml');
|
||||
const controller = this.get('adminCustomizeCssHtml');
|
||||
controller.send('newCustomization', object);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
import { exportUserArchive } from 'discourse/lib/export-csv';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
application: Ember.inject.controller(),
|
||||
user: Ember.inject.controller(),
|
||||
|
||||
userActionType: null,
|
||||
needs: ["application", "user"],
|
||||
currentPath: Em.computed.alias('controllers.application.currentPath'),
|
||||
viewingSelf: Em.computed.alias("controllers.user.viewingSelf"),
|
||||
showBookmarks: Em.computed.alias("controllers.user.showBookmarks"),
|
||||
currentPath: Ember.computed.alias('application.currentPath'),
|
||||
viewingSelf: Ember.computed.alias("user.viewingSelf"),
|
||||
showBookmarks: Ember.computed.alias("user.showBookmarks"),
|
||||
|
||||
_showFooter: function() {
|
||||
var showFooter;
|
||||
|
@ -15,7 +17,7 @@ export default Ember.Controller.extend({
|
|||
} else {
|
||||
showFooter = this.get("model.statsCountNonPM") <= this.get("model.stream.itemsLoaded");
|
||||
}
|
||||
this.set("controllers.application.showFooter", showFooter);
|
||||
this.set("application.showFooter", showFooter);
|
||||
}.observes("userActionType", "model.stream.itemsLoaded"),
|
||||
|
||||
actions: {
|
||||
|
|
|
@ -3,7 +3,9 @@ import { propertyNotEqual, setting } from 'discourse/lib/computed';
|
|||
import computed from 'ember-addons/ember-computed-decorators';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['topic', 'application'],
|
||||
topic: Ember.inject.controller(),
|
||||
application: Ember.inject.controller(),
|
||||
|
||||
visible: false,
|
||||
user: null,
|
||||
username: null,
|
||||
|
@ -15,10 +17,10 @@ export default Ember.Controller.extend({
|
|||
// If inside a topic
|
||||
topicPostCount: null,
|
||||
|
||||
postStream: Em.computed.alias('controllers.topic.model.postStream'),
|
||||
postStream: Em.computed.alias('topic.model.postStream'),
|
||||
enoughPostsForFiltering: Em.computed.gte('topicPostCount', 2),
|
||||
viewingTopic: Em.computed.match('controllers.application.currentPath', /^topic\./),
|
||||
viewingAdmin: Em.computed.match('controllers.application.currentPath', /^admin\./),
|
||||
viewingTopic: Em.computed.match('application.currentPath', /^topic\./),
|
||||
viewingAdmin: Em.computed.match('application.currentPath', /^admin\./),
|
||||
showFilter: Em.computed.and('viewingTopic', 'postStream.hasNoFilters', 'enoughPostsForFiltering'),
|
||||
showName: propertyNotEqual('user.name', 'user.username'),
|
||||
hasUserFilters: Em.computed.gt('postStream.userFilters.length', 0),
|
||||
|
@ -97,7 +99,7 @@ export default Ember.Controller.extend({
|
|||
this.setProperties({ username, userLoading: username, cardTarget: target, post });
|
||||
|
||||
const args = { stats: false };
|
||||
args.include_post_count_for = this.get('controllers.topic.model.id');
|
||||
args.include_post_count_for = this.get('topic.model.id');
|
||||
args.skip_track_visit = true;
|
||||
|
||||
return Discourse.User.findByUsername(username, args).then((user) => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
export default Ember.Controller.extend({
|
||||
needs: ["application"],
|
||||
application: Ember.inject.controller(),
|
||||
|
||||
_showFooter: function() {
|
||||
this.set("controllers.application.showFooter", !this.get("model.canLoadMore"));
|
||||
this.set("application.showFooter", !this.get("model.canLoadMore"));
|
||||
}.observes("model.canLoadMore")
|
||||
});
|
||||
|
|
|
@ -2,18 +2,21 @@ import computed from 'ember-addons/ember-computed-decorators';
|
|||
import Topic from 'discourse/models/topic';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
needs: ["application", "user-topics-list", "user"],
|
||||
application: Ember.inject.controller(),
|
||||
userTopicsList: Ember.inject.controller('user-topics-list'),
|
||||
user: Ember.inject.controller(),
|
||||
|
||||
pmView: false,
|
||||
viewingSelf: Em.computed.alias('controllers.user.viewingSelf'),
|
||||
viewingSelf: Em.computed.alias('user.viewingSelf'),
|
||||
isGroup: Em.computed.equal('pmView', 'groups'),
|
||||
currentPath: Em.computed.alias('controllers.application.currentPath'),
|
||||
selected: Em.computed.alias('controllers.user-topics-list.selected'),
|
||||
bulkSelectEnabled: Em.computed.alias('controllers.user-topics-list.bulkSelectEnabled'),
|
||||
currentPath: Em.computed.alias('application.currentPath'),
|
||||
selected: Em.computed.alias('userTopicsList.selected'),
|
||||
bulkSelectEnabled: Em.computed.alias('userTopicsList.bulkSelectEnabled'),
|
||||
|
||||
showNewPM: function(){
|
||||
return this.get('controllers.user.viewingSelf') &&
|
||||
return this.get('user.viewingSelf') &&
|
||||
Discourse.User.currentProp('can_send_private_messages');
|
||||
}.property('controllers.user.viewingSelf'),
|
||||
}.property('user.viewingSelf'),
|
||||
|
||||
@computed('selected.[]', 'bulkSelectEnabled')
|
||||
hasSelection(selected, bulkSelectEnabled){
|
||||
|
@ -39,7 +42,7 @@ export default Ember.Controller.extend({
|
|||
}
|
||||
|
||||
Topic.bulkOperation(selected,params).then(() => {
|
||||
const model = this.get('controllers.user-topics-list.model');
|
||||
const model = this.get('userTopicsList.model');
|
||||
const topics = model.get('topics');
|
||||
topics.removeObjects(selected);
|
||||
selected.clear();
|
||||
|
|
|
@ -6,8 +6,8 @@ const MAX_SUMMARY_RESULTS = 6;
|
|||
const MAX_BADGES = 6;
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['user'],
|
||||
user: Ember.computed.alias('controllers.user.model'),
|
||||
userController: Ember.inject.controller('user'),
|
||||
user: Ember.computed.alias('userController.model'),
|
||||
|
||||
@computed("model.topics.length")
|
||||
moreTopics(topicsLength) { return topicsLength >= MAX_SUMMARY_RESULTS; },
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
// Lists of topics on a user's page.
|
||||
export default Ember.Controller.extend({
|
||||
needs: ["application", "user"],
|
||||
application: Ember.inject.controller(),
|
||||
|
||||
hideCategory: false,
|
||||
showPosters: false,
|
||||
|
||||
_showFooter: function() {
|
||||
this.set("controllers.application.showFooter", !this.get("model.canLoadMore"));
|
||||
this.set("application.showFooter", !this.get("model.canLoadMore"));
|
||||
}.observes("model.canLoadMore"),
|
||||
|
||||
actions: {
|
||||
|
|
|
@ -6,8 +6,9 @@ import User from 'discourse/models/user';
|
|||
export default Ember.Controller.extend(CanCheckEmails, {
|
||||
indexStream: false,
|
||||
userActionType: null,
|
||||
needs: ['application','user-notifications', 'user-topics-list'],
|
||||
currentPath: Em.computed.alias('controllers.application.currentPath'),
|
||||
application: Ember.inject.controller(),
|
||||
userNotifications: Ember.inject.controller('user-notifications'),
|
||||
currentPath: Ember.computed.alias('application.currentPath'),
|
||||
|
||||
@computed("content.username")
|
||||
viewingSelf(username) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import debounce from 'discourse/lib/debounce';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
needs: ["application"],
|
||||
application: Ember.inject.controller(),
|
||||
queryParams: ["period", "order", "asc", "name"],
|
||||
period: "weekly",
|
||||
order: "likes_received",
|
||||
|
@ -15,7 +15,7 @@ export default Ember.Controller.extend({
|
|||
}, 500).observes("nameInput"),
|
||||
|
||||
_showFooter: function() {
|
||||
this.set("controllers.application.showFooter", !this.get("model.canLoadMore"));
|
||||
this.set("application.showFooter", !this.get("model.canLoadMore"));
|
||||
}.observes("model.canLoadMore"),
|
||||
|
||||
actions: {
|
||||
|
|
|
@ -26,6 +26,7 @@ export default function(name, opts) {
|
|||
}
|
||||
|
||||
if (controller) {
|
||||
controller.set('modal', modalController);
|
||||
const model = opts.model;
|
||||
if (model) { controller.set('model', model); }
|
||||
if (controller.onShow) { controller.onShow(); }
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
export default Em.Mixin.create({
|
||||
export default Ember.Mixin.create({
|
||||
flashMessage: null,
|
||||
|
||||
needs: ['modal'],
|
||||
|
||||
flash(message, messageClass) {
|
||||
this.set('flashMessage', Em.Object.create({ message, messageClass }));
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ export default Ember.View.extend({
|
|||
|
||||
const title = this.get('title');
|
||||
if (title) {
|
||||
this.set('controller.controllers.modal.title', title);
|
||||
this.set('controller.modal.title', title);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ import { default as computed, observes } from 'ember-addons/ember-computed-decor
|
|||
import InputValidation from 'discourse/models/input-validation';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['modal'],
|
||||
numberPollType: 'number',
|
||||
multiplePollType: 'multiple',
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import ModalBodyView from "discourse/views/modal-body";
|
||||
|
||||
export default ModalBodyView.extend({
|
||||
needs: ['modal'],
|
||||
|
||||
templateName: 'modals/poll-ui-builder',
|
||||
title: I18n.t("poll.ui_builder.title")
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue