mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
Remove ObjectController, Discouse Controllers + Presence
This commit is contained in:
parent
e2e3e7c0e0
commit
02a968bd27
130 changed files with 187 additions and 349 deletions
|
@ -20,8 +20,6 @@
|
|||
"not",
|
||||
"expect",
|
||||
"equal",
|
||||
"blank",
|
||||
"present",
|
||||
"visit",
|
||||
"andThen",
|
||||
"click",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export default Ember.ObjectController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
noOperationIsRunning: Ember.computed.not("model.isOperationRunning"),
|
||||
rollbackEnabled: Ember.computed.and("model.canRollback", "model.restoreEnabled", "noOperationIsRunning"),
|
||||
rollbackDisabled: Ember.computed.not("rollbackEnabled")
|
||||
|
|
|
@ -2,7 +2,7 @@ import { popupAjaxError } from 'discourse/lib/ajax-error';
|
|||
import BufferedContent from 'discourse/mixins/buffered-content';
|
||||
import { propertyNotEqual } from 'discourse/lib/computed';
|
||||
|
||||
export default Ember.ObjectController.extend(BufferedContent, {
|
||||
export default Ember.Controller.extend(BufferedContent, {
|
||||
needs: ['admin-badges'],
|
||||
saving: false,
|
||||
savingStatus: '',
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import DiscourseController from 'discourse/controllers/controller';
|
||||
|
||||
export default DiscourseController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
|
||||
/**
|
||||
Is the "send test email" button disabled?
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
export default ObjectController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
|
||||
actions: {
|
||||
refresh: function() {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import DiscourseController from 'discourse/controllers/controller';
|
||||
import debounce from 'discourse/lib/debounce';
|
||||
|
||||
export default DiscourseController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
|
||||
filterEmailLogs: debounce(function() {
|
||||
var self = this;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import debounce from 'discourse/lib/debounce';
|
||||
import DiscourseController from 'discourse/controllers/controller';
|
||||
|
||||
export default DiscourseController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
filterEmailLogs: debounce(function() {
|
||||
var self = this;
|
||||
Discourse.EmailLog.findAll(this.get("filter")).then(function(logs) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { popupAjaxError } from 'discourse/lib/ajax-error';
|
||||
import { propertyEqual } from 'discourse/lib/computed';
|
||||
|
||||
export default Em.ObjectController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['adminGroupsType'],
|
||||
disableSave: false,
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export default Ember.ObjectController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
editing: false,
|
||||
savedIpAddress: null,
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export default Ember.ObjectController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
viewMode: 'table',
|
||||
viewingTable: Em.computed.equal('viewMode', 'table'),
|
||||
viewingBarChart: Em.computed.equal('viewMode', 'barChart'),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export default Ember.ObjectController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
categoryNameKey: null,
|
||||
needs: ['adminSiteSettings'],
|
||||
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
import debounce from 'discourse/lib/debounce';
|
||||
import Presence from 'discourse/mixins/presence';
|
||||
|
||||
export default Ember.ArrayController.extend(Presence, {
|
||||
export default Ember.ArrayController.extend({
|
||||
filter: null,
|
||||
onlyOverridden: false,
|
||||
filtered: Ember.computed.notEmpty('filter'),
|
||||
|
||||
filterContentNow: function(category) {
|
||||
// If we have no content, don't bother filtering anything
|
||||
if (!this.present('allSiteSettings')) return;
|
||||
if (!!Ember.isEmpty(this.get('allSiteSettings'))) return;
|
||||
|
||||
let filter;
|
||||
if (this.get('filter')) {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import ObjectController from 'discourse/controllers/object';
|
||||
import CanCheckEmails from 'discourse/mixins/can-check-emails';
|
||||
import { propertyNotEqual, setting } from 'discourse/lib/computed';
|
||||
|
||||
export default ObjectController.extend(CanCheckEmails, {
|
||||
export default Ember.Controller.extend(CanCheckEmails, {
|
||||
editingTitle: false,
|
||||
originalPrimaryGroupId: null,
|
||||
availableGroups: null,
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
export default ObjectController.extend();
|
||||
export default Ember.Controller.extend();
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import DiscourseController from 'discourse/controllers/controller';
|
||||
|
||||
export default DiscourseController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
showBadges: function() {
|
||||
return this.get('currentUser.admin') && this.siteSettings.enable_badges;
|
||||
}.property()
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
export default ObjectController.extend(ModalFunctionality, {
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
needs: ["admin-flags-list"],
|
||||
|
||||
_agreeFlag: function (actionOnPost) {
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
|
||||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
export default ObjectController.extend(ModalFunctionality, {
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
needs: ["admin-flags-list"],
|
||||
|
||||
actions: {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
|
||||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
export default ObjectController.extend(ModalFunctionality);
|
||||
export default Ember.Controller.extend(ModalFunctionality);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import Controller from 'discourse/controllers/controller';
|
||||
|
||||
export default Controller.extend(ModalFunctionality, {
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
needs: ["adminBackupsLogs"],
|
||||
|
||||
_startBackup: function (withUploads) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
export default ObjectController.extend(ModalFunctionality, {
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
|
||||
submitDisabled: function() {
|
||||
return (!this.get('reason') || this.get('reason').length < 1);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
export default ObjectController.extend(ModalFunctionality, {
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
previousSelected: Ember.computed.equal('selectedTab', 'previous'),
|
||||
newSelected: Ember.computed.equal('selectedTab', 'new'),
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ Discourse.FlaggedPost = Discourse.Post.extend({
|
|||
},
|
||||
|
||||
wasEdited: function () {
|
||||
if (this.blank("last_revised_at")) { return false; }
|
||||
if (Ember.isEmpty(this.get("last_revised_at"))) { return false; }
|
||||
var lastRevisedAt = Date.parse(this.get("last_revised_at"));
|
||||
return _.some(this.get("post_actions"), function (postAction) {
|
||||
return Date.parse(postAction.created_at) < lastRevisedAt;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import debounce from 'discourse/lib/debounce';
|
||||
import { renderSpinner } from 'discourse/helpers/loading-spinner';
|
||||
|
||||
export default Discourse.View.extend({
|
||||
export default Ember.View.extend({
|
||||
classNames: ["admin-backups-logs"],
|
||||
|
||||
_initialize: function() { this._reset(); }.on("init"),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import DiscourseURL from 'discourse/lib/url';
|
||||
|
||||
export default Discourse.View.extend({
|
||||
export default Ember.View.extend({
|
||||
classNames: ["admin-backups"],
|
||||
|
||||
_hijackDownloads: function() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import LoadMore from "discourse/mixins/load-more";
|
||||
|
||||
export default Discourse.View.extend(LoadMore, {
|
||||
export default Ember.View.extend(LoadMore, {
|
||||
loading: false,
|
||||
eyelineSelector: '.admin-flags tbody tr',
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export default Discourse.View.extend({
|
||||
export default Ember.View.extend({
|
||||
_disableCustomStylesheets: function() {
|
||||
if (this.session.get("disableCustomCSS")) {
|
||||
$("link.custom-css").attr("rel", "");
|
||||
|
|
|
@ -1,11 +1,3 @@
|
|||
/**
|
||||
A view to handle color selections within a site customization
|
||||
|
||||
@class AdminCustomizeColorsView
|
||||
@extends Discourse.View
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminCustomizeColorsView = Discourse.View.extend({
|
||||
Discourse.AdminCustomizeColorsView = Ember.View.extend({
|
||||
templateName: 'admin/templates/customize_colors'
|
||||
});
|
||||
|
|
|
@ -1,10 +1 @@
|
|||
/**
|
||||
The view class for an Admin User
|
||||
|
||||
@class AdminUserView
|
||||
@extends Discourse.View
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminUserView = Discourse.View.extend(Discourse.ScrollTop);
|
||||
|
||||
Discourse.AdminUserView = Ember.View.extend(Discourse.ScrollTop);
|
||||
|
|
|
@ -155,3 +155,9 @@ function proxyDep(propName, moduleFunc, msg) {
|
|||
proxyDep('computed', function() { return require('discourse/lib/computed') });
|
||||
proxyDep('Formatter', function() { return require('discourse/lib/formatter') });
|
||||
proxyDep('PageTracker', function() { return require('discourse/lib/page-tracker').default });
|
||||
proxyDep('URL', function() { return require('discourse/lib/url').default });
|
||||
proxyDep('Quote', function() { return require('discourse/lib/quote').default });
|
||||
proxyDep('debounce', function() { return require('discourse/lib/debounce').default });
|
||||
proxyDep('View', function() { return Ember.View }, "Use `Ember.View` instead");
|
||||
proxyDep('Controller', function() { return Ember.Controller }, "Use `Ember.Controller` instead");
|
||||
proxyDep('ObjectController', function() { return Ember.ObjectController }, "Use `Ember.Controller` instead");
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import DiscourseController from 'discourse/controllers/controller';
|
||||
|
||||
export default DiscourseController.extend(ModalFunctionality, {
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
uploadedAvatarTemplate: null,
|
||||
saveDisabled: Em.computed.alias("uploading"),
|
||||
hasUploadedAvatar: Em.computed.or('uploadedAvatarTemplate', 'custom_avatar_upload_id'),
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
export default ObjectController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
noMoreBadges: false,
|
||||
userBadges: null,
|
||||
needs: ["application"],
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import Presence from 'discourse/mixins/presence';
|
||||
import SelectedPostsCount from 'discourse/mixins/selected-posts-count';
|
||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import DiscourseURL from 'discourse/lib/url';
|
||||
|
||||
// Modal related to changing the ownership of posts
|
||||
export default Ember.Controller.extend(Presence, SelectedPostsCount, ModalFunctionality, {
|
||||
export default Ember.Controller.extend(SelectedPostsCount, ModalFunctionality, {
|
||||
needs: ['topic'],
|
||||
|
||||
topicController: Em.computed.alias('controllers.topic'),
|
||||
|
@ -14,7 +13,7 @@ export default Ember.Controller.extend(Presence, SelectedPostsCount, ModalFuncti
|
|||
|
||||
buttonDisabled: function() {
|
||||
if (this.get('saving')) return true;
|
||||
return this.blank('new_user');
|
||||
return Ember.isEmpty(this.get('new_user'));
|
||||
}.property('saving', 'new_user'),
|
||||
|
||||
buttonTitle: function() {
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import { setting } from 'discourse/lib/computed';
|
||||
import Presence from 'discourse/mixins/presence';
|
||||
import DiscourseURL from 'discourse/lib/url';
|
||||
import Quote from 'discourse/lib/quote';
|
||||
import Draft from 'discourse/models/draft';
|
||||
|
||||
export default Ember.ObjectController.extend(Presence, {
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['modal', 'topic', 'composer-messages', 'application'],
|
||||
|
||||
replyAsNewTopicDraft: Em.computed.equal('model.draftKey', Discourse.Composer.REPLY_AS_NEW_TOPIC_KEY),
|
||||
|
@ -152,7 +151,7 @@ export default Ember.ObjectController.extend(Presence, {
|
|||
this.closeAutocomplete();
|
||||
switch (this.get('model.composeState')) {
|
||||
case Discourse.Composer.OPEN:
|
||||
if (this.blank('model.reply') && this.blank('model.title')) {
|
||||
if (Ember.isEmpty(this.get('model.reply')) && Ember.isEmpty(this.get('model.title'))) {
|
||||
this.close();
|
||||
} else {
|
||||
this.shrink();
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
import Presence from 'discourse/mixins/presence';
|
||||
|
||||
export default Ember.Controller.extend(Presence);
|
|
@ -1,9 +1,8 @@
|
|||
import debounce from 'discourse/lib/debounce';
|
||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import DiscourseController from 'discourse/controllers/controller';
|
||||
import { setting } from 'discourse/lib/computed';
|
||||
|
||||
export default DiscourseController.extend(ModalFunctionality, {
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
needs: ['login'],
|
||||
|
||||
uniqueUsernameValidation: null,
|
||||
|
@ -66,7 +65,7 @@ export default DiscourseController.extend(ModalFunctionality, {
|
|||
usernameRequired: Ember.computed.not('authOptions.omit_username'),
|
||||
|
||||
passwordRequired: function() {
|
||||
return this.blank('authOptions.auth_provider');
|
||||
return Ember.isEmpty(this.get('authOptions.auth_provider'));
|
||||
}.property('authOptions.auth_provider'),
|
||||
|
||||
passwordInstructions: function() {
|
||||
|
@ -83,7 +82,7 @@ export default DiscourseController.extend(ModalFunctionality, {
|
|||
this.fetchConfirmationValue();
|
||||
}
|
||||
|
||||
if (Discourse.SiteSettings.full_name_required && this.blank('accountName')) {
|
||||
if (Discourse.SiteSettings.full_name_required && Ember.isEmpty(this.get('accountName'))) {
|
||||
return Discourse.InputValidation.create({ failed: true });
|
||||
}
|
||||
|
||||
|
@ -94,7 +93,7 @@ export default DiscourseController.extend(ModalFunctionality, {
|
|||
emailValidation: function() {
|
||||
// If blank, fail without a reason
|
||||
let email;
|
||||
if (this.blank('accountEmail')) {
|
||||
if (Ember.isEmpty(this.get('accountEmail'))) {
|
||||
return Discourse.InputValidation.create({
|
||||
failed: true
|
||||
});
|
||||
|
@ -144,7 +143,7 @@ export default DiscourseController.extend(ModalFunctionality, {
|
|||
}
|
||||
this.set('prefilledUsername', null);
|
||||
}
|
||||
if (this.get('emailValidation.ok') && (this.blank('accountUsername') || this.get('authOptions.email'))) {
|
||||
if (this.get('emailValidation.ok') && (Ember.isEmpty(this.get('accountUsername')) || this.get('authOptions.email'))) {
|
||||
// If email is valid and username has not been entered yet,
|
||||
// or email and username were filled automatically by 3rd parth auth,
|
||||
// then look for a registered username that matches the email.
|
||||
|
@ -155,7 +154,7 @@ export default DiscourseController.extend(ModalFunctionality, {
|
|||
fetchExistingUsername: debounce(function() {
|
||||
const self = this;
|
||||
Discourse.User.checkUsername(null, this.get('accountEmail')).then(function(result) {
|
||||
if (result.suggestion && (self.blank('accountUsername') || self.get('accountUsername') === self.get('authOptions.username'))) {
|
||||
if (result.suggestion && (Ember.isEmpty(self.get('accountUsername')) || self.get('accountUsername') === self.get('authOptions.username'))) {
|
||||
self.set('accountUsername', result.suggestion);
|
||||
self.set('prefilledUsername', result.suggestion);
|
||||
}
|
||||
|
@ -194,7 +193,7 @@ export default DiscourseController.extend(ModalFunctionality, {
|
|||
}
|
||||
|
||||
// If blank, fail without a reason
|
||||
if (this.blank('accountUsername')) {
|
||||
if (Ember.isEmpty(this.get('accountUsername'))) {
|
||||
return Discourse.InputValidation.create({
|
||||
failed: true
|
||||
});
|
||||
|
@ -225,7 +224,7 @@ export default DiscourseController.extend(ModalFunctionality, {
|
|||
}.property('accountUsername'),
|
||||
|
||||
shouldCheckUsernameMatch: function() {
|
||||
return !this.blank('accountUsername') && this.get('accountUsername').length >= this.get('minUsernameLength');
|
||||
return !Ember.isEmpty(this.get('accountUsername')) && this.get('accountUsername').length >= this.get('minUsernameLength');
|
||||
},
|
||||
|
||||
checkUsernameAvailability: debounce(function() {
|
||||
|
@ -296,7 +295,7 @@ export default DiscourseController.extend(ModalFunctionality, {
|
|||
|
||||
// If blank, fail without a reason
|
||||
const password = this.get("accountPassword");
|
||||
if (this.blank('accountPassword')) {
|
||||
if (Ember.isEmpty(this.get('accountPassword'))) {
|
||||
return Discourse.InputValidation.create({ failed: true });
|
||||
}
|
||||
|
||||
|
@ -315,14 +314,14 @@ export default DiscourseController.extend(ModalFunctionality, {
|
|||
});
|
||||
}
|
||||
|
||||
if (!this.blank('accountUsername') && this.get('accountPassword') === this.get('accountUsername')) {
|
||||
if (!Ember.isEmpty(this.get('accountUsername')) && this.get('accountPassword') === this.get('accountUsername')) {
|
||||
return Discourse.InputValidation.create({
|
||||
failed: true,
|
||||
reason: I18n.t('user.password.same_as_username')
|
||||
});
|
||||
}
|
||||
|
||||
if (!this.blank('accountEmail') && this.get('accountPassword') === this.get('accountEmail')) {
|
||||
if (!Ember.isEmpty(this.get('accountEmail')) && this.get('accountPassword') === this.get('accountEmail')) {
|
||||
return Discourse.InputValidation.create({
|
||||
failed: true,
|
||||
reason: I18n.t('user.password.same_as_email')
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import DiscourseController from 'discourse/controllers/controller';
|
||||
|
||||
// Just add query params here to have them automatically passed to topic list filters.
|
||||
export var queryParams = {
|
||||
order: { replace: true, refreshModel: true },
|
||||
|
@ -22,4 +20,4 @@ controllerOpts.queryParams.forEach(function(p) {
|
|||
controllerOpts[p] = Em.computed.alias('controllers.discovery/topics.' + p);
|
||||
});
|
||||
|
||||
export default DiscourseController.extend(controllerOpts);
|
||||
export default Ember.Controller.extend(controllerOpts);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import DiscourseURL from 'discourse/lib/url';
|
||||
|
||||
export default Ember.ObjectController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['navigation/category', 'discovery/topics', 'application'],
|
||||
loading: false,
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import ObjectController from 'discourse/controllers/object';
|
||||
import DiscourseURL from 'discourse/lib/url';
|
||||
|
||||
// Modal for editing / creating a category
|
||||
export default ObjectController.extend(ModalFunctionality, {
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
selectedTab: null,
|
||||
saving: false,
|
||||
deleting: false,
|
||||
|
@ -19,7 +18,7 @@ export default ObjectController.extend(ModalFunctionality, {
|
|||
},
|
||||
|
||||
changeSize: function() {
|
||||
if (this.present('model.description')) {
|
||||
if (!Ember.isEmpty(this.get('model.description'))) {
|
||||
this.set('controllers.modal.modalClass', 'edit-category-modal full');
|
||||
} else {
|
||||
this.set('controllers.modal.modalClass', 'edit-category-modal small');
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
// Modal related to auto closing of topics
|
||||
export default ObjectController.extend(ModalFunctionality, {
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
auto_close_valid: true,
|
||||
auto_close_invalid: Em.computed.not('auto_close_valid'),
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
var ButtonBackBright = {
|
||||
classes: "btn-primary",
|
||||
action: "back",
|
||||
|
@ -22,7 +20,7 @@ var ButtonBackBright = {
|
|||
};
|
||||
|
||||
// The controller for the nice error page
|
||||
export default ObjectController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
thrown: null,
|
||||
lastTransition: null,
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import ObjectController from 'discourse/controllers/object';
|
||||
import { categoryLinkHTML } from 'discourse/helpers/category-link';
|
||||
|
||||
export default ObjectController.extend(ModalFunctionality, {
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
needs: ["topic"],
|
||||
|
||||
loading: true,
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import ObjectController from 'discourse/controllers/object';
|
||||
import { MAX_MESSAGE_LENGTH } from 'discourse/models/post-action-type';
|
||||
|
||||
// Supports logic for flags in the modal
|
||||
export default ObjectController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['flag'],
|
||||
|
||||
message: Em.computed.alias('controllers.flag.message'),
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import ObjectController from 'discourse/controllers/object';
|
||||
import { MAX_MESSAGE_LENGTH } from 'discourse/models/post-action-type';
|
||||
|
||||
export default ObjectController.extend(ModalFunctionality, {
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
userDetails: null,
|
||||
selected: null,
|
||||
flagTopic: null,
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import DiscourseController from 'discourse/controllers/controller';
|
||||
|
||||
export default DiscourseController.extend(ModalFunctionality, {
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
|
||||
// You need a value in the field to submit it.
|
||||
submitDisabled: function() {
|
||||
return this.blank('accountEmailOrUsername') || this.get('disabled');
|
||||
return Ember.isEmpty(this.get('accountEmailOrUsername')) || this.get('disabled');
|
||||
}.property('accountEmailOrUsername', 'disabled'),
|
||||
|
||||
actions: {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import DiscourseController from "discourse/controllers/controller";
|
||||
import { translateResults } from "discourse/lib/search-for-term";
|
||||
|
||||
export default DiscourseController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
needs: ["application"],
|
||||
|
||||
loading: Em.computed.not("model"),
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import DiscourseController from 'discourse/controllers/controller';
|
||||
|
||||
const HeaderController = DiscourseController.extend({
|
||||
const HeaderController = Ember.Controller.extend({
|
||||
topic: null,
|
||||
showExtraInfo: null,
|
||||
notifications: null,
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import ObjectController from 'discourse/controllers/object';
|
||||
import { categoryBadgeHTML } from 'discourse/helpers/category-link';
|
||||
|
||||
// This controller handles displaying of history
|
||||
export default ObjectController.extend(ModalFunctionality, {
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
loading: true,
|
||||
viewMode: "side_by_side",
|
||||
revisionsTextKey: "post.revisions.controls.comparing_previous_to_current_out_of_total",
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import Presence from 'discourse/mixins/presence';
|
||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import ObjectController from 'discourse/controllers/object';
|
||||
import Invite from 'discourse/models/invite';
|
||||
|
||||
export default ObjectController.extend(Presence, ModalFunctionality, {
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
needs: ['user-invited-show'],
|
||||
|
||||
// If this isn't defined, it will proxy to the user model on the preferences
|
||||
|
@ -16,14 +14,14 @@ export default ObjectController.extend(Presence, ModalFunctionality, {
|
|||
|
||||
disabled: function() {
|
||||
if (this.get('model.saving')) return true;
|
||||
if (this.blank('emailOrUsername')) return true;
|
||||
if (Ember.isEmpty(this.get('emailOrUsername'))) return true;
|
||||
const emailOrUsername = this.get('emailOrUsername').trim();
|
||||
// when inviting to forum, email must be valid
|
||||
if (!this.get('invitingToTopic') && !Discourse.Utilities.emailValid(emailOrUsername)) return true;
|
||||
// normal users (not admin) can't invite users to private topic via email
|
||||
if (!this.get('isAdmin') && this.get('isPrivateTopic') && Discourse.Utilities.emailValid(emailOrUsername)) return true;
|
||||
// when invting to private topic via email, group name must be specified
|
||||
if (this.get('isPrivateTopic') && this.blank('model.groupNames') && Discourse.Utilities.emailValid(emailOrUsername)) return true;
|
||||
if (this.get('isPrivateTopic') && Ember.isEmpty(this.get('model.groupNames')) && Discourse.Utilities.emailValid(emailOrUsername)) return true;
|
||||
if (this.get('model.details.can_invite_to')) return false;
|
||||
return false;
|
||||
}.property('isAdmin', 'emailOrUsername', 'invitingToTopic', 'isPrivateTopic', 'model.groupNames', 'model.saving'),
|
||||
|
@ -71,7 +69,7 @@ export default ObjectController.extend(Presence, ModalFunctionality, {
|
|||
return I18n.t('topic.invite_reply.to_username');
|
||||
} else {
|
||||
// when inviting to a topic, display instructions based on provided entity
|
||||
if (this.blank('emailOrUsername')) {
|
||||
if (Ember.isEmpty(this.get('emailOrUsername'))) {
|
||||
return I18n.t('topic.invite_reply.to_topic_blank');
|
||||
} else if (Discourse.Utilities.emailValid(this.get('emailOrUsername'))) {
|
||||
return I18n.t('topic.invite_reply.to_topic_email');
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import DiscourseController from 'discourse/controllers/controller';
|
||||
|
||||
export default DiscourseController.extend(ModalFunctionality, {
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
needs: ['modal'],
|
||||
|
||||
onShow: function() {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import DiscourseController from 'discourse/controllers/controller';
|
||||
import showModal from 'discourse/lib/show-modal';
|
||||
import { setting } from 'discourse/lib/computed';
|
||||
|
||||
|
@ -8,7 +7,7 @@ const AuthErrors =
|
|||
['requires_invite', 'awaiting_approval', 'awaiting_confirmation', 'admin_not_allowed_from_ip_address',
|
||||
'not_allowed_from_ip_address'];
|
||||
|
||||
export default DiscourseController.extend(ModalFunctionality, {
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
needs: ['modal', 'createAccount', 'forgotPassword', 'application'],
|
||||
authenticate: null,
|
||||
loggingIn: false,
|
||||
|
@ -39,7 +38,7 @@ export default DiscourseController.extend(ModalFunctionality, {
|
|||
showSignupLink: function() {
|
||||
return this.get('controllers.application.canSignUp') &&
|
||||
!this.get('loggingIn') &&
|
||||
this.blank('authenticate');
|
||||
Ember.isEmpty(this.get('authenticate'));
|
||||
}.property('loggingIn', 'authenticate'),
|
||||
|
||||
showSpinner: function() {
|
||||
|
@ -50,7 +49,7 @@ export default DiscourseController.extend(ModalFunctionality, {
|
|||
login: function() {
|
||||
const self = this;
|
||||
|
||||
if(this.blank('loginName') || this.blank('loginPassword')){
|
||||
if(Ember.isEmpty(this.get('loginName')) || Ember.isEmpty(this.get('loginPassword'))){
|
||||
self.flash(I18n.t('login.blank_username_or_password'), 'error');
|
||||
return;
|
||||
}
|
||||
|
@ -154,7 +153,7 @@ export default DiscourseController.extend(ModalFunctionality, {
|
|||
},
|
||||
|
||||
authMessage: (function() {
|
||||
if (this.blank('authenticate')) return "";
|
||||
if (Ember.isEmpty(this.get('authenticate'))) return "";
|
||||
const method = Discourse.get('LoginMethod.all').findProperty("name", this.get("authenticate"));
|
||||
if(method){
|
||||
return method.get('message');
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import Presence from 'discourse/mixins/presence';
|
||||
import SelectedPostsCount from 'discourse/mixins/selected-posts-count';
|
||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import { movePosts, mergeTopic } from 'discourse/models/topic';
|
||||
import DiscourseURL from 'discourse/lib/url';
|
||||
|
||||
// Modal related to merging of topics
|
||||
export default Ember.Controller.extend(SelectedPostsCount, ModalFunctionality, Presence, {
|
||||
export default Ember.Controller.extend(SelectedPostsCount, ModalFunctionality, {
|
||||
needs: ['topic'],
|
||||
|
||||
saving: false,
|
||||
|
@ -18,7 +17,7 @@ export default Ember.Controller.extend(SelectedPostsCount, ModalFunctionality, P
|
|||
|
||||
buttonDisabled: function() {
|
||||
if (this.get('saving')) return true;
|
||||
return this.blank('selectedTopicId');
|
||||
return Ember.isEmpty(this.get('selectedTopicId'));
|
||||
}.property('selectedTopicId', 'saving'),
|
||||
|
||||
buttonTitle: function() {
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
import DiscourseController from 'discourse/controllers/controller';
|
||||
|
||||
export default DiscourseController.extend({});
|
||||
export default Ember.Controller.extend();
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import DiscourseController from 'discourse/controllers/controller';
|
||||
|
||||
export default DiscourseController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['discovery', 'discovery/topics'],
|
||||
|
||||
categories: function() {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import DiscourseController from 'discourse/controllers/controller';
|
||||
|
||||
export default DiscourseController.extend(ModalFunctionality, {
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
emailSent: false,
|
||||
|
||||
onShow() {
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
import Presence from 'discourse/mixins/presence';
|
||||
|
||||
export default Ember.ObjectController.extend(Presence);
|
|
@ -1,9 +1,8 @@
|
|||
import { setting } from 'discourse/lib/computed';
|
||||
import ObjectController from 'discourse/controllers/object';
|
||||
import CanCheckEmails from 'discourse/mixins/can-check-emails';
|
||||
import { popupAjaxError } from 'discourse/lib/ajax-error';
|
||||
|
||||
export default ObjectController.extend(CanCheckEmails, {
|
||||
export default Ember.Controller.extend(CanCheckEmails, {
|
||||
|
||||
allowAvatarUpload: setting('allow_uploaded_avatars'),
|
||||
allowUserLocale: setting('allow_user_locale'),
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
export default ObjectController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
saving: false,
|
||||
newBio: null,
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { propertyEqual } from 'discourse/lib/computed';
|
||||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
export default ObjectController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
taken: false,
|
||||
saving: false,
|
||||
error: false,
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import { setting, propertyEqual } from 'discourse/lib/computed';
|
||||
import Presence from 'discourse/mixins/presence';
|
||||
import ObjectController from 'discourse/controllers/object';
|
||||
import DiscourseURL from 'discourse/lib/url';
|
||||
|
||||
export default ObjectController.extend(Presence, {
|
||||
export default Ember.Controller.extend({
|
||||
taken: false,
|
||||
saving: false,
|
||||
error: false,
|
||||
|
@ -23,7 +21,7 @@ export default ObjectController.extend(Presence, {
|
|||
var self = this;
|
||||
this.set('taken', false);
|
||||
this.set('errorMessage', null);
|
||||
if (this.blank('newUsername')) return;
|
||||
if (Ember.isEmpty(this.get('newUsername'))) return;
|
||||
if (this.get('unchanged')) return;
|
||||
Discourse.User.checkUsername(this.get('newUsername'), undefined, this.get('content.id')).then(function(result) {
|
||||
if (result.errors) {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import DiscourseController from 'discourse/controllers/controller';
|
||||
import loadScript from 'discourse/lib/load-script';
|
||||
import Quote from 'discourse/lib/quote';
|
||||
|
||||
export default DiscourseController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['topic', 'composer'],
|
||||
|
||||
_loadSanitizer: function() {
|
||||
|
@ -11,7 +10,7 @@ export default DiscourseController.extend({
|
|||
|
||||
// If the buffer is cleared, clear out other state (post)
|
||||
bufferChanged: function() {
|
||||
if (this.blank('buffer')) this.set('post', null);
|
||||
if (Ember.isEmpty(this.get('buffer'))) this.set('post', null);
|
||||
}.observes('buffer'),
|
||||
|
||||
// Save the currently selected text and displays the
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
// This controller handles displaying of raw email
|
||||
export default ObjectController.extend(ModalFunctionality, {
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
rawEmail: "",
|
||||
|
||||
loadRawEmail: function(postId) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import DiscourseController from 'discourse/controllers/controller';
|
||||
|
||||
export default DiscourseController.extend(ModalFunctionality, {
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
needs: ['modal'],
|
||||
|
||||
showGoogleSearch: function() {
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import Presence from 'discourse/mixins/presence';
|
||||
import searchForTerm from 'discourse/lib/search-for-term';
|
||||
import DiscourseURL from 'discourse/lib/url';
|
||||
|
||||
let _dontSearch = false;
|
||||
|
||||
export default Em.Controller.extend(Presence, {
|
||||
export default Em.Controller.extend({
|
||||
typeFilter: null,
|
||||
|
||||
contextType: function(key, value){
|
||||
|
@ -115,7 +114,7 @@ export default Em.Controller.extend(Presence, {
|
|||
|
||||
showCancelFilter: function() {
|
||||
if (this.get('loading')) return false;
|
||||
return this.present('typeFilter');
|
||||
return !Ember.isEmpty(this.get('typeFilter'));
|
||||
}.property('typeFilter', 'loading'),
|
||||
|
||||
termChanged: function() {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import Presence from 'discourse/mixins/presence';
|
||||
import SelectedPostsCount from 'discourse/mixins/selected-posts-count';
|
||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import { extractError } from 'discourse/lib/ajax-error';
|
||||
|
@ -6,7 +5,7 @@ import { movePosts } from 'discourse/models/topic';
|
|||
import DiscourseURL from 'discourse/lib/url';
|
||||
|
||||
// Modal related to auto closing of topics
|
||||
export default Ember.Controller.extend(SelectedPostsCount, ModalFunctionality, Presence, {
|
||||
export default Ember.Controller.extend(SelectedPostsCount, ModalFunctionality, {
|
||||
needs: ['topic'],
|
||||
topicName: null,
|
||||
saving: false,
|
||||
|
@ -19,7 +18,7 @@ export default Ember.Controller.extend(SelectedPostsCount, ModalFunctionality, P
|
|||
|
||||
buttonDisabled: function() {
|
||||
if (this.get('saving')) return true;
|
||||
return this.blank('topicName');
|
||||
return Ember.isEmpty(this.get('topicName'));
|
||||
}.property('saving', 'topicName'),
|
||||
|
||||
buttonTitle: function() {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
// This controller supports the admin menu on topics
|
||||
export default ObjectController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
menuVisible: false,
|
||||
showRecover: Em.computed.and('model.deleted', 'model.details.can_recover'),
|
||||
isFeatured: Em.computed.or("model.pinned_at", "model.isBanner"),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import DiscourseURL from 'discourse/lib/url';
|
||||
|
||||
export default Ember.ObjectController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['topic'],
|
||||
progressPosition: null,
|
||||
expanded: false,
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import ObjectController from 'discourse/controllers/object';
|
||||
import BufferedContent from 'discourse/mixins/buffered-content';
|
||||
import SelectedPostsCount from 'discourse/mixins/selected-posts-count';
|
||||
import { spinnerHTML } from 'discourse/helpers/loading-spinner';
|
||||
|
@ -6,7 +5,7 @@ import Topic from 'discourse/models/topic';
|
|||
import Quote from 'discourse/lib/quote';
|
||||
import { setting } from 'discourse/lib/computed';
|
||||
|
||||
export default ObjectController.extend(SelectedPostsCount, BufferedContent, {
|
||||
export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
||||
multiSelect: false,
|
||||
needs: ['header', 'modal', 'composer', 'quote-button', 'search', 'topic-progress', 'application'],
|
||||
allPostsSelected: false,
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import DiscourseController from 'discourse/controllers/controller';
|
||||
import { setting } from 'discourse/lib/computed';
|
||||
|
||||
export default DiscourseController.extend(ModalFunctionality, {
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
remote: Em.computed.not("local"),
|
||||
local: false,
|
||||
showMore: false,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export default Ember.ObjectController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
userActionType: null,
|
||||
needs: ["application"],
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import Invite from 'discourse/models/invite';
|
|||
import debounce from 'discourse/lib/debounce';
|
||||
|
||||
// This controller handles actions related to a user's invitations
|
||||
export default Ember.ObjectController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
user: null,
|
||||
model: null,
|
||||
filter: null,
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
// Lists of topics on a user's page.
|
||||
export default ObjectController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
needs: ["application", "user"],
|
||||
hideCategory: false,
|
||||
showParticipants: false,
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import { exportUserArchive } from 'discourse/lib/export-csv';
|
||||
import ObjectController from 'discourse/controllers/object';
|
||||
import CanCheckEmails from 'discourse/mixins/can-check-emails';
|
||||
|
||||
export default ObjectController.extend(CanCheckEmails, {
|
||||
export default Ember.Controller.extend(CanCheckEmails, {
|
||||
indexStream: false,
|
||||
pmView: false,
|
||||
userActionType: null,
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
import DiscourseURL from 'discourse/lib/url';
|
||||
import Quote from 'discourse/lib/quote';
|
||||
import debounce from 'discourse/lib/debounce';
|
||||
|
||||
function proxyDep(propName, module) {
|
||||
if (Discourse.hasOwnProperty(propName)) { return; }
|
||||
Object.defineProperty(Discourse, propName, {
|
||||
get: function() {
|
||||
Ember.warn(`DEPRECATION: \`Discourse.${propName}\` is deprecated, import the module.`);
|
||||
return module;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'es6-deprecations',
|
||||
before: 'inject-objects',
|
||||
|
||||
initialize: function() {
|
||||
// TODO: Once things have migrated remove these
|
||||
proxyDep('computed', require('discourse/lib/computed'));
|
||||
proxyDep('Formatter', require('discourse/lib/formatter'));
|
||||
proxyDep('URL', DiscourseURL);
|
||||
proxyDep('Quote', Quote);
|
||||
proxyDep('debounce', debounce);
|
||||
}
|
||||
};
|
|
@ -1,20 +0,0 @@
|
|||
/**
|
||||
This mixin provides `blank` and `present` to determine whether properties are
|
||||
there, accounting for more cases than just null and undefined.
|
||||
**/
|
||||
export default Ember.Mixin.create({
|
||||
|
||||
/**
|
||||
Returns whether a property is blank. It considers empty arrays, string, objects, undefined and null
|
||||
to be blank, otherwise true.
|
||||
*/
|
||||
blank(name) {
|
||||
return Ember.isEmpty(this[name] || this.get(name));
|
||||
},
|
||||
|
||||
// Returns whether a property is present. A present property is the opposite of a `blank` one.
|
||||
present(name) {
|
||||
return !this.blank(name);
|
||||
}
|
||||
|
||||
});
|
|
@ -1,6 +1,4 @@
|
|||
import Presence from 'discourse/mixins/presence';
|
||||
|
||||
const Model = Ember.Object.extend(Presence);
|
||||
const Model = Ember.Object.extend();
|
||||
|
||||
Model.reopenClass({
|
||||
extractByKey: function(collection, klass) {
|
||||
|
|
|
@ -97,7 +97,7 @@ const Post = RestModel.extend({
|
|||
},
|
||||
|
||||
internalLinks: function() {
|
||||
if (this.blank('link_counts')) return null;
|
||||
if (Ember.isEmpty(this.get('link_counts'))) return null;
|
||||
return this.get('link_counts').filterProperty('internal').filterProperty('title');
|
||||
}.property('link_counts.@each.internal'),
|
||||
|
||||
|
@ -112,7 +112,7 @@ const Post = RestModel.extend({
|
|||
}.property('actions_summary.@each.can_act'),
|
||||
|
||||
actionsWithoutLikes: function() {
|
||||
if (!this.present('actions_summary')) return null;
|
||||
if (!!Ember.isEmpty(this.get('actions_summary'))) return null;
|
||||
|
||||
return this.get('actions_summary').filter(function(i) {
|
||||
if (i.get('count') === 0) return false;
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import Presence from 'discourse/mixins/presence';
|
||||
|
||||
const RestModel = Ember.Object.extend(Presence, {
|
||||
const RestModel = Ember.Object.extend({
|
||||
isNew: Ember.computed.equal('__state', 'new'),
|
||||
isCreated: Ember.computed.equal('__state', 'created'),
|
||||
isSaving: false,
|
||||
|
|
|
@ -35,7 +35,7 @@ const TopicDetails = RestModel.extend({
|
|||
},
|
||||
|
||||
fewParticipants: function() {
|
||||
if (!this.present('participants')) return null;
|
||||
if (!!Ember.isEmpty(this.get('participants'))) return null;
|
||||
return this.get('participants').slice(0, 3);
|
||||
}.property('participants'),
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ const User = RestModel.extend({
|
|||
@type {String}
|
||||
**/
|
||||
displayName: function() {
|
||||
if (Discourse.SiteSettings.enable_names && !this.blank('name')) {
|
||||
if (Discourse.SiteSettings.enable_names && !Ember.isEmpty(this.get('name'))) {
|
||||
return this.get('name');
|
||||
}
|
||||
return this.get('username');
|
||||
|
@ -263,7 +263,7 @@ const User = RestModel.extend({
|
|||
statsCountNonPM: function() {
|
||||
var self = this;
|
||||
|
||||
if (this.blank('statsExcludingPms')) return 0;
|
||||
if (Ember.isEmpty(this.get('statsExcludingPms'))) return 0;
|
||||
var count = 0;
|
||||
_.each(this.get('statsExcludingPms'), function(val) {
|
||||
if (self.inAllStream(val)){
|
||||
|
@ -275,7 +275,7 @@ const User = RestModel.extend({
|
|||
|
||||
// The user's stats, excluding PMs.
|
||||
statsExcludingPms: function() {
|
||||
if (this.blank('stats')) return [];
|
||||
if (Ember.isEmpty(this.get('stats'))) return [];
|
||||
return this.get('stats').rejectProperty('isPM');
|
||||
}.property('stats.@each.isPM'),
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ export default Discourse.Route.extend({
|
|||
});
|
||||
DiscourseURL.jumpToPost(closest);
|
||||
|
||||
if (topic.present('draft')) {
|
||||
if (!Ember.isEmpty(topic.get('draft'))) {
|
||||
composerController.open({
|
||||
draft: Draft.getLocal(topic.get('draft_key'), topic.get('draft')),
|
||||
draftKey: topic.get('draft_key'),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import LoadMore from "discourse/mixins/load-more";
|
||||
|
||||
export default Discourse.View.extend(LoadMore, {
|
||||
export default Ember.View.extend(LoadMore, {
|
||||
eyelineSelector: '.badge-user',
|
||||
tickOrX: function(field){
|
||||
var icon = this.get('controller.model.' + field) ? "fa-check" : "fa-times";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import StringBuffer from 'discourse/mixins/string-buffer';
|
||||
|
||||
export default Discourse.View.extend(StringBuffer, {
|
||||
export default Ember.View.extend(StringBuffer, {
|
||||
tagName: 'button',
|
||||
classNameBindings: [':btn', ':standard', 'dropDownToggle'],
|
||||
attributeBindings: ['title', 'data-toggle', 'data-share-url'],
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import debounce from 'discourse/lib/debounce';
|
||||
import searchForTerm from 'discourse/lib/search-for-term';
|
||||
|
||||
export default Discourse.View.extend({
|
||||
export default Ember.View.extend({
|
||||
templateName: 'choose_topic',
|
||||
|
||||
topicTitleChanged: function() {
|
||||
|
|
|
@ -4,7 +4,7 @@ export default Ember.CollectionView.extend({
|
|||
|
||||
hidden: Em.computed.not('controller.controllers.composer.model.viewOpen'),
|
||||
|
||||
itemViewClass: Discourse.View.extend({
|
||||
itemViewClass: Ember.View.extend({
|
||||
classNames: ['composer-popup', 'hidden'],
|
||||
templateName: Em.computed.alias('content.templateName'),
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import positioningWorkaround from 'discourse/lib/safari-hacks';
|
|||
import debounce from 'discourse/lib/debounce';
|
||||
import { linkSeenMentions, fetchUnseenMentions } from 'discourse/lib/link-mentions';
|
||||
|
||||
const ComposerView = Discourse.View.extend(Ember.Evented, {
|
||||
const ComposerView = Ember.View.extend(Ember.Evented, {
|
||||
_lastKeyTimeout: null,
|
||||
templateName: 'composer',
|
||||
elementId: 'reply-control',
|
||||
|
@ -38,7 +38,7 @@ const ComposerView = Discourse.View.extend(Ember.Evented, {
|
|||
}.observes('loading'),
|
||||
|
||||
postMade: function() {
|
||||
return this.present('model.createdPost') ? 'created-post' : null;
|
||||
return !Ember.isEmpty(this.get('model.createdPost')) ? 'created-post' : null;
|
||||
}.property('model.createdPost'),
|
||||
|
||||
refreshPreview: debounce(function() {
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import Presence from 'discourse/mixins/presence';
|
||||
|
||||
export default Ember.ContainerView.extend(Presence, {
|
||||
export default Ember.ContainerView.extend({
|
||||
|
||||
attachViewWithArgs(viewArgs, viewClass) {
|
||||
if (!viewClass) { viewClass = Ember.View.extend(); }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import UrlRefresh from 'discourse/mixins/url-refresh';
|
||||
|
||||
export default Discourse.View.extend(UrlRefresh, {
|
||||
export default Ember.View.extend(UrlRefresh, {
|
||||
_addBodyClass: function() {
|
||||
$('body').addClass('categories-list');
|
||||
}.on('didInsertElement'),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import UrlRefresh from 'discourse/mixins/url-refresh';
|
||||
import ScrollTop from 'discourse/mixins/scroll-top';
|
||||
|
||||
export default Discourse.View.extend(ScrollTop, UrlRefresh);
|
||||
export default Ember.View.extend(ScrollTop, UrlRefresh);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import UrlRefresh from 'discourse/mixins/url-refresh';
|
||||
import LoadMore from "discourse/mixins/load-more";
|
||||
|
||||
export default Discourse.View.extend(LoadMore, UrlRefresh, {
|
||||
export default Ember.View.extend(LoadMore, UrlRefresh, {
|
||||
eyelineSelector: '.topic-list-item',
|
||||
|
||||
actions: {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import ScrollTop from 'discourse/mixins/scroll-top';
|
||||
import LoadMore from "discourse/mixins/load-more";
|
||||
|
||||
export default Discourse.View.extend(ScrollTop, LoadMore, {
|
||||
export default Ember.View.extend(ScrollTop, LoadMore, {
|
||||
eyelineSelector: '.user-stream .item',
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import ScrollTop from 'discourse/mixins/scroll-top';
|
||||
import LoadMore from "discourse/mixins/load-more";
|
||||
|
||||
export default Discourse.View.extend(ScrollTop, LoadMore, {
|
||||
export default Ember.View.extend(ScrollTop, LoadMore, {
|
||||
eyelineSelector: '.group-members tr',
|
||||
});
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import Presence from 'discourse/mixins/presence';
|
||||
|
||||
export default Ember.View.extend(Presence, {
|
||||
export default Ember.View.extend({
|
||||
_groupInit: function() {
|
||||
this.set('context', this.get('content'));
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
let originalZIndex;
|
||||
|
||||
export default Discourse.View.extend({
|
||||
export default Ember.View.extend({
|
||||
tagName: 'header',
|
||||
classNames: ['d-header', 'clearfix'],
|
||||
classNameBindings: ['editingTopic'],
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export default Discourse.View.extend({
|
||||
export default Ember.View.extend({
|
||||
focusInput: true,
|
||||
|
||||
_setupModal: function() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export default Discourse.View.extend({
|
||||
export default Ember.View.extend({
|
||||
classNames: ['quote-button'],
|
||||
classNameBindings: ['visible'],
|
||||
isMouseDown: false,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export default Discourse.View.extend({
|
||||
export default Ember.View.extend({
|
||||
tagName: 'div',
|
||||
classNames: ['d-dropdown'],
|
||||
elementId: 'search-dropdown',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export default Discourse.View.extend({
|
||||
export default Ember.View.extend({
|
||||
elementId: 'selected-posts',
|
||||
classNameBindings: ['customVisibility'],
|
||||
templateName: "selected-posts",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
export default Discourse.View.extend({
|
||||
export default Ember.View.extend({
|
||||
templateName: 'share',
|
||||
elementId: 'share-link',
|
||||
classNameBindings: ['hasLink'],
|
||||
|
@ -15,13 +15,13 @@ export default Discourse.View.extend({
|
|||
}.property('controller.type', 'controller.postNumber'),
|
||||
|
||||
hasLink: function() {
|
||||
if (this.present('controller.link')) return 'visible';
|
||||
if (!Ember.isEmpty(this.get('controller.link'))) return 'visible';
|
||||
return null;
|
||||
}.property('controller.link'),
|
||||
|
||||
linkChanged: function() {
|
||||
const self = this;
|
||||
if (this.present('controller.link')) {
|
||||
if (!Ember.isEmpty(this.get('controller.link'))) {
|
||||
Em.run.next(function() {
|
||||
if (!self.capabilities.touch) {
|
||||
var $linkInput = $('#share-link input');
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
This view is used for rendering the topic admin menu
|
||||
|
||||
@class TopicAdminMenuView
|
||||
@extends Discourse.View
|
||||
@extends Ember.View
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
export default Discourse.View.extend({
|
||||
export default Ember.View.extend({
|
||||
classNameBindings: ["controller.menuVisible::hidden", ":topic-admin-menu"],
|
||||
|
||||
_setup: function() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import StringBuffer from 'discourse/mixins/string-buffer';
|
||||
|
||||
export default Discourse.View.extend(StringBuffer, {
|
||||
export default Ember.View.extend(StringBuffer, {
|
||||
elementId: 'topic-closing-info',
|
||||
delayedRerender: null,
|
||||
|
||||
|
@ -10,7 +10,7 @@ export default Discourse.View.extend(StringBuffer, {
|
|||
'topic.details.auto_close_hours'],
|
||||
|
||||
renderString: function(buffer) {
|
||||
if (!this.present('topic.details.auto_close_at')) return;
|
||||
if (!!Ember.isEmpty(this.get('topic.details.auto_close_at'))) return;
|
||||
if (this.get("topic.closed")) return;
|
||||
|
||||
var autoCloseAt = moment(this.get('topic.details.auto_close_at'));
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue