From 2f23fd691474bbf3e588fd3235df273d1702cce7 Mon Sep 17 00:00:00 2001 From: echarp Date: Sat, 16 Aug 2014 17:39:24 +0200 Subject: [PATCH] =?UTF-8?q?Les=20mails=20envoy=C3=A9s=20n'ont=20plus=20de?= =?UTF-8?q?=20html,=20et=20sont=20wrapp=C3=A9s=20=C3=A0=20la=20colonne=208?= =?UTF-8?q?0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/events_helper.rb | 4 ++++ app/mailers/event_mailer.rb | 2 ++ app/mailers/moderation_mailer.rb | 2 ++ app/mailers/note_mailer.rb | 2 ++ app/views/events/show.text.haml | 21 ++++++++++---------- app/views/moderation_mailer/accept.text.haml | 3 +++ config/locales/fr.yml | 1 + 7 files changed, 25 insertions(+), 10 deletions(-) diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index 1c53e593..448a6e5b 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -23,4 +23,8 @@ module EventsHelper + "#{@event.related_city.try :longitude}" } end + + def wrap(s, width = 78) + s.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n") + end end diff --git a/app/mailers/event_mailer.rb b/app/mailers/event_mailer.rb index d2d5c183..21ed2863 100644 --- a/app/mailers/event_mailer.rb +++ b/app/mailers/event_mailer.rb @@ -1,5 +1,7 @@ # Sending mails related to events life cycle class EventMailer < ActionMailer::Base + helper :events + def create(event) @event = event diff --git a/app/mailers/moderation_mailer.rb b/app/mailers/moderation_mailer.rb index 8a1b80a3..31c0aeb8 100644 --- a/app/mailers/moderation_mailer.rb +++ b/app/mailers/moderation_mailer.rb @@ -1,5 +1,7 @@ # Sending mails related to events' moderation class ModerationMailer < ActionMailer::Base + helper :events + def create(event) @event = event diff --git a/app/mailers/note_mailer.rb b/app/mailers/note_mailer.rb index f6aeaddb..80ea9972 100644 --- a/app/mailers/note_mailer.rb +++ b/app/mailers/note_mailer.rb @@ -1,5 +1,7 @@ # Sending mails related to events' notes class NoteMailer < ActionMailer::Base + helper :events + def notify(note) @note = note diff --git a/app/views/events/show.text.haml b/app/views/events/show.text.haml index 2e3fa2b0..3bdb4930 100644 --- a/app/views/events/show.text.haml +++ b/app/views/events/show.text.haml @@ -1,12 +1,13 @@ ===================================================== -#{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.related_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} +#{Event.human_attribute_name(:title).concat(':').ljust 12 } #{@event.title} +#{Event.human_attribute_name(:start_time).concat(':').ljust 12 } #{l @event.start_time, format: :at} +#{Event.human_attribute_name(:end_time).concat(':').ljust 12 } #{l @event.end_time, format: :at} +#{Event.human_attribute_name(:region).concat(':').ljust 12 } #{@event.related_region} +#{Event.human_attribute_name(:city).concat(':').ljust 12 } #{@event.city} +#{Event.human_attribute_name(:url).concat(':').ljust 12 } #{@event.url} +#{Event.human_attribute_name(:contact).concat(':').ljust 12 } #{@event.contact} +#{Event.human_attribute_name(:submitter).concat(':').ljust 12 } #{@event.submitter} +#{Event.human_attribute_name(:tags).concat(':').ljust 12 } #{@event.tags} +#{Event.human_attribute_name(:description).concat(':').ljust 12} += wrap(strip_tags(@event.description)).gsub(/$/, ' ').gsub /^/, ' ' ===================================================== diff --git a/app/views/moderation_mailer/accept.text.haml b/app/views/moderation_mailer/accept.text.haml index 33491afd..6a600d84 100644 --- a/app/views/moderation_mailer/accept.text.haml +++ b/app/views/moderation_mailer/accept.text.haml @@ -4,4 +4,7 @@ \ = render file: '/events/show' \ +=t '.access' += event_url @event +\ =t '.signature' diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 5a232c0d..b93c6387 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -353,6 +353,7 @@ pouvez éditer votre événement à l'adresse:" subject: "[Agenda du Libre] Événement '%{subject}' modéré" title: Bonjour, body: L'événement a été modéré par %{author}. + access: "Vous pouvez le consulter ici:" signature: "-- \nL'équipe de modération" destroy: subject: "[Agenda du Libre] Événement '%{subject}' refusé"