mirror of
https://github.com/discourse/discourse.git
synced 2026-08-08 12:08:12 -05:00
ES6ify some of the remaining files
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
import { bufferedProperty } from 'discourse/mixins/buffered-content';
|
||||
import UserField from 'admin/models/user-field';
|
||||
import { bufferedProperty } from 'discourse/mixins/buffered-content';
|
||||
import { popupAjaxError } from 'discourse/lib/ajax-error';
|
||||
import { propertyEqual } from 'discourse/lib/computed';
|
||||
|
||||
export default Ember.Component.extend(bufferedProperty('userField'), {
|
||||
editing: Ember.computed.empty('userField.id'),
|
||||
classNameBindings: [':user-field'],
|
||||
|
||||
cantMoveUp: Discourse.computed.propertyEqual('userField', 'firstField'),
|
||||
cantMoveDown: Discourse.computed.propertyEqual('userField', 'lastField'),
|
||||
cantMoveUp: propertyEqual('userField', 'firstField'),
|
||||
cantMoveDown: propertyEqual('userField', 'lastField'),
|
||||
|
||||
userFieldsDescription: function() {
|
||||
return I18n.t('admin.user_fields.description');
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import BufferedContent from 'discourse/mixins/buffered-content';
|
||||
import ScrollTop from 'discourse/mixins/scroll-top';
|
||||
import SiteSetting from 'admin/models/site-setting';
|
||||
import { propertyNotEqual } from 'discourse/lib/computed';
|
||||
|
||||
const CustomTypes = ['bool', 'enum', 'list', 'url_list', 'host_list'];
|
||||
|
||||
export default Ember.Component.extend(BufferedContent, ScrollTop, {
|
||||
classNameBindings: [':row', ':setting', 'setting.overridden', 'typeClass'],
|
||||
content: Ember.computed.alias('setting'),
|
||||
dirty: Discourse.computed.propertyNotEqual('buffered.value', 'setting.value'),
|
||||
dirty: propertyNotEqual('buffered.value', 'setting.value'),
|
||||
validationMessage: null,
|
||||
|
||||
preview: function() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
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, {
|
||||
needs: ['admin-badges'],
|
||||
@@ -12,7 +13,7 @@ export default Ember.ObjectController.extend(BufferedContent, {
|
||||
protectedSystemFields: Em.computed.alias('controllers.admin-badges.protectedSystemFields'),
|
||||
|
||||
readOnly: Ember.computed.alias('buffered.system'),
|
||||
showDisplayName: Discourse.computed.propertyNotEqual('name', 'displayName'),
|
||||
showDisplayName: propertyNotEqual('name', 'displayName'),
|
||||
canEditDescription: Em.computed.none('buffered.translatedDescription'),
|
||||
|
||||
_resetSaving: function() {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { url } from 'discourse/lib/computed';
|
||||
|
||||
const sections = ['css', 'header', 'top', 'footer', 'head-tag', 'body-tag',
|
||||
'mobile-css', 'mobile-header', 'mobile-top', 'mobile-footer',
|
||||
'embedded-css'];
|
||||
@@ -12,8 +14,8 @@ export default Ember.Controller.extend(activeSections, {
|
||||
maximized: false,
|
||||
section: null,
|
||||
|
||||
previewUrl: Discourse.computed.url("model.key", "/?preview-style=%@"),
|
||||
downloadUrl: Discourse.computed.url('model.id', '/admin/size_customizations/%@'),
|
||||
previewUrl: url("model.key", "/?preview-style=%@"),
|
||||
downloadUrl: url('model.id', '/admin/size_customizations/%@'),
|
||||
|
||||
mobile: function() {
|
||||
return this.get('section').startsWith('mobile-');
|
||||
@@ -33,8 +35,8 @@ export default Ember.Controller.extend(activeSections, {
|
||||
|
||||
needs: ['adminCustomizeCssHtml'],
|
||||
|
||||
undoPreviewUrl: Discourse.computed.url('/?preview-style='),
|
||||
defaultStyleUrl: Discourse.computed.url('/?preview-style=default'),
|
||||
undoPreviewUrl: url('/?preview-style='),
|
||||
defaultStyleUrl: url('/?preview-style=default'),
|
||||
|
||||
actions: {
|
||||
save() {
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
/**
|
||||
This controller supports the default interface when you enter the admin section.
|
||||
import { setting } from 'discourse/lib/computed';
|
||||
|
||||
@class AdminDashboardController
|
||||
@extends Ember.Controller
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
// This controller supports the default interface when you enter the admin section.
|
||||
export default Ember.Controller.extend({
|
||||
loading: true,
|
||||
versionCheck: null,
|
||||
problemsCheckMinutes: 1,
|
||||
|
||||
showVersionChecks: Discourse.computed.setting('version_checks'),
|
||||
showVersionChecks: setting('version_checks'),
|
||||
|
||||
foundProblems: function() {
|
||||
return(Discourse.User.currentProp('admin') && this.get('problems') && this.get('problems').length > 0);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { popupAjaxError } from 'discourse/lib/ajax-error';
|
||||
import { propertyEqual } from 'discourse/lib/computed';
|
||||
|
||||
export default Em.ObjectController.extend({
|
||||
needs: ['adminGroupsType'],
|
||||
@@ -15,7 +16,7 @@ export default Em.ObjectController.extend({
|
||||
}.property("limit", "user_count"),
|
||||
|
||||
showingFirst: Em.computed.lte("currentPage", 1),
|
||||
showingLast: Discourse.computed.propertyEqual("currentPage", "totalPages"),
|
||||
showingLast: propertyEqual("currentPage", "totalPages"),
|
||||
|
||||
aliasLevelOptions: function() {
|
||||
return [
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
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, {
|
||||
editingTitle: false,
|
||||
originalPrimaryGroupId: null,
|
||||
availableGroups: null,
|
||||
|
||||
showApproval: Discourse.computed.setting('must_approve_users'),
|
||||
showBadges: Discourse.computed.setting('enable_badges'),
|
||||
showApproval: setting('must_approve_users'),
|
||||
showBadges: setting('enable_badges'),
|
||||
|
||||
primaryGroupDirty: Discourse.computed.propertyNotEqual('originalPrimaryGroupId', 'model.primary_group_id'),
|
||||
primaryGroupDirty: propertyNotEqual('originalPrimaryGroupId', 'model.primary_group_id'),
|
||||
|
||||
automaticGroups: function() {
|
||||
return this.get("model.automaticGroups").map((g) => g.name).join(", ");
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { i18n } from 'discourse/lib/computed';
|
||||
|
||||
export default Ember.ArrayController.extend({
|
||||
query: null,
|
||||
showEmails: false,
|
||||
@@ -9,7 +11,7 @@ export default Ember.ArrayController.extend({
|
||||
queryPending: Em.computed.equal('query', 'pending'),
|
||||
queryHasApproval: Em.computed.or('queryNew', 'queryPending'),
|
||||
showApproval: Em.computed.and('siteSettings.must_approve_users', 'queryHasApproval'),
|
||||
searchHint: Discourse.computed.i18n('search_hint'),
|
||||
searchHint: i18n('search_hint'),
|
||||
hasSelection: Em.computed.gt('selectedCount', 0),
|
||||
|
||||
selectedCount: function() {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { propertyNotEqual } from 'discourse/lib/computed';
|
||||
import { popupAjaxError } from 'discourse/lib/ajax-error';
|
||||
|
||||
const AdminUser = Discourse.User.extend({
|
||||
@@ -144,7 +145,7 @@ const AdminUser = Discourse.User.extend({
|
||||
this.set('originalTrustLevel', this.get('trust_level'));
|
||||
},
|
||||
|
||||
dirty: Discourse.computed.propertyNotEqual('originalTrustLevel', 'trustLevel.id'),
|
||||
dirty: propertyNotEqual('originalTrustLevel', 'trustLevel.id'),
|
||||
|
||||
saveTrustLevel() {
|
||||
return Discourse.ajax("/admin/users/" + this.id + "/trust_level", {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import round from "discourse/lib/round";
|
||||
import { fmt } from 'discourse/lib/computed';
|
||||
|
||||
const Report = Discourse.Model.extend({
|
||||
reportUrl: Discourse.computed.fmt("type", "/admin/reports/%@"),
|
||||
reportUrl: fmt("type", "/admin/reports/%@"),
|
||||
|
||||
valueAt(numDaysAgo) {
|
||||
if (this.data) {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import RestModel from 'discourse/models/rest';
|
||||
import { i18n } from 'discourse/lib/computed';
|
||||
|
||||
const UserField = RestModel.extend();
|
||||
|
||||
const UserFieldType = Ember.Object.extend({
|
||||
name: Discourse.computed.i18n('id', 'admin.user_fields.field_types.%@')
|
||||
name: i18n('id', 'admin.user_fields.field_types.%@')
|
||||
});
|
||||
|
||||
UserField.reopenClass({
|
||||
|
||||
Reference in New Issue
Block a user