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

View File

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

View File

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

View File

@ -34,7 +34,11 @@ class User < ApplicationRecord
end
def to_s
"#{firstname} #{lastname}"
if firstname.present? || lastname.present?
[firstname, lastname].join ' '
else
login
end
end
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
= title t '.title'
:markdown
### #{t '.rules'}
- if @orgas.present?
%table.list
%thead
%tr
%th(colspan='7')
%th(colspan='6')
%h3
%em.fa.fa-users
= 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.each do |orga|
- @orgas.group_by { |orga| orga.region.flag }.each do |code, orgas|
%thead
%tr
%td.flag{ title: orga.region }
= flag_icon orga.region.flag
%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'
%td(colspan='6')
%h4
- if code.present?
= flag_icon code
= t code.upcase, scope: :countries
- else
= orgas[0].region
%tr
%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= render partial: 'orga', collection: orgas
%tfoot
%tr
%td(colspan='6')
:markdown
#{t '.rules'}
- if @orgas.present? && @events.present?
%hr
- if @events.present?
%table.list
%thead
%tr
%th(colspan='7')
%th(colspan='6')
%h3
%em.fa.fa-calendar
= 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.each do |event|
- @events.group_by { |event| event.region.flag }.each do |code, events|
%thead
%tr
%td.flag= flag_icon event.region.flag
%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
= link_to edit_moderation_path event do
%em.fa.fa-edit
= t 'edit'
%td(colspan='6')
%h4
- if code.present?
= flag_icon code
= t code.upcase, scope: :countries
- else
= events[0].region
%tr
%th.title= Event.human_attribute_name :title
%th
= Event.human_attribute_name :start_time
\-
= 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'
\-
= 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.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'
- event.notes.each do |note|
%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
%tbody= render partial: 'event', collection: events
.actions
%tfoot
%tr
%td(colspan='6')
:markdown
#{t '.rules'}
%fieldset.actions
= link_to edit_user_registration_path do
%em.fa.fa-lock
= 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)
Lesen und Berücksichtigen.
actions: Aktionen
event:
posted_by: Gepostet von %{author} am %{date}
date: Datum
askInfos: Informationen anfordern

View File

@ -176,6 +176,7 @@ it more readable or agreable."
rules: Moderators, thanks for reading and taking notice of [moderation
recommandations](/pages/rules).
actions: Actions
event:
posted_by: Created by %{author} on %{date}
date: Date
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
de modération](/pages/rules).
actions: Actions
event:
posted_by: Posté par %{author} le %{date}
date: Date
askInfos: Demander des infos

View File

@ -187,6 +187,7 @@ te maken."
rules: Moderators opgelet, aub. na het lezen rekening houden met
[aanbevelingen van moderatie](/pages/rules)
actions: Acties
event:
posted_by: Gepost door %{author} op %{date}
date: Datum
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
de moderação](/pages/rules).
actions: Ações
event:
posted_by: Criado por %{author} em %{date}
date: Data
askInfos: Peça informações