Skip to content

Commit bd2a210

Browse files
committed
DEV: Update linting config and run gjs-codemod
1 parent 0d4a895 commit bd2a210

File tree

16 files changed

+617
-587
lines changed

16 files changed

+617
-587
lines changed

.discourse-compatibility

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
< 3.5.0.beta5-dev: 0d4a895d8913a3f55e68667255be9ad3a869eb56
12
< 3.5.0.beta1-dev: d94b28fa2482ac71351f3ab4885862100e310680
23
< 3.4.0.beta1-dev: b0370f7b7eb7feffc7a6ae9bdf5b0f4597763d8e
34
< 3.3.0.beta1-dev: 38e6cf2dd7bb16d56594eb406d8880709101e131

Gemfile.lock

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,44 @@ GEM
1414
securerandom (>= 0.3)
1515
tzinfo (~> 2.0, >= 2.0.5)
1616
uri (>= 0.13.1)
17-
ast (2.4.2)
18-
base64 (0.2.0)
19-
benchmark (0.4.0)
20-
bigdecimal (3.1.9)
17+
ast (2.4.3)
18+
base64 (0.3.0)
19+
benchmark (0.4.1)
20+
bigdecimal (3.2.1)
2121
concurrent-ruby (1.3.5)
22-
connection_pool (2.5.0)
23-
drb (2.2.1)
22+
connection_pool (2.5.3)
23+
drb (2.2.3)
2424
i18n (1.14.7)
2525
concurrent-ruby (~> 1.0)
26-
json (2.10.2)
27-
language_server-protocol (3.17.0.4)
26+
json (2.12.2)
27+
language_server-protocol (3.17.0.5)
2828
lint_roller (1.1.0)
29-
logger (1.6.6)
29+
logger (1.7.0)
3030
minitest (5.25.5)
31-
parallel (1.26.3)
32-
parser (3.3.7.1)
31+
parallel (1.27.0)
32+
parser (3.3.8.0)
3333
ast (~> 2.4.1)
3434
racc
3535
prettier_print (1.2.1)
36+
prism (1.4.0)
3637
racc (1.8.1)
37-
rack (3.1.12)
38+
rack (3.1.15)
3839
rainbow (3.1.1)
3940
regexp_parser (2.10.0)
40-
rubocop (1.74.0)
41+
rubocop (1.75.8)
4142
json (~> 2.3)
4243
language_server-protocol (~> 3.17.0.2)
4344
lint_roller (~> 1.1.0)
4445
parallel (~> 1.10)
4546
parser (>= 3.3.0.2)
4647
rainbow (>= 2.2.2, < 4.0)
4748
regexp_parser (>= 2.9.3, < 3.0)
48-
rubocop-ast (>= 1.38.0, < 2.0)
49+
rubocop-ast (>= 1.44.0, < 2.0)
4950
ruby-progressbar (~> 1.7)
5051
unicode-display_width (>= 2.4.0, < 4.0)
51-
rubocop-ast (1.39.0)
52-
parser (>= 3.3.1.0)
52+
rubocop-ast (1.44.1)
53+
parser (>= 3.3.7.2)
54+
prism (~> 1.4)
5355
rubocop-capybara (2.22.1)
5456
lint_roller (~> 1.1)
5557
rubocop (~> 1.72, >= 1.72.1)
@@ -65,13 +67,13 @@ GEM
6567
rubocop-factory_bot (2.27.1)
6668
lint_roller (~> 1.1)
6769
rubocop (~> 1.72, >= 1.72.1)
68-
rubocop-rails (2.30.3)
70+
rubocop-rails (2.32.0)
6971
activesupport (>= 4.2.0)
7072
lint_roller (~> 1.1)
7173
rack (>= 1.1)
72-
rubocop (>= 1.72.1, < 2.0)
73-
rubocop-ast (>= 1.38.0, < 2.0)
74-
rubocop-rspec (3.5.0)
74+
rubocop (>= 1.75.0, < 2.0)
75+
rubocop-ast (>= 1.44.0, < 2.0)
76+
rubocop-rspec (3.6.0)
7577
lint_roller (~> 1.1)
7678
rubocop (~> 1.72, >= 1.72.1)
7779
rubocop-rspec_rails (2.31.0)
@@ -98,4 +100,4 @@ DEPENDENCIES
98100
syntax_tree
99101

