mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 20:01:08 +08:00
DEV: apply coding standards to plugins (#10594)
This commit is contained in:
@ -18,12 +18,12 @@ export default Controller.extend({
|
||||
pollChartTypes: [
|
||||
{
|
||||
name: I18n.t("poll.ui_builder.poll_chart_type.bar"),
|
||||
value: BAR_CHART_TYPE
|
||||
value: BAR_CHART_TYPE,
|
||||
},
|
||||
{
|
||||
name: I18n.t("poll.ui_builder.poll_chart_type.pie"),
|
||||
value: PIE_CHART_TYPE
|
||||
}
|
||||
value: PIE_CHART_TYPE,
|
||||
},
|
||||
],
|
||||
|
||||
pollType: null,
|
||||
@ -39,16 +39,16 @@ export default Controller.extend({
|
||||
return [
|
||||
{
|
||||
name: I18n.t("poll.ui_builder.poll_type.regular"),
|
||||
value: regularPollType
|
||||
value: regularPollType,
|
||||
},
|
||||
{
|
||||
name: I18n.t("poll.ui_builder.poll_type.number"),
|
||||
value: numberPollType
|
||||
value: numberPollType,
|
||||
},
|
||||
{
|
||||
name: I18n.t("poll.ui_builder.poll_type.multiple"),
|
||||
value: multiplePollType
|
||||
}
|
||||
value: multiplePollType,
|
||||
},
|
||||
];
|
||||
},
|
||||
|
||||
@ -72,21 +72,21 @@ export default Controller.extend({
|
||||
let options = [
|
||||
{
|
||||
name: I18n.t("poll.ui_builder.poll_result.always"),
|
||||
value: alwaysPollResult
|
||||
value: alwaysPollResult,
|
||||
},
|
||||
{
|
||||
name: I18n.t("poll.ui_builder.poll_result.vote"),
|
||||
value: votePollResult
|
||||
value: votePollResult,
|
||||
},
|
||||
{
|
||||
name: I18n.t("poll.ui_builder.poll_result.closed"),
|
||||
value: closedPollResult
|
||||
}
|
||||
value: closedPollResult,
|
||||
},
|
||||
];
|
||||
if (this.get("currentUser.staff")) {
|
||||
options.push({
|
||||
name: I18n.t("poll.ui_builder.poll_result.staff"),
|
||||
value: staffPollResult
|
||||
value: staffPollResult,
|
||||
});
|
||||
}
|
||||
return options;
|
||||
@ -95,7 +95,7 @@ export default Controller.extend({
|
||||
@discourseComputed("site.groups")
|
||||
siteGroups(groups) {
|
||||
return groups
|
||||
.map(g => {
|
||||
.map((g) => {
|
||||
// prevents group "everyone" to be listed
|
||||
if (g.id !== 0) {
|
||||
return { name: g.name };
|
||||
@ -130,7 +130,7 @@ export default Controller.extend({
|
||||
|
||||
let length = 0;
|
||||
|
||||
pollOptions.split("\n").forEach(option => {
|
||||
pollOptions.split("\n").forEach((option) => {
|
||||
if (option.length !== 0) length += 1;
|
||||
});
|
||||
|
||||
@ -267,7 +267,7 @@ export default Controller.extend({
|
||||
output += `${pollHeader}\n`;
|
||||
|
||||
if (pollOptions.length > 0 && !isNumber) {
|
||||
pollOptions.split("\n").forEach(option => {
|
||||
pollOptions.split("\n").forEach((option) => {
|
||||
if (option.length !== 0) output += `* ${option}\n`;
|
||||
});
|
||||
}
|
||||
@ -299,7 +299,7 @@ export default Controller.extend({
|
||||
if (pollMin >= pollMax) {
|
||||
options = {
|
||||
failed: true,
|
||||
reason: I18n.t("poll.ui_builder.help.invalid_values")
|
||||
reason: I18n.t("poll.ui_builder.help.invalid_values"),
|
||||
};
|
||||
}
|
||||
|
||||
@ -313,7 +313,7 @@ export default Controller.extend({
|
||||
if (pollStep < 1) {
|
||||
options = {
|
||||
failed: true,
|
||||
reason: I18n.t("poll.ui_builder.help.min_step_value")
|
||||
reason: I18n.t("poll.ui_builder.help.min_step_value"),
|
||||
};
|
||||
}
|
||||
|
||||
@ -327,7 +327,7 @@ export default Controller.extend({
|
||||
if (disableInsert) {
|
||||
options = {
|
||||
failed: true,
|
||||
reason: I18n.t("poll.ui_builder.help.options_count")
|
||||
reason: I18n.t("poll.ui_builder.help.options_count"),
|
||||
};
|
||||
}
|
||||
|
||||
@ -335,9 +335,9 @@ export default Controller.extend({
|
||||
},
|
||||
|
||||
_comboboxOptions(startIndex, endIndex) {
|
||||
return [...Array(endIndex - startIndex).keys()].map(number => ({
|
||||
return [...Array(endIndex - startIndex).keys()].map((number) => ({
|
||||
value: number + startIndex,
|
||||
name: number + startIndex
|
||||
name: number + startIndex,
|
||||
}));
|
||||
},
|
||||
|
||||
@ -353,12 +353,8 @@ export default Controller.extend({
|
||||
chartType: BAR_CHART_TYPE,
|
||||
pollResult: this.alwaysPollResult,
|
||||
pollGroups: null,
|
||||
date: moment()
|
||||
.add(1, "day")
|
||||
.format("YYYY-MM-DD"),
|
||||
time: moment()
|
||||
.add(1, "hour")
|
||||
.format("HH:mm")
|
||||
date: moment().add(1, "day").format("YYYY-MM-DD"),
|
||||
time: moment().add(1, "hour").format("HH:mm"),
|
||||
});
|
||||
},
|
||||
|
||||
@ -367,6 +363,6 @@ export default Controller.extend({
|
||||
this.toolbarEvent.addText(this.pollOutput);
|
||||
this.send("closeModal");
|
||||
this._setupPoll();
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
Reference in New Issue
Block a user