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