From cc2ed4ee89ab255ac427efa934936c4e2164217b Mon Sep 17 00:00:00 2001 From: echarp Date: Sat, 21 Jun 2014 18:53:05 +0200 Subject: [PATCH] =?UTF-8?q?Quelques=20changements=20d'apparence=20et=20tra?= =?UTF-8?q?ductions=20suppl=C3=A9mentaires?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/all.css.sass | 1 + app/assets/stylesheets/events.css.sass | 3 +++ app/controllers/events_controller.rb | 6 ++++-- app/controllers/moderations_controller.rb | 3 +++ app/views/events/show.html.haml | 11 ++++++----- app/views/moderation_mailer/moderate.text.haml | 11 +++++++++++ config/locales/fr.yml | 5 ++++- 7 files changed, 32 insertions(+), 8 deletions(-) diff --git a/app/assets/stylesheets/all.css.sass b/app/assets/stylesheets/all.css.sass index 77db2175..cfc169d3 100644 --- a/app/assets/stylesheets/all.css.sass +++ b/app/assets/stylesheets/all.css.sass @@ -134,6 +134,7 @@ main @include box-shadow(5px 5px 5px lightblue) footer.bottom nav + clear: both margin: 26px auto -3px font-size: smaller a + a:before diff --git a/app/assets/stylesheets/events.css.sass b/app/assets/stylesheets/events.css.sass index 0356b093..f876e4af 100644 --- a/app/assets/stylesheets/events.css.sass +++ b/app/assets/stylesheets/events.css.sass @@ -164,3 +164,6 @@ table.calendar .actions margin-left: 6.75em margin-bottom: 10px + +.description + text-align: left diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index 7ca08302..050e6f98 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -48,8 +48,10 @@ class EventsController < InheritedResources::Base if @event.save # Send an event creation mail to its author EventMailer.create(@event).deliver + # Send a mail to moderators + ModerationMailer.create(@event).deliver - format.html { redirect_to @event, notice: 'Event was successfully created.' } + format.html { redirect_to @event, notice: t('.ok') } format.json { render action: 'show', status: :created, location: @event } else format.html { render action: 'new' } @@ -73,7 +75,7 @@ class EventsController < InheritedResources::Base respond_to do |format| if @event.update(event_params) - format.html { redirect_to @event, notice: 'Event was successfully updated.' } + format.html { redirect_to @event, notice: t('.ok') } format.json { head :no_content } else format.html { render action: 'edit' } diff --git a/app/controllers/moderations_controller.rb b/app/controllers/moderations_controller.rb index be6ffcd7..894f0dba 100644 --- a/app/controllers/moderations_controller.rb +++ b/app/controllers/moderations_controller.rb @@ -23,6 +23,9 @@ class ModerationsController < InheritedResources::Base respond_to do |format| if @event.update(event_params) + # Send an update mail to its author + ModerationMailer.update(@event, current_user).deliver + format.html { redirect_to moderations_path, notice: 'Event was successfully updated.' } format.json { head :no_content } else diff --git a/app/views/events/show.html.haml b/app/views/events/show.html.haml index 18d81c91..e7134d31 100644 --- a/app/views/events/show.html.haml +++ b/app/views/events/show.html.haml @@ -1,4 +1,4 @@ -- if request.format == 'text/html' && controller.controller_name != 'moderations' && controller.controller_name != 'notes' +- if request.format == 'text/html' && controller.controller_name != 'moderations' && controller.controller_name != 'notes' && controller.action_name != 'edit' #lug-list %h1=t '.lug-list' - if @event.region @@ -28,14 +28,15 @@ #{l @event.end_time, format: :at}. %p - À + =t '.at' %em= link_to(@event.city, "http://fr.wikipedia.org/wiki/#{@event.city}") + ',' = link_to @event.region.name, "http://fr.wikipedia.org/wiki/#{@event.region.name}" rescue nil %h3 Description -= sanitize @event.description, - tags: %w(p br table tr td ul ol li a strong b em i img), - attributes: %w(href src width height) +.description + = sanitize @event.description, + tags: %w(p br table tr td ul ol li a strong b em i img), + attributes: %w(href src width height) %h3 Informations %p diff --git a/app/views/moderation_mailer/moderate.text.haml b/app/views/moderation_mailer/moderate.text.haml index d9230021..26123b02 100644 --- a/app/views/moderation_mailer/moderate.text.haml +++ b/app/views/moderation_mailer/moderate.text.haml @@ -3,5 +3,16 @@ =t '.body', author: @current_user \ ===================================================== +#{Event.human_attribute_name(:title)}: #{@event.title} +#{Event.human_attribute_name(:start_time)}: #{l @event.start_time, format: :at} +#{Event.human_attribute_name(:end_time)}: #{l @event.end_time, format: :at} +#{Event.human_attribute_name(:region)}: #{@event.region} +#{Event.human_attribute_name(:city)}: #{@event.city} +#{Event.human_attribute_name(:url)}: #{@event.url} +#{Event.human_attribute_name(:contact)}: #{@event.contact} +#{Event.human_attribute_name(:submitter)}: #{@event.submitter} +#{Event.human_attribute_name(:tags)}: #{@event.tags} +#{Event.human_attribute_name(:description)}: #{raw @event.description} +===================================================== \ =t '.signature' diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 80094220..efb86603 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -112,8 +112,11 @@ fr: show: lug-list: Groupes d'utilisateurs de la région add_to_calendar: Ajouter à mon calendrier + at: À new: title: Soumettre un évènement + create: + ok: Votre évènement a bien été ajouté à la liste des évènements en attente de modération. Il apparaîtra en ligne dès qu'un modérateur l'aura validé. edit: title: Éditer un évènement preview: Prévisualisation de l'évènement @@ -216,4 +219,4 @@ fr: subject: "[Agenda du Libre] Évènement '%{subject}' modéré" title: Bonjour, body: L'évènement a été modéré par %{author} - signature: "Merci!\n\n-- \nAgenda du Libre" + signature: "-- \nL'équipe de modération"