DEV: Update eslint-config-discourse, use prettier for hbs (#365)

This commit is contained in:
David Taylor 2023-01-04 12:44:33 +00:00 committed by GitHub
parent 68c8f73be2
commit 820dd2ff5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 2356 additions and 806 deletions

View File

@ -41,8 +41,8 @@ jobs:
shell: bash
run: |
yarn prettier -v
if [ 0 -lt $(find assets admin/assets -type f \( -name "*.scss" -or -name "*.js" -or -name "*.es6" \) 2> /dev/null | wc -l) ]; then
yarn prettier --list-different "assets/**/*.{scss,js,es6}"
if [ 0 -lt $(find assets admin/assets -type f \( -name "*.scss" -or -name "*.js" -or -name "*.es6" -or -name "*.hbs" \) 2> /dev/null | wc -l) ]; then
yarn prettier --list-different "assets/**/*.{scss,js,es6,hbs}"
fi
if [ 0 -lt $(find test -type f \( -name "*.js" -or -name "*.es6" \) 2> /dev/null | wc -l) ]; then
yarn prettier --list-different "test/**/*.{js,es6}"
@ -50,7 +50,12 @@ jobs:
- name: Ember template lint
if: ${{ !cancelled() }}
run: yarn ember-template-lint --no-error-on-unmatched-pattern assets/javascripts admin/assets/javascripts
run: yarn ember-template-lint --no-error-on-unmatched-pattern assets/javascripts
# Separated due to https://github.com/ember-template-lint/ember-template-lint/issues/2758
- name: Ember template lint (admin)
if: ${{ !cancelled() }}
run: yarn ember-template-lint --no-error-on-unmatched-pattern admin/assets/javascripts
- name: Rubocop
if: ${{ !cancelled() }}

View File

@ -1 +1,2 @@
assets/stylesheets/vendor/*.scss
public/

View File

@ -1,3 +1,3 @@
{{#if user.custom_fields.on_holiday}}
{{replace-emoji ":palm_tree:" (hash class="on-holiday")}}
{{/if}}
{{/if}}

View File

@ -4,7 +4,10 @@
{{#if siteSettings.sort_categories_by_event_start_date_enabled}}
<section class="field show-subcategory-list-field">
<label>
<Input @type="checkbox" @checked={{this.category.custom_fields.sort_topics_by_event_start_date}} />
<Input
@type="checkbox"
@checked={{this.category.custom_fields.sort_topics_by_event_start_date}}
/>
{{i18n "category.sort_topics_by_event_start_date"}}
</label>
</section>
@ -13,9 +16,12 @@
{{#if siteSettings.disable_resorting_on_categories_enabled}}
<section class="field show-subcategory-list-field">
<label>
<Input @type="checkbox" @checked={{this.category.custom_fields.disable_topic_resorting}} />
<Input
@type="checkbox"
@checked={{this.category.custom_fields.disable_topic_resorting}}
/>
{{i18n "category.disable_topic_resorting"}}
</label>
</section>
{{/if}}
</section>
</section>

View File

@ -2,14 +2,11 @@
{{i18n "discourse_calendar.holidays.header_title"}}
</h3>
{{region-input
value=this.selectedRegion
onChange=(action "getHolidays")
}}
{{region-input value=this.selectedRegion onChange=(action "getHolidays")}}
<p class="desc">
{{i18n "discourse_calendar.holidays.pick_region_description"}}
<br><br>
<br /><br />
{{i18n "discourse_calendar.holidays.disabled_holidays_description"}}
</p>
@ -20,4 +17,4 @@
holidays=model.holidays
region_code=this.selectedRegion
}}
{{/if}}
{{/if}}

View File

@ -12,4 +12,4 @@
label="discourse_calendar.disable_holiday"
}}
{{/if}}
</td>
</td>

View File

@ -15,4 +15,4 @@
}}
{{/each}}
</tbody>
</table>
</table>

View File

@ -1,4 +1,4 @@
{{d-button
label="discourse_post_event.bulk_invite_modal.download_sample_csv"
action=(action "downloadSampleCsv")
}}
}}

View File

@ -1,7 +1,12 @@
<label class="btn" disabled={{uploadButtonDisabled}}>
{{d-icon "upload"}}&nbsp;{{uploadButtonText}}
<input class="hidden-upload-field" disabled={{uploading}} type="file" accept=".csv">
<input
class="hidden-upload-field"
disabled={{uploading}}
type="file"
accept=".csv"
/>
</label>
{{#if (or uploading processing)}}
<span>{{i18n "upload_selector.uploading"}} {{uploadProgress}}%</span>
{{/if}}
{{/if}}

View File

@ -9,4 +9,4 @@
{{yield}}
</div>
</div>
{{/if}}
{{/if}}

View File

@ -1 +1 @@
<div id="upcoming-events-calendar"></div>
<div id="upcoming-events-calendar"></div>

View File

@ -1,3 +1,3 @@
<div class="discourse-post-event-upcoming-events">
{{upcoming-events-calendar events=model}}
</div>
</div>

View File

@ -13,7 +13,10 @@
onChange=(action "onChangeDates")
}}
{{#event-field class="name" label="discourse_post_event.builder_modal.name.label"}}
{{#event-field
class="name"
label="discourse_post_event.builder_modal.name.label"
}}
{{input
value=(readonly model.eventModel.name)
placeholderKey="discourse_post_event.builder_modal.name.placeholder"
@ -21,7 +24,10 @@
}}
{{/event-field}}
{{#event-field class="url" label="discourse_post_event.builder_modal.url.label"}}
{{#event-field
class="url"
label="discourse_post_event.builder_modal.url.label"
}}
{{input
value=(readonly model.eventModel.url)
placeholderKey="discourse_post_event.builder_modal.url.placeholder"
@ -29,7 +35,10 @@
}}
{{/event-field}}
{{#event-field class="timezone" label="discourse_post_event.builder_modal.timezone.label"}}
{{#event-field
class="timezone"
label="discourse_post_event.builder_modal.timezone.label"
}}
{{timezone-input
value=model.eventModel.timezone
onChange=(action "onChangeTimezone")
@ -47,8 +56,12 @@
onChange=(action "onChangeStatus")
}}
<span class="message">
<span class="title">{{i18n "discourse_post_event.models.event.status.public.title"}}</span>
<span class="description">{{i18n "discourse_post_event.models.event.status.public.description"}}</span>
<span class="title">{{i18n
"discourse_post_event.models.event.status.public.title"
}}</span>
<span class="description">{{i18n
"discourse_post_event.models.event.status.public.description"
}}</span>
</span>
</label>
<label class="radio-label">
@ -59,8 +72,12 @@
onChange=(action "onChangeStatus")
}}
<span class="message">
<span class="title">{{i18n "discourse_post_event.models.event.status.private.title"}}</span>
<span class="description">{{i18n "discourse_post_event.models.event.status.private.description"}}</span>
<span class="title">{{i18n
"discourse_post_event.models.event.status.private.title"
}}</span>
<span class="description">{{i18n
"discourse_post_event.models.event.status.private.description"
}}</span>
</span>
</label>
<label class="radio-label">
@ -71,13 +88,20 @@
onChange=(action "onChangeStatus")
}}
<span class="message">
<span class="title">{{i18n "discourse_post_event.models.event.status.standalone.title"}}</span>
<span class="description">{{i18n "discourse_post_event.models.event.status.standalone.description"}}</span>
<span class="title">{{i18n
"discourse_post_event.models.event.status.standalone.title"
}}</span>
<span class="description">{{i18n
"discourse_post_event.models.event.status.standalone.description"
}}</span>
</span>
</label>
{{/event-field}}
{{#event-field enabled=allowsInvitees label="discourse_post_event.builder_modal.invitees.label"}}
{{#event-field
enabled=allowsInvitees
label="discourse_post_event.builder_modal.invitees.label"
}}
{{group-selector
fullWidthWrap=true
groupFinder=groupFinder
@ -87,7 +111,10 @@
}}
{{/event-field}}
{{#event-field class="reminders" label="discourse_post_event.builder_modal.reminders.label"}}
{{#event-field
class="reminders"
label="discourse_post_event.builder_modal.reminders.label"
}}
<div class="reminders-list">
{{#each model.eventModel.reminders as |reminder|}}
<div class="reminder-item">
@ -145,24 +172,35 @@
}}
{{/event-field}}
{{#event-field class="recurrence" label="discourse_post_event.builder_modal.recurrence.label"}}
{{#event-field
class="recurrence"
label="discourse_post_event.builder_modal.recurrence.label"
}}
{{combo-box
class="available-recurrences"
value=(readonly model.eventModel.recurrence)
content=availableRecurrences
onChange=(action (mut model.eventModel.recurrence))
options=(hash none="discourse_post_event.builder_modal.recurrence.none")
options=(hash
none="discourse_post_event.builder_modal.recurrence.none"
)
}}
{{/event-field}}
{{#if allowedCustomFields.length}}
{{#event-field label="discourse_post_event.builder_modal.custom_fields.label"}}
<p class="event-field-description">{{i18n "discourse_post_event.builder_modal.custom_fields.description"}}</p>
{{#event-field
label="discourse_post_event.builder_modal.custom_fields.label"
}}
<p class="event-field-description">{{i18n
"discourse_post_event.builder_modal.custom_fields.description"
}}</p>
{{#each allowedCustomFields as |allowedCustomField|}}
<span class="label custom-field-label">{{allowedCustomField}}</span>
{{input
class="custom-field-input"
value=(readonly (get model.eventModel.custom_fields allowedCustomField))
value=(readonly
(get model.eventModel.custom_fields allowedCustomField)
)
placeholderKey="discourse_post_event.builder_modal.custom_fields.placeholder"
input=(action "onChangeCustomField" allowedCustomField)
}}
@ -191,10 +229,6 @@
action=(action "updateEvent")
}}
{{d-button
icon="trash-alt"
class="btn-danger"
action="destroyPostEvent"
}}
{{d-button icon="trash-alt" class="btn-danger" action="destroyPostEvent"}}
{{/if}}
</div>
</div>

View File

@ -3,7 +3,12 @@
class="discourse-post-event-bulk-invite"
}}
<div class="bulk-invites">
<p class="bulk-event-help">{{i18n (concat "discourse_post_event.bulk_invite_modal.description_" model.eventModel.status)}}</p>
<p class="bulk-event-help">{{i18n
(concat
"discourse_post_event.bulk_invite_modal.description_"
model.eventModel.status
)
}}</p>
<h3>{{i18n "discourse_post_event.bulk_invite_modal.inline_title"}}</h3>
<div class="bulk-invite-rows">
@ -49,8 +54,17 @@
</div>
<div class="bulk-invite-actions">
{{d-button class="send-bulk-invites btn-primary" label="discourse_post_event.bulk_invite_modal.send_bulk_invites" action=(action "sendBulkInvites") disabled=bulkInviteDisabled}}
{{d-button class="add-bulk-invite" icon="plus" action=(action "addBulkInvite")}}
{{d-button
class="send-bulk-invites btn-primary"
label="discourse_post_event.bulk_invite_modal.send_bulk_invites"
action=(action "sendBulkInvites")
disabled=bulkInviteDisabled
}}
{{d-button
class="add-bulk-invite"
icon="plus"
action=(action "addBulkInvite")
}}
</div>
</div>
@ -63,11 +77,13 @@
{{csv-uploader
id="discourse-post-event-csv-uploader"
uploadUrl=(concat "/discourse-post-event/events/" model.eventModel.id "/csv-bulk-invite")
uploadUrl=(concat
"/discourse-post-event/events/" model.eventModel.id "/csv-bulk-invite"
)
i18nPrefix="discourse_post_event.bulk_invite_modal"
uploading=uploading
uploadDone=(action "uploadDone")
}}
</div>
</div>
{{/d-modal-body}}
{{/d-modal-body}}

View File

@ -26,4 +26,4 @@
label="discourse_post_event.invite_user_or_group.invite"
action=(action "invite")
}}
</div>
</div>

View File

@ -15,7 +15,11 @@
{{#if invitee.status}}
<span class="status {{invitee.status}}">
{{i18n (concat "discourse_post_event.models.invitee.status." invitee.status)}}
{{i18n
(concat
"discourse_post_event.models.invitee.status." invitee.status
)
}}
</span>
{{else}}
<span class="status">
@ -38,4 +42,4 @@
</p>
{{/if}}
{{/conditional-loading-spinner}}
{{/d-modal-body}}
{{/d-modal-body}}

View File

@ -78,9 +78,8 @@ export default createWidget("discourse-group-timezones", {
if (newDayIndex) {
groupedTimezones.splice(newDayIndex, 0, {
type: "discourse-group-timezone-new-day",
beforeDate: groupedTimezones[newDayIndex - 1].nowWithOffset.format(
"dddd"
),
beforeDate:
groupedTimezones[newDayIndex - 1].nowWithOffset.format("dddd"),
afterDate: groupedTimezones[newDayIndex].nowWithOffset.format("dddd"),
});
}

View File

@ -603,11 +603,10 @@ function initializeDiscourseCalendar(api) {
localEvents: {},
};
formattedGroupedEvents[identifier].localEvents[
groupedEvent.name
] = formattedGroupedEvents[identifier].localEvents[groupedEvent.name] || {
usernames: [],
};
formattedGroupedEvents[identifier].localEvents[groupedEvent.name] =
formattedGroupedEvents[identifier].localEvents[groupedEvent.name] || {
usernames: [],
};
formattedGroupedEvents[identifier].localEvents[
groupedEvent.name
@ -650,9 +649,8 @@ function initializeDiscourseCalendar(api) {
tzPicker.value = timezone;
} else {
document.querySelector(
".discourse-calendar-timezone-wrap"
).innerText = timezone;
document.querySelector(".discourse-calendar-timezone-wrap").innerText =
timezone;
}
}

View File

@ -110,9 +110,8 @@ export function setup(helper) {
]);
helper.registerOptions((opts, siteSettings) => {
opts.features[
"discourse-calendar-enabled"
] = !!siteSettings.calendar_enabled;
opts.features["discourse-calendar-enabled"] =
!!siteSettings.calendar_enabled;
});
helper.registerPlugin((md) => {

View File

@ -1 +1 @@
<img src={{holidayEmoji}} class="emoji" alt={{holidayEmojiName}}>
<img src={{holidayEmoji}} class="emoji" alt={{holidayEmojiName}} />

View File

@ -1 +1 @@
<div class="before-topic-list-body-outlet category-calendar"></div>
<div class="before-topic-list-body-outlet category-calendar"></div>

View File

@ -1 +1 @@
<div id="category-events-calendar"></div>
<div id="category-events-calendar"></div>

View File

@ -1,5 +1,7 @@
<div class="control-group">
<label class="control-label">{{i18n "discourse_calendar.region.title"}}</label>
<label class="control-label">{{i18n
"discourse_calendar.region.title"
}}</label>
<div class="controls">
{{region-input
value=model.custom_fields.holidays-region
@ -7,5 +9,9 @@
onChange=(action "onChange")
}}
</div>
{{d-button icon="globe" label="discourse_calendar.region.use_current_region" action=(action "useCurrentRegion") }}
</div>
{{d-button
icon="globe"
label="discourse_calendar.region.use_current_region"
action=(action "useCurrentRegion")
}}
</div>

2948
yarn.lock

File diff suppressed because it is too large Load Diff