Skip to content

Commit 27e6e6b

Browse files
[2025] Article archives (#4239)
Article archives are routes like: - `/2025` - `/2024/12` Though, not routes like: - `/page/2` - etc **…yet** Those routes currently point to `home#index` because the 2017 theme treated the home page page as `home#index page: 1`. The 2025 isn't doing that, so `/page/*` need to be moved to `article_archives#index`. And maybe `article_archives#index` can get moved into `article#index` for easier discovery when working in the repo. (Needs more exploration/consideration)
1 parent d98d889 commit 27e6e6b

33 files changed

+358
-231
lines changed

.rubocop.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Metrics/BlockLength:
3838
- 'config/routes.rb'
3939

4040
Metrics/ClassLength:
41-
Max: 135
41+
Max: 145
4242

4343
Metrics/CyclomaticComplexity:
4444
Max: 13
@@ -48,6 +48,9 @@ Metrics/MethodLength:
4848
Exclude:
4949
- 'db/migrate/*'
5050

51+
Metrics/ModuleLength:
52+
Max: 116
53+
5154
Metrics/ParameterLists:
5255
Max: 6
5356

@@ -58,7 +61,7 @@ Naming/VariableNumber:
5861
EnforcedStyle: snake_case
5962

6063
# TODO: https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsenvironmentvariableaccess
61-
# Consider using `Rails.application.config.foo` instead of `ENV["FOO"]`
64+
# Consider using `Rails.application.config.foo` instead of `ENV['FOO']`
6265
Rails/EnvironmentVariableAccess:
6366
Enabled: false
6467

app/assets/stylesheets/2025/fonts.css

+59-48
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ Fonts
114114
src: url("alrightsans-ultraitalic-webfont.woff2") format("woff2");
115115
}
116116

117+
/* -------------------------------------------------------------------------- */
118+
117119
/* arabic */
118120
@font-face {
119121
font-family: 'Markazi Text';
@@ -124,44 +126,46 @@ Fonts
124126
unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
125127
}
126128

127-
/* vietnamese */
129+
/* arabic */
128130
@font-face {
129131
font-family: 'Markazi Text';
130132
font-style: normal;
131-
font-weight: 400;
133+
font-weight: 500;
132134
font-display: swap;
133-
src: url('markazi-vietnamese.woff2') format('woff2');
134-
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
135+
src: url('markazi-arabic.woff2') format('woff2');
136+
unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
135137
}
136138

137-
/* latin-ext */
139+
/* arabic */
138140
@font-face {
139141
font-family: 'Markazi Text';
140142
font-style: normal;
141-
font-weight: 400;
143+
font-weight: 600;
142144
font-display: swap;
143-
src: url('latin-ext-arabic.woff2') format('woff2');
144-
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
145+
src: url('markazi-arabic.woff2') format('woff2');
146+
unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
145147
}
146148

147-
/* latin */
149+
/* arabic */
148150
@font-face {
149151
font-family: 'Markazi Text';
150152
font-style: normal;
151-
font-weight: 400;
153+
font-weight: 700;
152154
font-display: swap;
153-
src: url('markazi-latin.woff2') format('woff2');
154-
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
155+
src: url('markazi-arabic.woff2') format('woff2');
156+
unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
155157
}
156158

157-
/* arabic */
159+
/* -------------------------------------------------------------------------- */
160+
161+
/* vietnamese */
158162
@font-face {
159163
font-family: 'Markazi Text';
160164
font-style: normal;
161-
font-weight: 500;
165+
font-weight: 400;
162166
font-display: swap;
163-
src: url('markazi-arabic.woff2') format('woff2');
164-
unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
167+
src: url('markazi-vietnamese.woff2') format('woff2');
168+
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
165169
}
166170

167171
/* vietnamese */
@@ -174,44 +178,47 @@ Fonts
174178
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
175179
}
176180

177-
/* latin-ext */
181+
/* vietnamese */
178182
@font-face {
179183
font-family: 'Markazi Text';
180184
font-style: normal;
181-
font-weight: 500;
185+
font-weight: 600;
182186
font-display: swap;
183-
src: url('latin-ext-arabic.woff2') format('woff2');
184-
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
187+
src: url('markazi-vietnamese.woff2') format('woff2');
188+
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
185189
}
186190

