DEV: Use method definition syntax consistently (#14915)
This commit is contained in:
parent
bdd2c888b0
commit
f414d5eace
|
@ -33,7 +33,7 @@ export default Component.extend({
|
|||
}
|
||||
},
|
||||
|
||||
_updateFormattedLogsFunc: function () {
|
||||
_updateFormattedLogsFunc() {
|
||||
const logs = this.logs;
|
||||
if (logs.length === 0) {
|
||||
return;
|
||||
|
|
|
@ -114,7 +114,7 @@ export default Component.extend({
|
|||
this.fieldAdded(this.currentTargetName, name);
|
||||
},
|
||||
|
||||
toggleMaximize: function () {
|
||||
toggleMaximize() {
|
||||
this.toggleProperty("maximized");
|
||||
next(() => this.appEvents.trigger("ace:resize"));
|
||||
},
|
||||
|
|
|
@ -40,7 +40,7 @@ export default Component.extend({
|
|||
},
|
||||
|
||||
@observes("hexValue", "brightnessValue", "valid")
|
||||
hexValueChanged: function () {
|
||||
hexValueChanged() {
|
||||
const hex = this.hexValue;
|
||||
let text = this.element.querySelector("input.hex-input");
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||
},
|
||||
|
||||
@observes("model.id")
|
||||
_resetSaving: function () {
|
||||
_resetSaving() {
|
||||
this.set("saving", false);
|
||||
this.set("savingStatus", "");
|
||||
},
|
||||
|
|
|
@ -15,11 +15,11 @@ export default Controller.extend({
|
|||
},
|
||||
|
||||
actions: {
|
||||
revert: function (color) {
|
||||
revert(color) {
|
||||
color.revert();
|
||||
},
|
||||
|
||||
undo: function (color) {
|
||||
undo(color) {
|
||||
color.undo();
|
||||
},
|
||||
|
||||
|
@ -68,7 +68,7 @@ export default Controller.extend({
|
|||
});
|
||||
},
|
||||
|
||||
save: function () {
|
||||
save() {
|
||||
this.model.save();
|
||||
},
|
||||
|
||||
|
@ -76,7 +76,7 @@ export default Controller.extend({
|
|||
this.model.updateUserSelectable(this.get("model.user_selectable"));
|
||||
},
|
||||
|
||||
destroy: function () {
|
||||
destroy() {
|
||||
const model = this.model;
|
||||
return bootbox.confirm(
|
||||
I18n.t("admin.customize.colors.delete_confirm"),
|
||||
|
|
|
@ -12,7 +12,7 @@ export default Controller.extend({
|
|||
editRouteName: "adminCustomizeThemes.edit",
|
||||
showRouteName: "adminCustomizeThemes.show",
|
||||
|
||||
setTargetName: function (name) {
|
||||
setTargetName(name) {
|
||||
const target = this.get("model.targets").find((t) => t.name === name);
|
||||
this.set("currentTarget", target && target.id);
|
||||
},
|
||||
|
|
|
@ -19,7 +19,7 @@ export default Controller.extend({
|
|||
@method testEmailAddressChanged
|
||||
**/
|
||||
@observes("testEmailAddress")
|
||||
testEmailAddressChanged: function () {
|
||||
testEmailAddressChanged() {
|
||||
this.set("sentTestEmail", false);
|
||||
},
|
||||
|
||||
|
@ -29,7 +29,7 @@ export default Controller.extend({
|
|||
|
||||
@method sendTestEmail
|
||||
**/
|
||||
sendTestEmail: function () {
|
||||
sendTestEmail() {
|
||||
this.setProperties({
|
||||
sendingEmail: true,
|
||||
sentTestEmail: false,
|
||||
|
|
|
@ -37,7 +37,7 @@ export default Controller.extend({
|
|||
textArea.remove();
|
||||
},
|
||||
|
||||
destroy: function (record) {
|
||||
destroy(record) {
|
||||
return bootbox.confirm(
|
||||
I18n.t("admin.permalink.delete_confirm"),
|
||||
I18n.t("no_value"),
|
||||
|
|
|
@ -3,7 +3,7 @@ import discourseComputed from "discourse-common/utils/decorators";
|
|||
|
||||
export default Controller.extend({
|
||||
@discourseComputed
|
||||
adminRoutes: function () {
|
||||
adminRoutes() {
|
||||
return this.model
|
||||
.map((p) => {
|
||||
if (p.get("enabled")) {
|
||||
|
|
|
@ -61,7 +61,7 @@ export default Controller.extend(GrantBadgeController, {
|
|||
},
|
||||
|
||||
actions: {
|
||||
expandGroup: function (userBadge) {
|
||||
expandGroup(userBadge) {
|
||||
const model = this.model;
|
||||
model.set("expandedBadges", model.get("expandedBadges") || []);
|
||||
model.get("expandedBadges").pushObject(userBadge.badge.id);
|
||||
|
|
|
@ -4,7 +4,7 @@ import { ajax } from "discourse/lib/ajax";
|
|||
const EmailSettings = EmberObject.extend({});
|
||||
|
||||
EmailSettings.reopenClass({
|
||||
find: function () {
|
||||
find() {
|
||||
return ajax("/admin/email.json").then(function (settings) {
|
||||
return EmailSettings.create(settings);
|
||||
});
|
||||
|
|
|
@ -5,7 +5,7 @@ import { ajax } from "discourse/lib/ajax";
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
|
||||
const Permalink = EmberObject.extend({
|
||||
save: function () {
|
||||
save() {
|
||||
return ajax("/admin/permalinks.json", {
|
||||
type: "POST",
|
||||
data: {
|
||||
|
@ -17,16 +17,16 @@ const Permalink = EmberObject.extend({
|
|||
},
|
||||
|
||||
@discourseComputed("category_id")
|
||||
category: function (category_id) {
|
||||
category(category_id) {
|
||||
return Category.findById(category_id);
|
||||
},
|
||||
|
||||
@discourseComputed("external_url")
|
||||
linkIsExternal: function (external_url) {
|
||||
linkIsExternal(external_url) {
|
||||
return !DiscourseURL.isInternal(external_url);
|
||||
},
|
||||
|
||||
destroy: function () {
|
||||
destroy() {
|
||||
return ajax("/admin/permalinks/" + this.id + ".json", {
|
||||
type: "DELETE",
|
||||
});
|
||||
|
@ -34,7 +34,7 @@ const Permalink = EmberObject.extend({
|
|||
});
|
||||
|
||||
Permalink.reopenClass({
|
||||
findAll: function (filter) {
|
||||
findAll(filter) {
|
||||
return ajax("/admin/permalinks.json", { data: { filter } }).then(function (
|
||||
permalinks
|
||||
) {
|
||||
|
|
|
@ -9,7 +9,7 @@ const ScreenedEmail = EmberObject.extend({
|
|||
return I18n.t("admin.logs.screened_actions." + action);
|
||||
},
|
||||
|
||||
clearBlock: function () {
|
||||
clearBlock() {
|
||||
return ajax("/admin/logs/screened_emails/" + this.id, {
|
||||
type: "DELETE",
|
||||
});
|
||||
|
@ -17,7 +17,7 @@ const ScreenedEmail = EmberObject.extend({
|
|||
});
|
||||
|
||||
ScreenedEmail.reopenClass({
|
||||
findAll: function () {
|
||||
findAll() {
|
||||
return ajax("/admin/logs/screened_emails.json").then(function (
|
||||
screened_emails
|
||||
) {
|
||||
|
|
|
@ -11,7 +11,7 @@ const ScreenedUrl = EmberObject.extend({
|
|||
});
|
||||
|
||||
ScreenedUrl.reopenClass({
|
||||
findAll: function () {
|
||||
findAll() {
|
||||
return ajax("/admin/logs/screened_urls.json").then(function (
|
||||
screened_urls
|
||||
) {
|
||||
|
|
|
@ -3,7 +3,7 @@ import EmberObject from "@ember/object";
|
|||
import { ajax } from "discourse/lib/ajax";
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
model: function () {
|
||||
model() {
|
||||
return ajax("/admin/customize/emojis.json").then(function (emojis) {
|
||||
return emojis.map(function (emoji) {
|
||||
return EmberObject.create(emoji);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
redirect: function () {
|
||||
redirect() {
|
||||
this.transitionTo("adminLogs.staffActionLogs");
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
renderTemplate: function () {
|
||||
renderTemplate() {
|
||||
this.render("admin/templates/logs/screened-emails", { into: "adminLogs" });
|
||||
},
|
||||
|
||||
setupController: function () {
|
||||
setupController() {
|
||||
return this.controllerFor("adminLogsScreenedEmails").show();
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
renderTemplate: function () {
|
||||
renderTemplate() {
|
||||
this.render("admin/templates/logs/screened-urls", { into: "adminLogs" });
|
||||
},
|
||||
|
||||
setupController: function () {
|
||||
setupController() {
|
||||
return this.controllerFor("adminLogsScreenedUrls").show();
|
||||
},
|
||||
});
|
||||
|
|
|
@ -2,11 +2,11 @@ import DiscourseRoute from "discourse/routes/discourse";
|
|||
import UserField from "admin/models/user-field";
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
model: function () {
|
||||
model() {
|
||||
return this.store.findAll("user-field");
|
||||
},
|
||||
|
||||
setupController: function (controller, model) {
|
||||
setupController(controller, model) {
|
||||
controller.setProperties({ model, fieldTypes: UserField.fieldTypes() });
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
redirect: function () {
|
||||
redirect() {
|
||||
this.transitionTo("adminUsersList");
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
beforeModel: function () {
|
||||
beforeModel() {
|
||||
this.transitionTo("adminUsersList.show", "active");
|
||||
},
|
||||
});
|
||||
|
|
|
@ -11,7 +11,7 @@ export default function decoratorAlias(fn, errorMessage) {
|
|||
enumerable: desc.enumerable,
|
||||
configurable: desc.configurable,
|
||||
writable: desc.writable,
|
||||
initializer: function () {
|
||||
initializer() {
|
||||
let value = extractValue(desc);
|
||||
return fn.apply(null, params.concat(value));
|
||||
},
|
||||
|
|
|
@ -50,7 +50,7 @@ export function readOnly(target, name, desc) {
|
|||
writable: false,
|
||||
enumerable: desc.enumerable,
|
||||
configurable: desc.configurable,
|
||||
initializer: function () {
|
||||
initializer() {
|
||||
let value = extractValue(desc);
|
||||
return value.readOnly();
|
||||
},
|
||||
|
|
|
@ -6,7 +6,7 @@ export default function handleDescriptor(target, key, desc, params = []) {
|
|||
enumerable: desc.enumerable,
|
||||
configurable: desc.configurable,
|
||||
writeable: desc.writeable,
|
||||
initializer: function () {
|
||||
initializer() {
|
||||
let computedDescriptor;
|
||||
|
||||
if (desc.writable) {
|
||||
|
|
|
@ -5,7 +5,7 @@ function handleDescriptor(target, property, desc, fn, params = []) {
|
|||
enumerable: desc.enumerable,
|
||||
configurable: desc.configurable,
|
||||
writable: desc.writable,
|
||||
initializer: function () {
|
||||
initializer() {
|
||||
return fn(...params);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -19,7 +19,7 @@ export default Component.extend({
|
|||
},
|
||||
|
||||
@observes("topicList.[]")
|
||||
_topicListChanged: function () {
|
||||
_topicListChanged() {
|
||||
this._initFromTopicList(this.topicList);
|
||||
},
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ export default Component.extend({
|
|||
});
|
||||
},
|
||||
|
||||
_addToCollection: function () {
|
||||
_addToCollection() {
|
||||
this.panels.addObject(this.tabClassName);
|
||||
},
|
||||
|
||||
|
@ -50,7 +50,7 @@ export default Component.extend({
|
|||
},
|
||||
|
||||
actions: {
|
||||
select: function () {
|
||||
select() {
|
||||
this.set("selectedTab", this.tab);
|
||||
|
||||
if (!this.newCategory) {
|
||||
|
|
|
@ -8,7 +8,7 @@ export default buildCategoryPanel("topic-template", {
|
|||
showInsertLinkButton: false,
|
||||
|
||||
@observes("activeTab")
|
||||
_activeTabChanged: function () {
|
||||
_activeTabChanged() {
|
||||
if (this.activeTab) {
|
||||
schedule("afterRender", () =>
|
||||
this.element.querySelector(".d-editor-input").focus()
|
||||
|
|
|
@ -7,7 +7,7 @@ export default Component.extend({
|
|||
|
||||
@on("didInsertElement")
|
||||
@observes("highlight")
|
||||
_highlightOnInsert: function () {
|
||||
_highlightOnInsert() {
|
||||
const term = this.highlight;
|
||||
highlightSearch(this.element, term);
|
||||
},
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import Component from "@ember/component";
|
||||
export default Component.extend({
|
||||
tagName: "",
|
||||
|
||||
actions: {
|
||||
share: function (source) {
|
||||
share(source) {
|
||||
this.action(source);
|
||||
},
|
||||
},
|
||||
|
|
|
@ -159,16 +159,16 @@ export default Component.extend({
|
|||
return classes.join(" ");
|
||||
},
|
||||
|
||||
hasLikes: function () {
|
||||
hasLikes() {
|
||||
return this.get("topic.like_count") > 0;
|
||||
},
|
||||
|
||||
hasOpLikes: function () {
|
||||
hasOpLikes() {
|
||||
return this.get("topic.op_like_count") > 0;
|
||||
},
|
||||
|
||||
@discourseComputed
|
||||
expandPinned: function () {
|
||||
expandPinned() {
|
||||
const pinned = this.get("topic.pinned");
|
||||
if (!pinned) {
|
||||
return false;
|
||||
|
|
|
@ -5,7 +5,7 @@ export default Component.extend({
|
|||
tagName: "span",
|
||||
|
||||
@observes("selected")
|
||||
selectionChanged: function () {
|
||||
selectionChanged() {
|
||||
const selected = this.selected;
|
||||
const list = this.selectedList;
|
||||
const id = this.selectedId;
|
||||
|
|
|
@ -31,7 +31,7 @@ export default Component.extend(LoadMore, {
|
|||
classNames: ["user-stream"],
|
||||
|
||||
@observes("stream.user.id")
|
||||
_scrollTopOnModelChange: function () {
|
||||
_scrollTopOnModelChange() {
|
||||
schedule("afterRender", () => $(document).scrollTop(0));
|
||||
},
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ export default Controller.extend(
|
|||
},
|
||||
|
||||
@observes("emailValidation", "accountEmail")
|
||||
prefillUsername: function () {
|
||||
prefillUsername() {
|
||||
if (this.prefilledUsername) {
|
||||
// If username field has been filled automatically, and email field just changed,
|
||||
// then remove the username.
|
||||
|
|
|
@ -23,7 +23,7 @@ export default Controller.extend({
|
|||
loadedAllItems: not("discoveryTopics.model.canLoadMore"),
|
||||
|
||||
@observes("loadedAllItems")
|
||||
_showFooter: function () {
|
||||
_showFooter() {
|
||||
this.set("application.showFooter", this.loadedAllItems);
|
||||
},
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ addBulkButton("showTagTopics", "change_tags", {
|
|||
icon: "tag",
|
||||
class: "btn-default",
|
||||
enabledSetting: "tagging_enabled",
|
||||
buttonVisible: function () {
|
||||
buttonVisible() {
|
||||
return this.currentUser.staff;
|
||||
},
|
||||
});
|
||||
|
@ -85,7 +85,7 @@ addBulkButton("showAppendTagTopics", "append_tags", {
|
|||
icon: "tag",
|
||||
class: "btn-default",
|
||||
enabledSetting: "tagging_enabled",
|
||||
buttonVisible: function () {
|
||||
buttonVisible() {
|
||||
return this.currentUser.staff;
|
||||
},
|
||||
});
|
||||
|
@ -93,14 +93,14 @@ addBulkButton("removeTags", "remove_tags", {
|
|||
icon: "tag",
|
||||
class: "btn-default",
|
||||
enabledSetting: "tagging_enabled",
|
||||
buttonVisible: function () {
|
||||
buttonVisible() {
|
||||
return this.currentUser.staff;
|
||||
},
|
||||
});
|
||||
addBulkButton("deleteTopics", "delete", {
|
||||
icon: "trash-alt",
|
||||
class: "btn-danger delete-topics",
|
||||
buttonVisible: function () {
|
||||
buttonVisible() {
|
||||
return this.currentUser.staff;
|
||||
},
|
||||
});
|
||||
|
|
|
@ -13,7 +13,7 @@ export default Controller.extend({
|
|||
canDownloadPosts: alias("user.viewingSelf"),
|
||||
|
||||
@observes("userActionType", "model.stream.itemsLoaded")
|
||||
_showFooter: function () {
|
||||
_showFooter() {
|
||||
let showFooter;
|
||||
if (this.userActionType) {
|
||||
const stat = (this.get("model.stats") || []).find(
|
||||
|
|
|
@ -5,7 +5,7 @@ export default Controller.extend({
|
|||
application: controller(),
|
||||
|
||||
@observes("model.canLoadMore")
|
||||
_showFooter: function () {
|
||||
_showFooter() {
|
||||
this.set("application.showFooter", !this.get("model.canLoadMore"));
|
||||
},
|
||||
});
|
||||
|
|
|
@ -233,14 +233,14 @@ export default Controller.extend(CanCheckEmails, {
|
|||
`${iconHTML("exclamation-triangle")} ` +
|
||||
I18n.t("admin.user.delete_and_block"),
|
||||
class: "btn btn-danger",
|
||||
callback: function () {
|
||||
callback() {
|
||||
performDestroy(true);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: I18n.t("admin.user.delete_dont_block"),
|
||||
class: "btn btn-primary",
|
||||
callback: function () {
|
||||
callback() {
|
||||
performDestroy(false);
|
||||
},
|
||||
},
|
||||
|
|
|
@ -3,7 +3,7 @@ let initializedOnce = false;
|
|||
export default {
|
||||
name: "ember-events",
|
||||
|
||||
initialize: function () {
|
||||
initialize() {
|
||||
// By default Ember listens to too many events. This tells it the only events
|
||||
// we're interested in. (it removes mousemove and touchmove)
|
||||
if (initializedOnce) {
|
||||
|
|
|
@ -9,7 +9,7 @@ export default {
|
|||
name: "logout",
|
||||
after: "message-bus",
|
||||
|
||||
initialize: function (container) {
|
||||
initialize(container) {
|
||||
const messageBus = container.lookup("message-bus:main");
|
||||
|
||||
if (!messageBus) {
|
||||
|
|
|
@ -6,7 +6,7 @@ export default {
|
|||
name: "logs-notice",
|
||||
after: "message-bus",
|
||||
|
||||
initialize: function (container) {
|
||||
initialize(container) {
|
||||
if (initializedOnce) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -4,13 +4,13 @@ import Sharing from "discourse/lib/sharing";
|
|||
export default {
|
||||
name: "sharing-sources",
|
||||
|
||||
initialize: function (container) {
|
||||
initialize(container) {
|
||||
const siteSettings = container.lookup("site-settings:main");
|
||||
|
||||
Sharing.addSource({
|
||||
id: "twitter",
|
||||
icon: "fab-twitter",
|
||||
generateUrl: function (link, title, quote = "") {
|
||||
generateUrl(link, title, quote = "") {
|
||||
const text = quote ? `"${quote}" -- ` : title;
|
||||
return `http://twitter.com/intent/tweet?url=${encodeURIComponent(
|
||||
link
|
||||
|
@ -25,7 +25,7 @@ export default {
|
|||
id: "facebook",
|
||||
icon: "fab-facebook",
|
||||
title: I18n.t("share.facebook"),
|
||||
generateUrl: function (link, title, quote = "") {
|
||||
generateUrl(link, title, quote = "") {
|
||||
const fb_url = siteSettings.facebook_app_id
|
||||
? `https://www.facebook.com/dialog/share?app_id=${
|
||||
siteSettings.facebook_app_id
|
||||
|
@ -41,7 +41,7 @@ export default {
|
|||
id: "email",
|
||||
icon: "envelope",
|
||||
title: I18n.t("share.email"),
|
||||
generateUrl: function (link, title, quote = "") {
|
||||
generateUrl(link, title, quote = "") {
|
||||
const body = quote ? `${quote} \n\n ${link}` : link;
|
||||
return (
|
||||
"mailto:?to=&subject=" +
|
||||
|
|
|
@ -202,7 +202,7 @@ class PluginApi {
|
|||
*
|
||||
* ```
|
||||
* api.modifyClassStatic('controller:composer', {
|
||||
* superFinder: function() { return []; }
|
||||
* superFinder() { return []; }
|
||||
* });
|
||||
* ```
|
||||
**/
|
||||
|
@ -1036,7 +1036,7 @@ class PluginApi {
|
|||
* Example:
|
||||
*
|
||||
* api.addComposerUploadProcessor({action: 'myFileTransformation'}, {
|
||||
* myFileTransformation: function (data, options) {
|
||||
* myFileTransformation(data, options) {
|
||||
* let p = new Promise((resolve, reject) => {
|
||||
* let file = data.files[data.index];
|
||||
* console.log(`Transforming ${file.name}`);
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
import Sharing from 'discourse/lib/sharing';
|
||||
|
||||
Sharing.addSource({
|
||||
|
||||
// This id must be present in the `share_links` site setting too
|
||||
id: 'twitter',
|
||||
|
||||
|
@ -15,12 +14,12 @@
|
|||
htmlIcon: '<img src="example.com/example.jpg">',
|
||||
|
||||
// A callback for generating the remote link from the `link` and `title`
|
||||
generateUrl: function(link, title) {
|
||||
generateUrl(link, title) {
|
||||
return "http://twitter.com/intent/tweet?url=" + encodeURIComponent(link) + "&text=" + encodeURIComponent(title);
|
||||
},
|
||||
|
||||
// If provided, handle by custom javascript rather than default url open
|
||||
clickHandler: function(link, title){
|
||||
clickHandler(link, title) {
|
||||
alert("Hello!")
|
||||
},
|
||||
|
||||
|
|
|
@ -10,11 +10,11 @@ export function bufferedProperty(property) {
|
|||
});
|
||||
}),
|
||||
|
||||
rollbackBuffer: function () {
|
||||
rollbackBuffer() {
|
||||
this.buffered.discardBufferedChanges();
|
||||
},
|
||||
|
||||
commitBuffer: function () {
|
||||
commitBuffer() {
|
||||
this.buffered.applyBufferedChanges();
|
||||
},
|
||||
};
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
// Define your class and apply the Mixin
|
||||
Foot = EmberObject.extend({});
|
||||
Foot.reopenClass(Singleton, {
|
||||
createCurrent: function() {
|
||||
createCurrent() {
|
||||
return Foot.create({ toes: 5 });
|
||||
}
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@ export default RestModel.extend({
|
|||
canToggle: or("can_undo", "can_act"),
|
||||
|
||||
// Remove it
|
||||
removeAction: function () {
|
||||
removeAction() {
|
||||
this.setProperties({
|
||||
acted: false,
|
||||
count: this.count - 1,
|
||||
|
|
|
@ -9,7 +9,7 @@ import discourseComputed from "discourse-common/utils/decorators";
|
|||
|
||||
const UserBadge = EmberObject.extend({
|
||||
@discourseComputed
|
||||
postUrl: function () {
|
||||
postUrl() {
|
||||
if (this.topic_title) {
|
||||
return "/t/-/" + this.topic_id + "/" + this.post_number;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ const UserBadge = EmberObject.extend({
|
|||
});
|
||||
|
||||
UserBadge.reopenClass({
|
||||
createFromJson: function (json) {
|
||||
createFromJson(json) {
|
||||
// Create User objects.
|
||||
if (json.users === undefined) {
|
||||
json.users = [];
|
||||
|
@ -110,7 +110,7 @@ UserBadge.reopenClass({
|
|||
@param {Object} options
|
||||
@returns {Promise} a promise that resolves to an array of `UserBadge`.
|
||||
**/
|
||||
findByUsername: function (username, options) {
|
||||
findByUsername(username, options) {
|
||||
if (!username) {
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ UserBadge.reopenClass({
|
|||
@param {String} badgeId
|
||||
@returns {Promise} a promise that resolves to an array of `UserBadge`.
|
||||
**/
|
||||
findByBadgeId: function (badgeId, options) {
|
||||
findByBadgeId(badgeId, options) {
|
||||
if (!options) {
|
||||
options = {};
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ UserBadge.reopenClass({
|
|||
@param {String} username username of the user to be granted the badge.
|
||||
@returns {Promise} a promise that resolves to an instance of `UserBadge`.
|
||||
**/
|
||||
grant: function (badgeId, username, reason) {
|
||||
grant(badgeId, username, reason) {
|
||||
return ajax("/user_badges", {
|
||||
type: "POST",
|
||||
data: {
|
||||
|
|
|
@ -761,7 +761,7 @@ const User = RestModel.extend({
|
|||
return !this.siteSettings.enable_discourse_connect && canDeleteAccount;
|
||||
},
|
||||
|
||||
delete: function () {
|
||||
delete() {
|
||||
if (this.can_delete_account) {
|
||||
return ajax(userPath(this.username + ".json"), {
|
||||
type: "DELETE",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
export default {
|
||||
name: "register-discourse-dom-templates",
|
||||
|
||||
initialize: function () {
|
||||
initialize() {
|
||||
$('script[type="text/x-handlebars"]').each(function () {
|
||||
let $this = $(this);
|
||||
let name = $this.attr("name") || $this.data("template-name");
|
||||
|
|
|
@ -3,7 +3,7 @@ import discourseComputed from "discourse-common/utils/decorators";
|
|||
|
||||
export default EmberObject.extend({
|
||||
@discourseComputed
|
||||
isLastVisited: function () {
|
||||
isLastVisited() {
|
||||
return this.lastVisitedTopic === this.topic;
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Route from "@ember/routing/route";
|
||||
export default Route.extend({
|
||||
beforeModel: function () {
|
||||
beforeModel() {
|
||||
this.transitionTo("group.messages.inbox");
|
||||
},
|
||||
});
|
||||
|
|
|
@ -3,15 +3,15 @@ import RestrictedUserRoute from "discourse/routes/restricted-user";
|
|||
export default RestrictedUserRoute.extend({
|
||||
showFooter: true,
|
||||
|
||||
model: function () {
|
||||
model() {
|
||||
return this.modelFor("user");
|
||||
},
|
||||
|
||||
renderTemplate: function () {
|
||||
renderTemplate() {
|
||||
this.render({ into: "user" });
|
||||
},
|
||||
|
||||
setupController: function (controller, model) {
|
||||
setupController(controller, model) {
|
||||
controller.reset();
|
||||
controller.setProperties({
|
||||
model,
|
||||
|
@ -20,14 +20,14 @@ export default RestrictedUserRoute.extend({
|
|||
});
|
||||
},
|
||||
|
||||
resetController: function (controller, isExiting) {
|
||||
resetController(controller, isExiting) {
|
||||
if (isExiting) {
|
||||
controller.set("new", undefined);
|
||||
}
|
||||
},
|
||||
|
||||
// A bit odd, but if we leave to /preferences we need to re-render that outlet
|
||||
deactivate: function () {
|
||||
deactivate() {
|
||||
this._super(...arguments);
|
||||
this.render("preferences", { into: "user", controller: "preferences" });
|
||||
},
|
||||
|
|
|
@ -3,21 +3,21 @@ import RestrictedUserRoute from "discourse/routes/restricted-user";
|
|||
export default RestrictedUserRoute.extend({
|
||||
showFooter: true,
|
||||
|
||||
model: function () {
|
||||
model() {
|
||||
return this.modelFor("user");
|
||||
},
|
||||
|
||||
renderTemplate: function () {
|
||||
renderTemplate() {
|
||||
return this.render({ into: "user" });
|
||||
},
|
||||
|
||||
// A bit odd, but if we leave to /preferences we need to re-render that outlet
|
||||
deactivate: function () {
|
||||
deactivate() {
|
||||
this._super(...arguments);
|
||||
this.render("preferences", { into: "user", controller: "preferences" });
|
||||
},
|
||||
|
||||
setupController: function (controller, user) {
|
||||
setupController(controller, user) {
|
||||
controller.setProperties({
|
||||
model: user,
|
||||
newUsername: user.get("username"),
|
||||
|
|
|
@ -6,7 +6,7 @@ import I18n from "I18n";
|
|||
export default UserTopicListRoute.extend({
|
||||
userActionType: UserAction.TYPES.topics,
|
||||
|
||||
model: function () {
|
||||
model() {
|
||||
return this.store
|
||||
.findFiltered("topicList", {
|
||||
filter:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
beforeModel: function () {
|
||||
beforeModel() {
|
||||
this.replaceWith("userInvited.show", "pending");
|
||||
},
|
||||
});
|
||||
|
|
|
@ -39,7 +39,7 @@ export default DiscourseRoute.extend({
|
|||
this.refresh();
|
||||
},
|
||||
|
||||
willTransition: function () {
|
||||
willTransition() {
|
||||
this._super(...arguments);
|
||||
this.controllerFor("user").set("pmView", null);
|
||||
return true;
|
||||
|
|
|
@ -6,7 +6,7 @@ I18n.defaultLocale = "en";
|
|||
|
||||
// Set default pluralization rule
|
||||
I18n.pluralizationRules = {
|
||||
en: function(n) {
|
||||
en(n) {
|
||||
return n === 0 ? ["zero", "none", "other"] : n === 1 ? "one" : "other";
|
||||
}
|
||||
};
|
||||
|
|
|
@ -351,7 +351,7 @@ export function setup(helper) {
|
|||
|
||||
ruler.push("code", {
|
||||
tag: "code",
|
||||
replace: function (state, tagInfo, content) {
|
||||
replace(state, tagInfo, content) {
|
||||
let token;
|
||||
token = state.push("fence", "code", 0);
|
||||
token.content = content;
|
||||
|
|
|
@ -168,7 +168,7 @@ export function setup(helper) {
|
|||
|
||||
ruler.push("code", {
|
||||
tag: "code",
|
||||
replace: function (state, tagInfo, content) {
|
||||
replace(state, tagInfo, content) {
|
||||
let token;
|
||||
token = state.push("code_inline", "code", 0);
|
||||
token.content = content;
|
||||
|
@ -179,7 +179,7 @@ export function setup(helper) {
|
|||
const simpleUrlRegex = /^http[s]?:\/\//;
|
||||
ruler.push("url", {
|
||||
tag: "url",
|
||||
wrap: function (startToken, endToken, tagInfo, content) {
|
||||
wrap(startToken, endToken, tagInfo, content) {
|
||||
const url = (tagInfo.attrs["_default"] || content).trim();
|
||||
|
||||
if (simpleUrlRegex.test(url)) {
|
||||
|
@ -212,7 +212,7 @@ export function setup(helper) {
|
|||
|
||||
ruler.push("email", {
|
||||
tag: "email",
|
||||
replace: function (state, tagInfo, content) {
|
||||
replace(state, tagInfo, content) {
|
||||
let token;
|
||||
let email = tagInfo.attrs["_default"] || content;
|
||||
|
||||
|
@ -232,7 +232,7 @@ export function setup(helper) {
|
|||
|
||||
ruler.push("image", {
|
||||
tag: "img",
|
||||
replace: function (state, tagInfo, content) {
|
||||
replace(state, tagInfo, content) {
|
||||
let token = state.push("image", "img", 0);
|
||||
token.attrs = [
|
||||
["src", content],
|
||||
|
|
|
@ -151,7 +151,7 @@ const rule = {
|
|||
state.push("bbcode_open", "blockquote", 1);
|
||||
},
|
||||
|
||||
after: function (state) {
|
||||
after(state) {
|
||||
state.push("bbcode_close", "blockquote", -1);
|
||||
state.push("bbcode_close", "aside", -1);
|
||||
},
|
||||
|
|
|
@ -11,7 +11,7 @@ export function setup(helper) {
|
|||
|
||||
// we need a custom callback for style handling
|
||||
helper.allowList({
|
||||
custom: function (tag, attr, val) {
|
||||
custom(tag, attr, val) {
|
||||
if (tag !== "th" && tag !== "td") {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const rule = {
|
||||
tag: "details",
|
||||
before: function (state, tagInfo) {
|
||||
before(state, tagInfo) {
|
||||
const attrs = tagInfo.attrs;
|
||||
state.push("bbcode_open", "details", 1);
|
||||
state.push("bbcode_open", "summary", 1);
|
||||
|
@ -11,7 +11,7 @@ const rule = {
|
|||
state.push("bbcode_close", "summary", -1);
|
||||
},
|
||||
|
||||
after: function (state) {
|
||||
after(state) {
|
||||
state.push("bbcode_close", "details", -1);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -107,14 +107,14 @@ function getTitle(tokens, startToken) {
|
|||
const rule = {
|
||||
tag: "poll",
|
||||
|
||||
before: function (state, tagInfo, raw) {
|
||||
before(state, tagInfo, raw) {
|
||||
let token = state.push("text", "", 0);
|
||||
token.content = raw;
|
||||
token.bbcode_attrs = tagInfo.attrs;
|
||||
token.bbcode_type = "poll_open";
|
||||
},
|
||||
|
||||
after: function (state, openToken, raw) {
|
||||
after(state, openToken, raw) {
|
||||
const titleTokens = getTitle(state.tokens, openToken);
|
||||
let items = getListItems(state.tokens, openToken);
|
||||
|
||||
|
|
|
@ -567,7 +567,7 @@ function pieChartConfig(data, labels, opts = {}) {
|
|||
plugins: {
|
||||
legend: {
|
||||
labels: {
|
||||
generateLabels: function () {
|
||||
generateLabels() {
|
||||
return labels.map((text, index) => {
|
||||
return {
|
||||
fillStyle: getColors(data.length)[index],
|
||||
|
|
Loading…
Reference in New Issue