Skip to content

Commit e9268b8

Browse files
committed
redaction: when adding link through Push, directly add language description with hit counter
1 parent 34c5d92 commit e9268b8

3 files changed

Lines changed: 26 additions & 26 deletions

File tree

app/assets/javascripts/application.coffee

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,7 @@ $("textarea, #form_answers input").keypress (event) ->
3232
$(@).off event
3333

3434
# Add/Remove dynamically links in the news form
35-
langs =
36-
fr: "Français"
37-
de: "Allemand"
38-
en: "Anglais"
39-
eu: "Basque"
40-
ct: "Catalan"
41-
cn: "Chinois"
42-
ko: "Coréen"
43-
da: "Danois"
44-
es: "Espagnol"
45-
ee: "Estonien"
46-
fi: "Finnois"
47-
el: "Grec"
48-
it: "Italien"
49-
ja: "Japonais"
50-
nl: "Néerlandais"
51-
no: "Norvégien"
52-
pl: "Polonais"
53-
pt: "Portugais"
54-
ru: "Russe"
55-
sv: "Suédois"
56-
xx: "!? hmmm ?!"
57-
wq: "Code/binaire"
58-
59-
$("#form_links").nested_fields "news", "link", "lien", "fieldset", title: "text", url: "url", lang: langs
35+
$("#form_links").nested_fields "news", "link", "lien", "fieldset", title: "text", url: "url", lang: window.langs
6036
$("#form_answers").nested_fields "poll", "answer", "choix", "p", answer: "text"
6137

6238
# Mask the contributors if they are too many

app/assets/javascripts/lang.coffee

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Export langs as defined in rails
2+
window.langs =
3+
xx: "!? hmmm ?!" # default choice
4+
fr: "Français" # main language, then others sorted
5+
de: "Allemand"
6+
en: "Anglais"
7+
eu: "Basque"
8+
ct: "Catalan"
9+
cn: "Chinois"
10+
wq: "Code/binaire"
11+
ko: "Coréen"
12+
da: "Danois"
13+
es: "Espagnol"
14+
ee: "Estonien"
15+
fi: "Finnois"
16+
el: "Grec"
17+
it: "Italien"
18+
ja: "Japonais"
19+
nl: "Néerlandais"
20+
no: "Norvégien"
21+
pl: "Polonais"
22+
pt: "Portugais"
23+
ru: "Russe"
24+
sv: "Suédois"

app/assets/javascripts/redaction.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Redaction
4949

5050
innerHtmlForLink: (msg) ->
5151
"""
52-
<a href="/redirect/#{msg.id}" class="hit_counter">#{msg.title}</a> (#{msg.nb_clicks} clic#{if msg.nb_clicks > 1 then 's' else ''})
52+
<a href="/redirect/#{msg.id}" class="hit_counter">#{msg.title}</a> (#{if msg.lang == 'fr' then '' else 'en ' + window.langs[msg.lang].toLowerCase() + ', '}#{msg.nb_clicks} clic#{if msg.nb_clicks > 1 then 's' else ''})
5353
"""
5454

5555
htmlForLink: (msg) ->

0 commit comments

Comments
 (0)