187-
/* latin */
191+
192+
/* vietnamese */
188193
@font-face {
189194
font-family: 'Markazi Text';
190195
font-style: normal;
191-
font-weight: 500;
196+
font-weight: 700;
192197
font-display: swap;
193-
src: url('markazi-latin.woff2') format('woff2');
194-
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
198+
src: url('markazi-vietnamese.woff2') format('woff2');
199+
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
195200
}
196201

197-
/* arabic */
202+
/* -------------------------------------------------------------------------- */
203+
204+
/* latin-ext */
198205
@font-face {
199206
font-family: 'Markazi Text';
200207
font-style: normal;
201-
font-weight: 600;
208+
font-weight: 400;
202209
font-display: swap;
203-
src: url('markazi-arabic.woff2') format('woff2');
204-
unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
210+
src: url('latin-ext-arabic.woff2') format('woff2');
211+
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
205212
}
206213

207-
/* vietnamese */
214+
/* latin-ext */
208215
@font-face {
209216
font-family: 'Markazi Text';
210217
font-style: normal;
211-
font-weight: 600;
218+
font-weight: 500;
212219
font-display: swap;
213-
src: url('markazi-vietnamese.woff2') format('woff2');
214-
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
220+
src: url('latin-ext-arabic.woff2') format('woff2');
221+
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
215222
}
216223

217224
/* latin-ext */
@@ -224,44 +231,47 @@ Fonts
224231
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
225232
}
226233

227-
/* latin */
234+
/* latin-ext */
228235
@font-face {
229236
font-family: 'Markazi Text';
230237
font-style: normal;
231-
font-weight: 600;
238+
font-weight: 700;
232239
font-display: swap;
233-
src: url('markazi-latin.woff2') format('woff2');
234-
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
240+
src: url('latin-ext-arabic.woff2') format('woff2');
241+
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
235242
}
236243

237-
/* arabic */
244+
/* -------------------------------------------------------------------------- */
245+
246+
247+
/* latin */
238248
@font-face {
239249
font-family: 'Markazi Text';
240250
font-style: normal;
241-
font-weight: 700;
251+
font-weight: 400;
242252
font-display: swap;
243-
src: url('markazi-arabic.woff2') format('woff2');
244-
unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
253+
src: url('markazi-latin.woff2') format('woff2');
254+
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
245255
}
246256

247-
/* vietnamese */
257+
/* latin */
248258
@font-face {
249259
font-family: 'Markazi Text';
250260
font-style: normal;
251-
font-weight: 700;
261+
font-weight: 500;
252262
font-display: swap;
253-
src: url('markazi-vietnamese.woff2') format('woff2');
254-
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
263+
src: url('markazi-latin.woff2') format('woff2');
264+
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
255265
}
256266

257-
/* latin-ext */
267+
/* latin */
258268
@font-face {
259269
font-family: 'Markazi Text';
260270
font-style: normal;
261-
font-weight: 700;
271+
font-weight: 600;
262272
font-display: swap;
263-
src: url('latin-ext-arabic.woff2') format('woff2');
264-
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
273+
src: url('markazi-latin.woff2') format('woff2');
274+
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
265275
}
266276

267277
/* latin */
@@ -273,3 +283,4 @@ Fonts
273283
src: url('markazi-latin.woff2') format('woff2');
274284
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
275285
}
286+

app/assets/stylesheets/2025/headings.css

+12-8
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
H1-H6 headings
33
*/
44

