Skip to content

Commit e718ec1

Browse files
authored
Merge pull request #391 from echarp/rails7
Upgrade haml and sass
2 parents 07a1f9f + 750b438 commit e718ec1

File tree

6 files changed

+90
-76
lines changed

6 files changed

+90
-76
lines changed

Gemfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ gem "doorkeeper"
2020
gem "ffi-hunspell", github: "postmodern/ffi-hunspell"
2121
gem "french_rails", "~>0.5", github: "linuxfrorg/french-rails"
2222
gem "friendly_id", "~>5.1"
23-
gem "haml", "~>5.0"
23+
gem "haml", "~>6.3"
2424
gem "htmlentities", "~>4.3"
2525
gem "html-pipeline-linuxfr", "~>0.17", github: "linuxfrorg/html-pipeline-linuxfr"
2626
gem "html_spellchecker", "~>0.1"
@@ -38,10 +38,10 @@ gem "state_machines-activerecord"
3838
# Gems used for assets
3939
assets = !%w(production alpha).include?(ENV['RAILS_ENV'])
4040
assets = true if ENV['RAILS_GROUPS'] == "assets"
41-
gem "jquery-rails", "~>4.0", require: assets
42-
gem "normalize-rails", "~>8.0", require: assets
43-
gem "sass-rails", "~>5.0", require: assets
44-
gem "terser", "~> 1.2", require: assets
41+
gem "jquery-rails", "~>4.0", require: assets
42+
gem "normalize-rails", "~>8.0", require: assets
43+
gem "sassc-rails", require: assets
44+
gem "terser", "~> 1.2", require: assets
4545

4646
group :development, :test do
4747
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
@@ -64,5 +64,5 @@ group :test do
6464
end
6565

6666
group :production, :alpha do
67-
gem "unicorn", "~>6.1"
67+
gem "unicorn", "~>6.1"
6868
end

