diff --git a/.github/workflows/plugin-linting.yml b/.github/workflows/plugin-linting.yml index 6d2bb97..b5c963d 100644 --- a/.github/workflows/plugin-linting.yml +++ b/.github/workflows/plugin-linting.yml @@ -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() }} diff --git a/assets/javascripts/discourse/components/amazon-product-links.js b/assets/javascripts/discourse/components/amazon-product-links.js index cee56dd..4721c39 100644 --- a/assets/javascripts/discourse/components/amazon-product-links.js +++ b/assets/javascripts/discourse/components/amazon-product-links.js @@ -24,9 +24,8 @@ export default AdComponent.extend({ const placement = this.get("placement"); if (!mobileView && this.siteSettings.amazon_topic_list_top_src_code) { - data["topic-list-top"][ - "user_input" - ] = this.siteSettings.amazon_topic_list_top_src_code; + data["topic-list-top"]["user_input"] = + this.siteSettings.amazon_topic_list_top_src_code; data["topic-list-top"]["amazon_width"] = parseInt( this.siteSettings.amazon_topic_list_top_ad_width_code, 10 @@ -38,9 +37,8 @@ export default AdComponent.extend({ } if (mobileView && this.siteSettings.amazon_mobile_topic_list_top_src_code) { - data["topic-list-top"][ - "user_input_mobile" - ] = this.siteSettings.amazon_mobile_topic_list_top_src_code; + data["topic-list-top"]["user_input_mobile"] = + this.siteSettings.amazon_mobile_topic_list_top_src_code; data["topic-list-top"]["mobile_amazon_width"] = parseInt( this.siteSettings.amazon_mobile_topic_list_top_ad_width_code, 10 @@ -55,9 +53,8 @@ export default AdComponent.extend({ !mobileView && this.siteSettings.amazon_topic_above_post_stream_src_code ) { - data["topic-above-post-stream"][ - "user_input" - ] = this.siteSettings.amazon_topic_above_post_stream_src_code; + data["topic-above-post-stream"]["user_input"] = + this.siteSettings.amazon_topic_above_post_stream_src_code; data["topic-above-post-stream"]["amazon_width"] = parseInt( this.siteSettings.amazon_topic_above_post_stream_ad_width_code, 10 @@ -72,9 +69,8 @@ export default AdComponent.extend({ mobileView && this.siteSettings.amazon_mobile_topic_above_post_stream_src_code ) { - data["topic-above-post-stream"][ - "user_input_mobile" - ] = this.siteSettings.amazon_mobile_topic_above_post_stream_src_code; + data["topic-above-post-stream"]["user_input_mobile"] = + this.siteSettings.amazon_mobile_topic_above_post_stream_src_code; data["topic-above-post-stream"]["mobile_amazon_width"] = parseInt( this.siteSettings.amazon_mobile_topic_above_post_stream_ad_width_code, 10 @@ -89,9 +85,8 @@ export default AdComponent.extend({ !mobileView && this.siteSettings.amazon_topic_above_suggested_src_code ) { - data["topic-above-suggested"][ - "user_input" - ] = this.siteSettings.amazon_topic_above_suggested_src_code; + data["topic-above-suggested"]["user_input"] = + this.siteSettings.amazon_topic_above_suggested_src_code; data["topic-above-suggested"]["amazon_width"] = parseInt( this.siteSettings.amazon_topic_above_suggested_ad_width_code, 10 @@ -106,9 +101,8 @@ export default AdComponent.extend({ mobileView && this.siteSettings.amazon_mobile_topic_above_suggested_src_code ) { - data["topic-above-suggested"][ - "user_input_mobile" - ] = this.siteSettings.amazon_mobile_topic_above_suggested_src_code; + data["topic-above-suggested"]["user_input_mobile"] = + this.siteSettings.amazon_mobile_topic_above_suggested_src_code; data["topic-above-suggested"]["mobile_amazon_width"] = parseInt( this.siteSettings.amazon_mobile_topic_above_suggested_ad_width_code, 10 @@ -120,9 +114,8 @@ export default AdComponent.extend({ } if (!mobileView && this.siteSettings.amazon_post_bottom_src_code) { - data["post-bottom"][ - "user_input" - ] = this.siteSettings.amazon_post_bottom_src_code; + data["post-bottom"]["user_input"] = + this.siteSettings.amazon_post_bottom_src_code; data["post-bottom"]["amazon_width"] = parseInt( this.siteSettings.amazon_post_bottom_ad_width_code, 10 @@ -134,9 +127,8 @@ export default AdComponent.extend({ } if (mobileView && this.siteSettings.amazon_mobile_post_bottom_src_code) { - data["post-bottom"][ - "user_input_mobile" - ] = this.siteSettings.amazon_mobile_post_bottom_src_code; + data["post-bottom"]["user_input_mobile"] = + this.siteSettings.amazon_mobile_post_bottom_src_code; data["post-bottom"]["mobile_amazon_width"] = parseInt( this.siteSettings.amazon_mobile_post_bottom_ad_width_code, 10 diff --git a/assets/javascripts/discourse/components/house-ads-chooser.js b/assets/javascripts/discourse/components/house-ads-chooser.js index c6aeaad..3cf6f7b 100644 --- a/assets/javascripts/discourse/components/house-ads-chooser.js +++ b/assets/javascripts/discourse/components/house-ads-chooser.js @@ -1,4 +1,5 @@ import MultiSelectComponent from "select-kit/components/multi-select"; +import Ember from "ember"; const { makeArray } = Ember; import { computed } from "@ember/object"; diff --git a/assets/javascripts/discourse/templates/admin/plugins-house-ads-index.hbs b/assets/javascripts/discourse/templates/admin/plugins-house-ads-index.hbs index 47eae3a..dc26d4d 100644 --- a/assets/javascripts/discourse/templates/admin/plugins-house-ads-index.hbs +++ b/assets/javascripts/discourse/templates/admin/plugins-house-ads-index.hbs @@ -3,17 +3,43 @@ {{#if houseAds.length}}
- {{house-ads-list-setting name="topic_list_top" value=adSettings.topic_list_top allAds=houseAds adSettings=adSettings}} - {{house-ads-list-setting name="topic_above_post_stream" value=adSettings.topic_above_post_stream allAds=houseAds adSettings=adSettings}} - {{house-ads-list-setting name="topic_above_suggested" value=adSettings.topic_above_suggested allAds=houseAds adSettings=adSettings}} - {{house-ads-list-setting name="post_bottom" value=adSettings.post_bottom allAds=houseAds adSettings=adSettings}} - {{house-ads-list-setting name="topic_list_between" value=adSettings.topic_list_between allAds=houseAds adSettings=adSettings}} + {{house-ads-list-setting + name="topic_list_top" + value=adSettings.topic_list_top + allAds=houseAds + adSettings=adSettings + }} + {{house-ads-list-setting + name="topic_above_post_stream" + value=adSettings.topic_above_post_stream + allAds=houseAds + adSettings=adSettings + }} + {{house-ads-list-setting + name="topic_above_suggested" + value=adSettings.topic_above_suggested + allAds=houseAds + adSettings=adSettings + }} + {{house-ads-list-setting + name="post_bottom" + value=adSettings.post_bottom + allAds=houseAds + adSettings=adSettings + }} + {{house-ads-list-setting + name="topic_list_between" + value=adSettings.topic_list_between + allAds=houseAds + adSettings=adSettings + }} - {{d-button label="admin.adplugin.house_ads.more_settings" - icon="cog" - class="btn-default" - action=(route-action "moreSettings") - }} + {{d-button + label="admin.adplugin.house_ads.more_settings" + icon="cog" + class="btn-default" + action=(route-action "moreSettings") + }}
{{else}}

@@ -22,4 +48,4 @@ {{/link-to}}

{{/if}} -{{/d-section}} +{{/d-section}} \ No newline at end of file diff --git a/assets/javascripts/discourse/templates/admin/plugins-house-ads-show.hbs b/assets/javascripts/discourse/templates/admin/plugins-house-ads-show.hbs index b5244d3..7774d2d 100644 --- a/assets/javascripts/discourse/templates/admin/plugins-house-ads-show.hbs +++ b/assets/javascripts/discourse/templates/admin/plugins-house-ads-show.hbs @@ -8,7 +8,8 @@ action=(action "save") disabled=disableSave class="btn-primary" - label="admin.adplugin.house_ads.save"}} + label="admin.adplugin.house_ads.save" + }} {{#if saving}} {{savingStatus}} @@ -21,6 +22,7 @@ {{d-button action=(action "destroy") class="btn-danger delete-button" - label="admin.adplugin.house_ads.delete"}} + label="admin.adplugin.house_ads.delete" + }} -{{/d-section}} +{{/d-section}} \ No newline at end of file diff --git a/assets/javascripts/discourse/templates/admin/plugins-house-ads.hbs b/assets/javascripts/discourse/templates/admin/plugins-house-ads.hbs index fd39a6b..c01c14a 100644 --- a/assets/javascripts/discourse/templates/admin/plugins-house-ads.hbs +++ b/assets/javascripts/discourse/templates/admin/plugins-house-ads.hbs @@ -24,4 +24,4 @@ {{/if}} {{outlet}} - + \ No newline at end of file diff --git a/assets/javascripts/discourse/templates/components/ad-slot.hbs b/assets/javascripts/discourse/templates/components/ad-slot.hbs index ef081bf..7c71f75 100644 --- a/assets/javascripts/discourse/templates/components/ad-slot.hbs +++ b/assets/javascripts/discourse/templates/components/ad-slot.hbs @@ -1,5 +1,6 @@ {{#each adComponents as |adComponent|}} - {{component adComponent + {{component + adComponent placement=placement refreshOnChange=refreshOnChange category=category @@ -8,4 +9,4 @@ indexNumber=indexNumber tagName=childTagName }} -{{/each}} +{{/each}} \ No newline at end of file diff --git a/assets/javascripts/discourse/templates/components/adbutler-ad.hbs b/assets/javascripts/discourse/templates/components/adbutler-ad.hbs index a31c3fa..2d4fe3d 100644 --- a/assets/javascripts/discourse/templates/components/adbutler-ad.hbs +++ b/assets/javascripts/discourse/templates/components/adbutler-ad.hbs @@ -1,3 +1,3 @@ {{#if showAd}}
-{{/if}} +{{/if}} \ No newline at end of file diff --git a/assets/javascripts/discourse/templates/components/amazon-product-links.hbs b/assets/javascripts/discourse/templates/components/amazon-product-links.hbs index be08c1d..3c7813e 100644 --- a/assets/javascripts/discourse/templates/components/amazon-product-links.hbs +++ b/assets/javascripts/discourse/templates/components/amazon-product-links.hbs @@ -1,6 +1,7 @@ {{#if showAd}} {{#if site.mobileView}} - + {{else}} - +