Moderation elements are now organised per country

This commit is contained in:
echarp 2020-01-11 18:28:07 +01:00
parent 9f27812d70
commit baa08dc85c
12 changed files with 127 additions and 92 deletions

View File

@ -138,7 +138,7 @@ GEM
pry (>= 0.9.12) pry (>= 0.9.12)
shellany (~> 0.0) shellany (~> 0.0)
thor (>= 0.18.1) thor (>= 0.18.1)
guard-brakeman (0.8.5) guard-brakeman (0.8.6)
brakeman (>= 2.1.1) brakeman (>= 2.1.1)
guard (>= 2.0.0) guard (>= 2.0.0)
guard-compat (~> 1.0) guard-compat (~> 1.0)
@ -196,10 +196,10 @@ GEM
http_parser.rb (~> 0.6.0) http_parser.rb (~> 0.6.0)
http-cookie (1.0.3) http-cookie (1.0.3)
domain_name (~> 0.5) domain_name (~> 0.5)
http-form_data (2.1.1) http-form_data (2.2.0)
http_accept_language (2.1.1) http_accept_language (2.1.1)
http_parser.rb (0.6.0) http_parser.rb (0.6.0)
i18n (1.7.0) i18n (1.8.1)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
i18n-active_record (0.3.0) i18n-active_record (0.3.0)
i18n (>= 0.5.0) i18n (>= 0.5.0)
@ -253,7 +253,7 @@ GEM
loofah (2.4.0) loofah (2.4.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
lumberjack (1.1.0) lumberjack (1.1.1)
mail (2.7.1) mail (2.7.1)
mini_mime (>= 0.1.1) mini_mime (>= 0.1.1)
marcel (0.3.3) marcel (0.3.3)
@ -284,7 +284,7 @@ GEM
activerecord (>= 4.2) activerecord (>= 4.2)
request_store (~> 1.1) request_store (~> 1.1)
parallel (1.19.1) parallel (1.19.1)
parser (2.7.0.1) parser (2.7.0.2)
ast (~> 2.4.0) ast (~> 2.4.0)
piwik_analytics (1.0.2) piwik_analytics (1.0.2)
actionpack actionpack
@ -300,7 +300,7 @@ GEM
public_suffix (4.0.3) public_suffix (4.0.3)
puma (4.3.1) puma (4.3.1)
nio4r (~> 2.0) nio4r (~> 2.0)
rack (2.0.8) rack (2.1.0)
rack-livereload (0.3.17) rack-livereload (0.3.17)
rack rack
rack-test (1.1.0) rack-test (1.1.0)

View File

@ -105,7 +105,7 @@ class Event < ApplicationRecord
end end
def to_s def to_s
"#{start_time.to_date} #{city}: #{title} #{hashtags.join(' ')}" [start_time.to_date, city + ':', title, hashtags.join(' ')].join ' '
end end
def to_tweet def to_tweet

View File

@ -20,7 +20,7 @@ class Region < ApplicationRecord
end end
def flag def flag
region.try(:flag) || code.try(:downcase) region&.flag || code&.downcase
end end
# Attempt to get a corresponding timezone, used for ical # Attempt to get a corresponding timezone, used for ical

View File

@ -34,7 +34,11 @@ class User < ApplicationRecord
end end
def to_s def to_s
"#{firstname} #{lastname}" if firstname.present? || lastname.present?
[firstname, lastname].join ' '
else
login
end
end end
protected protected

View File

@ -0,0 +1,34 @@
%tr
%td.title= event.title
%td= display_date event
%td.city= event.city
%td.region= event.region
%td= time_ago_in_words event.submission_time
%th.actions{ rowspan: 1 + event.notes.size }
= link_to edit_moderation_path event do
%em.fa.fa-edit
= t 'edit'
\-
= link_to validate_moderation_path event do
%em.fa.fa-thumbs-up
= t 'validate'
\-
= link_to refuse_moderation_path event do
%em.fa.fa-thumbs-down
= t 'refuse'
%br
= link_to new_moderation_note_path event, envoiParMail: :oui do
%em.fa.fa-bullhorn
= t '.askInfos'
\-
= link_to new_moderation_note_path event do
%em.fa.fa-paperclip
= t '.createNote'
- event.notes.each do |note|
%tr
%td.note(colspan='5')
= note.contents
%em.author
= t '.posted_by', author: note.author, date: l(note.date, format: :at)

View File

@ -0,0 +1,21 @@
%tr
%td.kind
- if orga.kind
%em.fa{ class: "fa-#{orga.kind.icon}",
title: Kind.human_attribute_name("name_#{orga.kind.name}") }
%td.name= orga.name
%td.city= orga.city
%td.region= orga.region
%td= time_ago_in_words orga.submission_time
%th.actions
= link_to edit_orga_path orga do
%em.fa.fa-edit
= t 'edit'
\-
= link_to validate_orga_path orga do
%em.fa.fa-thumbs-up
= t 'validate'
\-
= link_to cancel_orga_path orga do
%em.fa.fa-thumbs-down
= t 'refuse'

View File

@ -2,111 +2,82 @@
%em.fa.fa-gavel %em.fa.fa-gavel
= title t '.title' = title t '.title'
:markdown
### #{t '.rules'}
- if @orgas.present? - if @orgas.present?
%table.list %table.list
%thead %thead
%tr %tr
%th(colspan='7') %th(colspan='6')
%h3 %h3
%em.fa.fa-users %em.fa.fa-users
= Orga.model_name.human.pluralize @orgas.count = Orga.model_name.human.pluralize @orgas.count
%tr
%th.flag
%th.name(colspan='2')= Orga.human_attribute_name :name
%th.city= Orga.human_attribute_name :city
%th.region= Orga.human_attribute_name :region
%th= Orga.human_attribute_name :submission_time
%th= t '.actions'
%tbody - @orgas.group_by { |orga| orga.region.flag }.each do |code, orgas|
- @orgas.each do |orga| %thead
%tr %tr
%td.flag{ title: orga.region } %td(colspan='6')
= flag_icon orga.region.flag %h4
%td.kind - if code.present?
- if orga.kind = flag_icon code
%em.fa{ class: "fa-#{orga.kind.icon}", = t code.upcase, scope: :countries
title: Kind.human_attribute_name("name_#{orga.kind.name}") } - else
%td.name= orga.name = orgas[0].region
%td.city= orga.city %tr
%td.region= orga.region %th.name(colspan='2')= Orga.human_attribute_name :name
%td= time_ago_in_words orga.submission_time %th.city= Orga.human_attribute_name :city
%th.actions %th.region= Orga.human_attribute_name :region
= link_to edit_orga_path orga do %th= Orga.human_attribute_name :submission_time
%em.fa.fa-edit %th= t '.actions'
= t 'edit'
\- %tbody= render partial: 'orga', collection: orgas
= link_to validate_orga_path orga do
%em.fa.fa-thumbs-up %tfoot
= t 'validate' %tr
\- %td(colspan='6')
= link_to cancel_orga_path orga do :markdown
%em.fa.fa-thumbs-down #{t '.rules'}
= t 'refuse'
- if @orgas.present? && @events.present?
%hr
- if @events.present? - if @events.present?
%table.list %table.list
%thead %thead
%tr %tr
%th(colspan='7') %th(colspan='6')
%h3 %h3
%em.fa.fa-calendar %em.fa.fa-calendar
= Event.model_name.human.pluralize @events.count = Event.model_name.human.pluralize @events.count
%tr
%th.flag
%th.title= Event.human_attribute_name :title
%th
= Event.human_attribute_name :start_time
\-
= Event.human_attribute_name :end_time
%th.city= Event.human_attribute_name :city
%th.region= Event.human_attribute_name :region
%th= Event.human_attribute_name :submission_time
%th.actions= t '.actions'
%tbody - @events.group_by { |event| event.region.flag }.each do |code, events|
- @events.each do |event| %thead
%tr %tr
%td.flag= flag_icon event.region.flag %td(colspan='6')
%td.title= event.title %h4
%td= display_date event - if code.present?
%td.city= event.city = flag_icon code
%td.region= event.region = t code.upcase, scope: :countries
%td= time_ago_in_words event.submission_time - else
%th.actions = events[0].region
= link_to edit_moderation_path event do %tr
%em.fa.fa-edit %th.title= Event.human_attribute_name :title
= t 'edit' %th
= Event.human_attribute_name :start_time
\- \-
= link_to validate_moderation_path event do = Event.human_attribute_name :end_time
%em.fa.fa-thumbs-up %th.city= Event.human_attribute_name :city
= t 'validate' %th.region= Event.human_attribute_name :region
\- %th= Event.human_attribute_name :submission_time
= link_to refuse_moderation_path event do %th.actions= t '.actions'
%em.fa.fa-thumbs-down
= t 'refuse'
\-
= link_to new_moderation_note_path event, envoiParMail: :oui do
%em.fa.fa-bullhorn
= t '.askInfos'
\-
= link_to new_moderation_note_path event do
%em.fa.fa-paperclip
= t '.createNote'
- event.notes.each do |note| %tbody= render partial: 'event', collection: events
%tr
%td.note(colspan='6')
= note.contents
%em.author
= t '.posted_by',
author: "#{note.author.firstname} #{note.author.lastname}",
date: l(note.date, format: :at) rescue nil
.actions %tfoot
%tr
%td(colspan='6')
:markdown
#{t '.rules'}
%fieldset.actions
= link_to edit_user_registration_path do = link_to edit_user_registration_path do
%em.fa.fa-lock %em.fa.fa-lock
= t('change_my_password', scope: 'devise.passwords.edit') = t('change_my_password', scope: 'devise.passwords.edit')

View File

@ -184,6 +184,7 @@ Veranstaltung zu ändern, um sie vollständiger, lesbarer oder attraktiver zu ge
rules: Moderatoren, bitte [Moderation Empfehlungen](/pages/rules) rules: Moderatoren, bitte [Moderation Empfehlungen](/pages/rules)
Lesen und Berücksichtigen. Lesen und Berücksichtigen.
actions: Aktionen actions: Aktionen
event:
posted_by: Gepostet von %{author} am %{date} posted_by: Gepostet von %{author} am %{date}
date: Datum date: Datum
askInfos: Informationen anfordern askInfos: Informationen anfordern

View File

@ -176,6 +176,7 @@ it more readable or agreable."
rules: Moderators, thanks for reading and taking notice of [moderation rules: Moderators, thanks for reading and taking notice of [moderation
recommandations](/pages/rules). recommandations](/pages/rules).
actions: Actions actions: Actions
event:
posted_by: Created by %{author} on %{date} posted_by: Created by %{author} on %{date}
date: Date date: Date
askInfos: Ask informations askInfos: Ask informations

View File

@ -192,6 +192,7 @@ procédure à l'aide d'un [script](/adl-submit.py)"
rules: Modérateurs, merci de lire et de tenir compte des [recommandations rules: Modérateurs, merci de lire et de tenir compte des [recommandations
de modération](/pages/rules). de modération](/pages/rules).
actions: Actions actions: Actions
event:
posted_by: Posté par %{author} le %{date} posted_by: Posté par %{author} le %{date}
date: Date date: Date
askInfos: Demander des infos askInfos: Demander des infos

View File

@ -187,6 +187,7 @@ te maken."
rules: Moderators opgelet, aub. na het lezen rekening houden met rules: Moderators opgelet, aub. na het lezen rekening houden met
[aanbevelingen van moderatie](/pages/rules) [aanbevelingen van moderatie](/pages/rules)
actions: Acties actions: Acties
event:
posted_by: Gepost door %{author} op %{date} posted_by: Gepost door %{author} op %{date}
date: Datum date: Datum
askInfos: Informatie aanvragen askInfos: Informatie aanvragen

View File

@ -169,6 +169,7 @@ completa, deixando o texto mais legível e agradável.
rules: Moderadores, obrigado por ler e tomar conhecimento das [recomendações rules: Moderadores, obrigado por ler e tomar conhecimento das [recomendações
de moderação](/pages/rules). de moderação](/pages/rules).
actions: Ações actions: Ações
event:
posted_by: Criado por %{author} em %{date} posted_by: Criado por %{author} em %{date}
date: Data date: Data
askInfos: Peça informações askInfos: Peça informações