Skip to content
Extraits de code Groupes Projets
Valider 2a4e71f7 rédigé par echarp's avatar echarp
Parcourir les fichiers

Translations and preview for organisation moderation mails

parent 367fb9bf
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -8,8 +8,7 @@ class EventMailer < ApplicationMailer ...@@ -8,8 +8,7 @@ class EventMailer < ApplicationMailer
mail 'Message-ID' => mail 'Message-ID' =>
"<event-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>", "<event-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
to: event.submitter, to: event.submitter,
subject: "#{t 'mail_prefix'}#{t 'event_mailer.create.subject', subject: subject(event)
subject: event.title}"
end end
# Send email to submitter too. Before, only moderators were receiving emails # Send email to submitter too. Before, only moderators were receiving emails
...@@ -21,8 +20,7 @@ class EventMailer < ApplicationMailer ...@@ -21,8 +20,7 @@ class EventMailer < ApplicationMailer
mail 'In-Reply-To' => mail 'In-Reply-To' =>
"<event-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>", "<event-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
to: event.submitter, to: event.submitter,
subject: "#{t 'mail_prefix'}#{t 'event_mailer.update.subject', subject: subject(event)
subject: event.title}"
end end
def accept(event) def accept(event)
...@@ -46,4 +44,11 @@ class EventMailer < ApplicationMailer ...@@ -46,4 +44,11 @@ class EventMailer < ApplicationMailer
subject: "#{t 'mail_prefix'}#{t 'event_mailer.destroy.subject', subject: "#{t 'mail_prefix'}#{t 'event_mailer.destroy.subject',
subject: event.title}" subject: event.title}"
end end
private
def subject(event)
t('mail_prefix') +
t("#{mailer_name}.#{action_name}.subject", subject: event.title)
end
end end
...@@ -7,8 +7,7 @@ class ModerationMailer < ApplicationMailer ...@@ -7,8 +7,7 @@ class ModerationMailer < ApplicationMailer
mail 'Message-ID' => mail 'Message-ID' =>
"<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>", "<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
subject: "#{t 'mail_prefix'}#{t 'moderation_mailer.create.subject', subject: subject(event)
subject: event.title}"
end end
def update(event) def update(event)
...@@ -17,8 +16,7 @@ class ModerationMailer < ApplicationMailer ...@@ -17,8 +16,7 @@ class ModerationMailer < ApplicationMailer
mail 'In-Reply-To' => mail 'In-Reply-To' =>
"<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>", "<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
subject: "#{t 'mail_prefix'}#{t 'moderation_mailer.update.subject', subject: subject(event)
subject: event.title}"
end end
def accept(event) def accept(event)
...@@ -27,8 +25,7 @@ class ModerationMailer < ApplicationMailer ...@@ -27,8 +25,7 @@ class ModerationMailer < ApplicationMailer
mail 'In-Reply-To' => mail 'In-Reply-To' =>
"<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>", "<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
subject: "#{t 'mail_prefix'}#{t 'moderation_mailer.accept.subject', subject: subject(event)
subject: event.title}"
end end
def destroy(event) def destroy(event)
...@@ -37,7 +34,13 @@ class ModerationMailer < ApplicationMailer ...@@ -37,7 +34,13 @@ class ModerationMailer < ApplicationMailer
mail 'In-Reply-To' => mail 'In-Reply-To' =>
"<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>", "<mod-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
subject: "#{t 'mail_prefix'}#{t 'moderation_mailer.destroy.subject', subject: subject(event)
subject: event.title}" end
private
def subject(event)
t('mail_prefix') +
t("#{mailer_name}.#{action_name}.subject", subject: event.title)
end end
end end
...@@ -2,55 +2,32 @@ ...@@ -2,55 +2,32 @@
class ModerationorgaMailer < ApplicationMailer class ModerationorgaMailer < ApplicationMailer
helper :events helper :events
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.orga_mailer.create.subject
#
def create(orga) def create(orga)
@orga = orga @orga = orga
mail 'Message-ID' => mail 'Message-ID' =>
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>", "<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
subject: "#{t 'mail_prefix'}#{t 'moderationorga_mailer.create.subject', subject: subject(orga)
subject: orga.name}"
end end
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.orga_mailer.update.subject
#
def update(orga) def update(orga)
@orga = orga @orga = orga
@current_user = User.find_by id: orga.paper_trail.originator @current_user = User.find_by id: orga.paper_trail.originator
mail 'In-Reply-To' => mail 'In-Reply-To' =>
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>", "<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
subject: "#{t 'mail_prefix'}#{t 'moderationorga_mailer.update.subject', subject: subject(orga)
subject: orga.name}"
end end
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.orga_mailer.accept.subject
#
def accept(orga) def accept(orga)
@orga = orga @orga = orga
@current_user = User.find_by id: orga.paper_trail.originator @current_user = User.find_by id: orga.paper_trail.originator
mail 'In-Reply-To' => mail 'In-Reply-To' =>
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>", "<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
subject: "#{t 'mail_prefix'}#{t 'moderationorga_mailer.accept.subject', subject: subject(orga)
subject: orga.name}"
end end
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.orga_mailer.destroy.subject
#
def destroy(orga, reason = '') def destroy(orga, reason = '')
@orga = orga @orga = orga
@current_user = User.find_by id: orga.paper_trail.originator @current_user = User.find_by id: orga.paper_trail.originator
...@@ -58,7 +35,13 @@ class ModerationorgaMailer < ApplicationMailer ...@@ -58,7 +35,13 @@ class ModerationorgaMailer < ApplicationMailer
mail 'In-Reply-To' => mail 'In-Reply-To' =>
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>", "<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
subject: t('mail_prefix') + t('moderationorga_mailer.destroy.subject', subject: subject(orga)
subject: orga.name) end
private
def subject(orga)
t('mail_prefix') +
t("#{mailer_name}.#{action_name}.subject", subject: orga.name)
end end
end end
...@@ -9,8 +9,7 @@ class NoteMailer < ApplicationMailer ...@@ -9,8 +9,7 @@ class NoteMailer < ApplicationMailer
mail 'In-Reply-To' => mail 'In-Reply-To' =>
"<event-#{note.event.id}@#{host}>", "<event-#{note.event.id}@#{host}>",
to: note.event.submitter, to: note.event.submitter,
subject: "#{t 'mail_prefix'}#{t 'note_mailer.notify.subject', subject: subject(note.event)
subject: note.event.title}"
end end
def create(note) def create(note)
...@@ -18,7 +17,13 @@ class NoteMailer < ApplicationMailer ...@@ -18,7 +17,13 @@ class NoteMailer < ApplicationMailer
mail 'In-Reply-To' => mail 'In-Reply-To' =>
"<mod-#{note.event.id}@#{ActionMailer::Base.default_url_options[:host]}>", "<mod-#{note.event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
subject: "#{t 'mail_prefix'}#{t 'note_mailer.create.subject', subject: subject(note.event)
subject: note.event.title}" end
private
def subject(event)
t('mail_prefix') +
t("#{mailer_name}.#{action_name}.subject", subject: event.title)
end end
end end
...@@ -2,26 +2,15 @@ ...@@ -2,26 +2,15 @@
class OrgaMailer < ApplicationMailer class OrgaMailer < ApplicationMailer
helper :events helper :events
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.orga_mailer.create.subject
#
def create(orga) def create(orga)
@orga = orga @orga = orga
mail 'Message-ID' => mail 'Message-ID' =>
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>", "<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
to: orga.submitter, to: orga.submitter,
subject: "#{t 'mail_prefix'}#{t 'orga_mailer.create.subject', subject: subject(orga)
subject: orga.name}"
end end
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.orga_mailer.update.subject
#
def update(orga) def update(orga)
@orga = orga @orga = orga
@current_user = User.find_by id: orga.paper_trail.originator @current_user = User.find_by id: orga.paper_trail.originator
...@@ -29,15 +18,9 @@ class OrgaMailer < ApplicationMailer ...@@ -29,15 +18,9 @@ class OrgaMailer < ApplicationMailer
mail 'Message-ID' => mail 'Message-ID' =>
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>", "<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
to: orga.submitter, to: orga.submitter,
subject: "#{t 'mail_prefix'}#{t 'orga_mailer.update.subject', subject: subject(orga)
subject: orga.name}"
end end
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.orga_mailer.accept.subject
#
def accept(orga) def accept(orga)
@orga = orga @orga = orga
@current_user = User.find_by id: orga.paper_trail.originator @current_user = User.find_by id: orga.paper_trail.originator
...@@ -45,15 +28,9 @@ class OrgaMailer < ApplicationMailer ...@@ -45,15 +28,9 @@ class OrgaMailer < ApplicationMailer
mail 'In-Reply-To' => mail 'In-Reply-To' =>
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>", "<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
to: orga.submitter, to: orga.submitter,
subject: "#{t 'mail_prefix'}#{t 'orga_mailer.accept.subject', subject: subject(orga)
subject: orga.name}"
end end
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.orga_mailer.destroy.subject
#
def destroy(orga, reason = '') def destroy(orga, reason = '')
@orga = orga @orga = orga
@current_user = User.find_by id: orga.paper_trail.originator @current_user = User.find_by id: orga.paper_trail.originator
...@@ -62,7 +39,13 @@ class OrgaMailer < ApplicationMailer ...@@ -62,7 +39,13 @@ class OrgaMailer < ApplicationMailer
mail 'In-Reply-To' => mail 'In-Reply-To' =>
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>", "<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
to: orga.submitter, to: orga.submitter,
subject: "#{t 'mail_prefix'}#{t 'orga_mailer.destroy.subject', subject: subject(orga)
subject: orga.name}" end
private
def subject(orga)
t('mail_prefix') +
t("#{mailer_name}.#{action_name}.subject", subject: orga.name)
end end
end end
= t '.body', author: @current_user = t '.body', subject: @orga.name, author: @current_user
\
= @reason
\ \
= t '.reclamation' = t '.reclamation'
\ \
......
...@@ -434,9 +434,7 @@ reason: ...@@ -434,9 +434,7 @@ reason:
destroy: destroy:
subject: "Organisation '%{subject}' refused" subject: "Organisation '%{subject}' refused"
body: "Organisation '%{subject}' was rejected by %{author} for the body: "Organisation '%{subject}' was rejected by %{author} for the
following reason: following reason:"
\n
\n"
reminder: "The organisation:" reminder: "The organisation:"
signature: Thank you for your contribution signature: Thank you for your contribution
......
...@@ -436,8 +436,9 @@ pouvez éditer votre événement à l'adresse:" ...@@ -436,8 +436,9 @@ pouvez éditer votre événement à l'adresse:"
signature: Merci pour votre contribution! signature: Merci pour votre contribution!
destroy: destroy:
subject: "Organisation '%{subject}' refusée" subject: "Organisation '%{subject}' refusée"
body: "L'organisation '%{subject}' a été rejetée par %{author} pour la body: "L'organisation '%{subject}' a été rejetée par %{author}"
raison suivante:" reclamation: Pour toute réclamation, n'hésitez pas à contacter l'équipe
de modérateurs.
reminder: "Pour rappel, l'organisation:" reminder: "Pour rappel, l'organisation:"
signature: Merci pour votre contribution signature: Merci pour votre contribution
......
...@@ -30,7 +30,8 @@ class OrgasControllerTest < ActionController::TestCase ...@@ -30,7 +30,8 @@ class OrgasControllerTest < ActionController::TestCase
url: @orga.url, url: @orga.url,
feed: @orga.feed, feed: @orga.feed,
contact: @orga.contact, contact: @orga.contact,
submitter: @orga.contact submitter: @orga.contact,
tags: @orga.tags
} }
assert_empty assigns(:orga).errors.messages assert_empty assigns(:orga).errors.messages
......
...@@ -3,25 +3,27 @@ ...@@ -3,25 +3,27 @@
one: one:
kind: lug kind: lug
name: MyString name: MyString
description: MyText
city: Jolie ville city: Jolie ville
department: 1
region: region_one region: region_one
url: http://april.org url: http://april.org
feed: http://april.org/index.rss feed: http://april.org/index.rss
contact: test@exemple.com contact: test@exemple.com
submitter: test@exemple.com submitter: test@exemple.com
submission_time: 2013-12-28 16:04:56 submission_time: 2013-12-28 16:04:56
tags: my-string
secret: my_secret secret: my_secret
moderated: true moderated: true
two: two:
kind: provider kind: provider
name: MyString name: MyString
description: MyText
city: Jolie ville city: Jolie ville
department: 1
region: region_two region: region_two
url: http://april.org url: http://april.org
feed: http://april.org/index.rss feed: http://april.org/index.rss
contact: test@exemple.com contact: test@exemple.com
submitter: test@exemple.com submitter: test@exemple.com
submission_time: 2013-12-28 16:04:56 submission_time: 2013-12-28 16:04:56
tags: my-string
# Preview all emails at http://localhost:3000/rails/mailers/moderationorga_mailer
class ModerationorgaMailerPreview < ActionMailer::Preview
# Preview this email at http://localhost:3000/rails/mailers/moderationorga_mailer/create
def create
ActionMailer::Base.default_url_options[:host] = 'localhost:3000'
ModerationorgaMailer.create Orga.last
end
# Preview this email at http://localhost:3000/rails/mailers/moderationorga_mailer/update
def update
ActionMailer::Base.default_url_options[:host] = 'localhost:3000'
orga = Orga.first
orga.tags += ' ho'
orga.save!
orga.description = orga.description + '
hello world'
ModerationorgaMailer.update orga
end
# Preview this email at http://localhost:3000/rails/mailers/moderationorga_mailer/accept
def accept
ActionMailer::Base.default_url_options[:host] = 'localhost:3000'
ModerationorgaMailer.accept Orga.last
end
# Preview this email at http://localhost:3000/rails/mailers/moderationorga_mailer/destroy
def destroy
ActionMailer::Base.default_url_options[:host] = 'localhost:3000'
orga = Orga.last
ModerationorgaMailer.destroy orga
end
end
...@@ -10,6 +10,7 @@ class OrgaMailerPreview < ActionMailer::Preview ...@@ -10,6 +10,7 @@ class OrgaMailerPreview < ActionMailer::Preview
def update def update
ActionMailer::Base.default_url_options[:host] = 'localhost:3000' ActionMailer::Base.default_url_options[:host] = 'localhost:3000'
orga = Orga.last orga = Orga.last
orga.name += ' et hop' orga.name += ' et hop'
orga.save! orga.save!
OrgaMailer.update orga OrgaMailer.update orga
......
...@@ -16,7 +16,8 @@ class OrgaTest < ActiveSupport::TestCase ...@@ -16,7 +16,8 @@ class OrgaTest < ActiveSupport::TestCase
url: 'http://example.com', url: 'http://example.com',
region: Region.first, region: Region.first,
contact: 'contact@example.com', contact: 'contact@example.com',
submitter: 'contact@example.com' submitter: 'contact@example.com',
tags: 'hello world'
) )
end end
...@@ -26,7 +27,8 @@ class OrgaTest < ActiveSupport::TestCase ...@@ -26,7 +27,8 @@ class OrgaTest < ActiveSupport::TestCase
name: 'Tested organisation', name: 'Tested organisation',
url: 'http://example.com', url: 'http://example.com',
region: Region.first, region: Region.first,
contact: 'contact@example.com' contact: 'contact@example.com',
tags: 'hello world'
) )
end end
end end
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter