From ec4e96d9bb2aaf4d32dec5dee28315bdab4ca38b Mon Sep 17 00:00:00 2001 From: echarp Date: Wed, 25 Dec 2019 16:46:50 +0100 Subject: [PATCH] Added flag and slightly reorganised the moderation page --- app/assets/stylesheets/moderations.sass | 7 +++-- app/assets/stylesheets/region.sass | 3 -- app/assets/stylesheets/stats.sass | 3 ++ app/models/region.rb | 4 +++ app/views/moderations/index.html.haml | 37 +++++++++++++++++-------- app/views/regions/_filter_region.haml | 4 +-- config/locales/views/de.yml | 2 +- config/locales/views/en.yml | 2 +- config/locales/views/fr.yml | 2 +- config/locales/views/nl.yml | 2 +- config/locales/views/pt-BR.yml | 2 +- 11 files changed, 44 insertions(+), 24 deletions(-) diff --git a/app/assets/stylesheets/moderations.sass b/app/assets/stylesheets/moderations.sass index beb53f8f..625fa7d8 100644 --- a/app/assets/stylesheets/moderations.sass +++ b/app/assets/stylesheets/moderations.sass @@ -1,10 +1,13 @@ h2.warning color: red +body.moderations h3 + text-align: center + .moderations, .notes table.list - min-width: 90% - margin-top: 15px + margin-top: 25px + margin-bottom: 25px td padding-top: 0.5em padding-bottom: 0.5em diff --git a/app/assets/stylesheets/region.sass b/app/assets/stylesheets/region.sass index f00eab2d..68eebd9e 100644 --- a/app/assets/stylesheets/region.sass +++ b/app/assets/stylesheets/region.sass @@ -69,9 +69,6 @@ html.iframe main > ul.regions .flag-icon-ca-qc background-image: image-url(regions/CA-QC) -body.stats h3 - text-align: center - table.list.dates th, td padding: 0 0.6em diff --git a/app/assets/stylesheets/stats.sass b/app/assets/stylesheets/stats.sass index 11f4f47d..803b1bee 100644 --- a/app/assets/stylesheets/stats.sass +++ b/app/assets/stylesheets/stats.sass @@ -1,3 +1,6 @@ +body.stats h3 + text-align: center + table.list.dates width: 100% thead th diff --git a/app/models/region.rb b/app/models/region.rb index 9308cd24..d73e8d2d 100644 --- a/app/models/region.rb +++ b/app/models/region.rb @@ -19,6 +19,10 @@ class Region < ApplicationRecord name end + def flag + region.try(:flag) || code.try(:downcase) + end + # Attempt to get a corresponding timezone, used for ical def tzid country = TZInfo::Country.get region.try(:code) || code diff --git a/app/views/moderations/index.html.haml b/app/views/moderations/index.html.haml index 1751cd95..26904e64 100644 --- a/app/views/moderations/index.html.haml +++ b/app/views/moderations/index.html.haml @@ -3,24 +3,33 @@ = title t '.title' :markdown - #### #{t '.rules'} + ### #{t '.rules'} - if @orgas.present? %table.list %thead %tr - %th= Orga.human_attribute_name :name + %th(colspan='5') + %h3 + %em.fa.fa-users + = Orga.model_name.human.pluralize @orgas.count + %tr %th= Orga.human_attribute_name :city - %th= Orga.human_attribute_name :region + %th(colspan='2')= Orga.human_attribute_name :name %th= Orga.human_attribute_name :submission_time %th= t '.actions' %tbody - @orgas.each do |orga| %tr + %td{ title: orga.region } + = flag_icon orga.region.flag + = orga.city || orga.region + %td.kind + - if orga.kind + %em.fa{ class: "fa-#{orga.kind.icon}", + title: Kind.human_attribute_name("name_#{orga.kind.name}") } %td= orga.name - %td= orga.city - %td= orga.region %td= time_ago_in_words orga.submission_time %th.actions = link_to edit_orga_path orga do @@ -39,23 +48,28 @@ %table.list %thead %tr + %th(colspan='5') + %h3 + %em.fa.fa-calendar + = Event.model_name.human.pluralize @events.count + %tr + %th= Event.human_attribute_name :city %th= Event.human_attribute_name :title %th = Event.human_attribute_name :start_time \- = Event.human_attribute_name :end_time - %th= Event.human_attribute_name :city - %th= Event.human_attribute_name :region %th= Event.human_attribute_name :submission_time %th= t '.actions' %tbody - @events.each do |event| %tr + %td{ title: event.region } + = flag_icon event.region.flag + = event.city %td= event.title %td= display_date event - %td= event.city - %td= event.region.name %td= time_ago_in_words event.submission_time %th.actions = link_to edit_moderation_path event do @@ -80,8 +94,7 @@ - event.notes.each do |note| %tr - %td.empty/ - %td.note(colspan="5") + %td.note(colspan='6') = note.contents %em.author = t '.posted_by', @@ -92,7 +105,7 @@ = link_to edit_user_registration_path do %em.fa.fa-lock = t('change_my_password', scope: 'devise.passwords.edit') - \| + \- = link_to destroy_user_session_path, method: :delete do %em.fa.fa-sign-out-alt = t 'logout' diff --git a/app/views/regions/_filter_region.haml b/app/views/regions/_filter_region.haml index e7e2d28b..68b36aa3 100644 --- a/app/views/regions/_filter_region.haml +++ b/app/views/regions/_filter_region.haml @@ -2,7 +2,7 @@ - if filter_region.url.present? = link_to filter_region.url do - if filter_region.code.present? - = flag_icon filter_region.code.downcase + = flag_icon filter_region.flag = t filter_region.code, scope: :countries, default: filter_region.name %small %em.fa.fa-external-link-alt @@ -10,7 +10,7 @@ - else = link_to region: params[:region] == filter_region.id.to_s ? '' : filter_region do - if filter_region.code.present? - = flag_icon filter_region.code.downcase + = flag_icon filter_region.flag = t filter_region.code, scope: :countries, default: filter_region.name - else diff --git a/config/locales/views/de.yml b/config/locales/views/de.yml index b412f0cf..1d14a9ba 100644 --- a/config/locales/views/de.yml +++ b/config/locales/views/de.yml @@ -182,7 +182,7 @@ Veranstaltung zu ändern, um sie vollständiger, lesbarer oder attraktiver zu ge link: Diese Veranstaltung findet statt im Rahmen des moderations: index: - title: Veranstaltungen zu bestätigen + title: Zu bestätigen rules: Moderatoren, bitte [Moderation Empfehlungen](/pages/rules) Lesen und Berücksichtigen. actions: Aktionen diff --git a/config/locales/views/en.yml b/config/locales/views/en.yml index fc8dd4ef..ac26a5a8 100644 --- a/config/locales/views/en.yml +++ b/config/locales/views/en.yml @@ -174,7 +174,7 @@ it more readable or agreable." link: This event is part of moderations: index: - title: Events to moderate + title: To moderate rules: Moderators, thanks for reading and taking notice of [moderation recommandations](/pages/rules). actions: Actions diff --git a/config/locales/views/fr.yml b/config/locales/views/fr.yml index 026a8abb..efb7198d 100644 --- a/config/locales/views/fr.yml +++ b/config/locales/views/fr.yml @@ -190,7 +190,7 @@ procédure à l'aide d'un [script](/adl-submit.py)" link: Cet événement s'inscrit dans le cadre de moderations: index: - title: Événements à modérer + title: À modérer rules: Modérateurs, merci de lire et de tenir compte des [recommandations de modération](/pages/rules). actions: Actions diff --git a/config/locales/views/nl.yml b/config/locales/views/nl.yml index 0437cbcf..75658b08 100644 --- a/config/locales/views/nl.yml +++ b/config/locales/views/nl.yml @@ -185,7 +185,7 @@ te maken." link: Dit evenement past in het kader van moderations: index: - title: Evaluatie van de evenementen + title: Evaluatie rules: Moderators opgelet, aub. na het lezen rekening houden met [aanbevelingen van moderatie](/pages/rules) actions: Acties diff --git a/config/locales/views/pt-BR.yml b/config/locales/views/pt-BR.yml index 3fedea39..89040be5 100644 --- a/config/locales/views/pt-BR.yml +++ b/config/locales/views/pt-BR.yml @@ -167,7 +167,7 @@ completa, deixando o texto mais legível e agradável. other: "%{count} eventos" moderations: index: - title: Eventos para moderar + title: Para moderar rules: Moderadores, obrigado por ler e tomar conhecimento das [recomendações de moderação](/pages/rules). actions: Ações