mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 04:34:32 +08:00
DEV: apply new coding standards (#10592)
This commit is contained in:
parent
80dfaeb0d2
commit
52672b9eab
|
@ -1,23 +1,18 @@
|
|||
// discourse-skip-module
|
||||
(function() {
|
||||
setTimeout(function() {
|
||||
(function () {
|
||||
setTimeout(function () {
|
||||
const $activateButton = $("#activate-account-button");
|
||||
$activateButton.on("click", function() {
|
||||
$activateButton.on("click", function () {
|
||||
$activateButton.prop("disabled", true);
|
||||
const hpPath = document.getElementById("data-activate-account").dataset
|
||||
.path;
|
||||
$.ajax(hpPath)
|
||||
.then(function(hp) {
|
||||
.then(function (hp) {
|
||||
$("#password_confirmation").val(hp.value);
|
||||
$("#challenge").val(
|
||||
hp.challenge
|
||||
.split("")
|
||||
.reverse()
|
||||
.join("")
|
||||
);
|
||||
$("#challenge").val(hp.challenge.split("").reverse().join(""));
|
||||
$("#activate-account-form").submit();
|
||||
})
|
||||
.fail(function() {
|
||||
.fail(function () {
|
||||
$activateButton.prop("disabled", false);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -9,5 +9,5 @@ export default RESTAdapter.extend({
|
|||
|
||||
apiNameFor() {
|
||||
return "key";
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -6,6 +6,6 @@ export default function buildPluginAdapter(pluginName) {
|
|||
return (
|
||||
"/admin/plugins/" + pluginName + this._super(store, type, findArgs)
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
@ -3,5 +3,5 @@ import RestAdapter from "discourse/adapters/rest";
|
|||
export default RestAdapter.extend({
|
||||
basePath() {
|
||||
return "/admin/customize/";
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -3,5 +3,5 @@ import RestAdapter from "discourse/adapters/rest";
|
|||
export default RestAdapter.extend({
|
||||
pathFor() {
|
||||
return "/admin/customize/email_style";
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -3,5 +3,5 @@ import RestAdapter from "discourse/adapters/rest";
|
|||
export default RestAdapter.extend({
|
||||
pathFor() {
|
||||
return "/admin/customize/embedding";
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -3,5 +3,5 @@ import RestAdapter from "discourse/adapters/rest";
|
|||
export default RestAdapter.extend({
|
||||
basePath() {
|
||||
return "/admin/logs/";
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import RestAdapter from "discourse/adapters/rest";
|
||||
|
||||
export default RestAdapter.extend({
|
||||
jsonMode: true
|
||||
jsonMode: true,
|
||||
});
|
||||
|
|
|
@ -7,20 +7,20 @@ export default RestAdapter.extend({
|
|||
|
||||
afterFindAll(results) {
|
||||
let map = {};
|
||||
results.forEach(theme => {
|
||||
results.forEach((theme) => {
|
||||
map[theme.id] = theme;
|
||||
});
|
||||
results.forEach(theme => {
|
||||
results.forEach((theme) => {
|
||||
let mapped = theme.get("child_themes") || [];
|
||||
mapped = mapped.map(t => map[t.id]);
|
||||
mapped = mapped.map((t) => map[t.id]);
|
||||
theme.set("childThemes", mapped);
|
||||
|
||||
let mappedParents = theme.get("parent_themes") || [];
|
||||
mappedParents = mappedParents.map(t => map[t.id]);
|
||||
mappedParents = mappedParents.map((t) => map[t.id]);
|
||||
theme.set("parentThemes", mappedParents);
|
||||
});
|
||||
return results;
|
||||
},
|
||||
|
||||
jsonMode: true
|
||||
jsonMode: true,
|
||||
});
|
||||
|
|
|
@ -3,5 +3,5 @@ import RESTAdapter from "discourse/adapters/rest";
|
|||
export default RESTAdapter.extend({
|
||||
basePath() {
|
||||
return "/admin/api/";
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -3,5 +3,5 @@ import RESTAdapter from "discourse/adapters/rest";
|
|||
export default RESTAdapter.extend({
|
||||
basePath() {
|
||||
return "/admin/api/";
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -37,7 +37,7 @@ export default Component.extend({
|
|||
placeholderChanged() {
|
||||
if (this._editor) {
|
||||
this._editor.setOptions({
|
||||
placeholder: this.placeholder
|
||||
placeholder: this.placeholder,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -54,13 +54,13 @@ export default Component.extend({
|
|||
editor.setOptions({
|
||||
readOnly: disabled,
|
||||
highlightActiveLine: !disabled,
|
||||
highlightGutterLine: !disabled
|
||||
highlightGutterLine: !disabled,
|
||||
});
|
||||
editor.container.parentNode.setAttribute("data-disabled", disabled);
|
||||
}
|
||||
},
|
||||
|
||||
_destroyEditor: on("willDestroyElement", function() {
|
||||
_destroyEditor: on("willDestroyElement", function () {
|
||||
if (this._editor) {
|
||||
this._editor.destroy();
|
||||
this._editor = null;
|
||||
|
@ -82,7 +82,7 @@ export default Component.extend({
|
|||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
loadScript("/javascripts/ace/ace.js?v=1.4.12").then(() => {
|
||||
window.ace.require(["ace/ace"], loadedAce => {
|
||||
window.ace.require(["ace/ace"], (loadedAce) => {
|
||||
loadedAce.config.set("loadWorkerFromBlob", false);
|
||||
loadedAce.config.set("workerPath", getURL("/javascripts/ace")); // Do not use CDN for workers
|
||||
|
||||
|
@ -129,6 +129,6 @@ export default Component.extend({
|
|||
this._editor.focus();
|
||||
this._editor.navigateFileEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -35,7 +35,7 @@ export default Component.extend({
|
|||
|
||||
@on("init")
|
||||
@observes("logs.[]")
|
||||
_updateFormattedLogs: discourseDebounce(function() {
|
||||
_updateFormattedLogs: discourseDebounce(function () {
|
||||
const logs = this.logs;
|
||||
if (logs.length === 0) return;
|
||||
|
||||
|
@ -49,7 +49,7 @@ export default Component.extend({
|
|||
// update the formatted logs & cache index
|
||||
this.setProperties({
|
||||
formattedLogs: formattedLogs,
|
||||
index: logs.length
|
||||
index: logs.length,
|
||||
});
|
||||
// force rerender
|
||||
this.renderLogs();
|
||||
|
@ -70,5 +70,5 @@ export default Component.extend({
|
|||
} else {
|
||||
this.set("showLoadingSpinner", false);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -19,6 +19,6 @@ export default Component.extend({
|
|||
save() {
|
||||
// Action has to toggle 'editing' property.
|
||||
this.action(this.buffer);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Component from "@ember/component";
|
||||
export default Component.extend({
|
||||
classNames: ["row"]
|
||||
classNames: ["row"],
|
||||
});
|
||||
|
|
|
@ -11,15 +11,15 @@ export default Component.extend({
|
|||
const rawData = this.get("model.data");
|
||||
|
||||
var data = {
|
||||
labels: rawData.map(r => r.x),
|
||||
labels: rawData.map((r) => r.x),
|
||||
datasets: [
|
||||
{
|
||||
data: rawData.map(r => r.y),
|
||||
data: rawData.map((r) => r.y),
|
||||
label: model.get("title"),
|
||||
backgroundColor: `rgba(200,220,240,${this.type === "bar" ? 1 : 0.3})`,
|
||||
borderColor: "#08C"
|
||||
}
|
||||
]
|
||||
borderColor: "#08C",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const config = {
|
||||
|
@ -29,21 +29,21 @@ export default Component.extend({
|
|||
responsive: true,
|
||||
tooltips: {
|
||||
callbacks: {
|
||||
title: context =>
|
||||
moment(context[0].xLabel, "YYYY-MM-DD").format("LL")
|
||||
}
|
||||
title: (context) =>
|
||||
moment(context[0].xLabel, "YYYY-MM-DD").format("LL"),
|
||||
},
|
||||
},
|
||||
scales: {
|
||||
yAxes: [
|
||||
{
|
||||
display: true,
|
||||
ticks: {
|
||||
stepSize: 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
stepSize: 1,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
this._chart = new window.Chart(ctx, config);
|
||||
|
@ -53,5 +53,5 @@ export default Component.extend({
|
|||
loadScript("/javascripts/Chart.min.js").then(() =>
|
||||
this.refreshChart.apply(this)
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Component from "@ember/component";
|
||||
export default Component.extend({
|
||||
tagName: ""
|
||||
tagName: "",
|
||||
});
|
||||
|
|
|
@ -59,13 +59,13 @@ export default Component.extend({
|
|||
model.get("prevChartData") || model.get("prev_data")
|
||||
);
|
||||
|
||||
const labels = chartData.map(d => d.x);
|
||||
const labels = chartData.map((d) => d.x);
|
||||
|
||||
const data = {
|
||||
labels,
|
||||
datasets: [
|
||||
{
|
||||
data: chartData.map(d => Math.round(parseFloat(d.y))),
|
||||
data: chartData.map((d) => Math.round(parseFloat(d.y))),
|
||||
backgroundColor: prevChartData.length
|
||||
? "transparent"
|
||||
: model.secondary_color,
|
||||
|
@ -73,19 +73,19 @@ export default Component.extend({
|
|||
pointRadius: 3,
|
||||
borderWidth: 1,
|
||||
pointBackgroundColor: model.primary_color,
|
||||
pointBorderColor: model.primary_color
|
||||
}
|
||||
]
|
||||
pointBorderColor: model.primary_color,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
if (prevChartData.length) {
|
||||
data.datasets.push({
|
||||
data: prevChartData.map(d => Math.round(parseFloat(d.y))),
|
||||
data: prevChartData.map((d) => Math.round(parseFloat(d.y))),
|
||||
borderColor: model.primary_color,
|
||||
borderDash: [5, 5],
|
||||
backgroundColor: "transparent",
|
||||
borderWidth: 1,
|
||||
pointRadius: 0
|
||||
pointRadius: 0,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -110,41 +110,41 @@ export default Component.extend({
|
|||
options: {
|
||||
tooltips: {
|
||||
callbacks: {
|
||||
title: tooltipItem =>
|
||||
moment(tooltipItem[0].xLabel, "YYYY-MM-DD").format("LL")
|
||||
}
|
||||
title: (tooltipItem) =>
|
||||
moment(tooltipItem[0].xLabel, "YYYY-MM-DD").format("LL"),
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
display: false
|
||||
display: false,
|
||||
},
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
responsiveAnimationDuration: 0,
|
||||
animation: {
|
||||
duration: 0
|
||||
duration: 0,
|
||||
},
|
||||
layout: {
|
||||
padding: {
|
||||
left: 0,
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0
|
||||
}
|
||||
bottom: 0,
|
||||
},
|
||||
},
|
||||
scales: {
|
||||
yAxes: [
|
||||
{
|
||||
display: true,
|
||||
ticks: {
|
||||
userCallback: label => {
|
||||
userCallback: (label) => {
|
||||
if (Math.floor(label) === label) return label;
|
||||
},
|
||||
callback: label => number(label),
|
||||
callback: (label) => number(label),
|
||||
sampleSize: 5,
|
||||
maxRotation: 25,
|
||||
minRotation: 25
|
||||
}
|
||||
}
|
||||
minRotation: 25,
|
||||
},
|
||||
},
|
||||
],
|
||||
xAxes: [
|
||||
{
|
||||
|
@ -152,17 +152,17 @@ export default Component.extend({
|
|||
gridLines: { display: false },
|
||||
type: "time",
|
||||
time: {
|
||||
unit: this._unitForGrouping(options)
|
||||
unit: this._unitForGrouping(options),
|
||||
},
|
||||
ticks: {
|
||||
sampleSize: 5,
|
||||
maxRotation: 50,
|
||||
minRotation: 50
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
minRotation: 50,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -192,11 +192,11 @@ export default Component.extend({
|
|||
const transformedData = [
|
||||
{
|
||||
x: currentStart.format("YYYY-MM-DD"),
|
||||
y: 0
|
||||
}
|
||||
y: 0,
|
||||
},
|
||||
];
|
||||
|
||||
data.forEach(d => {
|
||||
data.forEach((d) => {
|
||||
let date = moment(d.x, "YYYY-MM-DD");
|
||||
|
||||
if (!date.isBetween(currentStart, currentEnd)) {
|
||||
|
@ -210,7 +210,7 @@ export default Component.extend({
|
|||
} else {
|
||||
transformedData[currentIndex] = {
|
||||
x: d.x,
|
||||
y: d.y
|
||||
y: d.y,
|
||||
};
|
||||
}
|
||||
});
|
||||
|
@ -231,5 +231,5 @@ export default Component.extend({
|
|||
default:
|
||||
return "day";
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -2,5 +2,5 @@ import Component from "@ember/component";
|
|||
export default Component.extend({
|
||||
classNames: ["admin-report-counters"],
|
||||
|
||||
attributeBindings: ["model.description:title"]
|
||||
attributeBindings: ["model.description:title"],
|
||||
});
|
||||
|
|
|
@ -7,5 +7,5 @@ export default Component.extend({
|
|||
"report.type",
|
||||
/^(time_to_first_response|topics_with_no_response)$/
|
||||
),
|
||||
classNameBindings: ["reverseColors"]
|
||||
classNameBindings: ["reverseColors"],
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Component from "@ember/component";
|
||||
export default Component.extend({
|
||||
classNames: ["admin-report-inline-table"]
|
||||
classNames: ["admin-report-inline-table"],
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Component from "@ember/component";
|
||||
export default Component.extend({
|
||||
tagName: "tr"
|
||||
tagName: "tr",
|
||||
});
|
||||
|
|
|
@ -56,14 +56,14 @@ export default Component.extend({
|
|||
|
||||
const data = {
|
||||
labels: chartData[0].data.mapBy("x"),
|
||||
datasets: chartData.map(cd => {
|
||||
datasets: chartData.map((cd) => {
|
||||
return {
|
||||
label: cd.label,
|
||||
stack: "pageviews-stack",
|
||||
data: cd.data.map(d => Math.round(parseFloat(d.y))),
|
||||
backgroundColor: cd.color
|
||||
data: cd.data.map((d) => Math.round(parseFloat(d.y))),
|
||||
backgroundColor: cd.color,
|
||||
};
|
||||
})
|
||||
}),
|
||||
};
|
||||
|
||||
loadScript("/javascripts/Chart.min.js").then(() => {
|
||||
|
@ -83,30 +83,30 @@ export default Component.extend({
|
|||
responsiveAnimationDuration: 0,
|
||||
hover: { mode: "index" },
|
||||
animation: {
|
||||
duration: 0
|
||||
duration: 0,
|
||||
},
|
||||
tooltips: {
|
||||
mode: "index",
|
||||
intersect: false,
|
||||
callbacks: {
|
||||
beforeFooter: tooltipItem => {
|
||||
beforeFooter: (tooltipItem) => {
|
||||
let total = 0;
|
||||
tooltipItem.forEach(
|
||||
item => (total += parseInt(item.yLabel || 0, 10))
|
||||
(item) => (total += parseInt(item.yLabel || 0, 10))
|
||||
);
|
||||
return `= ${total}`;
|
||||
},
|
||||
title: tooltipItem =>
|
||||
moment(tooltipItem[0].xLabel, "YYYY-MM-DD").format("LL")
|
||||
}
|
||||
title: (tooltipItem) =>
|
||||
moment(tooltipItem[0].xLabel, "YYYY-MM-DD").format("LL"),
|
||||
},
|
||||
},
|
||||
layout: {
|
||||
padding: {
|
||||
left: 0,
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0
|
||||
}
|
||||
bottom: 0,
|
||||
},
|
||||
},
|
||||
scales: {
|
||||
yAxes: [
|
||||
|
@ -114,15 +114,15 @@ export default Component.extend({
|
|||
stacked: true,
|
||||
display: true,
|
||||
ticks: {
|
||||
userCallback: label => {
|
||||
userCallback: (label) => {
|
||||
if (Math.floor(label) === label) return label;
|
||||
},
|
||||
callback: label => number(label),
|
||||
callback: (label) => number(label),
|
||||
sampleSize: 5,
|
||||
maxRotation: 25,
|
||||
minRotation: 25
|
||||
}
|
||||
}
|
||||
minRotation: 25,
|
||||
},
|
||||
},
|
||||
],
|
||||
xAxes: [
|
||||
{
|
||||
|
@ -132,17 +132,17 @@ export default Component.extend({
|
|||
offset: true,
|
||||
time: {
|
||||
parser: "YYYY-MM-DD",
|
||||
minUnit: "day"
|
||||
minUnit: "day",
|
||||
},
|
||||
ticks: {
|
||||
sampleSize: 5,
|
||||
maxRotation: 50,
|
||||
minRotation: 50
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
minRotation: 50,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -151,5 +151,5 @@ export default Component.extend({
|
|||
this._chart.destroy();
|
||||
this._chart = null;
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -39,5 +39,5 @@ export default Component.extend({
|
|||
@discourseComputed("uploadStats.free_bytes")
|
||||
freeUploadSpace(bytes) {
|
||||
return I18n.toHumanSize(bytes);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -16,5 +16,5 @@ export default Component.extend({
|
|||
type: alias("label.type"),
|
||||
property: alias("label.mainProperty"),
|
||||
formatedValue: alias("computedLabel.formatedValue"),
|
||||
value: alias("computedLabel.value")
|
||||
value: alias("computedLabel.value"),
|
||||
});
|
||||
|
|
|
@ -15,5 +15,5 @@ export default Component.extend({
|
|||
@discourseComputed("currentSortDirection")
|
||||
sortIcon(currentSortDirection) {
|
||||
return currentSortDirection === 1 ? "caret-up" : "caret-down";
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -2,5 +2,5 @@ import Component from "@ember/component";
|
|||
export default Component.extend({
|
||||
tagName: "tr",
|
||||
classNames: ["admin-report-table-row"],
|
||||
options: null
|
||||
options: null,
|
||||
});
|
||||
|
|
|
@ -26,7 +26,7 @@ export default Component.extend({
|
|||
showTotalForSample(totalsForSample, total, datesFiltering) {
|
||||
// check if we have at least one cell which contains a value
|
||||
const sum = totalsForSample
|
||||
.map(t => t.value)
|
||||
.map((t) => t.value)
|
||||
.compact()
|
||||
.reduce((s, v) => s + v, 0);
|
||||
|
||||
|
@ -64,7 +64,7 @@ export default Component.extend({
|
|||
|
||||
@discourseComputed("totalsForSampleRow", "model.computedLabels")
|
||||
totalsForSample(row, labels) {
|
||||
return labels.map(label => {
|
||||
return labels.map((label) => {
|
||||
const computedLabel = label.compute(row);
|
||||
computedLabel.type = label.type;
|
||||
computedLabel.property = label.mainProperty;
|
||||
|
@ -78,7 +78,7 @@ export default Component.extend({
|
|||
|
||||
let totalsRow = {};
|
||||
|
||||
labels.forEach(label => {
|
||||
labels.forEach((label) => {
|
||||
const reducer = (sum, row) => {
|
||||
const computedLabel = label.compute(row);
|
||||
const value = computedLabel.value;
|
||||
|
@ -137,11 +137,11 @@ export default Component.extend({
|
|||
pagesIndexes.push(i);
|
||||
}
|
||||
|
||||
let pages = pagesIndexes.map(v => {
|
||||
let pages = pagesIndexes.map((v) => {
|
||||
return {
|
||||
page: v + 1,
|
||||
index: v,
|
||||
class: v === page ? "is-current" : null
|
||||
class: v === page ? "is-current" : null,
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -165,6 +165,6 @@ export default Component.extend({
|
|||
} else {
|
||||
this.set("sortLabel", label);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Component from "@ember/component";
|
||||
export default Component.extend({
|
||||
tagName: "tr"
|
||||
tagName: "tr",
|
||||
});
|
||||
|
|
|
@ -16,7 +16,7 @@ const TABLE_OPTIONS = {
|
|||
perPage: 8,
|
||||
total: true,
|
||||
limit: 20,
|
||||
formatNumbers: true
|
||||
formatNumbers: true,
|
||||
};
|
||||
|
||||
const CHART_OPTIONS = {};
|
||||
|
@ -46,7 +46,7 @@ export default Component.extend({
|
|||
"isVisible",
|
||||
"isEnabled",
|
||||
"isLoading",
|
||||
"dasherizedDataSourceName"
|
||||
"dasherizedDataSourceName",
|
||||
],
|
||||
classNames: ["admin-report"],
|
||||
isEnabled: true,
|
||||
|
@ -75,14 +75,14 @@ export default Component.extend({
|
|||
this._reports = [];
|
||||
},
|
||||
|
||||
isHidden: computed("siteSettings.dashboard_hidden_reports", function() {
|
||||
isHidden: computed("siteSettings.dashboard_hidden_reports", function () {
|
||||
return (this.siteSettings.dashboard_hidden_reports || "")
|
||||
.split("|")
|
||||
.filter(Boolean)
|
||||
.includes(this.dataSourceName);
|
||||
}),
|
||||
|
||||
startDate: computed("filters.startDate", function() {
|
||||
startDate: computed("filters.startDate", function () {
|
||||
if (this.filters && isPresent(this.filters.startDate)) {
|
||||
return moment(this.filters.startDate, "YYYY-MM-DD");
|
||||
} else {
|
||||
|
@ -90,7 +90,7 @@ export default Component.extend({
|
|||
}
|
||||
}),
|
||||
|
||||
endDate: computed("filters.endDate", function() {
|
||||
endDate: computed("filters.endDate", function () {
|
||||
if (this.filters && isPresent(this.filters.endDate)) {
|
||||
return moment(this.filters.endDate, "YYYY-MM-DD");
|
||||
} else {
|
||||
|
@ -139,7 +139,7 @@ export default Component.extend({
|
|||
@action
|
||||
changeGrouping(grouping) {
|
||||
this.send("refreshReport", {
|
||||
chartGrouping: grouping
|
||||
chartGrouping: grouping,
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -147,14 +147,14 @@ export default Component.extend({
|
|||
displayedModes(currentMode, reportModes, forcedModes) {
|
||||
const modes = forcedModes ? forcedModes.split(",") : reportModes;
|
||||
|
||||
return makeArray(modes).map(mode => {
|
||||
return makeArray(modes).map((mode) => {
|
||||
const base = `btn-default mode-btn ${mode}`;
|
||||
const cssClass = currentMode === mode ? `${base} is-current` : base;
|
||||
|
||||
return {
|
||||
mode,
|
||||
cssClass,
|
||||
icon: mode === "table" ? "table" : "signal"
|
||||
icon: mode === "table" ? "table" : "signal",
|
||||
};
|
||||
});
|
||||
},
|
||||
|
@ -187,10 +187,10 @@ export default Component.extend({
|
|||
customFilters
|
||||
? JSON.stringify(customFilters, (k, v) => (k ? `${v}` : v))
|
||||
: null,
|
||||
SCHEMA_VERSION
|
||||
SCHEMA_VERSION,
|
||||
]
|
||||
.filter(x => x)
|
||||
.map(x => x.toString())
|
||||
.filter((x) => x)
|
||||
.map((x) => x.toString())
|
||||
.join(":");
|
||||
|
||||
return reportKey;
|
||||
|
@ -200,11 +200,11 @@ export default Component.extend({
|
|||
chartGroupings(chartGrouping) {
|
||||
chartGrouping = chartGrouping || "daily";
|
||||
|
||||
return ["daily", "weekly", "monthly"].map(id => {
|
||||
return ["daily", "weekly", "monthly"].map((id) => {
|
||||
return {
|
||||
id,
|
||||
label: `admin.dashboard.reports.${id}`,
|
||||
class: `chart-grouping ${chartGrouping === id ? "active" : "inactive"}`
|
||||
class: `chart-grouping ${chartGrouping === id ? "active" : "inactive"}`,
|
||||
};
|
||||
});
|
||||
},
|
||||
|
@ -213,7 +213,7 @@ export default Component.extend({
|
|||
onChangeDateRange(range) {
|
||||
this.send("refreshReport", {
|
||||
startDate: range.from,
|
||||
endDate: range.to
|
||||
endDate: range.to,
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -228,7 +228,7 @@ export default Component.extend({
|
|||
}
|
||||
|
||||
this.send("refreshReport", {
|
||||
filters: customFilters
|
||||
filters: customFilters,
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -250,7 +250,7 @@ export default Component.extend({
|
|||
filters:
|
||||
typeof options.filters === "undefined"
|
||||
? this.get("filters.customFilters")
|
||||
: options.filters
|
||||
: options.filters,
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -259,7 +259,7 @@ export default Component.extend({
|
|||
const args = {
|
||||
name: this.get("model.type"),
|
||||
start_date: this.startDate.toISOString(true).split("T")[0],
|
||||
end_date: this.endDate.toISOString(true).split("T")[0]
|
||||
end_date: this.endDate.toISOString(true).split("T")[0],
|
||||
};
|
||||
|
||||
const customFilters = this.get("filters.customFilters");
|
||||
|
@ -275,7 +275,7 @@ export default Component.extend({
|
|||
this.set("currentMode", mode);
|
||||
|
||||
this.send("refreshReport", {
|
||||
chartGrouping: null
|
||||
chartGrouping: null,
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -295,7 +295,7 @@ export default Component.extend({
|
|||
let filteredReports = this._reports.uniqBy("report_key");
|
||||
let report;
|
||||
|
||||
const sort = r => {
|
||||
const sort = (r) => {
|
||||
if (r.length > 1) {
|
||||
return r.findBy("type", this.dataSourceName);
|
||||
} else {
|
||||
|
@ -307,7 +307,7 @@ export default Component.extend({
|
|||
report = sort(filteredReports)[0];
|
||||
} else {
|
||||
report = sort(
|
||||
filteredReports.filter(r => r.report_key.includes(this.reportKey))
|
||||
filteredReports.filter((r) => r.report_key.includes(this.reportKey))
|
||||
)[0];
|
||||
|
||||
if (!report) return;
|
||||
|
@ -327,7 +327,7 @@ export default Component.extend({
|
|||
this.setProperties({
|
||||
model: report,
|
||||
currentMode,
|
||||
options: this._buildOptions(currentMode)
|
||||
options: this._buildOptions(currentMode),
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -339,7 +339,7 @@ export default Component.extend({
|
|||
next(() => {
|
||||
let payload = this._buildPayload(["prev_period"]);
|
||||
|
||||
const callback = response => {
|
||||
const callback = (response) => {
|
||||
if (!this.element || this.isDestroying || this.isDestroyed) {
|
||||
return;
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ export default Component.extend({
|
|||
const chartOptions = JSON.parse(JSON.stringify(CHART_OPTIONS));
|
||||
return EmberObject.create(
|
||||
Object.assign(chartOptions, this.get("reportOptions.chart") || {}, {
|
||||
chartGrouping: this.get("reportOptions.chartGrouping")
|
||||
chartGrouping: this.get("reportOptions.chartGrouping"),
|
||||
})
|
||||
);
|
||||
}
|
||||
|
@ -409,13 +409,13 @@ export default Component.extend({
|
|||
Report.fillMissingDates(jsonReport, { filledField: "chartData" });
|
||||
|
||||
if (jsonReport.chartData && jsonReport.modes[0] === "stacked_chart") {
|
||||
jsonReport.chartData = jsonReport.chartData.map(chartData => {
|
||||
jsonReport.chartData = jsonReport.chartData.map((chartData) => {
|
||||
if (chartData.length > 40) {
|
||||
return {
|
||||
data: collapseWeekly(chartData.data),
|
||||
req: chartData.req,
|
||||
label: chartData.label,
|
||||
color: chartData.color
|
||||
color: chartData.color,
|
||||
};
|
||||
} else {
|
||||
return chartData;
|
||||
|
@ -433,7 +433,7 @@ export default Component.extend({
|
|||
filledField: "prevChartData",
|
||||
dataField: "prev_data",
|
||||
starDate: jsonReport.prev_startDate,
|
||||
endDate: jsonReport.prev_endDate
|
||||
endDate: jsonReport.prev_endDate,
|
||||
});
|
||||
|
||||
if (jsonReport.prevChartData && jsonReport.prevChartData.length > 40) {
|
||||
|
@ -445,5 +445,5 @@ export default Component.extend({
|
|||
}
|
||||
|
||||
return Report.create(jsonReport);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@ import { fmt } from "discourse/lib/computed";
|
|||
export default Component.extend({
|
||||
@discourseComputed("theme.targets", "onlyOverridden", "showAdvanced")
|
||||
visibleTargets(targets, onlyOverridden, showAdvanced) {
|
||||
return targets.filter(target => {
|
||||
return targets.filter((target) => {
|
||||
if (target.advanced && !showAdvanced) {
|
||||
return false;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ export default Component.extend({
|
|||
visibleFields(targetName, onlyOverridden, fields) {
|
||||
fields = fields[targetName];
|
||||
if (onlyOverridden) {
|
||||
fields = fields.filter(field => field.edited);
|
||||
fields = fields.filter((field) => field.edited);
|
||||
}
|
||||
return fields;
|
||||
},
|
||||
|
@ -50,7 +50,7 @@ export default Component.extend({
|
|||
set(value, fieldName, target, model) {
|
||||
model.setField(target, fieldName, value);
|
||||
return value;
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
editorId: fmt("fieldName", "currentTargetName", "%@|%@"),
|
||||
|
@ -62,7 +62,7 @@ export default Component.extend({
|
|||
|
||||
@discourseComputed("currentTargetName", "theme.targets")
|
||||
showAddField(currentTargetName, targets) {
|
||||
return targets.find(t => t.name === currentTargetName).customNames;
|
||||
return targets.find((t) => t.name === currentTargetName).customNames;
|
||||
},
|
||||
|
||||
@discourseComputed(
|
||||
|
@ -95,13 +95,13 @@ export default Component.extend({
|
|||
this.fieldAdded(this.currentTargetName, name);
|
||||
},
|
||||
|
||||
toggleMaximize: function() {
|
||||
toggleMaximize: function () {
|
||||
this.toggleProperty("maximized");
|
||||
next(() => this.appEvents.trigger("ace:resize"));
|
||||
},
|
||||
|
||||
onlyOverriddenChanged(value) {
|
||||
this.onlyOverriddenChanged(value);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -10,7 +10,7 @@ import { propertyEqual } from "discourse/lib/computed";
|
|||
import { i18n } from "discourse/lib/computed";
|
||||
import discourseComputed, {
|
||||
observes,
|
||||
on
|
||||
on,
|
||||
} from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend(bufferedProperty("userField"), {
|
||||
|
@ -103,6 +103,6 @@ export default Component.extend(bufferedProperty("userField"), {
|
|||
this.rollbackBuffer();
|
||||
this.set("editing", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -19,12 +19,12 @@ export default Component.extend({
|
|||
.then(() => {
|
||||
this.action(this.word);
|
||||
})
|
||||
.catch(e => {
|
||||
.catch((e) => {
|
||||
bootbox.alert(
|
||||
I18n.t("generic_error_with_reason", {
|
||||
error: `http: ${e.status} - ${e.body}`
|
||||
error: `http: ${e.status} - ${e.body}`,
|
||||
})
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -19,7 +19,7 @@ export default Component.extend({
|
|||
|
||||
@discourseComputed("model.[]", "typeName")
|
||||
eventTypeExists(eventTypes, typeName) {
|
||||
return eventTypes.any(event => event.name === typeName);
|
||||
return eventTypes.any((event) => event.name === typeName);
|
||||
},
|
||||
|
||||
@discourseComputed("eventTypeExists")
|
||||
|
@ -36,12 +36,12 @@ export default Component.extend({
|
|||
model.addObject(type);
|
||||
} else {
|
||||
model.removeObjects(
|
||||
model.filter(eventType => eventType.name === type.name)
|
||||
model.filter((eventType) => eventType.name === type.name)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -54,7 +54,7 @@ export default Component.extend({
|
|||
I18n.t("admin.web_hooks.events.redeliver_confirm"),
|
||||
I18n.t("no_value"),
|
||||
I18n.t("yes_value"),
|
||||
result => {
|
||||
(result) => {
|
||||
if (result) {
|
||||
ajax(
|
||||
`/admin/api/web_hooks/${this.get(
|
||||
|
@ -62,7 +62,7 @@ export default Component.extend({
|
|||
)}/events/${this.get("model.id")}/redeliver`,
|
||||
{ type: "POST" }
|
||||
)
|
||||
.then(json => {
|
||||
.then((json) => {
|
||||
this.set("model", json.web_hook_event);
|
||||
})
|
||||
.catch(popupAjaxError);
|
||||
|
@ -78,7 +78,7 @@ export default Component.extend({
|
|||
let headers = Object.assign(
|
||||
{
|
||||
"Request URL": this.get("model.request_url"),
|
||||
"Request method": "POST"
|
||||
"Request method": "POST",
|
||||
},
|
||||
ensureJSON(this.get("model.headers"))
|
||||
);
|
||||
|
@ -86,7 +86,7 @@ export default Component.extend({
|
|||
headers: plainJSON(headers),
|
||||
body: prettyJSON(this.get("model.payload")),
|
||||
expandDetails: expandDetailsKey,
|
||||
bodyLabel: I18n.t("admin.web_hooks.events.payload")
|
||||
bodyLabel: I18n.t("admin.web_hooks.events.payload"),
|
||||
});
|
||||
} else {
|
||||
this.set("expandDetails", null);
|
||||
|
@ -101,11 +101,11 @@ export default Component.extend({
|
|||
headers: plainJSON(this.get("model.response_headers")),
|
||||
body: this.get("model.response_body"),
|
||||
expandDetails: expandDetailsKey,
|
||||
bodyLabel: I18n.t("admin.web_hooks.events.body")
|
||||
bodyLabel: I18n.t("admin.web_hooks.events.body"),
|
||||
});
|
||||
} else {
|
||||
this.set("expandDetails", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -11,7 +11,7 @@ export default Component.extend({
|
|||
|
||||
@discourseComputed("deliveryStatuses", "model.last_delivery_status")
|
||||
status(deliveryStatuses, lastDeliveryStatus) {
|
||||
return deliveryStatuses.find(s => s.id === lastDeliveryStatus);
|
||||
return deliveryStatuses.find((s) => s.id === lastDeliveryStatus);
|
||||
},
|
||||
|
||||
@discourseComputed("status.id", "icons")
|
||||
|
@ -34,5 +34,5 @@ export default Component.extend({
|
|||
"deliveryStatus",
|
||||
I18n.t(`admin.web_hooks.delivery_status.${this.get("status.name")}`)
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -8,5 +8,5 @@ export default Component.extend({
|
|||
willDestroyElement() {
|
||||
this._super(...arguments);
|
||||
$("body").removeClass("admin-interface");
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Component from "@ember/component";
|
||||
export default Component.extend({
|
||||
tagName: ""
|
||||
tagName: "",
|
||||
});
|
||||
|
|
|
@ -18,7 +18,7 @@ export default Component.extend({
|
|||
|
||||
styleSelection: true,
|
||||
|
||||
maxlength: computed("onlyHex", function() {
|
||||
maxlength: computed("onlyHex", function () {
|
||||
return this.onlyHex ? 6 : null;
|
||||
}),
|
||||
|
||||
|
@ -28,7 +28,7 @@ export default Component.extend({
|
|||
},
|
||||
|
||||
@observes("hexValue", "brightnessValue", "valid")
|
||||
hexValueChanged: function() {
|
||||
hexValueChanged: function () {
|
||||
const hex = this.hexValue;
|
||||
let text = this.element.querySelector("input.hex-input");
|
||||
|
||||
|
@ -47,7 +47,7 @@ export default Component.extend({
|
|||
|
||||
if (this.pickerLoaded) {
|
||||
$(this.element.querySelector(".picker")).spectrum({
|
||||
color: "#" + hex
|
||||
color: "#" + hex,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
@ -69,5 +69,5 @@ export default Component.extend({
|
|||
});
|
||||
});
|
||||
schedule("afterRender", () => this.hexValueChanged());
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -28,18 +28,18 @@ export default Component.extend({
|
|||
set(value, styles, fieldName) {
|
||||
styles.setField(fieldName, value);
|
||||
return value;
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
actions: {
|
||||
reset() {
|
||||
bootbox.confirm(
|
||||
I18n.t("admin.customize.email_style.reset_confirm", {
|
||||
fieldName: I18n.t(`admin.customize.email_style.${this.fieldName}`)
|
||||
fieldName: I18n.t(`admin.customize.email_style.${this.fieldName}`),
|
||||
}),
|
||||
I18n.t("no_value"),
|
||||
I18n.t("yes_value"),
|
||||
result => {
|
||||
(result) => {
|
||||
if (result) {
|
||||
this.styles.setField(
|
||||
this.fieldName,
|
||||
|
@ -49,6 +49,6 @@ export default Component.extend({
|
|||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -60,7 +60,7 @@ export default Component.extend(bufferedProperty("host"), {
|
|||
},
|
||||
|
||||
delete() {
|
||||
bootbox.confirm(I18n.t("admin.embedding.confirm_delete"), result => {
|
||||
bootbox.confirm(I18n.t("admin.embedding.confirm_delete"), (result) => {
|
||||
if (result) {
|
||||
this.host.destroyRecord().then(() => {
|
||||
this.deleteHost(this.host);
|
||||
|
@ -77,6 +77,6 @@ export default Component.extend(bufferedProperty("host"), {
|
|||
this.rollbackBuffer();
|
||||
this.set("editToggled", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -27,6 +27,6 @@ export default Component.extend({
|
|||
set(value) {
|
||||
this.set("value", value);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Component from "@ember/component";
|
||||
export default Component.extend({
|
||||
classNames: ["flag-user-lists"]
|
||||
classNames: ["flag-user-lists"],
|
||||
});
|
||||
|
|
|
@ -7,5 +7,5 @@ export default Component.extend({
|
|||
@observes("code")
|
||||
_refresh() {
|
||||
highlightSyntax(this.element, this.siteSettings, this.session);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -37,6 +37,6 @@ export default Component.extend({
|
|||
finished() {
|
||||
this.set("checked", this.checkedInternal);
|
||||
this.action();
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Component from "@ember/component";
|
||||
export default Component.extend({
|
||||
classNames: ["install-theme-item"]
|
||||
classNames: ["install-theme-item"],
|
||||
});
|
||||
|
|
|
@ -24,7 +24,9 @@ export default Component.extend({
|
|||
this.set("show", true);
|
||||
|
||||
if (!this.location) {
|
||||
ajax("/admin/users/ip-info", { data: { ip: this.ip } }).then(location =>
|
||||
ajax("/admin/users/ip-info", {
|
||||
data: { ip: this.ip },
|
||||
}).then((location) =>
|
||||
this.set("location", EmberObject.create(location))
|
||||
);
|
||||
}
|
||||
|
@ -35,17 +37,17 @@ export default Component.extend({
|
|||
const data = {
|
||||
ip: this.ip,
|
||||
exclude: this.userId,
|
||||
order: "trust_level DESC"
|
||||
order: "trust_level DESC",
|
||||
};
|
||||
|
||||
ajax("/admin/users/total-others-with-same-ip", { data }).then(result =>
|
||||
this.set("totalOthersWithSameIP", result.total)
|
||||
);
|
||||
ajax("/admin/users/total-others-with-same-ip", {
|
||||
data,
|
||||
}).then((result) => this.set("totalOthersWithSameIP", result.total));
|
||||
|
||||
AdminUser.findAll("active", data).then(users => {
|
||||
AdminUser.findAll("active", data).then((users) => {
|
||||
this.setProperties({
|
||||
other_accounts: users,
|
||||
otherAccountsLoading: false
|
||||
otherAccountsLoading: false,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -91,12 +93,12 @@ export default Component.extend({
|
|||
I18n.t("ip_lookup.confirm_delete_other_accounts"),
|
||||
I18n.t("no_value"),
|
||||
I18n.t("yes_value"),
|
||||
confirmed => {
|
||||
(confirmed) => {
|
||||
if (confirmed) {
|
||||
this.setProperties({
|
||||
other_accounts: null,
|
||||
otherAccountsLoading: true,
|
||||
totalOthersWithSameIP: null
|
||||
totalOthersWithSameIP: null,
|
||||
});
|
||||
|
||||
ajax("/admin/users/delete-others-with-same-ip.json", {
|
||||
|
@ -104,12 +106,12 @@ export default Component.extend({
|
|||
data: {
|
||||
ip: this.ip,
|
||||
exclude: this.userId,
|
||||
order: "trust_level DESC"
|
||||
}
|
||||
order: "trust_level DESC",
|
||||
},
|
||||
}).then(() => this.send("lookup"));
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Component from "@ember/component";
|
||||
export default Component.extend({
|
||||
tagName: "tr"
|
||||
tagName: "tr",
|
||||
});
|
||||
|
|
|
@ -13,7 +13,7 @@ export default Component.extend({
|
|||
|
||||
@discourseComputed
|
||||
penaltyActions() {
|
||||
return ACTIONS.map(id => {
|
||||
return ACTIONS.map((id) => {
|
||||
return { id, name: I18n.t(`admin.user.penalty_post_${id}`) };
|
||||
});
|
||||
},
|
||||
|
@ -28,7 +28,7 @@ export default Component.extend({
|
|||
if (postAction === "edit") {
|
||||
this._focusEditTextarea();
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@afterRender
|
||||
|
@ -37,5 +37,5 @@ export default Component.extend({
|
|||
const body = elem.closest(".modal-body");
|
||||
body.scrollTo(0, body.clientHeight);
|
||||
elem.querySelector(".post-editor").focus();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -19,7 +19,7 @@ export default Component.extend({
|
|||
{ id: "post_id", name: I18n.t("admin.permalink.post_id") },
|
||||
{ id: "category_id", name: I18n.t("admin.permalink.category_id") },
|
||||
{ id: "tag_name", name: I18n.t("admin.permalink.tag_name") },
|
||||
{ id: "external_url", name: I18n.t("admin.permalink.external_url") }
|
||||
{ id: "external_url", name: I18n.t("admin.permalink.external_url") },
|
||||
];
|
||||
},
|
||||
|
||||
|
@ -27,7 +27,7 @@ export default Component.extend({
|
|||
this._super(...arguments);
|
||||
|
||||
schedule("afterRender", () => {
|
||||
$(this.element.querySelector(".external-url")).keydown(e => {
|
||||
$(this.element.querySelector(".external-url")).keydown((e) => {
|
||||
// enter key
|
||||
if (e.keyCode === 13) {
|
||||
this.send("submit");
|
||||
|
@ -50,28 +50,28 @@ export default Component.extend({
|
|||
Permalink.create({
|
||||
url: this.url,
|
||||
permalink_type: this.permalinkType,
|
||||
permalink_type_value: this.permalink_type_value
|
||||
permalink_type_value: this.permalink_type_value,
|
||||
})
|
||||
.save()
|
||||
.then(
|
||||
result => {
|
||||
(result) => {
|
||||
this.setProperties({
|
||||
url: "",
|
||||
permalink_type_value: "",
|
||||
formSubmitted: false
|
||||
formSubmitted: false,
|
||||
});
|
||||
|
||||
this.action(Permalink.create(result.permalink));
|
||||
|
||||
this.focusPermalink();
|
||||
},
|
||||
e => {
|
||||
(e) => {
|
||||
this.set("formSubmitted", false);
|
||||
|
||||
let error;
|
||||
if (e.responseJSON && e.responseJSON.errors) {
|
||||
error = I18n.t("generic_error_with_reason", {
|
||||
error: e.responseJSON.errors.join(". ")
|
||||
error: e.responseJSON.errors.join(". "),
|
||||
});
|
||||
} else {
|
||||
error = I18n.t("generic_error");
|
||||
|
@ -84,6 +84,6 @@ export default Component.extend({
|
|||
|
||||
onChangePermalinkType(type) {
|
||||
this.set("permalinkType", type);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -12,5 +12,5 @@ export default FilterComponent.extend({
|
|||
@action
|
||||
onChange() {
|
||||
this.applyFilter(this.filter.id, !this.checked || undefined);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -8,5 +8,5 @@ export default FilterComponent.extend({
|
|||
@action
|
||||
onChange(categoryId) {
|
||||
this.applyFilter(this.filter.id, categoryId || undefined);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -5,5 +5,5 @@ export default Component.extend({
|
|||
@action
|
||||
onChange(value) {
|
||||
this.applyFilter(this.filter.id, value);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -6,7 +6,7 @@ export default FilterComponent.extend({
|
|||
|
||||
@computed
|
||||
get groupOptions() {
|
||||
return (this.site.groups || []).map(group => {
|
||||
return (this.site.groups || []).map((group) => {
|
||||
return { name: group["name"], value: group["id"] };
|
||||
});
|
||||
},
|
||||
|
@ -14,5 +14,5 @@ export default FilterComponent.extend({
|
|||
@computed("filter.default")
|
||||
get groupId() {
|
||||
return this.filter.default ? parseInt(this.filter.default, 10) : null;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -36,8 +36,8 @@ export default Component.extend({
|
|||
maxFiles: 1, // only 1 file at a time
|
||||
headers: {
|
||||
"X-CSRF-Token": document.querySelector("meta[name='csrf-token']")
|
||||
.content
|
||||
}
|
||||
.content,
|
||||
},
|
||||
});
|
||||
|
||||
this.resumable.on("fileAdded", () => {
|
||||
|
@ -51,7 +51,7 @@ export default Component.extend({
|
|||
});
|
||||
});
|
||||
|
||||
this.resumable.on("fileProgress", file => {
|
||||
this.resumable.on("fileProgress", (file) => {
|
||||
// update progress
|
||||
later(() => {
|
||||
this.set("progress", parseInt(file.progress() * 100, 10));
|
||||
|
@ -59,7 +59,7 @@ export default Component.extend({
|
|||
});
|
||||
});
|
||||
|
||||
this.resumable.on("fileSuccess", file => {
|
||||
this.resumable.on("fileSuccess", (file) => {
|
||||
later(() => {
|
||||
// mark as not uploading anymore
|
||||
this._reset();
|
||||
|
@ -136,5 +136,5 @@ export default Component.extend({
|
|||
this.setProperties({ isUploading: false, progress: 0 });
|
||||
this._updateIcon();
|
||||
this._updateProgressBar();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -30,20 +30,20 @@ export default Component.extend({
|
|||
{ id: "block", name: I18n.t("admin.logs.screened_ips.actions.block") },
|
||||
{
|
||||
id: "do_nothing",
|
||||
name: I18n.t("admin.logs.screened_ips.actions.do_nothing")
|
||||
name: I18n.t("admin.logs.screened_ips.actions.do_nothing"),
|
||||
},
|
||||
{
|
||||
id: "allow_admin",
|
||||
name: I18n.t("admin.logs.screened_ips.actions.allow_admin")
|
||||
}
|
||||
name: I18n.t("admin.logs.screened_ips.actions.allow_admin"),
|
||||
},
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
{ id: "block", name: I18n.t("admin.logs.screened_ips.actions.block") },
|
||||
{
|
||||
id: "do_nothing",
|
||||
name: I18n.t("admin.logs.screened_ips.actions.do_nothing")
|
||||
}
|
||||
name: I18n.t("admin.logs.screened_ips.actions.do_nothing"),
|
||||
},
|
||||
];
|
||||
}
|
||||
},
|
||||
|
@ -54,23 +54,23 @@ export default Component.extend({
|
|||
this.set("formSubmitted", true);
|
||||
const screenedIpAddress = ScreenedIpAddress.create({
|
||||
ip_address: this.ip_address,
|
||||
action_name: this.actionName
|
||||
action_name: this.actionName,
|
||||
});
|
||||
screenedIpAddress
|
||||
.save()
|
||||
.then(result => {
|
||||
.then((result) => {
|
||||
this.setProperties({ ip_address: "", formSubmitted: false });
|
||||
this.action(ScreenedIpAddress.create(result.screened_ip_address));
|
||||
schedule("afterRender", () =>
|
||||
this.element.querySelector(".ip-address-input").focus()
|
||||
);
|
||||
})
|
||||
.catch(e => {
|
||||
.catch((e) => {
|
||||
this.set("formSubmitted", false);
|
||||
const msg =
|
||||
e.jqXHR.responseJSON && e.jqXHR.responseJSON.errors
|
||||
? I18n.t("generic_error_with_reason", {
|
||||
error: e.jqXHR.responseJSON.errors.join(". ")
|
||||
error: e.jqXHR.responseJSON.errors.join(". "),
|
||||
})
|
||||
: I18n.t("generic_error");
|
||||
bootbox.alert(msg, () =>
|
||||
|
@ -78,17 +78,17 @@ export default Component.extend({
|
|||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@on("didInsertElement")
|
||||
_init() {
|
||||
schedule("afterRender", () => {
|
||||
$(this.element.querySelector(".ip-address-input")).keydown(e => {
|
||||
$(this.element.querySelector(".ip-address-input")).keydown((e) => {
|
||||
if (e.keyCode === 13) {
|
||||
this.send("submit");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -40,7 +40,7 @@ export default Component.extend({
|
|||
|
||||
removeValue(value) {
|
||||
this._removeValue(value);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
_checkInvalidInput(inputs) {
|
||||
|
@ -78,7 +78,7 @@ export default Component.extend({
|
|||
this.set(
|
||||
"values",
|
||||
this.collection
|
||||
.map(function(elem) {
|
||||
.map(function (elem) {
|
||||
return `${elem.key}|${elem.secret}`;
|
||||
})
|
||||
.join("\n")
|
||||
|
@ -89,9 +89,9 @@ export default Component.extend({
|
|||
if (values && values.length) {
|
||||
const keys = ["key", "secret"];
|
||||
var res = [];
|
||||
values.split(delimiter).forEach(function(str) {
|
||||
values.split(delimiter).forEach(function (str) {
|
||||
var object = {};
|
||||
str.split("|").forEach(function(a, i) {
|
||||
str.split("|").forEach(function (a, i) {
|
||||
object[keys[i]] = a;
|
||||
});
|
||||
res.push(object);
|
||||
|
@ -101,5 +101,5 @@ export default Component.extend({
|
|||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Component from "@ember/component";
|
||||
export default Component.extend({
|
||||
tagName: ""
|
||||
tagName: "",
|
||||
});
|
||||
|
|
|
@ -53,5 +53,5 @@ export default Component.extend({
|
|||
return values && values.length
|
||||
? values.split(delimiter || "\n").filter(Boolean)
|
||||
: [];
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -9,7 +9,7 @@ export default Component.extend(BufferedContent, SettingComponent, {
|
|||
_save() {
|
||||
const setting = this.buffered;
|
||||
return SiteSetting.update(setting.get("setting"), setting.get("value"), {
|
||||
updateExistingUsers: this.updateExistingUsers
|
||||
updateExistingUsers: this.updateExistingUsers,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -2,5 +2,5 @@ import ImageUploader from "discourse/components/image-uploader";
|
|||
|
||||
export default ImageUploader.extend({
|
||||
layoutName: "components/image-uploader",
|
||||
uploadUrlParams: "&for_site_setting=true"
|
||||
uploadUrlParams: "&for_site_setting=true",
|
||||
});
|
||||
|
|
|
@ -14,6 +14,6 @@ export default Component.extend({
|
|||
set(value) {
|
||||
this.set("value", value ? "true" : "false");
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -3,13 +3,13 @@ import Category from "discourse/models/category";
|
|||
import { computed } from "@ember/object";
|
||||
|
||||
export default Component.extend({
|
||||
selectedCategories: computed("value", function() {
|
||||
selectedCategories: computed("value", function () {
|
||||
return Category.findByIds(this.value.split("|").filter(Boolean));
|
||||
}),
|
||||
|
||||
actions: {
|
||||
onChangeSelectedCategories(value) {
|
||||
this.set("value", (value || []).mapBy("id").join("|"));
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -5,10 +5,7 @@ function RGBToHex(rgb) {
|
|||
// Choose correct separator
|
||||
let sep = rgb.indexOf(",") > -1 ? "," : " ";
|
||||
// Turn "rgb(r,g,b)" into [r,g,b]
|
||||
rgb = rgb
|
||||
.substr(4)
|
||||
.split(")")[0]
|
||||
.split(sep);
|
||||
rgb = rgb.substr(4).split(")")[0].split(sep);
|
||||
|
||||
let r = (+rgb[0]).toString(16),
|
||||
g = (+rgb[1]).toString(16),
|
||||
|
@ -22,7 +19,7 @@ function RGBToHex(rgb) {
|
|||
}
|
||||
|
||||
export default Component.extend({
|
||||
valid: computed("value", function() {
|
||||
valid: computed("value", function () {
|
||||
let value = this.value.toLowerCase();
|
||||
|
||||
let testColor = new Option().style;
|
||||
|
@ -45,5 +42,5 @@ export default Component.extend({
|
|||
@action
|
||||
onChangeColor(color) {
|
||||
this.set("value", color);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -7,24 +7,21 @@ export default Component.extend({
|
|||
|
||||
createdChoices: null,
|
||||
|
||||
settingValue: computed("value", function() {
|
||||
return this.value
|
||||
.toString()
|
||||
.split(this.tokenSeparator)
|
||||
.filter(Boolean);
|
||||
settingValue: computed("value", function () {
|
||||
return this.value.toString().split(this.tokenSeparator).filter(Boolean);
|
||||
}),
|
||||
|
||||
settingChoices: computed(
|
||||
"settingValue",
|
||||
"setting.choices.[]",
|
||||
"createdChoices.[]",
|
||||
function() {
|
||||
function () {
|
||||
return [
|
||||
...new Set([
|
||||
...makeArray(this.settingValue),
|
||||
...makeArray(this.setting.choices),
|
||||
...makeArray(this.createdChoices)
|
||||
])
|
||||
...makeArray(this.createdChoices),
|
||||
]),
|
||||
];
|
||||
}
|
||||
),
|
||||
|
@ -36,8 +33,8 @@ export default Component.extend({
|
|||
|
||||
onChangeChoices(choices) {
|
||||
this.set("createdChoices", [
|
||||
...new Set([...makeArray(this.createdChoices), ...makeArray(choices)])
|
||||
...new Set([...makeArray(this.createdChoices), ...makeArray(choices)]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -7,19 +7,19 @@ export default Component.extend({
|
|||
nameProperty: "name",
|
||||
valueProperty: "id",
|
||||
|
||||
groupChoices: computed("site.groups", function() {
|
||||
return (this.site.groups || []).map(g => {
|
||||
groupChoices: computed("site.groups", function () {
|
||||
return (this.site.groups || []).map((g) => {
|
||||
return { name: g.name, id: g.id.toString() };
|
||||
});
|
||||
}),
|
||||
|
||||
settingValue: computed("value", function() {
|
||||
settingValue: computed("value", function () {
|
||||
return (this.value || "").split(this.tokenSeparator).filter(Boolean);
|
||||
}),
|
||||
|
||||
actions: {
|
||||
onChangeGroupListSetting(value) {
|
||||
this.set("value", value.join(this.tokenSeparator));
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -7,5 +7,5 @@ export default Component.extend({
|
|||
@action
|
||||
onChange(value) {
|
||||
this.set("value", value.join(this.inputDelimiter || "\n"));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -7,11 +7,11 @@ export default Component.extend({
|
|||
selectedTags: {
|
||||
get(value) {
|
||||
return value.split("|").filter(Boolean);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@action
|
||||
changeSelectedTags(tags) {
|
||||
this.set("value", tags.join("|"));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -7,10 +7,10 @@ export default Component.extend({
|
|||
showModal("admin-uploaded-image-list", {
|
||||
admin: true,
|
||||
title: `admin.site_settings.${setting.setting}.title`,
|
||||
model: { value, setting }
|
||||
model: { value, setting },
|
||||
}).setProperties({
|
||||
save: v => this.set("value", v)
|
||||
save: (v) => this.set("value", v),
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@ export default Component.extend({
|
|||
this.element.querySelector(".site-text-id, .site-text-value"),
|
||||
term,
|
||||
{
|
||||
className: "text-highlight"
|
||||
className: "text-highlight",
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -36,5 +36,5 @@ export default Component.extend({
|
|||
}
|
||||
|
||||
return this.term;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -14,10 +14,10 @@ export default Component.extend({
|
|||
$(this.element).on(
|
||||
"click.discourse-staff-logs",
|
||||
"[data-link-post-id]",
|
||||
e => {
|
||||
(e) => {
|
||||
let postId = $(e.target).attr("data-link-post-id");
|
||||
|
||||
this.store.find("post", postId).then(p => {
|
||||
this.store.find("post", postId).then((p) => {
|
||||
DiscourseURL.routeTo(p.get("url"));
|
||||
});
|
||||
return false;
|
||||
|
@ -27,7 +27,7 @@ export default Component.extend({
|
|||
$(this.element).on(
|
||||
"click.discourse-staff-logs",
|
||||
"[data-link-topic-id]",
|
||||
e => {
|
||||
(e) => {
|
||||
let topicId = $(e.target).attr("data-link-topic-id");
|
||||
|
||||
DiscourseURL.routeTo(`/t/${topicId}`);
|
||||
|
@ -35,5 +35,5 @@ export default Component.extend({
|
|||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Component from "@ember/component";
|
||||
export default Component.extend({
|
||||
tagName: ""
|
||||
tagName: "",
|
||||
});
|
||||
|
|
|
@ -19,5 +19,5 @@ export default Component.extend(UploadMixin, {
|
|||
this.refresh();
|
||||
this.closeModal();
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -13,8 +13,8 @@ export default Component.extend(BufferedContent, SettingComponent, {
|
|||
type: "PUT",
|
||||
data: {
|
||||
name: this.setting.setting,
|
||||
value: this.get("buffered.value")
|
||||
}
|
||||
value: this.get("buffered.value"),
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -15,12 +15,13 @@ export default Component.extend(BufferedContent, SettingComponent, {
|
|||
return this.get("buffered.value")
|
||||
.split("|")
|
||||
.filter(Boolean)
|
||||
.map(themeName => {
|
||||
.map((themeName) => {
|
||||
if (themeName !== "") {
|
||||
return this.setting.allThemes.find(theme => theme.name === themeName)
|
||||
.id;
|
||||
return this.setting.allThemes.find(
|
||||
(theme) => theme.name === themeName
|
||||
).id;
|
||||
}
|
||||
return themeName;
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -14,5 +14,5 @@ export default Component.extend(BufferedContent, SettingComponent, {
|
|||
this.get("translation.key"),
|
||||
this.get("buffered.value")
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -67,7 +67,7 @@ export default Component.extend({
|
|||
children = this.childrenExpanded
|
||||
? children
|
||||
: children.slice(0, MAX_COMPONENTS);
|
||||
return children.map(t => {
|
||||
return children.map((t) => {
|
||||
const name = escape(t.name);
|
||||
return t.enabled ? name : `${iconHTML("ban")} ${name}`;
|
||||
});
|
||||
|
@ -96,22 +96,22 @@ export default Component.extend({
|
|||
$list.css("display", "");
|
||||
$container.animate(
|
||||
{
|
||||
height: `${$container.height() + $list.outerHeight(true)}px`
|
||||
height: `${$container.height() + $list.outerHeight(true)}px`,
|
||||
},
|
||||
{
|
||||
duration,
|
||||
done: () => {
|
||||
$list.css("display", "");
|
||||
$container.css("height", "");
|
||||
}
|
||||
},
|
||||
}
|
||||
);
|
||||
$list.animate(
|
||||
{
|
||||
opacity: 1
|
||||
opacity: 1,
|
||||
},
|
||||
{
|
||||
duration
|
||||
duration,
|
||||
}
|
||||
);
|
||||
},
|
||||
|
@ -119,22 +119,22 @@ export default Component.extend({
|
|||
collapseComponentsList($container, $list, duration) {
|
||||
$container.animate(
|
||||
{
|
||||
height: `${$container.height() - $list.outerHeight(true)}px`
|
||||
height: `${$container.height() - $list.outerHeight(true)}px`,
|
||||
},
|
||||
{
|
||||
duration,
|
||||
done: () => {
|
||||
$list.css("display", "none");
|
||||
$container.css("height", "");
|
||||
}
|
||||
},
|
||||
}
|
||||
);
|
||||
$list.animate(
|
||||
{
|
||||
opacity: 0
|
||||
opacity: 0,
|
||||
},
|
||||
{
|
||||
duration
|
||||
duration,
|
||||
}
|
||||
);
|
||||
},
|
||||
|
@ -142,6 +142,6 @@ export default Component.extend({
|
|||
actions: {
|
||||
toggleChildrenExpanded() {
|
||||
this.toggleProperty("childrenExpanded");
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -35,10 +35,10 @@ export default Component.extend({
|
|||
)
|
||||
inactiveThemes(themes) {
|
||||
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(
|
||||
theme => !theme.get("user_selectable") && !theme.get("default")
|
||||
(theme) => !theme.get("user_selectable") && !theme.get("default")
|
||||
);
|
||||
},
|
||||
|
||||
|
@ -50,10 +50,10 @@ export default Component.extend({
|
|||
)
|
||||
activeThemes(themes) {
|
||||
if (this.componentsTabActive) {
|
||||
return themes.filter(theme => theme.get("parent_themes.length") > 0);
|
||||
return themes.filter((theme) => theme.get("parent_themes.length") > 0);
|
||||
} else {
|
||||
return themes
|
||||
.filter(theme => theme.get("user_selectable") || theme.get("default"))
|
||||
.filter((theme) => theme.get("user_selectable") || theme.get("default"))
|
||||
.sort((a, b) => {
|
||||
if (a.get("default") && !b.get("default")) {
|
||||
return -1;
|
||||
|
@ -76,6 +76,6 @@ export default Component.extend({
|
|||
},
|
||||
navigateToTheme(theme) {
|
||||
this.router.transitionTo("adminCustomizeThemes.show", theme);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -30,7 +30,7 @@ export default Component.extend({
|
|||
|
||||
@discourseComputed("choices.[]", "collection.[]")
|
||||
filteredChoices(choices, collection) {
|
||||
return makeArray(choices).filter(i => collection.indexOf(i) < 0);
|
||||
return makeArray(choices).filter((i) => collection.indexOf(i) < 0);
|
||||
},
|
||||
|
||||
keyDown(event) {
|
||||
|
@ -55,7 +55,7 @@ export default Component.extend({
|
|||
|
||||
selectChoice(choice) {
|
||||
this._addValue(choice);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
_addValue(value) {
|
||||
|
@ -98,9 +98,9 @@ export default Component.extend({
|
|||
|
||||
_splitValues(values, delimiter) {
|
||||
if (values && values.length) {
|
||||
return values.split(delimiter).filter(x => x);
|
||||
return values.split(delimiter).filter((x) => x);
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -6,7 +6,7 @@ import WatchedWord from "admin/models/watched-word";
|
|||
import bootbox from "bootbox";
|
||||
import discourseComputed, {
|
||||
on,
|
||||
observes
|
||||
observes,
|
||||
} from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend({
|
||||
|
@ -33,9 +33,11 @@ export default Component.extend({
|
|||
@discourseComputed("word")
|
||||
isUniqueWord(word) {
|
||||
const words = this.filteredContent || [];
|
||||
const filtered = words.filter(content => content.action === this.actionKey);
|
||||
const filtered = words.filter(
|
||||
(content) => content.action === this.actionKey
|
||||
);
|
||||
return filtered.every(
|
||||
content => content.word.toLowerCase() !== word.toLowerCase()
|
||||
(content) => content.word.toLowerCase() !== word.toLowerCase()
|
||||
);
|
||||
},
|
||||
|
||||
|
@ -44,7 +46,7 @@ export default Component.extend({
|
|||
if (!this.isUniqueWord) {
|
||||
this.setProperties({
|
||||
showMessage: true,
|
||||
message: I18n.t("admin.watched_words.form.exists")
|
||||
message: I18n.t("admin.watched_words.form.exists"),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
@ -54,29 +56,29 @@ export default Component.extend({
|
|||
|
||||
const watchedWord = WatchedWord.create({
|
||||
word: this.word,
|
||||
action: this.actionKey
|
||||
action: this.actionKey,
|
||||
});
|
||||
|
||||
watchedWord
|
||||
.save()
|
||||
.then(result => {
|
||||
.then((result) => {
|
||||
this.setProperties({
|
||||
word: "",
|
||||
formSubmitted: false,
|
||||
showMessage: true,
|
||||
message: I18n.t("admin.watched_words.form.success")
|
||||
message: I18n.t("admin.watched_words.form.success"),
|
||||
});
|
||||
this.action(WatchedWord.create(result));
|
||||
schedule("afterRender", () =>
|
||||
this.element.querySelector(".watched-word-input").focus()
|
||||
);
|
||||
})
|
||||
.catch(e => {
|
||||
.catch((e) => {
|
||||
this.set("formSubmitted", false);
|
||||
const msg =
|
||||
e.jqXHR.responseJSON && e.jqXHR.responseJSON.errors
|
||||
? I18n.t("generic_error_with_reason", {
|
||||
error: e.jqXHR.responseJSON.errors.join(". ")
|
||||
error: e.jqXHR.responseJSON.errors.join(". "),
|
||||
})
|
||||
: I18n.t("generic_error");
|
||||
bootbox.alert(msg, () =>
|
||||
|
@ -84,17 +86,17 @@ export default Component.extend({
|
|||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@on("didInsertElement")
|
||||
_init() {
|
||||
schedule("afterRender", () => {
|
||||
$(this.element.querySelector(".watched-word-input")).keydown(e => {
|
||||
$(this.element.querySelector(".watched-word-input")).keydown((e) => {
|
||||
if (e.keyCode === 13) {
|
||||
this.send("submit");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -25,5 +25,5 @@ export default Component.extend(UploadMixin, {
|
|||
bootbox.alert(I18n.t("admin.watched_words.form.upload_successful"));
|
||||
this.done();
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -9,6 +9,6 @@ export default Controller.extend({
|
|||
|
||||
undoRevokeKey(key) {
|
||||
key.undoRevoke().catch(popupAjaxError);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -8,7 +8,7 @@ import showModal from "discourse/lib/show-modal";
|
|||
export default Controller.extend({
|
||||
userModes: [
|
||||
{ id: "all", name: I18n.t("admin.api.all_users") },
|
||||
{ id: "single", name: I18n.t("admin.api.single_user") }
|
||||
{ id: "single", name: I18n.t("admin.api.single_user") },
|
||||
],
|
||||
useGlobalKey: false,
|
||||
scopes: null,
|
||||
|
@ -37,7 +37,7 @@ export default Controller.extend({
|
|||
if (!this.useGlobalKey) {
|
||||
const selectedScopes = Object.values(this.scopes)
|
||||
.flat()
|
||||
.filter(action => {
|
||||
.filter((action) => {
|
||||
return action.selected;
|
||||
});
|
||||
|
||||
|
@ -55,9 +55,9 @@ export default Controller.extend({
|
|||
return showModal("admin-api-key-urls", {
|
||||
admin: true,
|
||||
model: {
|
||||
urls
|
||||
}
|
||||
urls,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -58,9 +58,9 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||
return showModal("admin-api-key-urls", {
|
||||
admin: true,
|
||||
model: {
|
||||
urls
|
||||
}
|
||||
urls,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -31,7 +31,7 @@ export default Controller.extend({
|
|||
I18n.t("admin.backups.read_only.enable.confirm"),
|
||||
I18n.t("no_value"),
|
||||
I18n.t("yes_value"),
|
||||
confirmed => {
|
||||
(confirmed) => {
|
||||
if (confirmed) {
|
||||
this.set("currentUser.hideReadOnlyAlert", true);
|
||||
this._toggleReadOnlyMode(true);
|
||||
|
@ -48,13 +48,13 @@ export default Controller.extend({
|
|||
ajax(`/admin/backups/${link}`, { type: "PUT" }).then(() =>
|
||||
bootbox.alert(I18n.t("admin.backups.operations.download.alert"))
|
||||
);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
_toggleReadOnlyMode(enable) {
|
||||
ajax("/admin/backups/readonly", {
|
||||
type: "PUT",
|
||||
data: { enable }
|
||||
data: { enable },
|
||||
}).then(() => this.site.set("isReadOnly", enable));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -9,5 +9,5 @@ export default Controller.extend({
|
|||
this._super(...arguments);
|
||||
|
||||
this.logs = [];
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -7,5 +7,5 @@ export default Controller.extend({
|
|||
"model.restoreEnabled",
|
||||
"noOperationIsRunning"
|
||||
),
|
||||
rollbackDisabled: not("rollbackEnabled")
|
||||
rollbackDisabled: not("rollbackEnabled"),
|
||||
});
|
||||
|
|
|
@ -17,7 +17,7 @@ export default Controller.extend({
|
|||
type: "POST",
|
||||
processData: false,
|
||||
contentType: false,
|
||||
data: new FormData()
|
||||
data: new FormData(),
|
||||
};
|
||||
|
||||
options.data.append("file", file);
|
||||
|
@ -34,6 +34,6 @@ export default Controller.extend({
|
|||
} else {
|
||||
bootbox.alert(I18n.t("admin.badges.mass_award.aborted"));
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -57,7 +57,7 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||
},
|
||||
|
||||
@observes("model.id")
|
||||
_resetSaving: function() {
|
||||
_resetSaving: function () {
|
||||
this.set("saving", false);
|
||||
this.set("savingStatus", "");
|
||||
},
|
||||
|
@ -81,12 +81,12 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||
"query",
|
||||
"badge_grouping_id",
|
||||
"trigger",
|
||||
"badge_type_id"
|
||||
"badge_type_id",
|
||||
];
|
||||
|
||||
if (this.get("buffered.system")) {
|
||||
let protectedFields = this.protectedSystemFields || [];
|
||||
fields = fields.filter(f => !protectedFields.includes(f));
|
||||
fields = fields.filter((f) => !protectedFields.includes(f));
|
||||
}
|
||||
|
||||
this.set("saving", true);
|
||||
|
@ -99,12 +99,12 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||
"auto_revoke",
|
||||
"enabled",
|
||||
"show_posts",
|
||||
"target_posts"
|
||||
"target_posts",
|
||||
];
|
||||
|
||||
const data = {};
|
||||
const buffered = this.buffered;
|
||||
fields.forEach(function(field) {
|
||||
fields.forEach(function (field) {
|
||||
var d = buffered.get(field);
|
||||
if (boolFields.includes(field)) {
|
||||
d = !!d;
|
||||
|
@ -149,7 +149,7 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||
I18n.t("admin.badges.delete_confirm"),
|
||||
I18n.t("no_value"),
|
||||
I18n.t("yes_value"),
|
||||
result => {
|
||||
(result) => {
|
||||
if (result) {
|
||||
model
|
||||
.destroy()
|
||||
|
@ -163,6 +163,6 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -14,5 +14,5 @@ export default Controller.extend({
|
|||
} else {
|
||||
return this.routing.currentRouteName;
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -8,18 +8,18 @@ export default Controller.extend({
|
|||
@discourseComputed("model.colors", "onlyOverridden")
|
||||
colors(allColors, onlyOverridden) {
|
||||
if (onlyOverridden) {
|
||||
return allColors.filter(color => color.get("overridden"));
|
||||
return allColors.filter((color) => color.get("overridden"));
|
||||
} else {
|
||||
return allColors;
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
revert: function(color) {
|
||||
revert: function (color) {
|
||||
color.revert();
|
||||
},
|
||||
|
||||
undo: function(color) {
|
||||
undo: function (color) {
|
||||
color.undo();
|
||||
},
|
||||
|
||||
|
@ -68,7 +68,7 @@ export default Controller.extend({
|
|||
});
|
||||
},
|
||||
|
||||
save: function() {
|
||||
save: function () {
|
||||
this.model.save();
|
||||
},
|
||||
|
||||
|
@ -76,13 +76,13 @@ export default Controller.extend({
|
|||
this.model.updateUserSelectable(this.get("model.user_selectable"));
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
destroy: function () {
|
||||
const model = this.model;
|
||||
return bootbox.confirm(
|
||||
I18n.t("admin.customize.colors.delete_confirm"),
|
||||
I18n.t("no_value"),
|
||||
I18n.t("yes_value"),
|
||||
result => {
|
||||
(result) => {
|
||||
if (result) {
|
||||
model.destroy().then(() => {
|
||||
this.allColors.removeObject(model);
|
||||
|
@ -91,6 +91,6 @@ export default Controller.extend({
|
|||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -18,7 +18,7 @@ export default Controller.extend({
|
|||
@discourseComputed("baseColorScheme")
|
||||
baseColors(baseColorScheme) {
|
||||
const baseColorsHash = EmberObject.create({});
|
||||
baseColorScheme.get("colors").forEach(color => {
|
||||
baseColorScheme.get("colors").forEach((color) => {
|
||||
baseColorsHash.set(color.get("name"), color);
|
||||
});
|
||||
return baseColorsHash;
|
||||
|
@ -30,7 +30,7 @@ export default Controller.extend({
|
|||
const newColorScheme = base.copy();
|
||||
newColorScheme.setProperties({
|
||||
name: I18n.t("admin.customize.colors.new_name"),
|
||||
base_scheme_id: base.get("base_scheme_id")
|
||||
base_scheme_id: base.get("base_scheme_id"),
|
||||
});
|
||||
newColorScheme.save().then(() => {
|
||||
this.model.pushObject(newColorScheme);
|
||||
|
@ -42,8 +42,8 @@ export default Controller.extend({
|
|||
newColorScheme() {
|
||||
showModal("admin-color-scheme-select-base", {
|
||||
model: this.baseColorSchemes,
|
||||
admin: true
|
||||
admin: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -20,17 +20,17 @@ export default Controller.extend({
|
|||
this.set("saving", true);
|
||||
this.model
|
||||
.update(this.model.getProperties("html", "css"))
|
||||
.catch(e => {
|
||||
.catch((e) => {
|
||||
const msg =
|
||||
e.jqXHR.responseJSON && e.jqXHR.responseJSON.errors
|
||||
? I18n.t("admin.customize.email_style.save_error_with_reason", {
|
||||
error: e.jqXHR.responseJSON.errors.join(". ")
|
||||
error: e.jqXHR.responseJSON.errors.join(". "),
|
||||
})
|
||||
: I18n.t("generic_error");
|
||||
bootbox.alert(msg);
|
||||
})
|
||||
.finally(() => this.set("model.changed", false));
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -45,11 +45,11 @@ export default Controller.extend(bufferedProperty("emailTemplate"), {
|
|||
this.set("saved", false);
|
||||
bootbox.confirm(
|
||||
I18n.t("admin.customize.email_templates.revert_confirm"),
|
||||
result => {
|
||||
(result) => {
|
||||
if (result) {
|
||||
this.emailTemplate
|
||||
.revert()
|
||||
.then(props => {
|
||||
.then((props) => {
|
||||
const buffered = this.buffered;
|
||||
buffered.setProperties(props);
|
||||
this.commitBuffer();
|
||||
|
@ -58,5 +58,5 @@ export default Controller.extend(bufferedProperty("emailTemplate"), {
|
|||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -14,5 +14,5 @@ export default Controller.extend({
|
|||
@action
|
||||
onSelectTemplate(template) {
|
||||
this.transitionToRoute("adminCustomizeEmailTemplates.edit", template);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -14,14 +14,14 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||
save() {
|
||||
this.setProperties({
|
||||
isSaving: true,
|
||||
saved: false
|
||||
saved: false,
|
||||
});
|
||||
|
||||
ajax("robots.json", {
|
||||
type: "PUT",
|
||||
data: { robots_txt: this.buffered.get("robots_txt") }
|
||||
data: { robots_txt: this.buffered.get("robots_txt") },
|
||||
})
|
||||
.then(data => {
|
||||
.then((data) => {
|
||||
this.commitBuffer();
|
||||
this.set("saved", true);
|
||||
this.set("model.overridden", data.overridden);
|
||||
|
@ -32,16 +32,16 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||
reset() {
|
||||
this.setProperties({
|
||||
isSaving: true,
|
||||
saved: false
|
||||
saved: false,
|
||||
});
|
||||
ajax("robots.json", { type: "DELETE" })
|
||||
.then(data => {
|
||||
.then((data) => {
|
||||
this.buffered.set("robots_txt", data.robots_txt);
|
||||
this.commitBuffer();
|
||||
this.set("saved", true);
|
||||
this.set("model.overridden", false);
|
||||
})
|
||||
.finally(() => this.set("isSaving", false));
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -12,15 +12,15 @@ export default Controller.extend({
|
|||
editRouteName: "adminCustomizeThemes.edit",
|
||||
showRouteName: "adminCustomizeThemes.show",
|
||||
|
||||
setTargetName: function(name) {
|
||||
const target = this.get("model.targets").find(t => t.name === name);
|
||||
setTargetName: function (name) {
|
||||
const target = this.get("model.targets").find((t) => t.name === name);
|
||||
this.set("currentTarget", target && target.id);
|
||||
},
|
||||
|
||||
@discourseComputed("currentTarget")
|
||||
currentTargetName(id) {
|
||||
const target = this.get("model.targets").find(
|
||||
t => t.id === parseInt(id, 10)
|
||||
(t) => t.id === parseInt(id, 10)
|
||||
);
|
||||
return target && target.name;
|
||||
},
|
||||
|
@ -50,9 +50,9 @@ export default Controller.extend({
|
|||
onlyOverriddenChanged(onlyShowOverridden) {
|
||||
if (onlyShowOverridden) {
|
||||
if (!this.model.hasEdited(this.currentTargetName, this.fieldName)) {
|
||||
let firstTarget = this.get("model.targets").find(t => t.edited);
|
||||
let firstTarget = this.get("model.targets").find((t) => t.edited);
|
||||
let firstField = this.get(`model.fields.${firstTarget.name}`).find(
|
||||
f => f.edited
|
||||
(f) => f.edited
|
||||
);
|
||||
|
||||
this.replaceRoute(
|
||||
|
@ -63,6 +63,6 @@ export default Controller.extend({
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -5,7 +5,7 @@ import {
|
|||
filterBy,
|
||||
match,
|
||||
mapBy,
|
||||
notEmpty
|
||||
notEmpty,
|
||||
} from "@ember/object/computed";
|
||||
import Controller from "@ember/controller";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
|
@ -38,14 +38,14 @@ export default Controller.extend({
|
|||
@discourseComputed("model.editedFields")
|
||||
editedFieldsFormatted() {
|
||||
const descriptions = [];
|
||||
["common", "desktop", "mobile"].forEach(target => {
|
||||
["common", "desktop", "mobile"].forEach((target) => {
|
||||
const fields = this.editedFieldsForTarget(target);
|
||||
if (fields.length < 1) {
|
||||
return;
|
||||
}
|
||||
let resultString = I18n.t("admin.customize.theme." + target);
|
||||
const formattedFields = fields
|
||||
.map(f => I18n.t("admin.customize.theme." + f.name + ".text"))
|
||||
.map((f) => I18n.t("admin.customize.theme." + f.name + ".text"))
|
||||
.join(" , ");
|
||||
resultString += `: ${formattedFields}`;
|
||||
descriptions.push(resultString);
|
||||
|
@ -64,7 +64,7 @@ export default Controller.extend({
|
|||
if (available) {
|
||||
const themes = !childThemes
|
||||
? available
|
||||
: available.filter(theme => childThemes.indexOf(theme) === -1);
|
||||
: available.filter((theme) => childThemes.indexOf(theme) === -1);
|
||||
return themes.length === 0 ? null : themes;
|
||||
}
|
||||
},
|
||||
|
@ -83,7 +83,7 @@ export default Controller.extend({
|
|||
value: this.parentThemesNames.join("|"),
|
||||
defaultValues: this.availableActiveThemesNames.join("|"),
|
||||
allThemes: this.allThemes,
|
||||
setDefaultValuesLabel: I18n.t("admin.customize.theme.add_all_themes")
|
||||
setDefaultValuesLabel: I18n.t("admin.customize.theme.add_all_themes"),
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -101,7 +101,7 @@ export default Controller.extend({
|
|||
value: this.childThemesNames.join("|"),
|
||||
defaultValues: this.availableActiveComponentsNames.join("|"),
|
||||
allThemes: this.allThemes,
|
||||
setDefaultValuesLabel: I18n.t("admin.customize.theme.add_all")
|
||||
setDefaultValuesLabel: I18n.t("admin.customize.theme.add_all"),
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -110,7 +110,7 @@ export default Controller.extend({
|
|||
if (!this.get("model.component")) {
|
||||
const themeId = this.get("model.id");
|
||||
return allThemes.filter(
|
||||
theme => theme.get("id") !== themeId && theme.get("component")
|
||||
(theme) => theme.get("id") !== themeId && theme.get("component")
|
||||
);
|
||||
}
|
||||
},
|
||||
|
@ -134,14 +134,14 @@ export default Controller.extend({
|
|||
|
||||
@discourseComputed("model.settings")
|
||||
settings(settings) {
|
||||
return settings.map(setting => ThemeSettings.create(setting));
|
||||
return settings.map((setting) => ThemeSettings.create(setting));
|
||||
},
|
||||
|
||||
hasSettings: notEmpty("settings"),
|
||||
|
||||
@discourseComputed("model.translations")
|
||||
translations(translations) {
|
||||
return translations.map(setting => ThemeSettings.create(setting));
|
||||
return translations.map((setting) => ThemeSettings.create(setting));
|
||||
},
|
||||
|
||||
hasTranslations: notEmpty("translations"),
|
||||
|
@ -153,7 +153,7 @@ export default Controller.extend({
|
|||
|
||||
editedFieldsForTarget(target) {
|
||||
return this.get("model.editedFields").filter(
|
||||
field => field.target === target
|
||||
(field) => field.target === target
|
||||
);
|
||||
},
|
||||
|
||||
|
@ -178,10 +178,10 @@ export default Controller.extend({
|
|||
color_scheme_id: null,
|
||||
user_selectable: false,
|
||||
child_themes: [],
|
||||
childThemes: []
|
||||
childThemes: [],
|
||||
});
|
||||
|
||||
this.get("parentController.model.content").forEach(theme => {
|
||||
this.get("parentController.model.content").forEach((theme) => {
|
||||
const children = makeArray(theme.get("childThemes"));
|
||||
const rawChildren = makeArray(theme.get("child_themes"));
|
||||
const index = children ? children.indexOf(model) : -1;
|
||||
|
@ -190,7 +190,7 @@ export default Controller.extend({
|
|||
rawChildren.splice(index, 1);
|
||||
theme.setProperties({
|
||||
childThemes: children,
|
||||
child_themes: rawChildren
|
||||
child_themes: rawChildren,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -245,7 +245,7 @@ export default Controller.extend({
|
|||
addUpload(info) {
|
||||
let model = this.model;
|
||||
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));
|
||||
},
|
||||
|
||||
cancelChangeScheme() {
|
||||
|
@ -276,7 +276,7 @@ export default Controller.extend({
|
|||
if (this.get("model.remote_theme.is_git")) {
|
||||
bootbox.confirm(
|
||||
I18n.t("admin.customize.theme.edit_confirm"),
|
||||
result => {
|
||||
(result) => {
|
||||
if (result) {
|
||||
this.transitionToEditRoute();
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ export default Controller.extend({
|
|||
const model = this.model;
|
||||
model.saveChanges("default").then(() => {
|
||||
if (model.get("default")) {
|
||||
this.allThemes.forEach(theme => {
|
||||
this.allThemes.forEach((theme) => {
|
||||
if (theme !== model && theme.get("default")) {
|
||||
theme.set("default", false);
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ export default Controller.extend({
|
|||
I18n.t("admin.customize.theme.delete_upload_confirm"),
|
||||
I18n.t("no_value"),
|
||||
I18n.t("yes_value"),
|
||||
result => {
|
||||
(result) => {
|
||||
if (result) {
|
||||
this.model.removeField(upload);
|
||||
}
|
||||
|
@ -332,11 +332,11 @@ export default Controller.extend({
|
|||
destroy() {
|
||||
return bootbox.confirm(
|
||||
I18n.t("admin.customize.delete_confirm", {
|
||||
theme_name: this.get("model.name")
|
||||
theme_name: this.get("model.name"),
|
||||
}),
|
||||
I18n.t("no_value"),
|
||||
I18n.t("yes_value"),
|
||||
result => {
|
||||
(result) => {
|
||||
if (result) {
|
||||
const model = this.model;
|
||||
model.setProperties({ recentlyInstalled: false });
|
||||
|
@ -354,14 +354,14 @@ export default Controller.extend({
|
|||
? this.parentThemes
|
||||
: this.get("model.childThemes");
|
||||
if (relatives && relatives.length > 0) {
|
||||
const names = relatives.map(relative => relative.get("name"));
|
||||
const names = relatives.map((relative) => relative.get("name"));
|
||||
bootbox.confirm(
|
||||
I18n.t(`${this.convertKey}_alert`, {
|
||||
relatives: names.join(", ")
|
||||
relatives: names.join(", "),
|
||||
}),
|
||||
I18n.t("no_value"),
|
||||
I18n.t("yes_value"),
|
||||
result => {
|
||||
(result) => {
|
||||
if (result) {
|
||||
this.commitSwitchType();
|
||||
}
|
||||
|
@ -384,6 +384,6 @@ export default Controller.extend({
|
|||
this.model
|
||||
.saveChanges("enabled")
|
||||
.catch(() => this.model.set("enabled", true));
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -7,16 +7,16 @@ export default Controller.extend({
|
|||
|
||||
@discourseComputed("model", "model.@each.component")
|
||||
fullThemes(themes) {
|
||||
return themes.filter(t => !t.get("component"));
|
||||
return themes.filter((t) => !t.get("component"));
|
||||
},
|
||||
|
||||
@discourseComputed("model", "model.@each.component")
|
||||
childThemes(themes) {
|
||||
return themes.filter(t => t.get("component"));
|
||||
return themes.filter((t) => t.get("component"));
|
||||
},
|
||||
|
||||
@discourseComputed("model", "model.@each.component")
|
||||
installedThemes(themes) {
|
||||
return themes.map(t => t.name);
|
||||
}
|
||||
return themes.map((t) => t.name);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -11,8 +11,8 @@ import { computed } from "@ember/object";
|
|||
import getURL from "discourse-common/lib/get-url";
|
||||
|
||||
function staticReport(reportType) {
|
||||
return computed("reports.[]", function() {
|
||||
return makeArray(this.reports).find(report => report.type === reportType);
|
||||
return computed("reports.[]", function () {
|
||||
return makeArray(this.reports).find((report) => report.type === reportType);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ export default Controller.extend(PeriodComputationMixin, {
|
|||
return (metrics || "").split("|").filter(Boolean);
|
||||
},
|
||||
|
||||
hiddenReports: computed("siteSettings.dashboard_hidden_reports", function() {
|
||||
hiddenReports: computed("siteSettings.dashboard_hidden_reports", function () {
|
||||
return (this.siteSettings.dashboard_hidden_reports || "")
|
||||
.split("|")
|
||||
.filter(Boolean);
|
||||
|
@ -36,21 +36,21 @@ export default Controller.extend(PeriodComputationMixin, {
|
|||
isActivityMetricsVisible: computed(
|
||||
"activityMetrics",
|
||||
"hiddenReports",
|
||||
function() {
|
||||
function () {
|
||||
return (
|
||||
this.activityMetrics.length &&
|
||||
this.activityMetrics.some(x => !this.hiddenReports.includes(x))
|
||||
this.activityMetrics.some((x) => !this.hiddenReports.includes(x))
|
||||
);
|
||||
}
|
||||
),
|
||||
|
||||
isSearchReportsVisible: computed("hiddenReports", function() {
|
||||
isSearchReportsVisible: computed("hiddenReports", function () {
|
||||
return ["top_referred_topics", "trending_search"].some(
|
||||
x => !this.hiddenReports.includes(x)
|
||||
(x) => !this.hiddenReports.includes(x)
|
||||
);
|
||||
}),
|
||||
|
||||
isCommunityHealthVisible: computed("hiddenReports", function() {
|
||||
isCommunityHealthVisible: computed("hiddenReports", function () {
|
||||
return [
|
||||
"consolidated_page_views",
|
||||
"signups",
|
||||
|
@ -58,56 +58,52 @@ export default Controller.extend(PeriodComputationMixin, {
|
|||
"posts",
|
||||
"dau_by_mau",
|
||||
"daily_engaged_users",
|
||||
"new_contributors"
|
||||
].some(x => !this.hiddenReports.includes(x));
|
||||
"new_contributors",
|
||||
].some((x) => !this.hiddenReports.includes(x));
|
||||
}),
|
||||
|
||||
@discourseComputed
|
||||
activityMetricsFilters() {
|
||||
return {
|
||||
startDate: this.lastMonth,
|
||||
endDate: this.today
|
||||
endDate: this.today,
|
||||
};
|
||||
},
|
||||
|
||||
@discourseComputed
|
||||
topReferredTopicsOptions() {
|
||||
return {
|
||||
table: { total: false, limit: 8 }
|
||||
table: { total: false, limit: 8 },
|
||||
};
|
||||
},
|
||||
|
||||
@discourseComputed
|
||||
topReferredTopicsFilters() {
|
||||
return {
|
||||
startDate: moment()
|
||||
.subtract(6, "days")
|
||||
.startOf("day"),
|
||||
endDate: this.today
|
||||
startDate: moment().subtract(6, "days").startOf("day"),
|
||||
endDate: this.today,
|
||||
};
|
||||
},
|
||||
|
||||
@discourseComputed
|
||||
trendingSearchFilters() {
|
||||
return {
|
||||
startDate: moment()
|
||||
.subtract(1, "month")
|
||||
.startOf("day"),
|
||||
endDate: this.today
|
||||
startDate: moment().subtract(1, "month").startOf("day"),
|
||||
endDate: this.today,
|
||||
};
|
||||
},
|
||||
|
||||
@discourseComputed
|
||||
trendingSearchOptions() {
|
||||
return {
|
||||
table: { total: false, limit: 8 }
|
||||
table: { total: false, limit: 8 },
|
||||
};
|
||||
},
|
||||
|
||||
@discourseComputed
|
||||
trendingSearchDisabledLabel() {
|
||||
return I18n.t("admin.dashboard.reports.trending_search.disabled", {
|
||||
basePath: getURL("")
|
||||
basePath: getURL(""),
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -120,23 +116,21 @@ export default Controller.extend(PeriodComputationMixin, {
|
|||
|
||||
if (
|
||||
!this.dashboardFetchedAt ||
|
||||
moment()
|
||||
.subtract(30, "minutes")
|
||||
.toDate() > this.dashboardFetchedAt
|
||||
moment().subtract(30, "minutes").toDate() > this.dashboardFetchedAt
|
||||
) {
|
||||
this.set("isLoading", true);
|
||||
|
||||
AdminDashboard.fetchGeneral()
|
||||
.then(adminDashboardModel => {
|
||||
.then((adminDashboardModel) => {
|
||||
this.setProperties({
|
||||
dashboardFetchedAt: new Date(),
|
||||
model: adminDashboardModel,
|
||||
reports: makeArray(adminDashboardModel.reports).map(x =>
|
||||
reports: makeArray(adminDashboardModel.reports).map((x) =>
|
||||
Report.create(x)
|
||||
)
|
||||
),
|
||||
});
|
||||
})
|
||||
.catch(e => {
|
||||
.catch((e) => {
|
||||
this.exceptionController.set("thrown", e.jqXHR);
|
||||
this.replaceRoute("exception");
|
||||
})
|
||||
|
@ -151,5 +145,5 @@ export default Controller.extend(PeriodComputationMixin, {
|
|||
|
||||
_reportsForPeriodURL(period) {
|
||||
return getURL(`/admin?period=${period}`);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user