mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 03:06:53 +08:00
DEV: global s/this.get\("(\w+)"\)/this.$1 (#7592)
This commit is contained in:
@ -103,7 +103,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||
|
||||
actions: {
|
||||
updateName() {
|
||||
let name = this.get("name");
|
||||
let name = this.name;
|
||||
if (Ember.isEmpty(name)) {
|
||||
name = $("#file-input")[0].files[0].name;
|
||||
this.set("name", name.split(".")[0]);
|
||||
@ -123,14 +123,14 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||
|
||||
options.data.append("file", file);
|
||||
|
||||
ajax(this.get("uploadUrl"), options)
|
||||
ajax(this.uploadUrl, options)
|
||||
.then(result => {
|
||||
const upload = {
|
||||
upload_id: result.upload_id,
|
||||
name: this.get("name"),
|
||||
name: this.name,
|
||||
original_filename: file.name
|
||||
};
|
||||
this.get("adminCustomizeThemesShow").send("addUpload", upload);
|
||||
this.adminCustomizeThemesShow.send("addUpload", upload);
|
||||
this.send("closeModal");
|
||||
})
|
||||
.catch(e => {
|
||||
|
@ -5,9 +5,9 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||
|
||||
actions: {
|
||||
selectBase() {
|
||||
this.get("adminCustomizeColors").send(
|
||||
this.adminCustomizeColors.send(
|
||||
"newColorSchemeWithBase",
|
||||
this.get("selectedBaseThemeId")
|
||||
this.selectedBaseThemeId
|
||||
);
|
||||
this.send("closeModal");
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import { observes } from "ember-addons/ember-computed-decorators";
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
@observes("model")
|
||||
modelChanged() {
|
||||
const model = this.get("model");
|
||||
const model = this.model;
|
||||
const copy = Ember.A();
|
||||
const store = this.store;
|
||||
|
||||
@ -19,7 +19,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||
},
|
||||
|
||||
moveItem(item, delta) {
|
||||
const copy = this.get("workingCopy");
|
||||
const copy = this.workingCopy;
|
||||
const index = copy.indexOf(item);
|
||||
if (index + delta < 0 || index + delta >= copy.length) {
|
||||
return;
|
||||
@ -37,7 +37,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||
this.moveItem(item, 1);
|
||||
},
|
||||
delete(item) {
|
||||
this.get("workingCopy").removeObject(item);
|
||||
this.workingCopy.removeObject(item);
|
||||
},
|
||||
cancel() {
|
||||
this.setProperties({ model: null, workingCopy: null });
|
||||
@ -54,10 +54,10 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||
editing: true,
|
||||
name: I18n.t("admin.badges.badge_grouping")
|
||||
});
|
||||
this.get("workingCopy").pushObject(obj);
|
||||
this.workingCopy.pushObject(obj);
|
||||
},
|
||||
saveAll() {
|
||||
let items = this.get("workingCopy");
|
||||
let items = this.workingCopy;
|
||||
const groupIds = items.map(i => i.get("id") || -1);
|
||||
const names = items.map(i => i.get("name"));
|
||||
|
||||
@ -66,7 +66,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||
method: "POST"
|
||||
}).then(
|
||||
data => {
|
||||
items = this.get("model");
|
||||
items = this.model;
|
||||
items.clear();
|
||||
data.badge_groupings.forEach(g => {
|
||||
items.pushObject(this.store.createRecord("badge-grouping", g));
|
||||
|
@ -166,14 +166,14 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||
|
||||
@observes("privateChecked")
|
||||
privateWasChecked() {
|
||||
this.get("privateChecked")
|
||||
this.privateChecked
|
||||
? this.set("urlPlaceholder", "git@github.com:discourse/sample_theme.git")
|
||||
: this.set("urlPlaceholder", "https://github.com/discourse/sample_theme");
|
||||
|
||||
const checked = this.get("privateChecked");
|
||||
const checked = this.privateChecked;
|
||||
if (checked && !this._keyLoading) {
|
||||
this._keyLoading = true;
|
||||
ajax(this.get("keyGenUrl"), { method: "POST" })
|
||||
ajax(this.keyGenUrl, { method: "POST" })
|
||||
.then(pair => {
|
||||
this.setProperties({
|
||||
privateKey: pair.private_key,
|
||||
@ -228,13 +228,13 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||
},
|
||||
|
||||
installTheme() {
|
||||
if (this.get("create")) {
|
||||
if (this.create) {
|
||||
this.set("loading", true);
|
||||
const theme = this.store.createRecord(this.get("recordType"));
|
||||
const theme = this.store.createRecord(this.recordType);
|
||||
theme
|
||||
.save({ name: this.get("name"), component: this.get("component") })
|
||||
.save({ name: this.name, component: this.component })
|
||||
.then(() => {
|
||||
this.get("themesController").send("addTheme", theme);
|
||||
this.themesController.send("addTheme", theme);
|
||||
this.send("closeModal");
|
||||
})
|
||||
.catch(popupAjaxError)
|
||||
@ -247,21 +247,21 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||
type: "POST"
|
||||
};
|
||||
|
||||
if (this.get("local")) {
|
||||
if (this.local) {
|
||||
options.processData = false;
|
||||
options.contentType = false;
|
||||
options.data = new FormData();
|
||||
options.data.append("theme", this.get("localFile"));
|
||||
options.data.append("theme", this.localFile);
|
||||
}
|
||||
|
||||
if (this.get("remote") || this.get("popular")) {
|
||||
if (this.remote || this.popular) {
|
||||
options.data = {
|
||||
remote: this.get("uploadUrl"),
|
||||
branch: this.get("branch")
|
||||
remote: this.uploadUrl,
|
||||
branch: this.branch
|
||||
};
|
||||
|
||||
if (this.get("privateChecked")) {
|
||||
options.data.private_key = this.get("privateKey");
|
||||
if (this.privateChecked) {
|
||||
options.data.private_key = this.privateKey;
|
||||
}
|
||||
}
|
||||
|
||||
@ -271,13 +271,13 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||
}
|
||||
|
||||
this.set("loading", true);
|
||||
ajax(this.get("importUrl"), options)
|
||||
ajax(this.importUrl, options)
|
||||
.then(result => {
|
||||
const theme = this.store.createRecord(
|
||||
this.get("recordType"),
|
||||
this.recordType,
|
||||
result.theme
|
||||
);
|
||||
this.get("adminCustomizeThemes").send("addTheme", theme);
|
||||
this.adminCustomizeThemes.send("addTheme", theme);
|
||||
this.send("closeModal");
|
||||
})
|
||||
.then(() => {
|
||||
|
@ -19,19 +19,19 @@ export default Ember.Controller.extend(PenaltyController, {
|
||||
|
||||
actions: {
|
||||
silence() {
|
||||
if (this.get("submitDisabled")) {
|
||||
if (this.submitDisabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.set("silencing", true);
|
||||
this.penalize(() => {
|
||||
return this.get("user").silence({
|
||||
silenced_till: this.get("silenceUntil"),
|
||||
reason: this.get("reason"),
|
||||
message: this.get("message"),
|
||||
post_id: this.get("postId"),
|
||||
post_action: this.get("postAction"),
|
||||
post_edit: this.get("postEdit")
|
||||
return this.user.silence({
|
||||
silenced_till: this.silenceUntil,
|
||||
reason: this.reason,
|
||||
message: this.message,
|
||||
post_id: this.postId,
|
||||
post_action: this.postAction,
|
||||
post_edit: this.postEdit
|
||||
});
|
||||
}).finally(() => this.set("silencing", false));
|
||||
}
|
||||
|
@ -19,20 +19,20 @@ export default Ember.Controller.extend(PenaltyController, {
|
||||
|
||||
actions: {
|
||||
suspend() {
|
||||
if (this.get("submitDisabled")) {
|
||||
if (this.submitDisabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.set("suspending", true);
|
||||
|
||||
this.penalize(() => {
|
||||
return this.get("user").suspend({
|
||||
suspend_until: this.get("suspendUntil"),
|
||||
reason: this.get("reason"),
|
||||
message: this.get("message"),
|
||||
post_id: this.get("postId"),
|
||||
post_action: this.get("postAction"),
|
||||
post_edit: this.get("postEdit")
|
||||
return this.user.suspend({
|
||||
suspend_until: this.suspendUntil,
|
||||
reason: this.reason,
|
||||
message: this.message,
|
||||
post_id: this.postId,
|
||||
post_action: this.postAction,
|
||||
post_edit: this.postEdit
|
||||
});
|
||||
}).finally(() => this.set("suspending", false));
|
||||
}
|
||||
|
@ -11,15 +11,15 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||
|
||||
actions: {
|
||||
uploadDone({ url }) {
|
||||
this.get("images").addObject(url);
|
||||
this.images.addObject(url);
|
||||
},
|
||||
|
||||
remove(url) {
|
||||
this.get("images").removeObject(url);
|
||||
this.images.removeObject(url);
|
||||
},
|
||||
|
||||
close() {
|
||||
this.save(this.get("images").join("\n"));
|
||||
this.save(this.images.join("\n"));
|
||||
this.send("closeModal");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user