5-
h1, h2, h3, h4, h5, h6,
6-
.h1, .h2, .h3, .h4, .h5, .h6 {
7-
font-family: 'Markazi Text';
8-
line-height: 1;
5+
article,
6+
.titles {
7+
h1, h2, h3, h4, h5, h6,
8+
.h1, .h2, .h3, .h4, .h5, .h6 {
9+
font-family: 'Markazi Text';
10+
font-weight: bold;
11+
line-height: 1;
912

10-
small {
11-
font-family: var(--bs-font-sans-serif);
12-
font-weight: normal;
13-
font-size: .5em;
13+
small {
14+
font-family: var(--bs-font-sans-serif);
15+
font-weight: normal;
16+
font-size: .5em;
17+
}
1418
}
1519
}

app/controllers/application_controller.rb

+16-4
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@ class ApplicationController < ActionController::Base
99

1010
protect_from_forgery with: :exception
1111

12+
before_action :authorize, if: :staging?
13+
before_action :check_for_redirection
14+
before_action :strip_file_extension
15+
1216
before_action :set_current_locale
1317
before_action :set_current_theme
1418
before_action :set_site_locale
1519
before_action :set_subdomain_locales
20+
before_action :set_categories
21+
before_action :set_years
1622

17-
before_action :check_for_redirection
18-
before_action :strip_file_extension
19-
before_action :authorize, if: :staging?
2023
before_action :set_page_share
2124

2225
helper :meta
@@ -79,6 +82,7 @@ def next_theme = '2025'
7982

8083
def pages_for_2025_theme
8184
%w[
85+
article_archives#index
8286
home#index
8387
languages#index
8488
languages#show
@@ -188,6 +192,7 @@ def page_share_image_url
188192
# TODO: implement this algorithm
189193
'https://cdn.crimethinc.com/assets/share/crimethinc-site-share.png'
190194
end
195+
# ...Page Share
191196

192197
def set_site_locale
193198
@site_locale = LocaleService.find(locale: nil, lang_code: I18n.locale)
@@ -197,5 +202,12 @@ def set_subdomain_locales
197202
# Site language/subdomain switcher
198203
@subdomain_locales = Locale.where abbreviation: Rails.application.config.subdomain_locales
199204
end
200-
# ...Page Share
205+
206+
def set_categories
207+
@categories = Category.all
208+
end
209+
210+
def set_years
211+
@years = (1996..Time.current.year).to_a.reverse
212+
end
201213
end

app/controllers/article_archives_controller.rb

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ def index
44
@body_id = 'article-archives'
55
@title = PageTitle.new title_for :archives
66

7+
# NOTE: @categories and @years are used on every page in the header search card
8+
# each is set in a before_action in application_controller
9+
710
@article_archive = ArticleArchive.new(year: params[:year],
811
month: params[:month],
912
day: params[:day],

app/helpers/articles_helper.rb

+31-6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,23 @@ def story_card_background_image article:
1717
"background-image: url(#{article.image})" unless lite_mode?
1818
end
1919

20+
def social_share_sites article
21+
# TODO: change list of social sites
22+
# TODO: add: mastodon, bluesky, threads
23+
# TODO: remove: twitter
24+
url = article_url year: article.year,
25+
month: article.month,
26+
day: article.day,
27+
slug: article.slug
28+
29+
{
30+
Twitter: "https://twitter.com/intent/tweet?text=#{url_encode article.title}&amp;url=#{url}&amp;via=crimethinc",
31+
Facebook: "https://www.facebook.com/sharer?u=#{url_encode url}",
32+
Tumblr: ['http://tumblr.com/widgets/share/tool?canonicalUrl=', url, '&amp;caption=',
33+
url_encode(article.title), '&amp;content=', article.image].join
34+
}
35+
end
36+
2037
def social_links_for article
2138
tag.ul class: 'social-links' do
2239
social_link_for(article, :twitter) +
@@ -26,16 +43,24 @@ def social_links_for article
2643
end
2744

2845
def social_link_for article, site
29-
url =
46+
# TODO: change list of social sites
47+
# TODO: add: mastodon, bluesky, threads
48+
# TODO: remove: twitter
49+
url = article_url year: article.year,
50+
month: article.month,
51+
day: article.day,
52+
slug: article.slug
53+
54+
share_url =
3055
case site
3156
when :twitter
32-
"https://twitter.com/intent/tweet?text=#{url_encode article.title}&amp;url=#{article_url}&amp;via=crimethinc"
57+
"https://twitter.com/intent/tweet?text=#{url_encode article.title}&amp;url=#{url}&amp;via=crimethinc"
3358
when :facebook
34-
"https://www.facebook.com/sharer?u=#{url_encode article_url}"
59+
"https://www.facebook.com/sharer?u=#{url_encode url}"
3560
when :tumblr
3661
[
3762
'http://tumblr.com/widgets/share/tool?canonicalUrl=',
38-
article_url,
63+
url,
3964
'&amp;caption=',
4065
url_encode(article.title),
4166
'&amp;content=',
@@ -45,7 +70,7 @@ def social_link_for article, site
4570

4671
tag.li class: 'social-link' do
4772
link_to "Share on #{site.capitalize}",
48-
url,
73+
share_url,
4974
class: "link-domain-#{site}",
5075
target: '_blank',
5176
rel: 'noopener'
@@ -117,7 +142,7 @@ def link_to_dates year: nil, month: nil, day: nil, show_year: true, show_month:
117142
)
118143
end
119144

120-
links.join('-').html_safe
145+
links.join('').html_safe
121146
end
122147

123148
def publication_status_badge_class article

0 commit comments

Comments
 (0)