mirror of
https://github.com/discourse/discourse.git
synced 2025-04-16 22:19:02 +08:00
DEV: global s/this.get\("(\w+)"\)/this.$1 (#7592)
This commit is contained in:
parent
170c66c190
commit
bfea922167
@ -10,7 +10,7 @@ export default Ember.Component.extend({
|
||||
|
||||
@observes("editorId")
|
||||
editorIdChanged() {
|
||||
if (this.get("autofocus")) {
|
||||
if (this.autofocus) {
|
||||
this.send("focus");
|
||||
}
|
||||
},
|
||||
@ -18,14 +18,14 @@ export default Ember.Component.extend({
|
||||
@observes("content")
|
||||
contentChanged() {
|
||||
if (this._editor && !this._skipContentChangeEvent) {
|
||||
this._editor.getSession().setValue(this.get("content"));
|
||||
this._editor.getSession().setValue(this.content);
|
||||
}
|
||||
},
|
||||
|
||||
@observes("mode")
|
||||
modeChanged() {
|
||||
if (this._editor && !this._skipContentChangeEvent) {
|
||||
this._editor.getSession().setMode("ace/mode/" + this.get("mode"));
|
||||
this._editor.getSession().setMode("ace/mode/" + this.mode);
|
||||
}
|
||||
},
|
||||
|
||||
@ -37,7 +37,7 @@ export default Ember.Component.extend({
|
||||
changeDisabledState() {
|
||||
const editor = this._editor;
|
||||
if (editor) {
|
||||
const disabled = this.get("disabled");
|
||||
const disabled = this.disabled;
|
||||
editor.setOptions({
|
||||
readOnly: disabled,
|
||||
highlightActiveLine: !disabled,
|
||||
@ -79,7 +79,7 @@ export default Ember.Component.extend({
|
||||
editor.setTheme("ace/theme/chrome");
|
||||
editor.setShowPrintMargin(false);
|
||||
editor.setOptions({ fontSize: "14px" });
|
||||
editor.getSession().setMode("ace/mode/" + this.get("mode"));
|
||||
editor.getSession().setMode("ace/mode/" + this.mode);
|
||||
editor.on("change", () => {
|
||||
this._skipContentChangeEvent = true;
|
||||
this.set("content", editor.getSession().getValue());
|
||||
@ -103,7 +103,7 @@ export default Ember.Component.extend({
|
||||
this.appEvents.on("ace:resize", this, "resize");
|
||||
}
|
||||
|
||||
if (this.get("autofocus")) {
|
||||
if (this.autofocus) {
|
||||
this.send("focus");
|
||||
}
|
||||
});
|
||||
|
@ -25,7 +25,7 @@ export default Ember.Component.extend(
|
||||
@on("init")
|
||||
@observes("logs.[]")
|
||||
_resetFormattedLogs() {
|
||||
if (this.get("logs").length === 0) {
|
||||
if (this.logs.length === 0) {
|
||||
this._reset(); // reset the cached logs whenever the model is reset
|
||||
this.rerenderBuffer();
|
||||
}
|
||||
@ -34,12 +34,12 @@ export default Ember.Component.extend(
|
||||
@on("init")
|
||||
@observes("logs.[]")
|
||||
_updateFormattedLogs: debounce(function() {
|
||||
const logs = this.get("logs");
|
||||
const logs = this.logs;
|
||||
if (logs.length === 0) return;
|
||||
|
||||
// do the log formatting only once for HELLish performance
|
||||
let formattedLogs = this.get("formattedLogs");
|
||||
for (let i = this.get("index"), length = logs.length; i < length; i++) {
|
||||
let formattedLogs = this.formattedLogs;
|
||||
for (let i = this.index, length = logs.length; i < length; i++) {
|
||||
const date = logs[i].get("timestamp"),
|
||||
message = escapeExpression(logs[i].get("message"));
|
||||
formattedLogs += "[" + date + "] " + message + "\n";
|
||||
@ -56,7 +56,7 @@ export default Ember.Component.extend(
|
||||
}, 150),
|
||||
|
||||
buildBuffer(buffer) {
|
||||
const formattedLogs = this.get("formattedLogs");
|
||||
const formattedLogs = this.formattedLogs;
|
||||
if (formattedLogs && formattedLogs.length > 0) {
|
||||
buffer.push("<pre>");
|
||||
buffer.push(formattedLogs);
|
||||
|
@ -8,27 +8,25 @@ export default Ember.Component.extend(
|
||||
rerenderTriggers: ["order", "ascending"],
|
||||
|
||||
buildBuffer(buffer) {
|
||||
const icon = this.get("icon");
|
||||
const icon = this.icon;
|
||||
|
||||
if (icon) {
|
||||
buffer.push(iconHTML(icon));
|
||||
}
|
||||
|
||||
buffer.push(I18n.t(this.get("i18nKey")));
|
||||
buffer.push(I18n.t(this.i18nKey));
|
||||
|
||||
if (this.get("field") === this.get("order")) {
|
||||
buffer.push(
|
||||
iconHTML(this.get("ascending") ? "chevron-up" : "chevron-down")
|
||||
);
|
||||
if (this.field === this.order) {
|
||||
buffer.push(iconHTML(this.ascending ? "chevron-up" : "chevron-down"));
|
||||
}
|
||||
},
|
||||
|
||||
click() {
|
||||
const currentOrder = this.get("order");
|
||||
const field = this.get("field");
|
||||
const currentOrder = this.order;
|
||||
const field = this.field;
|
||||
|
||||
if (currentOrder === field) {
|
||||
this.set("ascending", this.get("ascending") ? null : true);
|
||||
this.set("ascending", this.ascending ? null : true);
|
||||
} else {
|
||||
this.setProperties({ order: field, ascending: null });
|
||||
}
|
||||
|
@ -11,13 +11,13 @@ export default Ember.Component.extend({
|
||||
|
||||
actions: {
|
||||
edit() {
|
||||
this.set("buffer", this.get("value"));
|
||||
this.set("buffer", this.value);
|
||||
this.toggleProperty("editing");
|
||||
},
|
||||
|
||||
save() {
|
||||
// Action has to toggle 'editing' property.
|
||||
this.action(this.get("buffer"));
|
||||
this.action(this.buffer);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -6,7 +6,7 @@ export default Ember.Component.extend({
|
||||
|
||||
refreshChart() {
|
||||
const ctx = this.$()[0].getContext("2d");
|
||||
const model = this.get("model");
|
||||
const model = this.model;
|
||||
const rawData = this.get("model.data");
|
||||
|
||||
var data = {
|
||||
@ -16,7 +16,7 @@ export default Ember.Component.extend({
|
||||
data: rawData.map(r => r.y),
|
||||
label: model.get("title"),
|
||||
backgroundColor: `rgba(200,220,240,${
|
||||
this.get("type") === "bar" ? 1 : 0.3
|
||||
this.type === "bar" ? 1 : 0.3
|
||||
})`,
|
||||
borderColor: "#08C"
|
||||
}
|
||||
@ -24,7 +24,7 @@ export default Ember.Component.extend({
|
||||
};
|
||||
|
||||
const config = {
|
||||
type: this.get("type"),
|
||||
type: this.type,
|
||||
data: data,
|
||||
options: {
|
||||
responsive: true,
|
||||
|
@ -35,7 +35,7 @@ export default Ember.Component.extend({
|
||||
|
||||
_scheduleChartRendering() {
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
this._renderChart(this.get("model"), this.$(".chart-canvas"));
|
||||
this._renderChart(this.model, this.$(".chart-canvas"));
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -33,7 +33,7 @@ export default Ember.Component.extend({
|
||||
|
||||
_scheduleChartRendering() {
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
this._renderChart(this.get("model"), this.$(".chart-canvas"));
|
||||
this._renderChart(this.model, this.$(".chart-canvas"));
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -134,8 +134,8 @@ export default Ember.Component.extend({
|
||||
},
|
||||
|
||||
sortByLabel(label) {
|
||||
if (this.get("sortLabel") === label) {
|
||||
this.set("sortDirection", this.get("sortDirection") === 1 ? -1 : 1);
|
||||
if (this.sortLabel === label) {
|
||||
this.set("sortDirection", this.sortDirection === 1 ? -1 : 1);
|
||||
} else {
|
||||
this.set("sortLabel", label);
|
||||
}
|
||||
|
@ -74,13 +74,13 @@ export default Ember.Component.extend({
|
||||
didReceiveAttrs() {
|
||||
this._super(...arguments);
|
||||
|
||||
if (this.get("report")) {
|
||||
if (this.report) {
|
||||
this._renderReport(
|
||||
this.get("report"),
|
||||
this.get("forcedModes"),
|
||||
this.get("currentMode")
|
||||
this.report,
|
||||
this.forcedModes,
|
||||
this.currentMode
|
||||
);
|
||||
} else if (this.get("dataSourceName")) {
|
||||
} else if (this.dataSourceName) {
|
||||
this._fetchReport();
|
||||
}
|
||||
},
|
||||
@ -199,8 +199,8 @@ export default Ember.Component.extend({
|
||||
|
||||
this.attrs.onRefresh({
|
||||
type: this.get("model.type"),
|
||||
startDate: this.get("startDate"),
|
||||
endDate: this.get("endDate"),
|
||||
startDate: this.startDate,
|
||||
endDate: this.endDate,
|
||||
filters: customFilters
|
||||
});
|
||||
},
|
||||
@ -208,8 +208,8 @@ export default Ember.Component.extend({
|
||||
refreshReport() {
|
||||
this.attrs.onRefresh({
|
||||
type: this.get("model.type"),
|
||||
startDate: this.get("startDate"),
|
||||
endDate: this.get("endDate"),
|
||||
startDate: this.startDate,
|
||||
endDate: this.endDate,
|
||||
filters: this.get("filters.customFilters")
|
||||
});
|
||||
},
|
||||
@ -219,8 +219,8 @@ export default Ember.Component.extend({
|
||||
|
||||
exportEntity("report", {
|
||||
name: this.get("model.type"),
|
||||
start_date: this.get("startDate"),
|
||||
end_date: this.get("endDate"),
|
||||
start_date: this.startDate,
|
||||
end_date: this.endDate,
|
||||
category_id: customFilters.category,
|
||||
group_id: customFilters.group
|
||||
}).then(outputExportResult);
|
||||
@ -249,16 +249,16 @@ export default Ember.Component.extend({
|
||||
|
||||
const sort = r => {
|
||||
if (r.length > 1) {
|
||||
return r.findBy("type", this.get("dataSourceName"));
|
||||
return r.findBy("type", this.dataSourceName);
|
||||
} else {
|
||||
return r;
|
||||
}
|
||||
};
|
||||
|
||||
if (!this.get("startDate") || !this.get("endDate")) {
|
||||
if (!this.startDate || !this.endDate) {
|
||||
report = sort(filteredReports)[0];
|
||||
} else {
|
||||
const reportKey = this.get("reportKey");
|
||||
const reportKey = this.reportKey;
|
||||
|
||||
report = sort(
|
||||
filteredReports.filter(r => r.report_key.includes(reportKey))
|
||||
@ -273,8 +273,8 @@ export default Ember.Component.extend({
|
||||
|
||||
this._renderReport(
|
||||
report,
|
||||
this.get("forcedModes"),
|
||||
this.get("currentMode")
|
||||
this.forcedModes,
|
||||
this.currentMode
|
||||
);
|
||||
},
|
||||
|
||||
@ -317,22 +317,22 @@ export default Ember.Component.extend({
|
||||
}
|
||||
};
|
||||
|
||||
ReportLoader.enqueue(this.get("dataSourceName"), payload.data, callback);
|
||||
ReportLoader.enqueue(this.dataSourceName, payload.data, callback);
|
||||
});
|
||||
},
|
||||
|
||||
_buildPayload(facets) {
|
||||
let payload = { data: { cache: true, facets } };
|
||||
|
||||
if (this.get("startDate")) {
|
||||
if (this.startDate) {
|
||||
payload.data.start_date = moment
|
||||
.utc(this.get("startDate"), "YYYY-MM-DD")
|
||||
.utc(this.startDate, "YYYY-MM-DD")
|
||||
.toISOString();
|
||||
}
|
||||
|
||||
if (this.get("endDate")) {
|
||||
if (this.endDate) {
|
||||
payload.data.end_date = moment
|
||||
.utc(this.get("endDate"), "YYYY-MM-DD")
|
||||
.utc(this.endDate, "YYYY-MM-DD")
|
||||
.toISOString();
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ export default Ember.Component.extend({
|
||||
|
||||
@computed("currentTargetName", "fieldName", "theme.theme_fields.@each.error")
|
||||
error(target, fieldName) {
|
||||
return this.get("theme").getError(target, fieldName);
|
||||
return this.theme.getError(target, fieldName);
|
||||
},
|
||||
|
||||
actions: {
|
||||
@ -75,9 +75,9 @@ export default Ember.Component.extend({
|
||||
addField(name) {
|
||||
if (!name) return;
|
||||
name = name.replace(/[^a-zA-Z0-9-_/]/g, "");
|
||||
this.get("theme").setField(this.get("currentTargetName"), name, "");
|
||||
this.theme.setField(this.currentTargetName, name, "");
|
||||
this.setProperties({ newFieldName: "", addingField: false });
|
||||
this.fieldAdded(this.get("currentTargetName"), name);
|
||||
this.fieldAdded(this.currentTargetName, name);
|
||||
},
|
||||
|
||||
toggleMaximize: function() {
|
||||
|
@ -26,7 +26,7 @@ export default Ember.Component.extend(bufferedProperty("userField"), {
|
||||
@on("didInsertElement")
|
||||
@observes("editing")
|
||||
_focusOnEdit() {
|
||||
if (this.get("editing")) {
|
||||
if (this.editing) {
|
||||
Ember.run.scheduleOnce("afterRender", this, "_focusName");
|
||||
}
|
||||
},
|
||||
@ -66,7 +66,7 @@ export default Ember.Component.extend(bufferedProperty("userField"), {
|
||||
|
||||
actions: {
|
||||
save() {
|
||||
const buffered = this.get("buffered");
|
||||
const buffered = this.buffered;
|
||||
const attrs = buffered.getProperties(
|
||||
"name",
|
||||
"description",
|
||||
@ -78,7 +78,7 @@ export default Ember.Component.extend(bufferedProperty("userField"), {
|
||||
"options"
|
||||
);
|
||||
|
||||
this.get("userField")
|
||||
this.userField
|
||||
.save(attrs)
|
||||
.then(() => {
|
||||
this.set("editing", false);
|
||||
@ -94,7 +94,7 @@ export default Ember.Component.extend(bufferedProperty("userField"), {
|
||||
cancel() {
|
||||
const id = this.get("userField.id");
|
||||
if (Ember.isEmpty(id)) {
|
||||
this.destroyAction(this.get("userField"));
|
||||
this.destroyAction(this.userField);
|
||||
} else {
|
||||
this.rollbackBuffer();
|
||||
this.set("editing", false);
|
||||
|
@ -11,10 +11,10 @@ export default Ember.Component.extend(
|
||||
},
|
||||
|
||||
click() {
|
||||
this.get("word")
|
||||
this.word
|
||||
.destroy()
|
||||
.then(() => {
|
||||
this.action(this.get("word"));
|
||||
this.action(this.word);
|
||||
})
|
||||
.catch(e => {
|
||||
bootbox.alert(
|
||||
|
@ -25,8 +25,8 @@ export default Ember.Component.extend({
|
||||
return eventTypeExists;
|
||||
},
|
||||
set(value, eventTypeExists) {
|
||||
const type = this.get("type");
|
||||
const model = this.get("model");
|
||||
const type = this.type;
|
||||
const model = this.model;
|
||||
// add an association when not exists
|
||||
if (value !== eventTypeExists) {
|
||||
if (value) {
|
||||
|
@ -33,14 +33,14 @@ export default Ember.Component.extend({
|
||||
|
||||
@computed("expandDetails")
|
||||
expandRequestIcon(expandDetails) {
|
||||
return expandDetails === this.get("expandDetailsRequestKey")
|
||||
return expandDetails === this.expandDetailsRequestKey
|
||||
? "ellipsis-h"
|
||||
: "ellipsis-v";
|
||||
},
|
||||
|
||||
@computed("expandDetails")
|
||||
expandResponseIcon(expandDetails) {
|
||||
return expandDetails === this.get("expandDetailsResponseKey")
|
||||
return expandDetails === this.expandDetailsResponseKey
|
||||
? "ellipsis-h"
|
||||
: "ellipsis-v";
|
||||
},
|
||||
@ -69,9 +69,9 @@ export default Ember.Component.extend({
|
||||
},
|
||||
|
||||
toggleRequest() {
|
||||
const expandDetailsKey = this.get("expandDetailsRequestKey");
|
||||
const expandDetailsKey = this.expandDetailsRequestKey;
|
||||
|
||||
if (this.get("expandDetails") !== expandDetailsKey) {
|
||||
if (this.expandDetails !== expandDetailsKey) {
|
||||
let headers = _.extend(
|
||||
{
|
||||
"Request URL": this.get("model.request_url"),
|
||||
@ -91,9 +91,9 @@ export default Ember.Component.extend({
|
||||
},
|
||||
|
||||
toggleResponse() {
|
||||
const expandDetailsKey = this.get("expandDetailsResponseKey");
|
||||
const expandDetailsKey = this.expandDetailsResponseKey;
|
||||
|
||||
if (this.get("expandDetails") !== expandDetailsKey) {
|
||||
if (this.expandDetails !== expandDetailsKey) {
|
||||
this.setProperties({
|
||||
headers: plainJSON(this.get("model.response_headers")),
|
||||
body: this.get("model.response_body"),
|
||||
|
@ -23,7 +23,7 @@ export default Ember.Component.extend(
|
||||
},
|
||||
|
||||
buildBuffer(buffer) {
|
||||
buffer.push(iconHTML(this.get("icon"), { class: this.get("class") }));
|
||||
buffer.push(iconHTML(this.icon, { class: this.class }));
|
||||
buffer.push(
|
||||
I18n.t(`admin.web_hooks.delivery_status.${this.get("status.name")}`)
|
||||
);
|
||||
|
@ -10,21 +10,21 @@ import { default as loadScript, loadCSS } from "discourse/lib/load-script";
|
||||
export default Ember.Component.extend({
|
||||
classNames: ["color-picker"],
|
||||
hexValueChanged: function() {
|
||||
var hex = this.get("hexValue");
|
||||
var hex = this.hexValue;
|
||||
let $text = this.$("input.hex-input");
|
||||
|
||||
if (this.get("valid")) {
|
||||
if (this.valid) {
|
||||
$text.attr(
|
||||
"style",
|
||||
"color: " +
|
||||
(this.get("brightnessValue") > 125 ? "black" : "white") +
|
||||
(this.brightnessValue > 125 ? "black" : "white") +
|
||||
"; background-color: #" +
|
||||
hex +
|
||||
";"
|
||||
);
|
||||
|
||||
if (this.get("pickerLoaded")) {
|
||||
this.$(".picker").spectrum({ color: "#" + this.get("hexValue") });
|
||||
if (this.pickerLoaded) {
|
||||
this.$(".picker").spectrum({ color: "#" + this.hexValue });
|
||||
}
|
||||
} else {
|
||||
$text.attr("style", "");
|
||||
@ -36,7 +36,7 @@ export default Ember.Component.extend({
|
||||
loadCSS("/javascripts/spectrum.css").then(() => {
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
this.$(".picker")
|
||||
.spectrum({ color: "#" + this.get("hexValue") })
|
||||
.spectrum({ color: "#" + this.hexValue })
|
||||
.on("change.spectrum", (me, color) => {
|
||||
this.set("hexValue", color.toHexString().replace("#", ""));
|
||||
});
|
||||
|
@ -30,25 +30,25 @@ export default Ember.Component.extend(bufferedProperty("host"), {
|
||||
},
|
||||
|
||||
save() {
|
||||
if (this.get("cantSave")) {
|
||||
if (this.cantSave) {
|
||||
return;
|
||||
}
|
||||
|
||||
const props = this.get("buffered").getProperties(
|
||||
const props = this.buffered.getProperties(
|
||||
"host",
|
||||
"path_whitelist",
|
||||
"class_name"
|
||||
);
|
||||
props.category_id = this.get("categoryId");
|
||||
props.category_id = this.categoryId;
|
||||
|
||||
const host = this.get("host");
|
||||
const host = this.host;
|
||||
|
||||
host
|
||||
.save(props)
|
||||
.then(() => {
|
||||
host.set(
|
||||
"category",
|
||||
Discourse.Category.findById(this.get("categoryId"))
|
||||
Discourse.Category.findById(this.categoryId)
|
||||
);
|
||||
this.set("editToggled", false);
|
||||
})
|
||||
@ -58,17 +58,17 @@ export default Ember.Component.extend(bufferedProperty("host"), {
|
||||
delete() {
|
||||
bootbox.confirm(I18n.t("admin.embedding.confirm_delete"), result => {
|
||||
if (result) {
|
||||
this.get("host")
|
||||
this.host
|
||||
.destroyRecord()
|
||||
.then(() => {
|
||||
this.deleteHost(this.get("host"));
|
||||
this.deleteHost(this.host);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
cancel() {
|
||||
const host = this.get("host");
|
||||
const host = this.host;
|
||||
if (host.get("isNew")) {
|
||||
this.deleteHost(host);
|
||||
} else {
|
||||
|
@ -12,12 +12,12 @@ export default Ember.Component.extend({
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
|
||||
this.set("checkedInternal", this.get("checked"));
|
||||
this.set("checkedInternal", this.checked);
|
||||
},
|
||||
|
||||
@observes("checked")
|
||||
checkedChanged() {
|
||||
this.set("checkedInternal", this.get("checked"));
|
||||
this.set("checkedInternal", this.checked);
|
||||
},
|
||||
|
||||
@computed("labelKey")
|
||||
@ -32,11 +32,11 @@ export default Ember.Component.extend({
|
||||
|
||||
actions: {
|
||||
cancelled() {
|
||||
this.set("checkedInternal", this.get("checked"));
|
||||
this.set("checkedInternal", this.checked);
|
||||
},
|
||||
|
||||
finished() {
|
||||
this.set("checked", this.get("checkedInternal"));
|
||||
this.set("checked", this.checkedInternal);
|
||||
this.action();
|
||||
}
|
||||
}
|
||||
|
@ -18,18 +18,18 @@ export default Ember.Component.extend({
|
||||
lookup() {
|
||||
this.set("show", true);
|
||||
|
||||
if (!this.get("location")) {
|
||||
ajax("/admin/users/ip-info", { data: { ip: this.get("ip") } }).then(
|
||||
if (!this.location) {
|
||||
ajax("/admin/users/ip-info", { data: { ip: this.ip } }).then(
|
||||
location => this.set("location", Ember.Object.create(location))
|
||||
);
|
||||
}
|
||||
|
||||
if (!this.get("other_accounts")) {
|
||||
if (!this.other_accounts) {
|
||||
this.set("otherAccountsLoading", true);
|
||||
|
||||
const data = {
|
||||
ip: this.get("ip"),
|
||||
exclude: this.get("userId"),
|
||||
ip: this.ip,
|
||||
exclude: this.userId,
|
||||
order: "trust_level DESC"
|
||||
};
|
||||
|
||||
@ -51,8 +51,8 @@ export default Ember.Component.extend({
|
||||
},
|
||||
|
||||
copy() {
|
||||
let text = `IP: ${this.get("ip")}\n`;
|
||||
const location = this.get("location");
|
||||
let text = `IP: ${this.ip}\n`;
|
||||
const location = this.location;
|
||||
if (location) {
|
||||
if (location.hostname) {
|
||||
text += `${I18n.t("ip_lookup.hostname")}: ${location.hostname}\n`;
|
||||
@ -97,8 +97,8 @@ export default Ember.Component.extend({
|
||||
ajax("/admin/users/delete-others-with-same-ip.json", {
|
||||
type: "DELETE",
|
||||
data: {
|
||||
ip: this.get("ip"),
|
||||
exclude: this.get("userId"),
|
||||
ip: this.ip,
|
||||
exclude: this.userId,
|
||||
order: "trust_level DESC"
|
||||
}
|
||||
}).then(() => this.send("lookup"));
|
||||
|
@ -17,7 +17,7 @@ export default Ember.Component.extend({
|
||||
|
||||
actions: {
|
||||
penaltyChanged() {
|
||||
let postAction = this.get("postAction");
|
||||
let postAction = this.postAction;
|
||||
|
||||
// If we switch to edit mode, jump to the edit textarea
|
||||
if (postAction === "edit") {
|
||||
|
@ -24,13 +24,13 @@ export default Ember.Component.extend({
|
||||
|
||||
actions: {
|
||||
submit() {
|
||||
if (!this.get("formSubmitted")) {
|
||||
if (!this.formSubmitted) {
|
||||
this.set("formSubmitted", true);
|
||||
|
||||
Permalink.create({
|
||||
url: this.get("url"),
|
||||
permalink_type: this.get("permalinkType"),
|
||||
permalink_type_value: this.get("permalink_type_value")
|
||||
url: this.url,
|
||||
permalink_type: this.permalinkType,
|
||||
permalink_type_value: this.permalink_type_value
|
||||
})
|
||||
.save()
|
||||
.then(
|
||||
|
@ -31,7 +31,7 @@ export default Ember.Component.extend(
|
||||
@on("init")
|
||||
_initialize() {
|
||||
this.resumable = new Resumable({
|
||||
target: Discourse.getURL(this.get("target")),
|
||||
target: Discourse.getURL(this.target),
|
||||
maxFiles: 1, // only 1 file at a time
|
||||
headers: {
|
||||
"X-CSRF-Token": document.querySelector("meta[name='csrf-token']")
|
||||
@ -100,23 +100,23 @@ export default Ember.Component.extend(
|
||||
if (isUploading) {
|
||||
return progress + " %";
|
||||
} else {
|
||||
return this.get("uploadText");
|
||||
return this.uploadText;
|
||||
}
|
||||
},
|
||||
|
||||
buildBuffer(buffer) {
|
||||
const icon = this.get("isUploading") ? "times" : "upload";
|
||||
const icon = this.isUploading ? "times" : "upload";
|
||||
buffer.push(iconHTML(icon));
|
||||
buffer.push("<span class='ru-label'>" + this.get("text") + "</span>");
|
||||
buffer.push("<span class='ru-label'>" + this.text + "</span>");
|
||||
buffer.push(
|
||||
"<span class='ru-progress' style='width:" +
|
||||
this.get("progress") +
|
||||
this.progress +
|
||||
"%'></span>"
|
||||
);
|
||||
},
|
||||
|
||||
click() {
|
||||
if (this.get("isUploading")) {
|
||||
if (this.isUploading) {
|
||||
this.resumable.cancel();
|
||||
Ember.run.later(() => this._reset());
|
||||
return false;
|
||||
|
@ -50,11 +50,11 @@ export default Ember.Component.extend({
|
||||
|
||||
actions: {
|
||||
submit() {
|
||||
if (!this.get("formSubmitted")) {
|
||||
if (!this.formSubmitted) {
|
||||
this.set("formSubmitted", true);
|
||||
const screenedIpAddress = ScreenedIpAddress.create({
|
||||
ip_address: this.get("ip_address"),
|
||||
action_name: this.get("actionName")
|
||||
ip_address: this.ip_address,
|
||||
action_name: this.actionName
|
||||
});
|
||||
screenedIpAddress
|
||||
.save()
|
||||
|
@ -9,11 +9,11 @@ export default Ember.Component.extend({
|
||||
|
||||
@on("didReceiveAttrs")
|
||||
_setupCollection() {
|
||||
const values = this.get("values");
|
||||
const values = this.values;
|
||||
|
||||
this.set(
|
||||
"collection",
|
||||
this._splitValues(values, this.get("inputDelimiter") || "\n")
|
||||
this._splitValues(values, this.inputDelimiter || "\n")
|
||||
);
|
||||
},
|
||||
|
||||
@ -29,9 +29,9 @@ export default Ember.Component.extend({
|
||||
},
|
||||
|
||||
addValue() {
|
||||
if (this._checkInvalidInput([this.get("newKey"), this.get("newSecret")]))
|
||||
if (this._checkInvalidInput([this.newKey, this.newSecret]))
|
||||
return;
|
||||
this._addValue(this.get("newKey"), this.get("newSecret"));
|
||||
this._addValue(this.newKey, this.newSecret);
|
||||
this.setProperties({ newKey: "", newSecret: "" });
|
||||
},
|
||||
|
||||
@ -54,18 +54,18 @@ export default Ember.Component.extend({
|
||||
},
|
||||
|
||||
_addValue(value, secret) {
|
||||
this.get("collection").addObject({ key: value, secret: secret });
|
||||
this.collection.addObject({ key: value, secret: secret });
|
||||
this._saveValues();
|
||||
},
|
||||
|
||||
_removeValue(value) {
|
||||
const collection = this.get("collection");
|
||||
const collection = this.collection;
|
||||
collection.removeObject(value);
|
||||
this._saveValues();
|
||||
},
|
||||
|
||||
_replaceValue(index, newValue, keyName) {
|
||||
let item = this.get("collection")[index];
|
||||
let item = this.collection[index];
|
||||
Ember.set(item, keyName, newValue);
|
||||
|
||||
this._saveValues();
|
||||
@ -74,7 +74,7 @@ export default Ember.Component.extend({
|
||||
_saveValues() {
|
||||
this.set(
|
||||
"values",
|
||||
this.get("collection")
|
||||
this.collection
|
||||
.map(function(elem) {
|
||||
return `${elem.key}|${elem.secret}`;
|
||||
})
|
||||
|
@ -4,7 +4,7 @@ import SettingComponent from "admin/mixins/setting-component";
|
||||
|
||||
export default Ember.Component.extend(BufferedContent, SettingComponent, {
|
||||
_save() {
|
||||
const setting = this.get("buffered");
|
||||
const setting = this.buffered;
|
||||
return SiteSetting.update(setting.get("setting"), setting.get("value"));
|
||||
}
|
||||
});
|
||||
|
@ -17,18 +17,18 @@ export default Ember.Component.extend({
|
||||
},
|
||||
|
||||
click() {
|
||||
this.editAction(this.get("siteText"));
|
||||
this.editAction(this.siteText);
|
||||
},
|
||||
|
||||
_searchTerm() {
|
||||
const regex = this.get("searchRegex");
|
||||
const siteText = this.get("siteText");
|
||||
const regex = this.searchRegex;
|
||||
const siteText = this.siteText;
|
||||
|
||||
if (regex && siteText) {
|
||||
const matches = siteText.value.match(new RegExp(regex, "i"));
|
||||
if (matches) return matches[0];
|
||||
}
|
||||
|
||||
return this.get("term");
|
||||
return this.term;
|
||||
}
|
||||
});
|
||||
|
@ -4,7 +4,7 @@ import SettingComponent from "admin/mixins/setting-component";
|
||||
export default Ember.Component.extend(BufferedContent, SettingComponent, {
|
||||
layoutName: "admin/templates/components/site-setting",
|
||||
_save() {
|
||||
return this.get("model").saveSettings(
|
||||
return this.model.saveSettings(
|
||||
this.get("setting.setting"),
|
||||
this.get("buffered.value")
|
||||
);
|
||||
|
@ -8,7 +8,7 @@ export default Ember.Component.extend(BufferedContent, SettingComponent, {
|
||||
settingName: Ember.computed.alias("translation.key"),
|
||||
|
||||
_save() {
|
||||
return this.get("model").saveTranslation(
|
||||
return this.model.saveTranslation(
|
||||
this.get("translation.key"),
|
||||
this.get("buffered.value")
|
||||
);
|
||||
|
@ -56,12 +56,12 @@ export default Ember.Component.extend({
|
||||
"childrenExpanded"
|
||||
)
|
||||
children() {
|
||||
const theme = this.get("theme");
|
||||
const theme = this.theme;
|
||||
let children = theme.get("childThemes");
|
||||
if (theme.get("component") || !children) {
|
||||
return [];
|
||||
}
|
||||
children = this.get("childrenExpanded")
|
||||
children = this.childrenExpanded
|
||||
? children
|
||||
: children.slice(0, MAX_COMPONENTS);
|
||||
return children.map(t => t.get("name"));
|
||||
|
@ -16,7 +16,7 @@ export default Ember.Component.extend({
|
||||
|
||||
@computed("themes", "components", "currentTab")
|
||||
themesList(themes, components) {
|
||||
if (this.get("themesTabActive")) {
|
||||
if (this.themesTabActive) {
|
||||
return themes;
|
||||
} else {
|
||||
return components;
|
||||
@ -30,7 +30,7 @@ export default Ember.Component.extend({
|
||||
"themesList.@each.default"
|
||||
)
|
||||
inactiveThemes(themes) {
|
||||
if (this.get("componentsTabActive")) {
|
||||
if (this.componentsTabActive) {
|
||||
return themes.filter(theme => theme.get("parent_themes.length") <= 0);
|
||||
}
|
||||
return themes.filter(
|
||||
@ -45,7 +45,7 @@ export default Ember.Component.extend({
|
||||
"themesList.@each.default"
|
||||
)
|
||||
activeThemes(themes) {
|
||||
if (this.get("componentsTabActive")) {
|
||||
if (this.componentsTabActive) {
|
||||
return themes.filter(theme => theme.get("parent_themes.length") > 0);
|
||||
} else {
|
||||
themes = themes.filter(
|
||||
@ -63,7 +63,7 @@ export default Ember.Component.extend({
|
||||
|
||||
actions: {
|
||||
changeView(newTab) {
|
||||
if (newTab !== this.get("currentTab")) {
|
||||
if (newTab !== this.currentTab) {
|
||||
this.set("currentTab", newTab);
|
||||
}
|
||||
},
|
||||
|
@ -15,15 +15,15 @@ export default Ember.Component.extend({
|
||||
|
||||
@on("didReceiveAttrs")
|
||||
_setupCollection() {
|
||||
const values = this.get("values");
|
||||
if (this.get("inputType") === "array") {
|
||||
const values = this.values;
|
||||
if (this.inputType === "array") {
|
||||
this.set("collection", values || []);
|
||||
return;
|
||||
}
|
||||
|
||||
this.set(
|
||||
"collection",
|
||||
this._splitValues(values, this.get("inputDelimiter") || "\n")
|
||||
this._splitValues(values, this.inputDelimiter || "\n")
|
||||
);
|
||||
},
|
||||
|
||||
@ -33,7 +33,7 @@ export default Ember.Component.extend({
|
||||
},
|
||||
|
||||
keyDown(event) {
|
||||
if (event.keyCode === 13) this.send("addValue", this.get("newValue"));
|
||||
if (event.keyCode === 13) this.send("addValue", this.newValue);
|
||||
},
|
||||
|
||||
actions: {
|
||||
@ -42,7 +42,7 @@ export default Ember.Component.extend({
|
||||
},
|
||||
|
||||
addValue(newValue) {
|
||||
if (this.get("inputInvalid")) return;
|
||||
if (this.inputInvalid) return;
|
||||
|
||||
this.set("newValue", "");
|
||||
this._addValue(newValue);
|
||||
@ -58,30 +58,30 @@ export default Ember.Component.extend({
|
||||
},
|
||||
|
||||
_addValue(value) {
|
||||
this.get("collection").addObject(value);
|
||||
this.collection.addObject(value);
|
||||
this._saveValues();
|
||||
},
|
||||
|
||||
_removeValue(value) {
|
||||
const collection = this.get("collection");
|
||||
const collection = this.collection;
|
||||
collection.removeObject(value);
|
||||
this._saveValues();
|
||||
},
|
||||
|
||||
_replaceValue(index, newValue) {
|
||||
this.get("collection").replace(index, 1, [newValue]);
|
||||
this.collection.replace(index, 1, [newValue]);
|
||||
this._saveValues();
|
||||
},
|
||||
|
||||
_saveValues() {
|
||||
if (this.get("inputType") === "array") {
|
||||
this.set("values", this.get("collection"));
|
||||
if (this.inputType === "array") {
|
||||
this.set("values", this.collection);
|
||||
return;
|
||||
}
|
||||
|
||||
this.set(
|
||||
"values",
|
||||
this.get("collection").join(this.get("inputDelimiter") || "\n")
|
||||
this.collection.join(this.inputDelimiter || "\n")
|
||||
);
|
||||
},
|
||||
|
||||
|
@ -21,16 +21,16 @@ export default Ember.Component.extend({
|
||||
|
||||
@observes("word")
|
||||
removeMessage() {
|
||||
if (this.get("showMessage") && !Ember.isEmpty(this.get("word"))) {
|
||||
if (this.showMessage && !Ember.isEmpty(this.word)) {
|
||||
this.set("showMessage", false);
|
||||
}
|
||||
},
|
||||
|
||||
@computed("word")
|
||||
isUniqueWord(word) {
|
||||
const words = this.get("filteredContent") || [];
|
||||
const words = this.filteredContent || [];
|
||||
const filtered = words.filter(
|
||||
content => content.action === this.get("actionKey")
|
||||
content => content.action === this.actionKey
|
||||
);
|
||||
return filtered.every(
|
||||
content => content.word.toLowerCase() !== word.toLowerCase()
|
||||
@ -39,7 +39,7 @@ export default Ember.Component.extend({
|
||||
|
||||
actions: {
|
||||
submit() {
|
||||
if (!this.get("isUniqueWord")) {
|
||||
if (!this.isUniqueWord) {
|
||||
this.setProperties({
|
||||
showMessage: true,
|
||||
message: I18n.t("admin.watched_words.form.exists")
|
||||
@ -47,12 +47,12 @@ export default Ember.Component.extend({
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.get("formSubmitted")) {
|
||||
if (!this.formSubmitted) {
|
||||
this.set("formSubmitted", true);
|
||||
|
||||
const watchedWord = WatchedWord.create({
|
||||
word: this.get("word"),
|
||||
action: this.get("actionKey")
|
||||
word: this.word,
|
||||
action: this.actionKey
|
||||
});
|
||||
|
||||
watchedWord
|
||||
|
@ -9,7 +9,7 @@ export default Ember.Controller.extend({
|
||||
|
||||
actions: {
|
||||
generateMasterKey() {
|
||||
ApiKey.generateMasterKey().then(key => this.get("model").pushObject(key));
|
||||
ApiKey.generateMasterKey().then(key => this.model.pushObject(key));
|
||||
},
|
||||
|
||||
regenerateKey(key) {
|
||||
@ -32,7 +32,7 @@ export default Ember.Controller.extend({
|
||||
I18n.t("yes_value"),
|
||||
result => {
|
||||
if (result) {
|
||||
key.revoke().then(() => this.get("model").removeObject(key));
|
||||
key.revoke().then(() => this.model.removeObject(key));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -33,7 +33,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
|
||||
|
||||
actions: {
|
||||
save() {
|
||||
if (!this.get("saving")) {
|
||||
if (!this.saving) {
|
||||
let fields = [
|
||||
"allow_title",
|
||||
"multiple_grant",
|
||||
@ -54,7 +54,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
|
||||
];
|
||||
|
||||
if (this.get("buffered.system")) {
|
||||
var protectedFields = this.get("protectedSystemFields") || [];
|
||||
var protectedFields = this.protectedSystemFields || [];
|
||||
fields = _.filter(fields, f => !protectedFields.includes(f));
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
|
||||
];
|
||||
|
||||
const data = {};
|
||||
const buffered = this.get("buffered");
|
||||
const buffered = this.buffered;
|
||||
fields.forEach(function(field) {
|
||||
var d = buffered.get(field);
|
||||
if (boolFields.includes(field)) {
|
||||
@ -81,9 +81,9 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
|
||||
data[field] = d;
|
||||
});
|
||||
|
||||
const newBadge = !this.get("id");
|
||||
const model = this.get("model");
|
||||
this.get("model")
|
||||
const newBadge = !this.id;
|
||||
const model = this.model;
|
||||
this.model
|
||||
.save(data)
|
||||
.then(() => {
|
||||
if (newBadge) {
|
||||
@ -107,7 +107,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
|
||||
|
||||
destroy() {
|
||||
const adminBadges = this.get("adminBadges.model");
|
||||
const model = this.get("model");
|
||||
const model = this.model;
|
||||
|
||||
if (!model.get("id")) {
|
||||
this.transitionToRoute("adminBadges.index");
|
||||
|
@ -23,7 +23,7 @@ export default Ember.Controller.extend({
|
||||
$(".table.colors").hide();
|
||||
let area = $("<textarea id='copy-range'></textarea>");
|
||||
$(".table.colors").after(area);
|
||||
area.text(this.get("model").schemeJson());
|
||||
area.text(this.model.schemeJson());
|
||||
let range = document.createRange();
|
||||
range.selectNode(area[0]);
|
||||
window.getSelection().addRange(range);
|
||||
@ -51,7 +51,7 @@ export default Ember.Controller.extend({
|
||||
},
|
||||
|
||||
copy() {
|
||||
var newColorScheme = Ember.copy(this.get("model"), true);
|
||||
var newColorScheme = Ember.copy(this.model, true);
|
||||
newColorScheme.set(
|
||||
"name",
|
||||
I18n.t("admin.customize.colors.copy_name_prefix") +
|
||||
@ -59,17 +59,17 @@ export default Ember.Controller.extend({
|
||||
this.get("model.name")
|
||||
);
|
||||
newColorScheme.save().then(() => {
|
||||
this.get("allColors").pushObject(newColorScheme);
|
||||
this.allColors.pushObject(newColorScheme);
|
||||
this.replaceRoute("adminCustomize.colors.show", newColorScheme);
|
||||
});
|
||||
},
|
||||
|
||||
save: function() {
|
||||
this.get("model").save();
|
||||
this.model.save();
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
const model = this.get("model");
|
||||
const model = this.model;
|
||||
return bootbox.confirm(
|
||||
I18n.t("admin.customize.colors.delete_confirm"),
|
||||
I18n.t("no_value"),
|
||||
@ -77,7 +77,7 @@ export default Ember.Controller.extend({
|
||||
result => {
|
||||
if (result) {
|
||||
model.destroy().then(() => {
|
||||
this.get("allColors").removeObject(model);
|
||||
this.allColors.removeObject(model);
|
||||
this.replaceRoute("adminCustomize.colors");
|
||||
});
|
||||
}
|
||||
|
@ -4,12 +4,12 @@ import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
export default Ember.Controller.extend({
|
||||
@computed("model.@each.id")
|
||||
baseColorScheme() {
|
||||
return this.get("model").findBy("is_base", true);
|
||||
return this.model.findBy("is_base", true);
|
||||
},
|
||||
|
||||
@computed("model.@each.id")
|
||||
baseColorSchemes() {
|
||||
return this.get("model").filterBy("is_base", true);
|
||||
return this.model.filterBy("is_base", true);
|
||||
},
|
||||
|
||||
@computed("baseColorScheme")
|
||||
@ -23,7 +23,7 @@ export default Ember.Controller.extend({
|
||||
|
||||
actions: {
|
||||
newColorSchemeWithBase(baseKey) {
|
||||
const base = this.get("baseColorSchemes").findBy(
|
||||
const base = this.baseColorSchemes.findBy(
|
||||
"base_scheme_id",
|
||||
baseKey
|
||||
);
|
||||
@ -33,7 +33,7 @@ export default Ember.Controller.extend({
|
||||
base_scheme_id: base.get("base_scheme_id")
|
||||
});
|
||||
newColorScheme.save().then(() => {
|
||||
this.get("model").pushObject(newColorScheme);
|
||||
this.model.pushObject(newColorScheme);
|
||||
newColorScheme.set("savingStatus", null);
|
||||
this.replaceRoute("adminCustomize.colors.show", newColorScheme);
|
||||
});
|
||||
@ -41,7 +41,7 @@ export default Ember.Controller.extend({
|
||||
|
||||
newColorScheme() {
|
||||
showModal("admin-color-scheme-select-base", {
|
||||
model: this.get("baseColorSchemes"),
|
||||
model: this.baseColorSchemes,
|
||||
admin: true
|
||||
});
|
||||
}
|
||||
|
@ -17,8 +17,8 @@ export default Ember.Controller.extend(bufferedProperty("emailTemplate"), {
|
||||
actions: {
|
||||
saveChanges() {
|
||||
this.set("saved", false);
|
||||
const buffered = this.get("buffered");
|
||||
this.get("emailTemplate")
|
||||
const buffered = this.buffered;
|
||||
this.emailTemplate
|
||||
.save(buffered.getProperties("subject", "body"))
|
||||
.then(() => {
|
||||
this.set("saved", true);
|
||||
@ -32,10 +32,10 @@ export default Ember.Controller.extend(bufferedProperty("emailTemplate"), {
|
||||
I18n.t("admin.customize.email_templates.revert_confirm"),
|
||||
result => {
|
||||
if (result) {
|
||||
this.get("emailTemplate")
|
||||
this.emailTemplate
|
||||
.revert()
|
||||
.then(props => {
|
||||
const buffered = this.get("buffered");
|
||||
const buffered = this.buffered;
|
||||
buffered.setProperties(props);
|
||||
this.commitBuffer();
|
||||
})
|
||||
|
@ -36,7 +36,7 @@ export default Ember.Controller.extend({
|
||||
actions: {
|
||||
save() {
|
||||
this.set("saving", true);
|
||||
this.get("model")
|
||||
this.model
|
||||
.saveChanges("theme_fields")
|
||||
.finally(() => {
|
||||
this.set("saving", false);
|
||||
@ -45,7 +45,7 @@ export default Ember.Controller.extend({
|
||||
|
||||
fieldAdded(target, name) {
|
||||
this.replaceRoute(
|
||||
this.get("editRouteName"),
|
||||
this.editRouteName,
|
||||
this.get("model.id"),
|
||||
target,
|
||||
name
|
||||
@ -55,9 +55,9 @@ export default Ember.Controller.extend({
|
||||
onlyOverriddenChanged(onlyShowOverridden) {
|
||||
if (onlyShowOverridden) {
|
||||
if (
|
||||
!this.get("model").hasEdited(
|
||||
this.get("currentTargetName"),
|
||||
this.get("fieldName")
|
||||
!this.model.hasEdited(
|
||||
this.currentTargetName,
|
||||
this.fieldName
|
||||
)
|
||||
) {
|
||||
let firstTarget = this.get("model.targets").find(t => t.edited);
|
||||
@ -66,7 +66,7 @@ export default Ember.Controller.extend({
|
||||
);
|
||||
|
||||
this.replaceRoute(
|
||||
this.get("editRouteName"),
|
||||
this.editRouteName,
|
||||
this.get("model.id"),
|
||||
firstTarget.name,
|
||||
firstField.name
|
||||
|
@ -100,7 +100,7 @@ export default Ember.Controller.extend({
|
||||
},
|
||||
|
||||
commitSwitchType() {
|
||||
const model = this.get("model");
|
||||
const model = this.model;
|
||||
const newValue = !model.get("component");
|
||||
model.set("component", newValue);
|
||||
|
||||
@ -141,7 +141,7 @@ export default Ember.Controller.extend({
|
||||
},
|
||||
transitionToEditRoute() {
|
||||
this.transitionToRoute(
|
||||
this.get("editRouteName"),
|
||||
this.editRouteName,
|
||||
this.get("model.id"),
|
||||
"common",
|
||||
"scss"
|
||||
@ -154,7 +154,7 @@ export default Ember.Controller.extend({
|
||||
actions: {
|
||||
updateToLatest() {
|
||||
this.set("updatingRemote", true);
|
||||
this.get("model")
|
||||
this.model
|
||||
.updateToLatest()
|
||||
.catch(popupAjaxError)
|
||||
.finally(() => {
|
||||
@ -164,7 +164,7 @@ export default Ember.Controller.extend({
|
||||
|
||||
checkForThemeUpdates() {
|
||||
this.set("updatingRemote", true);
|
||||
this.get("model")
|
||||
this.model
|
||||
.checkForUpdates()
|
||||
.catch(popupAjaxError)
|
||||
.finally(() => {
|
||||
@ -177,7 +177,7 @@ export default Ember.Controller.extend({
|
||||
},
|
||||
|
||||
addUpload(info) {
|
||||
let model = this.get("model");
|
||||
let model = this.model;
|
||||
model.setField("common", info.name, "", info.upload_id, THEME_UPLOAD_VAR);
|
||||
model.saveChanges("theme_fields").catch(e => popupAjaxError(e));
|
||||
},
|
||||
@ -186,23 +186,23 @@ export default Ember.Controller.extend({
|
||||
this.set("colorSchemeId", this.get("model.color_scheme_id"));
|
||||
},
|
||||
changeScheme() {
|
||||
let schemeId = this.get("colorSchemeId");
|
||||
let schemeId = this.colorSchemeId;
|
||||
this.set(
|
||||
"model.color_scheme_id",
|
||||
schemeId === null ? null : parseInt(schemeId)
|
||||
);
|
||||
this.get("model").saveChanges("color_scheme_id");
|
||||
this.model.saveChanges("color_scheme_id");
|
||||
},
|
||||
startEditingName() {
|
||||
this.set("oldName", this.get("model.name"));
|
||||
this.set("editingName", true);
|
||||
},
|
||||
cancelEditingName() {
|
||||
this.set("model.name", this.get("oldName"));
|
||||
this.set("model.name", this.oldName);
|
||||
this.set("editingName", false);
|
||||
},
|
||||
finishedEditingName() {
|
||||
this.get("model").saveChanges("name");
|
||||
this.model.saveChanges("name");
|
||||
this.set("editingName", false);
|
||||
},
|
||||
|
||||
@ -222,10 +222,10 @@ export default Ember.Controller.extend({
|
||||
},
|
||||
|
||||
applyDefault() {
|
||||
const model = this.get("model");
|
||||
const model = this.model;
|
||||
model.saveChanges("default").then(() => {
|
||||
if (model.get("default")) {
|
||||
this.get("allThemes").forEach(theme => {
|
||||
this.allThemes.forEach(theme => {
|
||||
if (theme !== model && theme.get("default")) {
|
||||
theme.set("default", false);
|
||||
}
|
||||
@ -235,13 +235,13 @@ export default Ember.Controller.extend({
|
||||
},
|
||||
|
||||
applyUserSelectable() {
|
||||
this.get("model").saveChanges("user_selectable");
|
||||
this.model.saveChanges("user_selectable");
|
||||
},
|
||||
|
||||
addChildTheme() {
|
||||
let themeId = parseInt(this.get("selectedChildThemeId"));
|
||||
let theme = this.get("allThemes").findBy("id", themeId);
|
||||
this.get("model").addChildTheme(theme);
|
||||
let themeId = parseInt(this.selectedChildThemeId);
|
||||
let theme = this.allThemes.findBy("id", themeId);
|
||||
this.model.addChildTheme(theme);
|
||||
},
|
||||
|
||||
removeUpload(upload) {
|
||||
@ -251,14 +251,14 @@ export default Ember.Controller.extend({
|
||||
I18n.t("yes_value"),
|
||||
result => {
|
||||
if (result) {
|
||||
this.get("model").removeField(upload);
|
||||
this.model.removeField(upload);
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
removeChildTheme(theme) {
|
||||
this.get("model").removeChildTheme(theme);
|
||||
this.model.removeChildTheme(theme);
|
||||
},
|
||||
|
||||
destroy() {
|
||||
@ -270,9 +270,9 @@ export default Ember.Controller.extend({
|
||||
I18n.t("yes_value"),
|
||||
result => {
|
||||
if (result) {
|
||||
const model = this.get("model");
|
||||
const model = this.model;
|
||||
model.destroyRecord().then(() => {
|
||||
this.get("allThemes").removeObject(model);
|
||||
this.allThemes.removeObject(model);
|
||||
this.transitionToRoute("adminCustomizeThemes");
|
||||
});
|
||||
}
|
||||
@ -282,12 +282,12 @@ export default Ember.Controller.extend({
|
||||
|
||||
switchType() {
|
||||
const relatives = this.get("model.component")
|
||||
? this.get("parentThemes")
|
||||
? this.parentThemes
|
||||
: this.get("model.childThemes");
|
||||
if (relatives && relatives.length > 0) {
|
||||
const names = relatives.map(relative => relative.get("name"));
|
||||
bootbox.confirm(
|
||||
I18n.t(`${this.get("convertKey")}_alert`, {
|
||||
I18n.t(`${this.convertKey}_alert`, {
|
||||
relatives: names.join(", ")
|
||||
}),
|
||||
I18n.t("no_value"),
|
||||
|
@ -6,7 +6,7 @@ import PeriodComputationMixin from "admin/mixins/period-computation";
|
||||
|
||||
function staticReport(reportType) {
|
||||
return function() {
|
||||
return Ember.makeArray(this.get("reports")).find(
|
||||
return Ember.makeArray(this.reports).find(
|
||||
report => report.type === reportType
|
||||
);
|
||||
}.property("reports.[]");
|
||||
@ -27,8 +27,8 @@ export default Ember.Controller.extend(PeriodComputationMixin, {
|
||||
@computed
|
||||
activityMetricsFilters() {
|
||||
return {
|
||||
startDate: this.get("lastMonth"),
|
||||
endDate: this.get("today")
|
||||
startDate: this.lastMonth,
|
||||
endDate: this.today
|
||||
};
|
||||
},
|
||||
|
||||
@ -45,7 +45,7 @@ export default Ember.Controller.extend(PeriodComputationMixin, {
|
||||
startDate: moment()
|
||||
.subtract(6, "days")
|
||||
.startOf("day"),
|
||||
endDate: this.get("today")
|
||||
endDate: this.today
|
||||
};
|
||||
},
|
||||
|
||||
@ -55,7 +55,7 @@ export default Ember.Controller.extend(PeriodComputationMixin, {
|
||||
startDate: moment()
|
||||
.subtract(1, "month")
|
||||
.startOf("day"),
|
||||
endDate: this.get("today")
|
||||
endDate: this.today
|
||||
};
|
||||
},
|
||||
|
||||
@ -78,13 +78,13 @@ export default Ember.Controller.extend(PeriodComputationMixin, {
|
||||
storageReport: staticReport("storage_report"),
|
||||
|
||||
fetchDashboard() {
|
||||
if (this.get("isLoading")) return;
|
||||
if (this.isLoading) return;
|
||||
|
||||
if (
|
||||
!this.get("dashboardFetchedAt") ||
|
||||
!this.dashboardFetchedAt ||
|
||||
moment()
|
||||
.subtract(30, "minutes")
|
||||
.toDate() > this.get("dashboardFetchedAt")
|
||||
.toDate() > this.dashboardFetchedAt
|
||||
) {
|
||||
this.set("isLoading", true);
|
||||
|
||||
@ -99,7 +99,7 @@ export default Ember.Controller.extend(PeriodComputationMixin, {
|
||||
});
|
||||
})
|
||||
.catch(e => {
|
||||
this.get("exceptionController").set("thrown", e.jqXHR);
|
||||
this.exceptionController.set("thrown", e.jqXHR);
|
||||
this.replaceRoute("exception");
|
||||
})
|
||||
.finally(() => this.set("isLoading", false));
|
||||
|
@ -17,13 +17,13 @@ export default Ember.Controller.extend({
|
||||
},
|
||||
|
||||
fetchProblems() {
|
||||
if (this.get("isLoadingProblems")) return;
|
||||
if (this.isLoadingProblems) return;
|
||||
|
||||
if (
|
||||
!this.get("problemsFetchedAt") ||
|
||||
!this.problemsFetchedAt ||
|
||||
moment()
|
||||
.subtract(PROBLEMS_CHECK_MINUTES, "minutes")
|
||||
.toDate() > this.get("problemsFetchedAt")
|
||||
.toDate() > this.problemsFetchedAt
|
||||
) {
|
||||
this._loadProblems();
|
||||
}
|
||||
@ -32,13 +32,13 @@ export default Ember.Controller.extend({
|
||||
fetchDashboard() {
|
||||
const versionChecks = this.siteSettings.version_checks;
|
||||
|
||||
if (this.get("isLoading") || !versionChecks) return;
|
||||
if (this.isLoading || !versionChecks) return;
|
||||
|
||||
if (
|
||||
!this.get("dashboardFetchedAt") ||
|
||||
!this.dashboardFetchedAt ||
|
||||
moment()
|
||||
.subtract(30, "minutes")
|
||||
.toDate() > this.get("dashboardFetchedAt")
|
||||
.toDate() > this.dashboardFetchedAt
|
||||
) {
|
||||
this.set("isLoading", true);
|
||||
|
||||
@ -55,7 +55,7 @@ export default Ember.Controller.extend({
|
||||
this.setProperties(properties);
|
||||
})
|
||||
.catch(e => {
|
||||
this.get("exceptionController").set("thrown", e.jqXHR);
|
||||
this.exceptionController.set("thrown", e.jqXHR);
|
||||
this.replaceRoute("exception");
|
||||
})
|
||||
.finally(() => {
|
||||
|
@ -14,7 +14,7 @@ export default Ember.Controller.extend({
|
||||
|
||||
ajax("/admin/email/advanced-test", {
|
||||
type: "POST",
|
||||
data: { email: this.get("email") }
|
||||
data: { email: this.email }
|
||||
})
|
||||
.then(data => {
|
||||
this.setProperties({
|
||||
|
@ -30,7 +30,7 @@ export default Ember.Controller.extend({
|
||||
|
||||
ajax("/admin/email/test", {
|
||||
type: "POST",
|
||||
data: { email_address: this.get("testEmailAddress") }
|
||||
data: { email_address: this.testEmailAddress }
|
||||
})
|
||||
.then(response =>
|
||||
this.set("sentTestEmailMessage", response.sent_test_email_message)
|
||||
|
@ -4,7 +4,7 @@ export default Ember.Controller.extend({
|
||||
loading: false,
|
||||
|
||||
loadLogs(sourceModel, loadMore) {
|
||||
if ((loadMore && this.get("loading")) || this.get("model.allLoaded")) {
|
||||
if ((loadMore && this.loading) || this.get("model.allLoaded")) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -13,14 +13,14 @@ export default Ember.Controller.extend({
|
||||
sourceModel = sourceModel || EmailLog;
|
||||
|
||||
return sourceModel
|
||||
.findAll(this.get("filter"), loadMore ? this.get("model.length") : null)
|
||||
.findAll(this.filter, loadMore ? this.get("model.length") : null)
|
||||
.then(logs => {
|
||||
if (this.get("model") && loadMore && logs.length < 50) {
|
||||
this.get("model").set("allLoaded", true);
|
||||
if (this.model && loadMore && logs.length < 50) {
|
||||
this.model.set("allLoaded", true);
|
||||
}
|
||||
|
||||
if (this.get("model") && loadMore) {
|
||||
this.get("model").addObjects(logs);
|
||||
if (this.model && loadMore) {
|
||||
this.model.addObjects(logs);
|
||||
} else {
|
||||
this.set("model", logs);
|
||||
}
|
||||
|
@ -12,18 +12,18 @@ export default Ember.Controller.extend({
|
||||
|
||||
actions: {
|
||||
refresh() {
|
||||
const model = this.get("model");
|
||||
const model = this.model;
|
||||
|
||||
this.set("loading", true);
|
||||
this.set("sentEmail", false);
|
||||
|
||||
let username = this.get("username");
|
||||
let username = this.username;
|
||||
if (!username) {
|
||||
username = this.currentUser.get("username");
|
||||
this.set("username", username);
|
||||
}
|
||||
|
||||
EmailPreview.findDigest(username, this.get("lastSeen")).then(email => {
|
||||
EmailPreview.findDigest(username, this.lastSeen).then(email => {
|
||||
model.setProperties(
|
||||
email.getProperties("html_content", "text_content")
|
||||
);
|
||||
@ -40,9 +40,9 @@ export default Ember.Controller.extend({
|
||||
this.set("sentEmail", false);
|
||||
|
||||
EmailPreview.sendDigest(
|
||||
this.get("username"),
|
||||
this.get("lastSeen"),
|
||||
this.get("email")
|
||||
this.username,
|
||||
this.lastSeen,
|
||||
this.email
|
||||
)
|
||||
.then(result => {
|
||||
if (result.errors) {
|
||||
|
@ -32,11 +32,11 @@ export default Ember.Controller.extend({
|
||||
|
||||
actions: {
|
||||
saveChanges() {
|
||||
const embedding = this.get("embedding");
|
||||
const embedding = this.embedding;
|
||||
const updates = embedding.getProperties(embedding.get("fields"));
|
||||
|
||||
this.set("saved", false);
|
||||
this.get("embedding")
|
||||
this.embedding
|
||||
.update(updates)
|
||||
.then(() => this.set("saved", true))
|
||||
.catch(popupAjaxError);
|
||||
|
@ -6,7 +6,7 @@ export default Ember.Controller.extend({
|
||||
actions: {
|
||||
emojiUploaded(emoji) {
|
||||
emoji.url += "?t=" + new Date().getTime();
|
||||
this.get("model").pushObject(Ember.Object.create(emoji));
|
||||
this.model.pushObject(Ember.Object.create(emoji));
|
||||
},
|
||||
|
||||
destroy(emoji) {
|
||||
@ -19,7 +19,7 @@ export default Ember.Controller.extend({
|
||||
return ajax("/admin/customize/emojis/" + emoji.get("name"), {
|
||||
type: "DELETE"
|
||||
}).then(() => {
|
||||
this.get("model").removeObject(emoji);
|
||||
this.model.removeObject(emoji);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ export default Ember.Controller.extend({
|
||||
|
||||
show: debounce(function() {
|
||||
this.set("loading", true);
|
||||
ScreenedIpAddress.findAll(this.get("filter")).then(result => {
|
||||
ScreenedIpAddress.findAll(this.filter).then(result => {
|
||||
this.setProperties({ model: result, loading: false });
|
||||
});
|
||||
}, 250).observes("filter"),
|
||||
@ -34,7 +34,7 @@ export default Ember.Controller.extend({
|
||||
},
|
||||
|
||||
cancel(record) {
|
||||
const savedIpAddress = this.get("savedIpAddress");
|
||||
const savedIpAddress = this.savedIpAddress;
|
||||
if (savedIpAddress && record.get("editing")) {
|
||||
record.set("ip_address", savedIpAddress);
|
||||
}
|
||||
@ -74,7 +74,7 @@ export default Ember.Controller.extend({
|
||||
.destroy()
|
||||
.then(deleted => {
|
||||
if (deleted) {
|
||||
this.get("model").removeObject(record);
|
||||
this.model.removeObject(record);
|
||||
} else {
|
||||
bootbox.alert(I18n.t("generic_error"));
|
||||
}
|
||||
@ -92,7 +92,7 @@ export default Ember.Controller.extend({
|
||||
},
|
||||
|
||||
recordAdded(arg) {
|
||||
this.get("model").unshiftObject(arg);
|
||||
this.model.unshiftObject(arg);
|
||||
},
|
||||
|
||||
rollUp() {
|
||||
|
@ -11,11 +11,11 @@ export default Ember.Controller.extend({
|
||||
filtersExists: Ember.computed.gt("filterCount", 0),
|
||||
|
||||
filterActionIdChanged: function() {
|
||||
const filterActionId = this.get("filterActionId");
|
||||
const filterActionId = this.filterActionId;
|
||||
if (filterActionId) {
|
||||
this._changeFilters({
|
||||
action_name: filterActionId,
|
||||
action_id: this.get("userHistoryActions").findBy("id", filterActionId)
|
||||
action_id: this.userHistoryActions.findBy("id", filterActionId)
|
||||
.action_id
|
||||
});
|
||||
}
|
||||
@ -35,7 +35,7 @@ export default Ember.Controller.extend({
|
||||
_refresh() {
|
||||
this.set("loading", true);
|
||||
|
||||
var filters = this.get("filters"),
|
||||
var filters = this.filters,
|
||||
params = {},
|
||||
count = 0;
|
||||
|
||||
@ -52,7 +52,7 @@ export default Ember.Controller.extend({
|
||||
StaffActionLog.findAll(params)
|
||||
.then(result => {
|
||||
this.set("model", result.staff_action_logs);
|
||||
if (this.get("userHistoryActions").length === 0) {
|
||||
if (this.userHistoryActions.length === 0) {
|
||||
let actionTypes = result.user_history_actions.map(action => {
|
||||
return {
|
||||
id: action.id,
|
||||
@ -80,7 +80,7 @@ export default Ember.Controller.extend({
|
||||
}.on("init"),
|
||||
|
||||
_changeFilters: function(props) {
|
||||
this.get("filters").setProperties(props);
|
||||
this.filters.setProperties(props);
|
||||
this.scheduleRefresh();
|
||||
},
|
||||
|
||||
|
@ -6,7 +6,7 @@ export default Ember.Controller.extend({
|
||||
filter: null,
|
||||
|
||||
show: debounce(function() {
|
||||
Permalink.findAll(this.get("filter")).then(result => {
|
||||
Permalink.findAll(this.filter).then(result => {
|
||||
this.set("model", result);
|
||||
this.set("loading", false);
|
||||
});
|
||||
@ -14,7 +14,7 @@ export default Ember.Controller.extend({
|
||||
|
||||
actions: {
|
||||
recordAdded(arg) {
|
||||
this.get("model").unshiftObject(arg);
|
||||
this.model.unshiftObject(arg);
|
||||
},
|
||||
|
||||
destroy: function(record) {
|
||||
@ -27,7 +27,7 @@ export default Ember.Controller.extend({
|
||||
record.destroy().then(
|
||||
deleted => {
|
||||
if (deleted) {
|
||||
this.get("model").removeObject(record);
|
||||
this.model.removeObject(record);
|
||||
} else {
|
||||
bootbox.alert(I18n.t("generic_error"));
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import computed from "ember-addons/ember-computed-decorators";
|
||||
export default Ember.Controller.extend({
|
||||
@computed
|
||||
adminRoutes: function() {
|
||||
return this.get("model")
|
||||
return this.model
|
||||
.map(p => {
|
||||
if (p.get("enabled")) {
|
||||
return p.admin_route;
|
||||
|
@ -8,18 +8,18 @@ export default Ember.Controller.extend({
|
||||
|
||||
filterContentNow(category) {
|
||||
// If we have no content, don't bother filtering anything
|
||||
if (!!Ember.isEmpty(this.get("allSiteSettings"))) return;
|
||||
if (!!Ember.isEmpty(this.allSiteSettings)) return;
|
||||
|
||||
let filter;
|
||||
if (this.get("filter")) {
|
||||
filter = this.get("filter")
|
||||
if (this.filter) {
|
||||
filter = this.filter
|
||||
.toLowerCase()
|
||||
.trim();
|
||||
}
|
||||
|
||||
if ((!filter || 0 === filter.length) && !this.get("onlyOverridden")) {
|
||||
this.set("visibleSiteSettings", this.get("allSiteSettings"));
|
||||
if (this.get("categoryNameKey") === "all_results") {
|
||||
if ((!filter || 0 === filter.length) && !this.onlyOverridden) {
|
||||
this.set("visibleSiteSettings", this.allSiteSettings);
|
||||
if (this.categoryNameKey === "all_results") {
|
||||
this.transitionToRoute("adminSiteSettings");
|
||||
}
|
||||
return;
|
||||
@ -33,9 +33,9 @@ export default Ember.Controller.extend({
|
||||
const matchesGroupedByCategory = [all];
|
||||
|
||||
const matches = [];
|
||||
this.get("allSiteSettings").forEach(settingsCategory => {
|
||||
this.allSiteSettings.forEach(settingsCategory => {
|
||||
const siteSettings = settingsCategory.siteSettings.filter(item => {
|
||||
if (this.get("onlyOverridden") && !item.get("overridden")) return false;
|
||||
if (this.onlyOverridden && !item.get("overridden")) return false;
|
||||
if (filter) {
|
||||
const setting = item.get("setting").toLowerCase();
|
||||
return (
|
||||
@ -76,7 +76,7 @@ export default Ember.Controller.extend({
|
||||
},
|
||||
|
||||
filterContent: debounce(function() {
|
||||
if (this.get("_skipBounce")) {
|
||||
if (this._skipBounce) {
|
||||
this.set("_skipBounce", false);
|
||||
} else {
|
||||
this.filterContentNow();
|
||||
|
@ -6,8 +6,8 @@ export default Ember.Controller.extend(bufferedProperty("siteText"), {
|
||||
|
||||
actions: {
|
||||
saveChanges() {
|
||||
const buffered = this.get("buffered");
|
||||
this.get("siteText")
|
||||
const buffered = this.buffered;
|
||||
this.siteText
|
||||
.save(buffered.getProperties("value"))
|
||||
.then(() => {
|
||||
this.commitBuffer();
|
||||
@ -20,10 +20,10 @@ export default Ember.Controller.extend(bufferedProperty("siteText"), {
|
||||
this.set("saved", false);
|
||||
bootbox.confirm(I18n.t("admin.site_text.revert_confirm"), result => {
|
||||
if (result) {
|
||||
this.get("siteText")
|
||||
this.siteText
|
||||
.revert()
|
||||
.then(props => {
|
||||
const buffered = this.get("buffered");
|
||||
const buffered = this.buffered;
|
||||
buffered.setProperties(props);
|
||||
this.commitBuffer();
|
||||
})
|
||||
|
@ -30,7 +30,7 @@ export default Ember.Controller.extend({
|
||||
},
|
||||
|
||||
search() {
|
||||
const q = this.get("q");
|
||||
const q = this.q;
|
||||
if (q !== lastSearch) {
|
||||
this.set("searching", true);
|
||||
Ember.run.debounce(this, this._performSearch, 400);
|
||||
|
@ -13,7 +13,7 @@ export default Ember.Controller.extend(GrantBadgeController, {
|
||||
|
||||
@computed("model", "model.[]", "model.expandedBadges.[]")
|
||||
groupedBadges() {
|
||||
const allBadges = this.get("model");
|
||||
const allBadges = this.model;
|
||||
|
||||
var grouped = _.groupBy(allBadges, badge => badge.badge_id);
|
||||
|
||||
@ -52,22 +52,22 @@ export default Ember.Controller.extend(GrantBadgeController, {
|
||||
|
||||
actions: {
|
||||
expandGroup: function(userBadge) {
|
||||
const model = this.get("model");
|
||||
const model = this.model;
|
||||
model.set("expandedBadges", model.get("expandedBadges") || []);
|
||||
model.get("expandedBadges").pushObject(userBadge.badge.id);
|
||||
},
|
||||
|
||||
grantBadge() {
|
||||
this.grantBadge(
|
||||
this.get("selectedBadgeId"),
|
||||
this.selectedBadgeId,
|
||||
this.get("user.username"),
|
||||
this.get("badgeReason")
|
||||
this.badgeReason
|
||||
).then(
|
||||
() => {
|
||||
this.set("badgeReason", "");
|
||||
Ember.run.next(() => {
|
||||
// Update the selected badge ID after the combobox has re-rendered.
|
||||
const newSelectedBadge = this.get("grantableBadges")[0];
|
||||
const newSelectedBadge = this.grantableBadges[0];
|
||||
if (newSelectedBadge) {
|
||||
this.set("selectedBadgeId", newSelectedBadge.get("id"));
|
||||
}
|
||||
@ -87,7 +87,7 @@ export default Ember.Controller.extend(GrantBadgeController, {
|
||||
result => {
|
||||
if (result) {
|
||||
userBadge.revoke().then(() => {
|
||||
this.get("model").removeObject(userBadge);
|
||||
this.model.removeObject(userBadge);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -15,13 +15,13 @@ export default Ember.Controller.extend({
|
||||
field_type: "text",
|
||||
position: MAX_FIELDS
|
||||
});
|
||||
this.get("model").pushObject(f);
|
||||
this.model.pushObject(f);
|
||||
},
|
||||
|
||||
moveUp(f) {
|
||||
const idx = this.get("sortedFields").indexOf(f);
|
||||
const idx = this.sortedFields.indexOf(f);
|
||||
if (idx) {
|
||||
const prev = this.get("sortedFields").objectAt(idx - 1);
|
||||
const prev = this.sortedFields.objectAt(idx - 1);
|
||||
const prevPos = prev.get("position");
|
||||
|
||||
prev.update({ position: f.get("position") });
|
||||
@ -30,9 +30,9 @@ export default Ember.Controller.extend({
|
||||
},
|
||||
|
||||
moveDown(f) {
|
||||
const idx = this.get("sortedFields").indexOf(f);
|
||||
const idx = this.sortedFields.indexOf(f);
|
||||
if (idx > -1) {
|
||||
const next = this.get("sortedFields").objectAt(idx + 1);
|
||||
const next = this.sortedFields.objectAt(idx + 1);
|
||||
const nextPos = next.get("position");
|
||||
|
||||
next.update({ position: f.get("position") });
|
||||
@ -41,7 +41,7 @@ export default Ember.Controller.extend({
|
||||
},
|
||||
|
||||
destroy(f) {
|
||||
const model = this.get("model");
|
||||
const model = this.model;
|
||||
|
||||
// Only confirm if we already been saved
|
||||
if (f.get("id")) {
|
||||
|
@ -107,16 +107,16 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||
},
|
||||
|
||||
groupAdded(added) {
|
||||
this.get("model")
|
||||
this.model
|
||||
.groupAdded(added)
|
||||
.catch(() => bootbox.alert(I18n.t("generic_error")));
|
||||
},
|
||||
|
||||
groupRemoved(groupId) {
|
||||
this.get("model")
|
||||
this.model
|
||||
.groupRemoved(groupId)
|
||||
.then(() => {
|
||||
if (groupId === this.get("originalPrimaryGroupId")) {
|
||||
if (groupId === this.originalPrimaryGroupId) {
|
||||
this.set("originalPrimaryGroupId", null);
|
||||
}
|
||||
})
|
||||
@ -125,65 +125,65 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||
|
||||
actions: {
|
||||
impersonate() {
|
||||
return this.get("model").impersonate();
|
||||
return this.model.impersonate();
|
||||
},
|
||||
logOut() {
|
||||
return this.get("model").logOut();
|
||||
return this.model.logOut();
|
||||
},
|
||||
resetBounceScore() {
|
||||
return this.get("model").resetBounceScore();
|
||||
return this.model.resetBounceScore();
|
||||
},
|
||||
approve() {
|
||||
return this.get("model").approve();
|
||||
return this.model.approve();
|
||||
},
|
||||
deactivate() {
|
||||
return this.get("model").deactivate();
|
||||
return this.model.deactivate();
|
||||
},
|
||||
sendActivationEmail() {
|
||||
return this.get("model").sendActivationEmail();
|
||||
return this.model.sendActivationEmail();
|
||||
},
|
||||
activate() {
|
||||
return this.get("model").activate();
|
||||
return this.model.activate();
|
||||
},
|
||||
revokeAdmin() {
|
||||
return this.get("model").revokeAdmin();
|
||||
return this.model.revokeAdmin();
|
||||
},
|
||||
grantAdmin() {
|
||||
return this.get("model").grantAdmin();
|
||||
return this.model.grantAdmin();
|
||||
},
|
||||
revokeModeration() {
|
||||
return this.get("model").revokeModeration();
|
||||
return this.model.revokeModeration();
|
||||
},
|
||||
grantModeration() {
|
||||
return this.get("model").grantModeration();
|
||||
return this.model.grantModeration();
|
||||
},
|
||||
saveTrustLevel() {
|
||||
return this.get("model").saveTrustLevel();
|
||||
return this.model.saveTrustLevel();
|
||||
},
|
||||
restoreTrustLevel() {
|
||||
return this.get("model").restoreTrustLevel();
|
||||
return this.model.restoreTrustLevel();
|
||||
},
|
||||
lockTrustLevel(locked) {
|
||||
return this.get("model").lockTrustLevel(locked);
|
||||
return this.model.lockTrustLevel(locked);
|
||||
},
|
||||
unsilence() {
|
||||
return this.get("model").unsilence();
|
||||
return this.model.unsilence();
|
||||
},
|
||||
silence() {
|
||||
return this.get("model").silence();
|
||||
return this.model.silence();
|
||||
},
|
||||
deleteAllPosts() {
|
||||
return this.get("model").deleteAllPosts();
|
||||
return this.model.deleteAllPosts();
|
||||
},
|
||||
anonymize() {
|
||||
return this.get("model").anonymize();
|
||||
return this.model.anonymize();
|
||||
},
|
||||
disableSecondFactor() {
|
||||
return this.get("model").disableSecondFactor();
|
||||
return this.model.disableSecondFactor();
|
||||
},
|
||||
|
||||
clearPenaltyHistory() {
|
||||
const user = this.get("model");
|
||||
const user = this.model;
|
||||
const path = `/admin/users/${user.get("id")}/penalty_history`;
|
||||
|
||||
return ajax(path, { type: "DELETE" })
|
||||
@ -194,27 +194,27 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||
destroy() {
|
||||
const postCount = this.get("model.post_count");
|
||||
if (postCount <= 5) {
|
||||
return this.get("model").destroy({ deletePosts: true });
|
||||
return this.model.destroy({ deletePosts: true });
|
||||
} else {
|
||||
return this.get("model").destroy();
|
||||
return this.model.destroy();
|
||||
}
|
||||
},
|
||||
|
||||
viewActionLogs() {
|
||||
this.get("adminTools").showActionLogs(this, {
|
||||
this.adminTools.showActionLogs(this, {
|
||||
target_user: this.get("model.username")
|
||||
});
|
||||
},
|
||||
showSuspendModal() {
|
||||
this.get("adminTools").showSuspendModal(this.get("model"));
|
||||
this.adminTools.showSuspendModal(this.model);
|
||||
},
|
||||
unsuspend() {
|
||||
this.get("model")
|
||||
this.model
|
||||
.unsuspend()
|
||||
.catch(popupAjaxError);
|
||||
},
|
||||
showSilenceModal() {
|
||||
this.get("adminTools").showSilenceModal(this.get("model"));
|
||||
this.adminTools.showSilenceModal(this.model);
|
||||
},
|
||||
|
||||
saveUsername(newUsername) {
|
||||
@ -260,13 +260,13 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||
},
|
||||
|
||||
generateApiKey() {
|
||||
this.get("model").generateApiKey();
|
||||
this.model.generateApiKey();
|
||||
},
|
||||
|
||||
saveCustomGroups() {
|
||||
const currentIds = this.get("customGroupIds");
|
||||
const bufferedIds = this.get("customGroupIdsBuffer");
|
||||
const availableGroups = this.get("availableGroups");
|
||||
const currentIds = this.customGroupIds;
|
||||
const bufferedIds = this.customGroupIdsBuffer;
|
||||
const availableGroups = this.availableGroups;
|
||||
|
||||
bufferedIds
|
||||
.filter(id => !currentIds.includes(id))
|
||||
@ -294,7 +294,7 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||
},
|
||||
|
||||
resetPrimaryGroup() {
|
||||
this.set("model.primary_group_id", this.get("originalPrimaryGroupId"));
|
||||
this.set("model.primary_group_id", this.originalPrimaryGroupId);
|
||||
},
|
||||
|
||||
regenerateApiKey() {
|
||||
@ -304,7 +304,7 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||
I18n.t("yes_value"),
|
||||
result => {
|
||||
if (result) {
|
||||
this.get("model").generateApiKey();
|
||||
this.model.generateApiKey();
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -317,7 +317,7 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||
I18n.t("yes_value"),
|
||||
result => {
|
||||
if (result) {
|
||||
this.get("model").revokeApiKey();
|
||||
this.model.revokeApiKey();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -27,11 +27,11 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||
_refreshUsers() {
|
||||
this.set("refreshing", true);
|
||||
|
||||
AdminUser.findAll(this.get("query"), {
|
||||
filter: this.get("listFilter"),
|
||||
show_emails: this.get("showEmails"),
|
||||
order: this.get("order"),
|
||||
ascending: this.get("ascending")
|
||||
AdminUser.findAll(this.query, {
|
||||
filter: this.listFilter,
|
||||
show_emails: this.showEmails,
|
||||
order: this.order,
|
||||
ascending: this.ascending
|
||||
})
|
||||
.then(result => this.set("model", result))
|
||||
.finally(() => this.set("refreshing", false));
|
||||
|
@ -39,7 +39,7 @@ export default Ember.Controller.extend({
|
||||
|
||||
actions: {
|
||||
recordAdded(arg) {
|
||||
const a = this.findAction(this.get("actionNameKey"));
|
||||
const a = this.findAction(this.actionNameKey);
|
||||
if (a) {
|
||||
a.words.unshiftObject(arg);
|
||||
a.incrementProperty("count");
|
||||
@ -49,7 +49,7 @@ export default Ember.Controller.extend({
|
||||
this.get("adminWatchedWords.model").forEach(action => {
|
||||
if (match) return;
|
||||
|
||||
if (action.nameKey !== this.get("actionNameKey")) {
|
||||
if (action.nameKey !== this.actionNameKey) {
|
||||
match = action.words.findBy("id", arg.id);
|
||||
if (match) {
|
||||
action.words.removeObject(match);
|
||||
@ -62,7 +62,7 @@ export default Ember.Controller.extend({
|
||||
},
|
||||
|
||||
recordRemoved(arg) {
|
||||
const a = this.findAction(this.get("actionNameKey"));
|
||||
const a = this.findAction(this.actionNameKey);
|
||||
if (a) {
|
||||
a.words.removeObject(arg);
|
||||
a.decrementProperty("count");
|
||||
|
@ -8,21 +8,21 @@ export default Ember.Controller.extend({
|
||||
regularExpressions: null,
|
||||
|
||||
filterContentNow() {
|
||||
if (!!Ember.isEmpty(this.get("allWatchedWords"))) return;
|
||||
if (!!Ember.isEmpty(this.allWatchedWords)) return;
|
||||
|
||||
let filter;
|
||||
if (this.get("filter")) {
|
||||
filter = this.get("filter").toLowerCase();
|
||||
if (this.filter) {
|
||||
filter = this.filter.toLowerCase();
|
||||
}
|
||||
|
||||
if (filter === undefined || filter.length < 1) {
|
||||
this.set("model", this.get("allWatchedWords"));
|
||||
this.set("model", this.allWatchedWords);
|
||||
return;
|
||||
}
|
||||
|
||||
const matchesByAction = [];
|
||||
|
||||
this.get("allWatchedWords").forEach(wordsForAction => {
|
||||
this.allWatchedWords.forEach(wordsForAction => {
|
||||
const wordRecords = wordsForAction.words.filter(wordRecord => {
|
||||
return wordRecord.word.indexOf(filter) > -1;
|
||||
});
|
||||
@ -41,7 +41,7 @@ export default Ember.Controller.extend({
|
||||
|
||||
filterContent: debounce(function() {
|
||||
this.filterContentNow();
|
||||
this.set("filtered", !Ember.isEmpty(this.get("filter")));
|
||||
this.set("filtered", !Ember.isEmpty(this.filter));
|
||||
}, 250).observes("filter"),
|
||||
|
||||
actions: {
|
||||
|
@ -29,7 +29,7 @@ export default Ember.Controller.extend({
|
||||
},
|
||||
|
||||
_addIncoming(eventId) {
|
||||
const incomingEventIds = this.get("incomingEventIds");
|
||||
const incomingEventIds = this.incomingEventIds;
|
||||
|
||||
if (incomingEventIds.indexOf(eventId) === -1) {
|
||||
incomingEventIds.pushObject(eventId);
|
||||
@ -38,7 +38,7 @@ export default Ember.Controller.extend({
|
||||
|
||||
actions: {
|
||||
loadMore() {
|
||||
this.get("model").loadMore();
|
||||
this.model.loadMore();
|
||||
},
|
||||
|
||||
ping() {
|
||||
@ -60,12 +60,12 @@ export default Ember.Controller.extend({
|
||||
|
||||
ajax(`/admin/api/web_hooks/${webHookId}/events/bulk`, {
|
||||
type: "GET",
|
||||
data: { ids: this.get("incomingEventIds") }
|
||||
data: { ids: this.incomingEventIds }
|
||||
}).then(data => {
|
||||
const objects = data.map(event =>
|
||||
this.store.createRecord("web-hook-event", event)
|
||||
);
|
||||
this.get("model").unshiftObjects(objects);
|
||||
this.model.unshiftObjects(objects);
|
||||
this.set("incomingEventIds", []);
|
||||
});
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ export default Ember.Controller.extend({
|
||||
this.set("saved", false);
|
||||
const url = this.get("model.payload_url");
|
||||
const domain = extractDomainFromUrl(url);
|
||||
const model = this.get("model");
|
||||
const model = this.model;
|
||||
const isNew = model.get("isNew");
|
||||
|
||||
const saveWebHook = () => {
|
||||
@ -92,7 +92,7 @@ export default Ember.Controller.extend({
|
||||
.save()
|
||||
.then(() => {
|
||||
this.set("saved", true);
|
||||
this.get("adminWebHooks")
|
||||
this.adminWebHooks
|
||||
.get("model")
|
||||
.addObject(model);
|
||||
|
||||
@ -131,11 +131,11 @@ export default Ember.Controller.extend({
|
||||
I18n.t("yes_value"),
|
||||
result => {
|
||||
if (result) {
|
||||
const model = this.get("model");
|
||||
const model = this.model;
|
||||
model
|
||||
.destroyRecord()
|
||||
.then(() => {
|
||||
this.get("adminWebHooks")
|
||||
this.adminWebHooks
|
||||
.get("model")
|
||||
.removeObject(model);
|
||||
this.transitionToRoute("adminWebHooks");
|
||||
|
@ -12,7 +12,7 @@ export default Ember.Controller.extend({
|
||||
webhook
|
||||
.destroyRecord()
|
||||
.then(() => {
|
||||
this.get("model").removeObject(webhook);
|
||||
this.model.removeObject(webhook);
|
||||
})
|
||||
.catch(popupAjaxError);
|
||||
}
|
||||
@ -21,7 +21,7 @@ export default Ember.Controller.extend({
|
||||
},
|
||||
|
||||
loadMore() {
|
||||
this.get("model").loadMore();
|
||||
this.model.loadMore();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -24,14 +24,14 @@ export default Ember.Mixin.create(ModalFunctionality, {
|
||||
},
|
||||
|
||||
penalize(cb) {
|
||||
let before = this.get("before");
|
||||
let before = this.before;
|
||||
let promise = before ? before() : Ember.RSVP.resolve();
|
||||
|
||||
return promise
|
||||
.then(() => cb())
|
||||
.then(result => {
|
||||
this.send("closeModal");
|
||||
let callback = this.get("successCallback");
|
||||
let callback = this.successCallback;
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ export default Ember.Mixin.create({
|
||||
@computed("valid_values")
|
||||
validValues(validValues) {
|
||||
const vals = [],
|
||||
translateNames = this.get("translate_names");
|
||||
translateNames = this.translate_names;
|
||||
|
||||
validValues.forEach(v => {
|
||||
if (v.name && v.name.length > 0 && translateNames) {
|
||||
|
@ -76,15 +76,15 @@ const AdminUser = Discourse.User.extend({
|
||||
return ajax(`/admin/users/${this.id}/groups`, {
|
||||
type: "POST",
|
||||
data: { group_id: added.id }
|
||||
}).then(() => this.get("groups").pushObject(added));
|
||||
}).then(() => this.groups.pushObject(added));
|
||||
},
|
||||
|
||||
groupRemoved(groupId) {
|
||||
return ajax(`/admin/users/${this.id}/groups/${groupId}`, {
|
||||
type: "DELETE"
|
||||
}).then(() => {
|
||||
this.set("groups.[]", this.get("groups").rejectBy("id", groupId));
|
||||
if (this.get("primary_group_id") === groupId) {
|
||||
this.set("groups.[]", this.groups.rejectBy("id", groupId));
|
||||
if (this.primary_group_id === groupId) {
|
||||
this.set("primary_group_id", null);
|
||||
}
|
||||
});
|
||||
@ -240,7 +240,7 @@ const AdminUser = Discourse.User.extend({
|
||||
},
|
||||
|
||||
setOriginalTrustLevel() {
|
||||
this.set("originalTrustLevel", this.get("trust_level"));
|
||||
this.set("originalTrustLevel", this.trust_level);
|
||||
},
|
||||
|
||||
dirty: propertyNotEqual("originalTrustLevel", "trustLevel.id"),
|
||||
@ -266,7 +266,7 @@ const AdminUser = Discourse.User.extend({
|
||||
},
|
||||
|
||||
restoreTrustLevel() {
|
||||
this.set("trustLevel.id", this.get("originalTrustLevel"));
|
||||
this.set("trustLevel.id", this.originalTrustLevel);
|
||||
},
|
||||
|
||||
lockTrustLevel(locked) {
|
||||
@ -316,14 +316,14 @@ const AdminUser = Discourse.User.extend({
|
||||
logOut() {
|
||||
return ajax("/admin/users/" + this.id + "/log_out", {
|
||||
type: "POST",
|
||||
data: { username_or_email: this.get("username") }
|
||||
data: { username_or_email: this.username }
|
||||
}).then(() => bootbox.alert(I18n.t("admin.user.logged_out")));
|
||||
},
|
||||
|
||||
impersonate() {
|
||||
return ajax("/admin/impersonate", {
|
||||
type: "POST",
|
||||
data: { username_or_email: this.get("username") }
|
||||
data: { username_or_email: this.username }
|
||||
})
|
||||
.then(() => (document.location = Discourse.getURL("/")))
|
||||
.catch(e => {
|
||||
@ -397,7 +397,7 @@ const AdminUser = Discourse.User.extend({
|
||||
sendActivationEmail() {
|
||||
return ajax(userPath("action/send_activation_email"), {
|
||||
type: "POST",
|
||||
data: { username: this.get("username") }
|
||||
data: { username: this.username }
|
||||
})
|
||||
.then(() => bootbox.alert(I18n.t("admin.user.activation_email_sent")))
|
||||
.catch(popupAjaxError);
|
||||
@ -518,7 +518,7 @@ const AdminUser = Discourse.User.extend({
|
||||
},
|
||||
|
||||
loadDetails() {
|
||||
if (this.get("loadedDetails")) {
|
||||
if (this.loadedDetails) {
|
||||
return Ember.RSVP.resolve(this);
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ const ApiKey = Discourse.Model.extend({
|
||||
regenerate() {
|
||||
return ajax(KEY_ENDPOINT, {
|
||||
type: "PUT",
|
||||
data: { id: this.get("id") }
|
||||
data: { id: this.id }
|
||||
}).then(result => {
|
||||
this.set("key", result.api_key.key);
|
||||
return this;
|
||||
@ -18,7 +18,7 @@ const ApiKey = Discourse.Model.extend({
|
||||
revoke() {
|
||||
return ajax(KEY_ENDPOINT, {
|
||||
type: "DELETE",
|
||||
data: { id: this.get("id") }
|
||||
data: { id: this.id }
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -3,11 +3,11 @@ import { extractError } from "discourse/lib/ajax-error";
|
||||
|
||||
const Backup = Discourse.Model.extend({
|
||||
destroy() {
|
||||
return ajax("/admin/backups/" + this.get("filename"), { type: "DELETE" });
|
||||
return ajax("/admin/backups/" + this.filename, { type: "DELETE" });
|
||||
},
|
||||
|
||||
restore() {
|
||||
return ajax("/admin/backups/" + this.get("filename") + "/restore", {
|
||||
return ajax("/admin/backups/" + this.filename + "/restore", {
|
||||
type: "POST",
|
||||
data: { client_id: window.MessageBus.clientId }
|
||||
});
|
||||
|
@ -8,7 +8,7 @@ import { propertyNotEqual, i18n } from "discourse/lib/computed";
|
||||
const ColorSchemeColor = Discourse.Model.extend({
|
||||
@on("init")
|
||||
startTrackingChanges() {
|
||||
this.set("originals", { hex: this.get("hex") || "FFFFFF" });
|
||||
this.set("originals", { hex: this.hex || "FFFFFF" });
|
||||
|
||||
// force changed property to be recalculated
|
||||
this.notifyPropertyChange("hex");
|
||||
@ -17,8 +17,8 @@ const ColorSchemeColor = Discourse.Model.extend({
|
||||
// Whether value has changed since it was last saved.
|
||||
@computed("hex")
|
||||
changed(hex) {
|
||||
if (!this.get("originals")) return false;
|
||||
if (hex !== this.get("originals").hex) return true;
|
||||
if (!this.originals) return false;
|
||||
if (hex !== this.originals.hex) return true;
|
||||
|
||||
return false;
|
||||
},
|
||||
@ -29,16 +29,16 @@ const ColorSchemeColor = Discourse.Model.extend({
|
||||
// Whether the saved value is different than Discourse's default color scheme.
|
||||
@computed("default_hex", "hex")
|
||||
savedIsOverriden(defaultHex) {
|
||||
return this.get("originals").hex !== defaultHex;
|
||||
return this.originals.hex !== defaultHex;
|
||||
},
|
||||
|
||||
revert() {
|
||||
this.set("hex", this.get("default_hex"));
|
||||
this.set("hex", this.default_hex);
|
||||
},
|
||||
|
||||
undo() {
|
||||
if (this.get("originals")) {
|
||||
this.set("hex", this.get("originals").hex);
|
||||
if (this.originals) {
|
||||
this.set("hex", this.originals.hex);
|
||||
}
|
||||
},
|
||||
|
||||
@ -75,10 +75,10 @@ const ColorSchemeColor = Discourse.Model.extend({
|
||||
|
||||
@observes("hex")
|
||||
hexValueChanged() {
|
||||
if (this.get("hex")) {
|
||||
if (this.hex) {
|
||||
this.set(
|
||||
"hex",
|
||||
this.get("hex")
|
||||
this.hex
|
||||
.toString()
|
||||
.replace(/[^0-9a-fA-F]/g, "")
|
||||
);
|
||||
|
@ -4,7 +4,7 @@ const { getProperties } = Ember;
|
||||
|
||||
export default RestModel.extend({
|
||||
revert() {
|
||||
return ajax(`/admin/customize/email_templates/${this.get("id")}`, {
|
||||
return ajax(`/admin/customize/email_templates/${this.id}`, {
|
||||
method: "DELETE"
|
||||
}).then(result =>
|
||||
getProperties(result.email_template, "subject", "body", "can_revert")
|
||||
|
@ -4,15 +4,15 @@ const Permalink = Discourse.Model.extend({
|
||||
return ajax("/admin/permalinks.json", {
|
||||
type: "POST",
|
||||
data: {
|
||||
url: this.get("url"),
|
||||
permalink_type: this.get("permalink_type"),
|
||||
permalink_type_value: this.get("permalink_type_value")
|
||||
url: this.url,
|
||||
permalink_type: this.permalink_type,
|
||||
permalink_type_value: this.permalink_type_value
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
return ajax("/admin/permalinks/" + this.get("id") + ".json", {
|
||||
return ajax("/admin/permalinks/" + this.id + ".json", {
|
||||
type: "DELETE"
|
||||
});
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ const Report = Discourse.Model.extend({
|
||||
count++;
|
||||
}
|
||||
});
|
||||
if (this.get("method") === "average" && count > 0) {
|
||||
if (this.method === "average" && count > 0) {
|
||||
sum /= count;
|
||||
}
|
||||
return round(sum, -2);
|
||||
@ -107,7 +107,7 @@ const Report = Discourse.Model.extend({
|
||||
},
|
||||
|
||||
averageCount(count, value) {
|
||||
return this.get("average") ? value / count : value;
|
||||
return this.average ? value / count : value;
|
||||
},
|
||||
|
||||
@computed("yesterdayCount", "higher_is_better")
|
||||
@ -158,7 +158,7 @@ const Report = Discourse.Model.extend({
|
||||
|
||||
@computed("prev_period", "currentTotal", "currentAverage", "higher_is_better")
|
||||
trend(prev, currentTotal, currentAverage, higherIsBetter) {
|
||||
const total = this.get("average") ? currentAverage : currentTotal;
|
||||
const total = this.average ? currentAverage : currentTotal;
|
||||
return this._computeTrend(prev, total, higherIsBetter);
|
||||
},
|
||||
|
||||
@ -190,12 +190,12 @@ const Report = Discourse.Model.extend({
|
||||
|
||||
@computed("prev_period", "currentTotal", "currentAverage")
|
||||
trendTitle(prev, currentTotal, currentAverage) {
|
||||
let current = this.get("average") ? currentAverage : currentTotal;
|
||||
let current = this.average ? currentAverage : currentTotal;
|
||||
let percent = this.percentChangeString(prev, current);
|
||||
|
||||
if (this.get("average")) {
|
||||
if (this.average) {
|
||||
prev = prev ? prev.toFixed(1) : "0";
|
||||
if (this.get("percent")) {
|
||||
if (this.percent) {
|
||||
current += "%";
|
||||
prev += "%";
|
||||
}
|
||||
@ -246,7 +246,7 @@ const Report = Discourse.Model.extend({
|
||||
|
||||
@computed("data")
|
||||
sortedData(data) {
|
||||
return this.get("xAxisIsDate") ? data.toArray().reverse() : data.toArray();
|
||||
return this.xAxisIsDate ? data.toArray().reverse() : data.toArray();
|
||||
},
|
||||
|
||||
@computed("data")
|
||||
|
@ -8,7 +8,7 @@ const ScreenedEmail = Discourse.Model.extend({
|
||||
},
|
||||
|
||||
clearBlock: function() {
|
||||
return ajax("/admin/logs/screened_emails/" + this.get("id"), {
|
||||
return ajax("/admin/logs/screened_emails/" + this.id, {
|
||||
method: "DELETE"
|
||||
});
|
||||
}
|
||||
|
@ -22,8 +22,8 @@ const ScreenedIpAddress = Discourse.Model.extend({
|
||||
{
|
||||
type: this.id ? "PUT" : "POST",
|
||||
data: {
|
||||
ip_address: this.get("ip_address"),
|
||||
action_name: this.get("action_name")
|
||||
ip_address: this.ip_address,
|
||||
action_name: this.action_name
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -31,7 +31,7 @@ const ScreenedIpAddress = Discourse.Model.extend({
|
||||
|
||||
destroy() {
|
||||
return ajax(
|
||||
"/admin/logs/screened_ip_addresses/" + this.get("id") + ".json",
|
||||
"/admin/logs/screened_ip_addresses/" + this.id + ".json",
|
||||
{ type: "DELETE" }
|
||||
);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ const { getProperties } = Ember;
|
||||
|
||||
export default RestModel.extend({
|
||||
revert() {
|
||||
return ajax(`/admin/customize/site_texts/${this.get("id")}`, {
|
||||
return ajax(`/admin/customize/site_texts/${this.id}`, {
|
||||
method: "DELETE"
|
||||
}).then(result => getProperties(result.site_text, "value", "can_revert"));
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ const Theme = RestModel.extend({
|
||||
"footer"
|
||||
];
|
||||
|
||||
const scss_fields = (this.get("theme_fields") || [])
|
||||
const scss_fields = (this.theme_fields || [])
|
||||
.filter(f => f.target === "extra_scss" && f.name !== "")
|
||||
.map(f => f.name);
|
||||
|
||||
@ -71,7 +71,7 @@ const Theme = RestModel.extend({
|
||||
settings: ["yaml"],
|
||||
translations: [
|
||||
"en",
|
||||
...(this.get("theme_fields") || [])
|
||||
...(this.theme_fields || [])
|
||||
.filter(f => f.target === "translations" && f.name !== "en")
|
||||
.map(f => f.name)
|
||||
],
|
||||
@ -118,7 +118,7 @@ const Theme = RestModel.extend({
|
||||
|
||||
let hash = {};
|
||||
fields.forEach(field => {
|
||||
if (!field.type_id || this.get("FIELDS_IDS").includes(field.type_id)) {
|
||||
if (!field.type_id || this.FIELDS_IDS.includes(field.type_id)) {
|
||||
hash[this.getKey(field)] = field;
|
||||
}
|
||||
});
|
||||
@ -162,7 +162,7 @@ const Theme = RestModel.extend({
|
||||
if (name) {
|
||||
return !Ember.isEmpty(this.getField(target, name));
|
||||
} else {
|
||||
let fields = this.get("theme_fields") || [];
|
||||
let fields = this.theme_fields || [];
|
||||
return fields.any(
|
||||
field => field.target === target && !Ember.isEmpty(field.value)
|
||||
);
|
||||
@ -170,20 +170,20 @@ const Theme = RestModel.extend({
|
||||
},
|
||||
|
||||
hasError(target, name) {
|
||||
return this.get("theme_fields")
|
||||
return this.theme_fields
|
||||
.filter(f => f.target === target && (!name || name === f.name))
|
||||
.any(f => f.error);
|
||||
},
|
||||
|
||||
getError(target, name) {
|
||||
let themeFields = this.get("themeFields");
|
||||
let themeFields = this.themeFields;
|
||||
let key = this.getKey({ target, name });
|
||||
let field = themeFields[key];
|
||||
return field ? field.error : "";
|
||||
},
|
||||
|
||||
getField(target, name) {
|
||||
let themeFields = this.get("themeFields");
|
||||
let themeFields = this.themeFields;
|
||||
let key = this.getKey({ target, name });
|
||||
let field = themeFields[key];
|
||||
return field ? field.value : "";
|
||||
@ -200,12 +200,12 @@ const Theme = RestModel.extend({
|
||||
|
||||
setField(target, name, value, upload_id, type_id) {
|
||||
this.set("changed", true);
|
||||
let themeFields = this.get("themeFields");
|
||||
let themeFields = this.themeFields;
|
||||
let field = { name, target, value, upload_id, type_id };
|
||||
|
||||
// slow path for uploads and so on
|
||||
if (type_id && type_id > 1) {
|
||||
let fields = this.get("theme_fields");
|
||||
let fields = this.theme_fields;
|
||||
let existing = fields.find(
|
||||
f => f.target === target && f.name === name && f.type_id === type_id
|
||||
);
|
||||
@ -246,13 +246,13 @@ const Theme = RestModel.extend({
|
||||
},
|
||||
|
||||
removeChildTheme(theme) {
|
||||
const childThemes = this.get("childThemes");
|
||||
const childThemes = this.childThemes;
|
||||
childThemes.removeObject(theme);
|
||||
return this.saveChanges("child_theme_ids");
|
||||
},
|
||||
|
||||
addChildTheme(theme) {
|
||||
let childThemes = this.get("childThemes");
|
||||
let childThemes = this.childThemes;
|
||||
if (!childThemes) {
|
||||
childThemes = [];
|
||||
this.set("childThemes", childThemes);
|
||||
|
@ -44,30 +44,30 @@ export default Discourse.Model.extend({
|
||||
)
|
||||
met() {
|
||||
return {
|
||||
days_visited: this.get("days_visited") >= this.get("min_days_visited"),
|
||||
days_visited: this.days_visited >= this.min_days_visited,
|
||||
topics_replied_to:
|
||||
this.get("num_topics_replied_to") >= this.get("min_topics_replied_to"),
|
||||
topics_viewed: this.get("topics_viewed") >= this.get("min_topics_viewed"),
|
||||
posts_read: this.get("posts_read") >= this.get("min_posts_read"),
|
||||
this.num_topics_replied_to >= this.min_topics_replied_to,
|
||||
topics_viewed: this.topics_viewed >= this.min_topics_viewed,
|
||||
posts_read: this.posts_read >= this.min_posts_read,
|
||||
topics_viewed_all_time:
|
||||
this.get("topics_viewed_all_time") >=
|
||||
this.get("min_topics_viewed_all_time"),
|
||||
this.topics_viewed_all_time >=
|
||||
this.min_topics_viewed_all_time,
|
||||
posts_read_all_time:
|
||||
this.get("posts_read_all_time") >= this.get("min_posts_read_all_time"),
|
||||
this.posts_read_all_time >= this.min_posts_read_all_time,
|
||||
flagged_posts:
|
||||
this.get("num_flagged_posts") <= this.get("max_flagged_posts"),
|
||||
this.num_flagged_posts <= this.max_flagged_posts,
|
||||
flagged_by_users:
|
||||
this.get("num_flagged_by_users") <= this.get("max_flagged_by_users"),
|
||||
likes_given: this.get("num_likes_given") >= this.get("min_likes_given"),
|
||||
this.num_flagged_by_users <= this.max_flagged_by_users,
|
||||
likes_given: this.num_likes_given >= this.min_likes_given,
|
||||
likes_received:
|
||||
this.get("num_likes_received") >= this.get("min_likes_received"),
|
||||
this.num_likes_received >= this.min_likes_received,
|
||||
likes_received_days:
|
||||
this.get("num_likes_received_days") >=
|
||||
this.get("min_likes_received_days"),
|
||||
this.num_likes_received_days >=
|
||||
this.min_likes_received_days,
|
||||
likes_received_users:
|
||||
this.get("num_likes_received_users") >=
|
||||
this.get("min_likes_received_users"),
|
||||
level_locked: this.get("trust_level_locked"),
|
||||
this.num_likes_received_users >=
|
||||
this.min_likes_received_users,
|
||||
level_locked: this.trust_level_locked,
|
||||
silenced: this.get("penalty_counts.silenced") === 0,
|
||||
suspended: this.get("penalty_counts.suspended") === 0
|
||||
};
|
||||
|
@ -6,14 +6,14 @@ const WatchedWord = Discourse.Model.extend({
|
||||
"/admin/logs/watched_words" + (this.id ? "/" + this.id : "") + ".json",
|
||||
{
|
||||
type: this.id ? "PUT" : "POST",
|
||||
data: { word: this.get("word"), action_key: this.get("action") },
|
||||
data: { word: this.word, action_key: this.action },
|
||||
dataType: "json"
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
destroy() {
|
||||
return ajax("/admin/logs/watched_words/" + this.get("id") + ".json", {
|
||||
return ajax("/admin/logs/watched_words/" + this.id + ".json", {
|
||||
type: "DELETE"
|
||||
});
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ export default RestModel.extend({
|
||||
|
||||
@observes("group_ids")
|
||||
updateGroupsFilter() {
|
||||
const groupIds = this.get("group_ids");
|
||||
const groupIds = this.group_ids;
|
||||
this.set(
|
||||
"groupsFilterInName",
|
||||
Discourse.Site.currentProp("groups").reduce((groupNames, g) => {
|
||||
@ -61,23 +61,23 @@ export default RestModel.extend({
|
||||
},
|
||||
|
||||
createProperties() {
|
||||
const types = this.get("web_hook_event_types");
|
||||
const categoryIds = this.get("categories").map(c => c.id);
|
||||
const tagNames = this.get("tag_names");
|
||||
const types = this.web_hook_event_types;
|
||||
const categoryIds = this.categories.map(c => c.id);
|
||||
const tagNames = this.tag_names;
|
||||
|
||||
// Hack as {{group-selector}} accepts a comma-separated string as data source, but
|
||||
// we use an array to populate the datasource above.
|
||||
const groupsFilter = this.get("groupsFilterInName");
|
||||
const groupsFilter = this.groupsFilterInName;
|
||||
const groupNames =
|
||||
typeof groupsFilter === "string" ? groupsFilter.split(",") : groupsFilter;
|
||||
|
||||
return {
|
||||
payload_url: this.get("payload_url"),
|
||||
content_type: this.get("content_type"),
|
||||
secret: this.get("secret"),
|
||||
wildcard_web_hook: this.get("wildcard_web_hook"),
|
||||
verify_certificate: this.get("verify_certificate"),
|
||||
active: this.get("active"),
|
||||
payload_url: this.payload_url,
|
||||
content_type: this.content_type,
|
||||
secret: this.secret,
|
||||
wildcard_web_hook: this.wildcard_web_hook,
|
||||
verify_certificate: this.verify_certificate,
|
||||
active: this.active,
|
||||
web_hook_event_type_ids: Ember.isEmpty(types)
|
||||
? [null]
|
||||
: types.map(type => type.id),
|
||||
|
@ -42,7 +42,7 @@ export default Ember.Route.extend({
|
||||
willTransition(transition) {
|
||||
if (
|
||||
this.get("controller.model.changed") &&
|
||||
this.get("shouldAlertUnsavedChanges") &&
|
||||
this.shouldAlertUnsavedChanges &&
|
||||
transition.intent.name !== this.routeName
|
||||
) {
|
||||
transition.abort();
|
||||
|
@ -2,11 +2,11 @@ import IncomingEmail from "admin/models/incoming-email";
|
||||
|
||||
export default Discourse.Route.extend({
|
||||
model() {
|
||||
return IncomingEmail.findAll({ status: this.get("status") });
|
||||
return IncomingEmail.findAll({ status: this.status });
|
||||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
controller.set("model", model);
|
||||
controller.set("filter", { status: this.get("status") });
|
||||
controller.set("filter", { status: this.status });
|
||||
}
|
||||
});
|
||||
|
@ -2,7 +2,7 @@ export default Discourse.Route.extend({
|
||||
setupController(controller) {
|
||||
controller.setProperties({
|
||||
loading: true,
|
||||
filter: { status: this.get("status") }
|
||||
filter: { status: this.status }
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -50,7 +50,7 @@ const Discourse = Ember.Application.extend(FocusEvent, {
|
||||
|
||||
@observes("_docTitle", "hasFocus", "contextCount", "notificationCount")
|
||||
_titleChanged() {
|
||||
let title = this.get("_docTitle") || Discourse.SiteSettings.title;
|
||||
let title = this._docTitle || Discourse.SiteSettings.title;
|
||||
|
||||
// if we change this we can trigger changes on document.title
|
||||
// only set if changed.
|
||||
@ -58,7 +58,7 @@ const Discourse = Ember.Application.extend(FocusEvent, {
|
||||
$("title").text(title);
|
||||
}
|
||||
|
||||
var displayCount = this.get("displayCount");
|
||||
var displayCount = this.displayCount;
|
||||
if (displayCount > 0 && !Discourse.User.currentProp("dynamic_favicon")) {
|
||||
title = `(${displayCount}) ${title}`;
|
||||
}
|
||||
@ -70,8 +70,8 @@ const Discourse = Ember.Application.extend(FocusEvent, {
|
||||
displayCount() {
|
||||
return Discourse.User.current() &&
|
||||
Discourse.User.currentProp("title_count_mode") === "notifications"
|
||||
? this.get("notificationCount")
|
||||
: this.get("contextCount");
|
||||
? this.notificationCount
|
||||
: this.contextCount;
|
||||
},
|
||||
|
||||
@observes("contextCount", "notificationCount")
|
||||
@ -86,7 +86,7 @@ const Discourse = Ember.Application.extend(FocusEvent, {
|
||||
url = Discourse.getURL("/favicon/proxied?" + encodeURIComponent(url));
|
||||
}
|
||||
|
||||
var displayCount = this.get("displayCount");
|
||||
var displayCount = this.displayCount;
|
||||
|
||||
new window.Favcount(url).set(displayCount);
|
||||
}
|
||||
@ -105,26 +105,26 @@ const Discourse = Ember.Application.extend(FocusEvent, {
|
||||
},
|
||||
|
||||
updateNotificationCount(count) {
|
||||
if (!this.get("hasFocus")) {
|
||||
if (!this.hasFocus) {
|
||||
this.set("notificationCount", count);
|
||||
}
|
||||
},
|
||||
|
||||
incrementBackgroundContextCount() {
|
||||
if (!this.get("hasFocus")) {
|
||||
if (!this.hasFocus) {
|
||||
this.set("backgroundNotify", true);
|
||||
this.set("contextCount", (this.get("contextCount") || 0) + 1);
|
||||
this.set("contextCount", (this.contextCount || 0) + 1);
|
||||
}
|
||||
},
|
||||
|
||||
@observes("hasFocus")
|
||||
resetCounts() {
|
||||
if (this.get("hasFocus") && this.get("backgroundNotify")) {
|
||||
if (this.hasFocus && this.backgroundNotify) {
|
||||
this.set("contextCount", 0);
|
||||
}
|
||||
this.set("backgroundNotify", false);
|
||||
|
||||
if (this.get("hasFocus")) {
|
||||
if (this.hasFocus) {
|
||||
this.set("notificationCount", 0);
|
||||
}
|
||||
},
|
||||
@ -198,17 +198,17 @@ const Discourse = Ember.Application.extend(FocusEvent, {
|
||||
|
||||
assetVersion: Ember.computed({
|
||||
get() {
|
||||
return this.get("currentAssetVersion");
|
||||
return this.currentAssetVersion;
|
||||
},
|
||||
set(key, val) {
|
||||
if (val) {
|
||||
if (this.get("currentAssetVersion")) {
|
||||
if (this.currentAssetVersion) {
|
||||
this.set("desiredAssetVersion", val);
|
||||
} else {
|
||||
this.set("currentAssetVersion", val);
|
||||
}
|
||||
}
|
||||
return this.get("currentAssetVersion");
|
||||
return this.currentAssetVersion;
|
||||
}
|
||||
})
|
||||
}).create();
|
||||
|
@ -13,7 +13,7 @@ export default Ember.Component.extend({
|
||||
return;
|
||||
}
|
||||
const slug = this.get("category.fullSlug");
|
||||
const tags = this.get("tags");
|
||||
const tags = this.tags;
|
||||
|
||||
this._removeClass();
|
||||
|
||||
|
@ -29,10 +29,10 @@ export default DropdownSelectBoxComponent.extend({
|
||||
onSelect(id) {
|
||||
switch (id) {
|
||||
case "notYou":
|
||||
this.showToken(this.get("token"));
|
||||
this.showToken(this.token);
|
||||
break;
|
||||
case "logOut":
|
||||
this.revokeAuthToken(this.get("token"));
|
||||
this.revokeAuthToken(this.token);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -11,10 +11,10 @@ export default MountWidget.extend({
|
||||
|
||||
buildArgs() {
|
||||
return {
|
||||
primary_group_flair_url: this.get("flairURL"),
|
||||
primary_group_flair_bg_color: this.get("flairBgColor"),
|
||||
primary_group_flair_color: this.get("flairColor"),
|
||||
primary_group_name: this.get("groupName")
|
||||
primary_group_flair_url: this.flairURL,
|
||||
primary_group_flair_bg_color: this.flairBgColor,
|
||||
primary_group_flair_color: this.flairColor,
|
||||
primary_group_name: this.groupName
|
||||
};
|
||||
}
|
||||
});
|
||||
|
@ -44,13 +44,13 @@ export default Ember.Component.extend({
|
||||
actions: {
|
||||
copyToClipboard() {
|
||||
this._selectAllBackupCodes();
|
||||
this.get("copyBackupCode")(document.execCommand("copy"));
|
||||
this.copyBackupCode(document.execCommand("copy"));
|
||||
}
|
||||
},
|
||||
|
||||
_selectAllBackupCodes() {
|
||||
const $textArea = this.$("#backupCodes");
|
||||
$textArea[0].focus();
|
||||
$textArea[0].setSelectionRange(0, this.get("formattedBackupCodes").length);
|
||||
$textArea[0].setSelectionRange(0, this.formattedBackupCodes.length);
|
||||
}
|
||||
});
|
||||
|
@ -13,7 +13,7 @@ export default Ember.Component.extend({
|
||||
|
||||
@observes("badgeNames")
|
||||
_update() {
|
||||
if (this.get("canReceiveUpdates") === "true")
|
||||
if (this.canReceiveUpdates === "true")
|
||||
this._initializeAutocomplete({ updateData: true });
|
||||
},
|
||||
|
||||
@ -24,10 +24,10 @@ export default Ember.Component.extend({
|
||||
|
||||
self.$("input").autocomplete({
|
||||
allowAny: false,
|
||||
items: _.isArray(this.get("badgeNames"))
|
||||
? this.get("badgeNames")
|
||||
: [this.get("badgeNames")],
|
||||
single: this.get("single"),
|
||||
items: _.isArray(this.badgeNames)
|
||||
? this.badgeNames
|
||||
: [this.badgeNames],
|
||||
single: this.single,
|
||||
updateData: opts && opts.updateData ? opts.updateData : false,
|
||||
onChangeItems: function(items) {
|
||||
selectedBadges = items;
|
||||
|
@ -11,7 +11,7 @@ export default Ember.Component.extend(BadgeSelectController, {
|
||||
save() {
|
||||
this.setProperties({ saved: false, saving: true });
|
||||
|
||||
const badge_id = this.get("selectedUserBadgeId") || 0;
|
||||
const badge_id = this.selectedUserBadgeId || 0;
|
||||
|
||||
ajax(this.get("user.path") + "/preferences/badge_title", {
|
||||
type: "PUT",
|
||||
|
@ -6,7 +6,7 @@ export default Ember.Component.extend({
|
||||
|
||||
@computed("topicList.loaded")
|
||||
loaded() {
|
||||
var topicList = this.get("topicList");
|
||||
var topicList = this.topicList;
|
||||
if (topicList) {
|
||||
return topicList.get("loaded");
|
||||
} else {
|
||||
@ -15,7 +15,7 @@ export default Ember.Component.extend({
|
||||
},
|
||||
|
||||
_topicListChanged: function() {
|
||||
this._initFromTopicList(this.get("topicList"));
|
||||
this._initFromTopicList(this.topicList);
|
||||
}.observes("topicList.[]"),
|
||||
|
||||
_initFromTopicList(topicList) {
|
||||
@ -27,7 +27,7 @@ export default Ember.Component.extend({
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
const topicList = this.get("topicList");
|
||||
const topicList = this.topicList;
|
||||
if (topicList) {
|
||||
this._initFromTopicList(topicList);
|
||||
}
|
||||
@ -58,7 +58,7 @@ export default Ember.Component.extend({
|
||||
}
|
||||
}
|
||||
|
||||
const topic = this.get("topics").findBy("id", parseInt(topicId));
|
||||
const topic = this.topics.findBy("id", parseInt(topicId));
|
||||
this.appEvents.trigger("topic-entrance:show", {
|
||||
topic,
|
||||
position: target.offset()
|
||||
|
@ -51,7 +51,7 @@ export default Ember.Component.extend({
|
||||
return [];
|
||||
}
|
||||
|
||||
return this.get("categories").filter(
|
||||
return this.categories.filter(
|
||||
c => c.get("parentCategory") === firstCategory
|
||||
);
|
||||
}
|
||||
|
@ -7,13 +7,13 @@ export default Ember.Component.extend({
|
||||
showBulkActions() {
|
||||
const controller = showModal("topic-bulk-actions", {
|
||||
model: {
|
||||
topics: this.get("selected"),
|
||||
category: this.get("category")
|
||||
topics: this.selected,
|
||||
category: this.category
|
||||
},
|
||||
title: "topics.bulk.actions"
|
||||
});
|
||||
|
||||
const action = this.get("action");
|
||||
const action = this.action;
|
||||
if (action) {
|
||||
controller.set("refreshClosure", () => action());
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ export default Ember.Component.extend({
|
||||
|
||||
@computed("categories.[].uploaded_logo.url")
|
||||
anyLogos() {
|
||||
return this.get("categories").any(c => {
|
||||
return this.categories.any(c => {
|
||||
return !Ember.isEmpty(c.get("uploaded_logo.url"));
|
||||
});
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user