Gemfile.lock

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ GEM
132132
erubi (>= 1.0.0)
133133
rack (>= 0.9.0)
134134
rouge (>= 1.0.0)
135-
bigdecimal (3.1.6)
135+
bigdecimal (3.1.7)
136136
bindex (0.8.1)
137137
binding_of_caller (1.0.1)
138138
debug_inspector (>= 1.2.0)
@@ -143,13 +143,14 @@ GEM
143143
builder (3.2.4)
144144
byebug (11.1.3)
145145
canable (0.3.0)
146-
carrierwave (3.0.6)
146+
carrierwave (3.0.7)
147147
activemodel (>= 6.0.0)
148148
activesupport (>= 6.0.0)
149149
addressable (~> 2.6)
150150
image_processing (~> 1.1)
151151
marcel (~> 1.0.0)
152152
ssrf_filter (~> 1.0)
153+
childprocess (5.0.0)
153154
concurrent-ruby (1.2.3)
154155
connection_pool (2.4.1)
155156
crass (1.0.6)
@@ -173,8 +174,9 @@ GEM
173174
activerecord (>= 4.0.0)
174175
globalid (1.2.1)
175176
activesupport (>= 6.1)
176-
haml (5.2.2)
177-
temple (>= 0.8.0)
177+
haml (6.3.0)
178+
temple (>= 0.8.2)
179+
thor
178180
tilt
179181
has_scope (0.8.2)
180182
actionpack (>= 5.2)
@@ -216,10 +218,11 @@ GEM
216218
kaminari-core (= 1.2.2)
217219
kaminari-core (1.2.2)
218220
kgio (2.11.4)
219-
launchy (2.5.2)
221+
launchy (3.0.0)
220222
addressable (~> 2.8)
221-
letter_opener (1.9.0)
222-
launchy (>= 2.2, < 3)
223+
childprocess (~> 5.0)
224+
letter_opener (1.10.0)
225+
launchy (>= 2.2, < 4)
223226
loofah (2.22.0)
224227
crass (~> 1.0.2)
225228
nokogiri (>= 1.12.0)
@@ -231,7 +234,7 @@ GEM
231234
marcel (1.0.4)
232235
mini_magick (4.12.0)
233236
mini_mime (1.1.5)
234-
minitest (5.22.2)
237+
minitest (5.22.3)
235238
msgpack (1.7.2)
236239
multi_json (1.15.0)
237240
mutex_m (0.2.0)
@@ -243,10 +246,10 @@ GEM
243246
net-protocol
244247
net-protocol (0.2.2)
245248
timeout
246-
net-smtp (0.4.0.1)
249+
net-smtp (0.5.0)
247250
net-protocol
248-
nio4r (2.7.0)
249-
nokogiri (1.16.2-x86_64-linux)
251+
nio4r (2.7.1)
252+
nokogiri (1.16.3-x86_64-linux)
250253
racc (~> 1.4)
251254
nokogumbo (2.0.5)
252255
nokogiri (~> 1.8, >= 1.8.4)
@@ -261,14 +264,14 @@ GEM
261264
pygments.rb (1.2.1)
262265
multi_json (>= 1.0.0)
263266
racc (1.7.3)
264-
rack (2.2.8.1)
265-
rack-session (1.0.2)
266-
rack (< 3)
267+
rack (3.0.10)
268+
rack-session (2.0.0)
269+
rack (>= 3.0.0)
267270
rack-test (2.1.0)
268271
rack (>= 1.3)
269-
rackup (1.0.0)
270-
rack (< 3)
271-
webrick
272+
rackup (2.1.0)
273+
rack (>= 3)
274+
webrick (~> 1.8)
272275
rails (7.1.3.2)
273276
actioncable (= 7.1.3.2)
274277
actionmailbox (= 7.1.3.2)
@@ -303,37 +306,34 @@ GEM
303306
rb-fsevent (0.11.2)
304307
rb-inotify (0.10.1)
305308
ffi (~> 1.0)
306-
rdoc (6.6.2)
309+
rdoc (6.6.3.1)
307310
psych (>= 4.0.0)
308311
redcarpet (3.6.0)
309312
redis (5.1.0)
310313
redis-client (>= 0.17.0)
311-
redis-client (0.21.0)
314+
redis-client (0.21.1)
312315
connection_pool
313-
reline (0.4.3)
316+
reline (0.5.0)
314317
io-console (~> 0.5)
315318
responders (3.1.1)
316319
actionpack (>= 5.2)
317320
railties (>= 5.2)
318321
rinku (2.0.6)
319-
rouge (4.2.0)
322+
rouge (4.2.1)
320323
ruby-vips (2.2.1)
321324
ffi (~> 1.12)
322325
sanitize (5.2.3)
323326
crass (~> 1.0.2)
324327
nokogiri (>= 1.8.0)
325328
nokogumbo (~> 2.0)
326-
sass (3.7.4)
327-
sass-listen (~> 4.0.0)
328-
sass-listen (4.0.0)
329-
rb-fsevent (~> 0.9, >= 0.9.4)
330-
rb-inotify (~> 0.9, >= 0.9.7)
331-
sass-rails (5.1.0)
332-
railties (>= 5.2.0)
333-
sass (~> 3.1)
334-
sprockets (>= 2.8, < 4.0)
335-
sprockets-rails (>= 2.0, < 4.0)
336-
tilt (>= 1.1, < 3)
329+
sassc (2.4.0)
330+
ffi (~> 1.9)
331+
sassc-rails (2.1.2)
332+
railties (>= 4.0.0)
333+
sassc (>= 2.0)
334+
sprockets (> 3.0)
335+
sprockets-rails
336+
tilt
337337
simplecov (0.22.0)
338338
docile (~> 1.1)
339339
simplecov-html (~> 0.11)
@@ -342,9 +342,9 @@ GEM
342342
simplecov_json_formatter (0.1.4)
343343
sitemap_generator (2.2.1)
344344
spring (4.1.3)
345-
sprockets (3.7.2)
345+
sprockets (4.2.1)
346346
concurrent-ruby (~> 1.0)
347-
rack (> 1, < 3)
347+
rack (>= 2.2.4, < 4)
348348
sprockets-rails (3.4.2)
349349
actionpack (>= 5.2)
350350
activesupport (>= 5.2)
@@ -359,7 +359,7 @@ GEM
359359
state_machines-activemodel (>= 0.9.0)
360360
stringio (3.1.0)
361361
temple (0.10.3)
362-
terser (1.2.0)
362+
terser (1.2.1)
363363
execjs (>= 0.3.0, < 3)
364364
thor (1.3.1)
365365
tilt (2.3.0)
@@ -403,7 +403,7 @@ DEPENDENCIES
403403
ffi-hunspell!
404404
french_rails (~> 0.5)!
405405
friendly_id (~> 5.1)
406-
haml (~> 5.0)
406+
haml (~> 6.3)
407407
html-pipeline-linuxfr (~> 0.17)!
408408
html_spellchecker (~> 0.1)
409409
html_truncator (~> 0.4)
@@ -421,7 +421,7 @@ DEPENDENCIES
421421
rails (~> 7.1)
422422
redis (~> 5.0)
423423
rinku (~> 2.0)
424-
sass-rails (~> 5.0)
424+
sassc-rails
425425
simplecov
426426
sitemap_generator (~> 2.1)
427427
spring
Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,3 @@
11
@charset "UTF-8";
22

