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