Count by country in the markdown digest
This commit is contained in:
parent
803511cde2
commit
2cc8012731
@ -7,4 +7,19 @@ module DigestHelper
|
|||||||
|
|
||||||
description.gsub(/\[(\d)+\]/, "[#{id}_\\1]")
|
description.gsub(/\[(\d)+\]/, "[#{id}_\\1]")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def count_by_country(events)
|
||||||
|
events.group_by { |e| e.region&.region || e.region }.collect do |region, es|
|
||||||
|
"#{region}: #{es.size}"
|
||||||
|
end.join ', '
|
||||||
|
end
|
||||||
|
|
||||||
|
# [country city] title - date
|
||||||
|
def to_title(event)
|
||||||
|
["[#{event.region.region&.code || event.region&.code}",
|
||||||
|
"#{event.city}]",
|
||||||
|
"[#{event.title}](#{event_url event})",
|
||||||
|
'-',
|
||||||
|
display_date(event)].join ' '
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
- title = t '.title', week: @week.cweek, year: @week.year
|
- title = t '.title', week: @week.cweek, year: @week.year
|
||||||
|
|
||||||
- description = capture_haml do
|
- description = capture_haml do
|
||||||
= t '.week', count: @events.count
|
= t '.week', count: @events.count, count_by_country: count_by_country(@events)
|
||||||
|
|
||||||
- second_part = capture_haml do
|
- second_part = capture_haml do
|
||||||
- @events.sort_by(&:start_time).each do |event|
|
- @events.sort_by(&:start_time).each do |event|
|
||||||
[#{event.region.region.try(:code) || event.region.try(:code)} #{event.city}] [#{event.title}](#{event_url event}) - #{display_date event}
|
= to_title event
|
||||||
\-----
|
\-----
|
||||||
= renumber_footnotes event.id, to_markdown(event.description)
|
= renumber_footnotes event.id, to_markdown(event.description)
|
||||||
\
|
\
|
||||||
@ -24,18 +24,6 @@
|
|||||||
|
|
||||||
%hr
|
%hr
|
||||||
|
|
||||||
:markdown
|
|
||||||
* [April](https://april.org)
|
|
||||||
* [Agenda du Libre](https://www.agendadulibre.org)
|
|
||||||
* [Carte des événements](#{maps_url future: false, period:
|
|
||||||
{ year: @week.year, week: @week.cweek }})
|
|
||||||
* [Proposer un événement](https://www.agendadulibre.org/events/new)
|
|
||||||
* [Annuaire des organisations](https://www.agendadulibre.org/orgas)
|
|
||||||
* [Agenda pour la semaine précédente](#{digest_url :markdown,
|
|
||||||
future: false, period: { year: @week.year, week: (@week - 1.week).cweek }})
|
|
||||||
|
|
||||||
%hr
|
|
||||||
|
|
||||||
.second_part
|
.second_part
|
||||||
:markdown
|
:markdown
|
||||||
#{second_part}
|
#{second_part}
|
||||||
|
@ -310,7 +310,7 @@ description."
|
|||||||
digests:
|
digests:
|
||||||
markdown:
|
markdown:
|
||||||
title: Agenda du Libre for week %{week} of the year %{year}
|
title: Agenda du Libre for week %{week} of the year %{year}
|
||||||
week: Week of %{count} events.
|
week: Week of %{count} events (%{count_by_country}).
|
||||||
|
|
||||||
devise:
|
devise:
|
||||||
sessions:
|
sessions:
|
||||||
|
@ -326,7 +326,7 @@ description plus complète."
|
|||||||
digests:
|
digests:
|
||||||
markdown:
|
markdown:
|
||||||
title: Agenda du Libre pour la semaine %{week} de l'année %{year}
|
title: Agenda du Libre pour la semaine %{week} de l'année %{year}
|
||||||
week: Calendrier web, regroupant des événements liés au Libre (logiciel, salon, atelier, install party, conférence), annoncés par leurs organisateurs. Voici un récapitulatif de la semaine à venir. Le détail de chacun de ces %{count} événements est en seconde partie de dépêche.
|
week: Calendrier web, regroupant des événements liés au Libre (logiciel, salon, atelier, install party, conférence), annoncés par leurs organisateurs. Voici un récapitulatif de la semaine à venir. Le détail de chacun de ces %{count} événements (%{count_by_country}) est en seconde partie de dépêche.
|
||||||
|
|
||||||
devise:
|
devise:
|
||||||
sessions:
|
sessions:
|
||||||
|
@ -311,7 +311,7 @@ descrição mais completa."
|
|||||||
digests:
|
digests:
|
||||||
markdown:
|
markdown:
|
||||||
title: Agenda Livre da semana %{week} do ano de %{year}
|
title: Agenda Livre da semana %{week} do ano de %{year}
|
||||||
week: Semana com %{count} eventos.
|
week: Semana com %{count} eventos (%{count_by_country}).
|
||||||
|
|
||||||
devise:
|
devise:
|
||||||
sessions:
|
sessions:
|
||||||
|
Loading…
Reference in New Issue
Block a user