3-
/* Color constants */
4-
$C_CLAIR: #e9e6e4;
5-
$C_BANDEAU: #4c575f !default;
6-
$C_FONCE: #877768;
7-
$C_INTER: #93877b;
8-
$C_SOMBRE: #4e4e50;
9-
$C_INACTIVE: #cacacb;
10-
$C_BAS_FOND: #e4e4e4;
11-
$C_FOOT: #d4d1cf;
12-
$C_MIBLANC_MIFOOT: #e9e8e7;
13-
$C_CONTAINER: #f9f9f9;
14-
$C_MENU: #4c575f;
15-
$C_BORDER_FONCE: #999;
16-
17-
/*$C_BD1: #F9DEE8;
18-
$C_BD2: #F1ABC5;
19-
$C_BD3: #E978A3;
20-
$C_BD4: #E14E85;
21-
$C_BD5: #D91C64;*/
22-
$C_BD1: transparentize($C_BANDEAU, 0.84);
23-
$C_BD2: transparentize($C_BANDEAU, 0.67);
24-
$C_BD3: transparentize($C_BANDEAU, 0.5);
25-
$C_BD4: transparentize($C_BANDEAU, 0.33);
26-
$C_BD5: transparentize($C_BANDEAU, 0.17);
27-
283
@import "RonRonnement";
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/* Color constants */
2+
$C_CLAIR: #e9e6e4;
3+
$C_BANDEAU: #4c575f !default;
4+
$C_FONCE: #877768;
5+
$C_INTER: #93877b;
6+
$C_SOMBRE: #4e4e50;
7+
$C_INACTIVE: #cacacb;
8+
$C_BAS_FOND: #e4e4e4;
9+
$C_FOOT: #d4d1cf;
10+
$C_MIBLANC_MIFOOT: #e9e8e7;
11+
$C_CONTAINER: #f9f9f9;
12+
$C_MENU: #4c575f;
13+
$C_BORDER_FONCE: #999;
14+
15+
/*$C_BD1: #F9DEE8;
16+
$C_BD2: #F1ABC5;
17+
$C_BD3: #E978A3;
18+
$C_BD4: #E14E85;
19+
$C_BD5: #D91C64;*/
20+
$C_BD1: transparentize($C_BANDEAU, 0.84);
21+
$C_BD2: transparentize($C_BANDEAU, 0.67);
22+
$C_BD3: transparentize($C_BANDEAU, 0.5);
23+
$C_BD4: transparentize($C_BANDEAU, 0.33);
24+
$C_BD5: transparentize($C_BANDEAU, 0.17);

app/helpers/application_helper.rb

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
# encoding: utf-8
1+
# Helper methods for the whole application
22
module ApplicationHelper
3-
4-
def title(title, tag=nil)
3+
def title(title, tag = nil)
54
title = h(title)
65
@title.unshift title
76
content_tag(tag, title) if tag
@@ -11,7 +10,7 @@ def h1(str)
1110
title(str, :h1)
1211
end
1312

14-
def feed(title, link=nil)
13+
def feed(title, link = nil)
1514
link ||= { format: :atom }
1615
@feeds[link] = title
1716
end
@@ -22,15 +21,30 @@ def link(rel, link)
2221

2322
def meta_for(content)
2423
@author = content.node.user.try(:name)
25-
@keywords = content.node.popular_tags.map &:name
24+
@keywords = content.node.popular_tags.map(&:name)
2625
@description = content.title
27-
@dont_index = true if content.node.score < 0
28-
published_at = content.node.try(:created_at) || DateTime.now()
26+
@dont_index = true if content.node.score.negative?
27+
published_at = content.node.try(:created_at) || DateTime.now
2928
# For all content recently published, ask robots to not index it if
3029
# a minimum score is not reached during the first 24 hours.
3130
# The threshold is set to the one used by moderated News, so the moderated
3231
# content can still be fastly indexed by robots.
33-
@dont_index ||= true if published_at > DateTime.now() - 24.hour && content.node.score <= News.accept_threshold
32+
@dont_index ||= true if published_at > DateTime.now - 24.hours && content.node.score <= News.accept_threshold
3433
end
3534

35+
def list_of(enum, opts = {}, &block)
36+
opts_attributes = opts.map { |k, v| " #{k}='#{v}'" }.join
37+
enum.map do |i|
38+
result = capture(i, &block)
39+
40+
if result.count("\n") > 1
41+
result.gsub!("\n", "\n ")
42+
result = "\n #{result.strip}\n"
43+
else
44+
result.strip!
45+
end
46+
47+
%(<li#{opts_attributes}>#{result}</li>)
48+
end.join("\n").html_safe
49+
end
3650
end

test/fixtures/news.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ first_part_only:
3636
cached_slug: une-actualite-avec-une-seule-partie
3737
author_name: Auteur sympa
3838
author_email: [email protected]
39+
body: Uns seule partie

0 commit comments

Comments
 (0)