mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Update linting setup and fix issues (#17345)
Re-lands #16119 and #17298 * Update eslint-config-discourse * Update linting workflow * Prettier-ignore stuff * Update template-lint config * Auto-fix template issues * Fix various template issues Mostly incorrect attributes and unused templates * Prettier js files * Fix template auto-fix regressions * Small css tweak Co-authored-by: Peter Wagenet <peter.wagenet@gmail.com>
This commit is contained in:
@@ -48,13 +48,13 @@
|
||||
</div>
|
||||
|
||||
<div class="picker-panel">
|
||||
<Input @class="fake-input" />
|
||||
<Input class="fake-input" />
|
||||
<div class="date-picker" id="picker-container-{{this.elementId}}"></div>
|
||||
|
||||
{{#if this.fromSelected}}
|
||||
<div class="time-pickers">
|
||||
{{d-icon "far-clock"}}
|
||||
<Input @maxlength={{5}} @placeholder="hh:mm" @input={{action "setTime"}} @type="time" @value={{this.time}} @class="time-picker" />
|
||||
<Input maxlength={{5}} placeholder="hh:mm" @type="time" @value={{this.time}} class="time-picker" {{on "input" (action "setTime")}} />
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
{{#if this.toDate}}
|
||||
<div class="time-pickers">
|
||||
{{d-icon "far-clock"}}
|
||||
<Input @maxlength={{5}} @placeholder="hh:mm" @input={{action "setToTime"}} @type="time" @value={{this.toTime}} @class="time-picker" />
|
||||
<Input maxlength={{5}} placeholder="hh:mm" @type="time" @value={{this.toTime}} class="time-picker" {{on "input" (action "setToTime")}} />
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
@@ -190,9 +190,8 @@ function initializeDiscourseLocalDates(api) {
|
||||
return "";
|
||||
}
|
||||
if (this.element.attributes["data-range"] === "true") {
|
||||
this.metadata.discourseLocalDateStartRangeOpts = buildOptionsFromMarkdownTag(
|
||||
this.element
|
||||
);
|
||||
this.metadata.discourseLocalDateStartRangeOpts =
|
||||
buildOptionsFromMarkdownTag(this.element);
|
||||
return "";
|
||||
}
|
||||
const opts = buildOptionsFromMarkdownTag(this.element, siteSettings);
|
||||
|
||||
@@ -202,9 +202,8 @@ export function setup(helper) {
|
||||
helper.registerOptions((opts, siteSettings) => {
|
||||
opts.datesEmailFormat = siteSettings.discourse_local_dates_email_format;
|
||||
|
||||
opts.features[
|
||||
"discourse-local-dates"
|
||||
] = !!siteSettings.discourse_local_dates_enabled;
|
||||
opts.features["discourse-local-dates"] =
|
||||
!!siteSettings.discourse_local_dates_enabled;
|
||||
});
|
||||
|
||||
helper.registerPlugin((md) => {
|
||||
|
||||
@@ -96,14 +96,16 @@ Some text [date-range from=2022-06-17T09:30:00 to=2022-06-18T10:30:00 format="LL
|
||||
});
|
||||
});
|
||||
|
||||
acceptance("Local Dates - quoting with recurring and countdown", function (needs) {
|
||||
needs.user();
|
||||
needs.settings({ discourse_local_dates_enabled: true });
|
||||
acceptance(
|
||||
"Local Dates - quoting with recurring and countdown",
|
||||
function (needs) {
|
||||
needs.user();
|
||||
needs.settings({ discourse_local_dates_enabled: true });
|
||||
|
||||
needs.pretender((server, helper) => {
|
||||
const topicResponse = cloneJSON(topicFixtures["/t/280/1.json"]);
|
||||
const firstPost = topicResponse.post_stream.posts[0];
|
||||
firstPost.cooked += `<div class='select-local-date-test'><p dir="ltr">Testing countdown <span data-date="2022-06-21" data-time="09:30:00" class="discourse-local-date cooked-date" data-format="LL" data-countdown="true" data-timezone="Australia/Brisbane" data-email-preview="2022-06-20T23:30:00Z UTC" aria-label="Brisbane Tuesday, June 21, 2022 <br /><svg class='fa d-icon d-icon-clock svg-icon svg-string' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 9:30 AM, Paris Tuesday, June 21, 2022 <br /><svg class='fa d-icon d-icon-clock svg-icon svg-string' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 1:30 AM, Los Angeles Monday, June 20, 2022 <br /><svg class='fa d-icon d-icon-clock svg-icon svg-string' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 4:30 PM" data-title="This is a new topic to check on chat quote issues">
|
||||
needs.pretender((server, helper) => {
|
||||
const topicResponse = cloneJSON(topicFixtures["/t/280/1.json"]);
|
||||
const firstPost = topicResponse.post_stream.posts[0];
|
||||
firstPost.cooked += `<div class='select-local-date-test'><p dir="ltr">Testing countdown <span data-date="2022-06-21" data-time="09:30:00" class="discourse-local-date cooked-date" data-format="LL" data-countdown="true" data-timezone="Australia/Brisbane" data-email-preview="2022-06-20T23:30:00Z UTC" aria-label="Brisbane Tuesday, June 21, 2022 <br /><svg class='fa d-icon d-icon-clock svg-icon svg-string' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 9:30 AM, Paris Tuesday, June 21, 2022 <br /><svg class='fa d-icon d-icon-clock svg-icon svg-string' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 1:30 AM, Los Angeles Monday, June 20, 2022 <br /><svg class='fa d-icon d-icon-clock svg-icon svg-string' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 4:30 PM" data-title="This is a new topic to check on chat quote issues">
|
||||
<svg class="fa d-icon d-icon-globe-americas svg-icon" xmlns="http://www.w3.org/2000/svg">
|
||||
<use href="#globe-americas"></use>
|
||||
</svg>
|
||||
@@ -116,25 +118,25 @@ acceptance("Local Dates - quoting with recurring and countdown", function (needs
|
||||
<span class="relative-time">Wednesday</span>
|
||||
</span></p></div>`;
|
||||
|
||||
server.get("/t/280.json", () => helper.response(topicResponse));
|
||||
server.get("/t/280/:post_number.json", () => {
|
||||
helper.response(topicResponse);
|
||||
server.get("/t/280.json", () => helper.response(topicResponse));
|
||||
server.get("/t/280/:post_number.json", () => {
|
||||
helper.response(topicResponse);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test("quoting single local dates with recurring and countdown options", async function (assert) {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await selectText("#post_1 .select-local-date-test");
|
||||
await click(".insert-quote");
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val().trim(),
|
||||
`[quote=\"Uwe Keim, post:1, topic:280, username:uwe_keim\"]
|
||||
test("quoting single local dates with recurring and countdown options", async function (assert) {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await selectText("#post_1 .select-local-date-test");
|
||||
await click(".insert-quote");
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val().trim(),
|
||||
`[quote=\"Uwe Keim, post:1, topic:280, username:uwe_keim\"]
|
||||
Testing countdown [date=2022-06-21 time=09:30:00 format="LL" timezone="Australia/Brisbane" countdown="true"]
|
||||
|
||||
Testing recurring [date=2022-06-22 timezone="Australia/Brisbane" recurring="2.weeks"]
|
||||
[/quote]`,
|
||||
"converts the dates to markdown with all options correctly"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
"converts the dates to markdown with all options correctly"
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<div class="poll-options">
|
||||
{{#if this.showAdvanced}}
|
||||
<label class="input-group-label">{{i18n "poll.ui_builder.poll_options.label"}}</label>
|
||||
<Textarea @value={{this.pollOptionsText}} @input={{action "onOptionsTextChange"}} />
|
||||
<Textarea @value={{this.pollOptionsText}} {{on "input" (action "onOptionsTextChange")}} />
|
||||
{{#if this.showMinNumOfOptionsValidation}}
|
||||
{{#unless this.minNumOfOptionsValidation.ok}}
|
||||
<InputTip @validation={{this.minNumOfOptionsValidation}} />
|
||||
@@ -56,18 +56,18 @@
|
||||
<div class="options">
|
||||
<div class="input-group poll-number">
|
||||
<label class="input-group-label">{{i18n "poll.ui_builder.poll_config.min"}}</label>
|
||||
<Input @type="number" @value={{this.pollMin}} @valueProperty="value" class="poll-options-min" @min={{1}} />
|
||||
<Input @type="number" @value={{this.pollMin}} class="poll-options-min" min="1" />
|
||||
</div>
|
||||
|
||||
<div class="input-group poll-number">
|
||||
<label class="input-group-label">{{i18n "poll.ui_builder.poll_config.max"}}</label>
|
||||
<Input @type="number" @value={{this.pollMax}} @valueProperty="value" class="poll-options-max" @min={{1}} />
|
||||
<Input @type="number" @value={{this.pollMax}} class="poll-options-max" min="1" />
|
||||
</div>
|
||||
|
||||
{{#if this.isNumber}}
|
||||
<div class="input-group poll-number">
|
||||
<label class="input-group-label">{{i18n "poll.ui_builder.poll_config.step"}}</label>
|
||||
<Input @type="number" @value={{this.pollStep}} @valueProperty="value" @min="1" class="poll-options-step" />
|
||||
<Input @type="number" @value={{this.pollStep}} min="1" class="poll-options-step" />
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
@@ -24,8 +24,8 @@ function cleanUpPolls() {
|
||||
|
||||
function initializePolls(api) {
|
||||
const register = getRegister(api),
|
||||
pollGroupableUserFields = api.container.lookup("site-settings:main")
|
||||
.poll_groupable_user_fields;
|
||||
pollGroupableUserFields =
|
||||
api.container.lookup("site-settings:main").poll_groupable_user_fields;
|
||||
cleanUpPolls();
|
||||
|
||||
api.modifyClass("controller:topic", {
|
||||
|
||||
@@ -47,8 +47,7 @@ acceptance("Poll quote", function (needs) {
|
||||
title_is_group: false,
|
||||
bookmarked: false,
|
||||
bookmarks: [],
|
||||
raw:
|
||||
"[poll name=poll1 type=regular results=always chartType=bar]\n* Alpha\n* Beta\n[/poll]\n\n[poll name=poll2 type=regular results=always chartType=bar]\n* First\n* Second\n[/poll]",
|
||||
raw: "[poll name=poll1 type=regular results=always chartType=bar]\n* Alpha\n* Beta\n[/poll]\n\n[poll name=poll2 type=regular results=always chartType=bar]\n* First\n* Second\n[/poll]",
|
||||
actions_summary: [
|
||||
{
|
||||
id: 3,
|
||||
|
||||
@@ -51,8 +51,7 @@ acceptance("Poll results", function (needs) {
|
||||
title_is_group: false,
|
||||
bookmarked: false,
|
||||
bookmarks: [],
|
||||
raw:
|
||||
"[poll type=regular results=always public=true chartType=bar]\n* Option #1\n* Option #2\n[/poll]",
|
||||
raw: "[poll type=regular results=always public=true chartType=bar]\n* Option #1\n* Option #2\n[/poll]",
|
||||
actions_summary: [
|
||||
{ id: 3, can_act: true },
|
||||
{ id: 4, can_act: true },
|
||||
@@ -87,14 +86,12 @@ acceptance("Poll results", function (needs) {
|
||||
options: [
|
||||
{
|
||||
id: "db753fe0bc4e72869ac1ad8765341764",
|
||||
html:
|
||||
'Option \u003cspan class="hashtag"\u003e#1\u003c/span\u003e',
|
||||
html: 'Option \u003cspan class="hashtag"\u003e#1\u003c/span\u003e',
|
||||
votes: 1,
|
||||
},
|
||||
{
|
||||
id: "d8c22ff912e03740d9bc19e133e581e0",
|
||||
html:
|
||||
'Option \u003cspan class="hashtag"\u003e#2\u003c/span\u003e',
|
||||
html: 'Option \u003cspan class="hashtag"\u003e#2\u003c/span\u003e',
|
||||
votes: 0,
|
||||
},
|
||||
],
|
||||
@@ -192,14 +189,12 @@ acceptance("Poll results", function (needs) {
|
||||
options: [
|
||||
{
|
||||
id: "db753fe0bc4e72869ac1ad8765341764",
|
||||
html:
|
||||
'Option \u003cspan class="hashtag"\u003e#1\u003c/span\u003e',
|
||||
html: 'Option \u003cspan class="hashtag"\u003e#1\u003c/span\u003e',
|
||||
votes: 1,
|
||||
},
|
||||
{
|
||||
id: "d8c22ff912e03740d9bc19e133e581e0",
|
||||
html:
|
||||
'Option \u003cspan class="hashtag"\u003e#2\u003c/span\u003e',
|
||||
html: 'Option \u003cspan class="hashtag"\u003e#2\u003c/span\u003e',
|
||||
votes: 0,
|
||||
},
|
||||
],
|
||||
@@ -705,8 +700,7 @@ acceptance("Poll results - no voters", function (needs) {
|
||||
title_is_group: false,
|
||||
bookmarked: false,
|
||||
bookmarks: [],
|
||||
raw:
|
||||
"[poll type=regular results=always public=true chartType=bar]\n* Option #1\n* Option #2\n[/poll]",
|
||||
raw: "[poll type=regular results=always public=true chartType=bar]\n* Option #1\n* Option #2\n[/poll]",
|
||||
actions_summary: [
|
||||
{ id: 3, can_act: true },
|
||||
{ id: 4, can_act: true },
|
||||
@@ -741,14 +735,12 @@ acceptance("Poll results - no voters", function (needs) {
|
||||
options: [
|
||||
{
|
||||
id: "db753fe0bc4e72869ac1ad8765341764",
|
||||
html:
|
||||
'Option \u003cspan class="hashtag"\u003e#1\u003c/span\u003e',
|
||||
html: 'Option \u003cspan class="hashtag"\u003e#1\u003c/span\u003e',
|
||||
votes: 0,
|
||||
},
|
||||
{
|
||||
id: "d8c22ff912e03740d9bc19e133e581e0",
|
||||
html:
|
||||
'Option \u003cspan class="hashtag"\u003e#2\u003c/span\u003e',
|
||||
html: 'Option \u003cspan class="hashtag"\u003e#2\u003c/span\u003e',
|
||||
votes: 0,
|
||||
},
|
||||
],
|
||||
@@ -835,14 +827,12 @@ acceptance("Poll results - no voters", function (needs) {
|
||||
options: [
|
||||
{
|
||||
id: "db753fe0bc4e72869ac1ad8765341764",
|
||||
html:
|
||||
'Option \u003cspan class="hashtag"\u003e#1\u003c/span\u003e',
|
||||
html: 'Option \u003cspan class="hashtag"\u003e#1\u003c/span\u003e',
|
||||
votes: 0,
|
||||
},
|
||||
{
|
||||
id: "d8c22ff912e03740d9bc19e133e581e0",
|
||||
html:
|
||||
'Option \u003cspan class="hashtag"\u003e#2\u003c/span\u003e',
|
||||
html: 'Option \u003cspan class="hashtag"\u003e#2\u003c/span\u003e',
|
||||
votes: 0,
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user