100102
BUNDLED WITH
101-
2.6.6
103+
2.6.9

common/common.scss

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ html.homepage-featured-topics {
1010
border-bottom: 1px solid var(--primary-low);
1111
position: relative;
1212

13-
@media screen and (max-width: 450px) {
13+
@media screen and (width <= 450px) {
1414
margin-top: 1em;
1515
}
1616

@@ -22,7 +22,7 @@ html.homepage-featured-topics {
2222
margin-left: auto;
2323
margin-right: auto;
2424

25-
@media screen and (max-width: 450px) {
25+
@media screen and (width <= 450px) {
2626
top: 70px;
2727
}
2828
}
@@ -46,7 +46,7 @@ html.homepage-featured-topics {
4646
align-items: center;
4747
justify-content: center;
4848

49-
@media screen and (min-width: 451px) {
49+
@media screen and (width >= 451px) {
5050
margin: 0 1.25em;
5151

5252
&:first-of-type:not(:last-of-type) {
@@ -58,7 +58,7 @@ html.homepage-featured-topics {
5858
}
5959
}
6060

61-
@media screen and (max-width: 999px) {
61+
@media screen and (width <= 999px) {
6262
&:nth-of-type(4) {
6363
margin-right: 0;
6464
}
@@ -68,7 +68,7 @@ html.homepage-featured-topics {
6868
}
6969
}
7070

71-
@media screen and (max-width: 800px) {
71+
@media screen and (width <= 800px) {
7272
&:nth-of-type(3) {
7373
margin-right: 0;
7474
}
@@ -78,7 +78,7 @@ html.homepage-featured-topics {
7878
}
7979
}
8080

81-
@media screen and (max-width: 600px) {
81+
@media screen and (width <= 600px) {
8282
width: 100%;
8383

8484
&:nth-of-type(2) {
@@ -90,7 +90,7 @@ html.homepage-featured-topics {
9090
}
9191
}
9292

93-
@media screen and (max-width: 450px) {
93+
@media screen and (width <= 450px) {
9494
width: 100%;
9595

9696
&:nth-of-type(n + 2) {
@@ -135,7 +135,7 @@ html.homepage-featured-topics {
135135
.featured-topics {
136136
justify-content: flex-start;
137137

138-
@media screen and (max-width: 999px) {
138+
@media screen and (width <= 999px) {
139139
flex-direction: row;
140140
gap: 1.25em;
141141
padding-bottom: 1rem; // spacing for scroll on mobile
@@ -151,7 +151,7 @@ html.homepage-featured-topics {
151151
}
152152
}
153153

154-
@media screen and (max-width: 800px) {
154+
@media screen and (width <= 800px) {
155155
.featured-topic {
156156
flex-basis: 45%;
157157

@@ -163,7 +163,7 @@ html.homepage-featured-topics {
163163
}
164164
}
165165

166-
@media screen and (max-width: 600px) {
166+
@media screen and (width <= 600px) {
167167
&.-mobile-stacked {
168168
.featured-topics {
169169
flex-direction: column;
@@ -206,7 +206,7 @@ html.homepage-featured-topics {
206206
}
207207
}
208208

209-
@media screen and (max-width: 400px) {
209+
@media screen and (width <= 400px) {
210210
&.-mobile-horizontal {
211211
.featured-topics {
212212
.featured-topic {

javascripts/discourse/components/featured-homepage-topics.js renamed to javascripts/discourse/components/featured-homepage-topics.gjs

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import Component from "@glimmer/component";
22
import { tracked } from "@glimmer/tracking";
3+
import { concat } from "@ember/helper";
34
import { action } from "@ember/object";
5+
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
46
import { service } from "@ember/service";
7+
import { and, not } from "truth-helpers";
8+
import DButton from "discourse/components/d-button";
9+
import concatClass from "discourse/helpers/concat-class";
10+
import icon from "discourse/helpers/d-icon";
11+
import htmlSafe from "discourse/helpers/html-safe";
512
import getURL from "discourse/lib/get-url";
613
import { emojiUnescape } from "discourse/lib/text";
714
import { defaultHomepage } from "discourse/lib/utilities";
@@ -128,4 +135,76 @@ export default class FeaturedHomepageTopics extends Component {
128135
)
129136
.slice(0, settings.number_of_topics);
130137
}
138+
139+
<template>
140+
{{#if (and this.showFor this.showHere)}}
141+
<div
142+
class="custom-homepage-wrapper"
143+
{{didInsert this.getBannerTopics}}
144+
{{didInsert this.checkShowHere}}
145+
>
146+
{{#if this.featuredTagTopics}}
147+
<div class="custom-homepage">
148+
{{#if settings.make_collapsible}}
149+
<DButton
150+
class={{concatClass
151+
"featured-topic-toggle"
152+
(if this.toggleTopics "is-open")
153+
}}
154+
@action={{action "toggle"}}
155+
@translatedLabel={{this.featuredTitle}}
156+
>
157+
{{#if this.toggleTopics}}
158+
{{icon "angle-right"}}
159+
{{else}}
160+
{{icon "angle-down"}}
161+
{{/if}}
162+
</DButton>
163+
{{/if}}
164+
165+
<div
166+
class={{concatClass
167+
"featured-topic-wrapper"
168+
this.mobileStyle
169+
(if (and this.toggleTopics settings.make_collapsible) "hidden")
170+
}}
171+
>
172+
{{#if (and settings.show_title (not settings.make_collapsible))}}
173+
<h2>
174+
{{this.featuredTitle}}
175+
</h2>
176+
{{/if}}
177+
178+
<div class="featured-topics">
179+
{{#each this.featuredTagTopics as |t|}}
180+
<div class="featured-topic">
181+
<div
182+
class="featured-topic-image"
183+
style={{htmlSafe
184+
(concat "background-image: url(" t.image_url ")")
185+
}}
186+
>
187+
{{! template-lint-disable no-invalid-link-text }}
188+
<a href={{this.topicHref t}}></a>
189+
</div>
190+
<h3>
191+
<a
192+
href={{this.topicHref t}}
193+
role="heading"
194+
aria-level="2"
195+
data-topic-id={{t.id}}
196+
>
197+
{{htmlSafe (this.emojiTitle t.fancy_title)}}
198+
</a>
199+
</h3>
200+
</div>
201+
{{/each}}
202+
</div>
203+
</div>
204+
</div>
205+
{{/if}}
206+
</div>
207+
208+
{{/if}}
209+
</template>
131210
}

javascripts/discourse/components/featured-homepage-topics.hbs

Lines changed: 0 additions & 77 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import Component from "@ember/component";
2+
import FeaturedHomepageTopics from "_fake_theme/discourse/components/featured-homepage-topics";
3+
import { classNames } from "@ember-decorators/component";
4+
5+
@classNames("above-main-container-outlet", "homepage-featured-topics")
6+
export default class HomepageFeaturedTopics extends Component {
7+
init() {
8+
super.init(...arguments);
9+
this.set(
10+
"switchOutletToAboveMainContainer",
11+
settings.featured_content_position === "above_main_container" ||
12+
settings.show_on === "all"
13+
);
14+
}
15+
16+
<template>
17+
{{#if this.switchOutletToAboveMainContainer}}
18+
<FeaturedHomepageTopics />
19+
{{/if}}
20+
</template>
21+
}

javascripts/homepage-featured-topics/connectors/above-main-container/homepage-featured-topics.hbs

Lines changed: 0 additions & 3 deletions
This file was deleted.

javascripts/homepage-featured-topics/connectors/above-main-container/homepage-featured-topics.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)