Mails' translations should not have ' html encoded anymore

This commit is contained in:
echarp 2017-10-21 20:21:25 +02:00
parent 4a4cce9978
commit e3a012fcdf
25 changed files with 109 additions and 96 deletions

View File

@ -1,12 +1,12 @@
= t '.body', moderator: @current_user != t '.body', moderator: @current_user
= surround '<'.html_safe, '>'.html_safe do = surround '<'.html_safe, '>'.html_safe do
= event_url @event = event_url @event
\ \
= t '.edit_link' != t '.edit_link'
= surround '<'.html_safe, '>'.html_safe do = surround '<'.html_safe, '>'.html_safe do
= edit_event_url @event, secret: @event.secret = edit_event_url @event, secret: @event.secret
\ \
= t '.delete_link' != t '.delete_link'
= surround '<'.html_safe, '>'.html_safe do = surround '<'.html_safe, '>'.html_safe do
= cancel_event_url @event, secret: @event.secret = cancel_event_url @event, secret: @event.secret
\ \
@ -19,7 +19,7 @@
= surround '<'.html_safe, '>'.html_safe do = surround '<'.html_safe, '>'.html_safe do
= cancel_event_url e, secret: e.secret = cancel_event_url e, secret: e.secret
\ \
= t '.reminder' != t '.reminder'
= render file: '/events/show' = render file: '/events/show'
\ \
= t '.signature' != t '.signature'

View File

@ -1,10 +1,10 @@
= t '.body', subject: @event.title, != t '.body', subject: @event.title,
start_time: l(@event.start_time, format: :at) start_time: l(@event.start_time, format: :at)
= surround '<'.html_safe, '>'.html_safe do = surround '<'.html_safe, '>'.html_safe do
= edit_event_url @event, secret: @event.secret = edit_event_url @event, secret: @event.secret
\ \
= t '.delete_link' != t '.delete_link'
= surround '<'.html_safe, '>'.html_safe do = surround '<'.html_safe, '>'.html_safe do
= cancel_event_url @event, secret: @event.secret = cancel_event_url @event, secret: @event.secret
\ \
= t '.signature' != t '.signature'

View File

@ -1,10 +1,10 @@
= t '.body', author: @current_user != t '.body', author: @current_user
\ \
= @event.reason = @event.reason
\ \
= t '.reclamation' != t '.reclamation'
\ \
= t '.reminder' != t '.reminder'
= render file: '/events/show' = render file: '/events/show'
\ \
= t '.signature' != t '.signature'

View File

@ -1,4 +1,4 @@
= t '.body', subject: @event.title, author: @current_user || t('.submitter') != t '.body', subject: @event.title, author: @current_user || t('.submitter')
:ruby :ruby
new = render file: '/events/show' new = render file: '/events/show'
@ -11,9 +11,9 @@
require 'differ/format/patch' require 'differ/format/patch'
Differ.format = Differ::Format::Patch Differ.format = Differ::Format::Patch
= Differ.diff new, prev != Differ.diff new, prev
\ \
= surround '<'.html_safe, '>'.html_safe do = surround '<'.html_safe, '>'.html_safe do
= edit_event_url @event, secret: @event.secret = edit_event_url @event, secret: @event.secret
\ \
= t '.signature' != t '.signature'

View File

@ -1,19 +1,19 @@
============================================================================== ==============================================================================
= display_attr @event, :title != display_attr @event, :title
= display_attr @event, :start_time, l(@event.start_time, format: :at) != display_attr @event, :start_time, l(@event.start_time, format: :at)
= display_attr @event, :end_time, l(@event.end_time, format: :at) != display_attr @event, :end_time, l(@event.end_time, format: :at)
= display_attr @event, :place_name != display_attr @event, :place_name
= display_attr @event, :address != display_attr @event, :address
= display_attr @event, :city != display_attr @event, :city
= display_attr @event, :region, @event.region != display_attr @event, :region, @event.region
= display_attr @event, :locality, t("attributes.locality_#{@event.locality}") != display_attr @event, :locality, t("attributes.locality_#{@event.locality}")
= display_attr @event, :url != display_attr @event, :url
= display_attr @event, :contact != display_attr @event, :contact
= display_attr @event, :submitter != display_attr @event, :submitter
= display_attr @event, :tag_list, @event.tag_list != display_attr @event, :tag_list, @event.tag_list
- if @event.repeat > 0 - if @event.repeat > 0
= display_attr @event, :repeat = display_attr @event, :repeat
= display_attr @event, :rule, t(@event.rule, scope: 'activerecord.attributes.event.rule_values') = display_attr @event, :rule, t(@event.rule, scope: 'activerecord.attributes.event.rule_values')
\ \
= raw to_markdown @event.description, 78 != to_markdown @event.description, 78
============================================================================== ==============================================================================

View File

@ -1,5 +1,5 @@
= t '.title' != t '.title'
\ \
= yield = yield
\-- \--
= t 'layouts.application.title' != t 'layouts.application.title'

View File

@ -1,10 +1,10 @@
= t '.body', author: @current_user != t '.body', author: @current_user
\ \
= t '.reminder' != t '.reminder'
= render file: '/events/show' = render file: '/events/show'
\ \
= t '.access' != t '.access'
= surround '<'.html_safe, '>'.html_safe do = surround '<'.html_safe, '>'.html_safe do
= event_url @event = event_url @event
\ \
= t '.signature' != t '.signature'

View File

@ -1,8 +1,8 @@
= t '.body', subject: @event.title, start_time: l(@event.start_time, != t '.body', subject: @event.title, start_time: l(@event.start_time,
format: :at) format: :at)
= surround '<'.html_safe, '>'.html_safe do = surround '<'.html_safe, '>'.html_safe do
= moderations_url = moderations_url
\ \
= render file: '/events/show' = render file: '/events/show'
\ \
= t '.signature' != t '.signature'

View File

@ -1,8 +1,8 @@
= t '.body', subject: @event.title, author: @current_user != t '.body', subject: @event.title, author: @current_user
\ \
= @event.reason = @event.reason
\ \
= t '.reminder' != t '.reminder'
= render file: '/events/show' = render file: '/events/show'
\ \
= t '.signature' != t '.signature'

View File

@ -1,4 +1,4 @@
= t '.body', subject: @event.title, author: @current_user || t('.submitter') != t '.body', subject: @event.title, author: @current_user || t('.submitter')
:ruby :ruby
new = render file: '/events/show' new = render file: '/events/show'
@ -11,9 +11,9 @@
require 'differ/format/patch' require 'differ/format/patch'
Differ.format = Differ::Format::Patch Differ.format = Differ::Format::Patch
= Differ.diff new, prev != Differ.diff new, prev
\ \
= surround '<'.html_safe, '>'.html_safe do = surround '<'.html_safe, '>'.html_safe do
= edit_moderation_url @event = edit_moderation_url @event
\ \
= t '.signature' != t '.signature'

View File

@ -1,10 +1,10 @@
= t '.body', author: @current_user != t '.body', author: @current_user
\ \
= t '.reminder' != t '.reminder'
= render file: '/orgas/show' = render file: '/orgas/show'
\ \
= t '.access' != t '.access'
= surround '<'.html_safe, '>'.html_safe do = surround '<'.html_safe, '>'.html_safe do
= orga_url @orga = orga_url @orga
\ \
= t '.signature' != t '.signature'

View File

@ -1,7 +1,7 @@
= t '.body', subject: @orga.name != t '.body', subject: @orga.name
= surround '<'.html_safe, '>'.html_safe do = surround '<'.html_safe, '>'.html_safe do
= moderations_url = moderations_url
\ \
= render file: '/orgas/show' = render file: '/orgas/show'
\ \
= t '.signature' != t '.signature'

View File

@ -1,6 +1,6 @@
= t '.body', subject: @orga.name, author: @current_user != t '.body', subject: @orga.name, author: @current_user
\ \
= t '.reminder' != t '.reminder'
= render file: '/orgas/show' = render file: '/orgas/show'
\ \
= t '.signature' != t '.signature'

View File

@ -1,4 +1,4 @@
= t '.body', subject: @orga.name, author: @current_user || t('.submitter') != t '.body', subject: @orga.name, author: @current_user || t('.submitter')
:ruby :ruby
new = render file: '/orgas/show' new = render file: '/orgas/show'
@ -11,9 +11,9 @@
require 'differ/format/patch' require 'differ/format/patch'
Differ.format = Differ::Format::Patch Differ.format = Differ::Format::Patch
= Differ.diff new, prev != Differ.diff new, prev
\ \
= surround '<'.html_safe, '>'.html_safe do = surround '<'.html_safe, '>'.html_safe do
= edit_orga_url @orga = edit_orga_url @orga
\ \
= t '.signature' != t '.signature'

View File

@ -1,8 +1,8 @@
= t '.body', subject: @note.event.title, contents: @note.contents != t '.body', subject: @note.event.title, contents: @note.contents
\ \
= strip_tags @note.contents != strip_tags @note.contents
\ \
= surround '<'.html_safe, '>'.html_safe do = surround '<'.html_safe, '>'.html_safe do
= moderations_url = moderations_url
\ \
= t '.signature' != t '.signature'

View File

@ -1,12 +1,12 @@
= t '.body', subject: @note.event.title, contents: @note.contents != t '.body', subject: @note.event.title, contents: @note.contents
\ \
= sanitize @note.contents.html_safe, != sanitize @note.contents.html_safe,
tags: %w(p br table tr td ul ol li a strong b em i img), tags: %w[p br table tr td ul ol li a strong b em i img],
attributes: %w(href src width height) attributes: %w[href src width height]
\ \
= t '.edit_link' != t '.edit_link'
\ \
= surround '<'.html_safe, '>'.html_safe do = surround '<'.html_safe, '>'.html_safe do
= edit_event_url @note.event, secret: @note.event.secret = edit_event_url @note.event, secret: @note.event.secret
\ \
= t '.signature' != t '.signature'

View File

@ -1,9 +1,9 @@
= t '.body', author: @current_user != t '.body', author: @current_user
\ \
= render file: '/orgas/show' = render file: '/orgas/show'
\ \
= t '.access' != t '.access'
= surround '<'.html_safe, '>'.html_safe do = surround '<'.html_safe, '>'.html_safe do
= orga_url @orga = orga_url @orga
\ \
= t '.signature' != t '.signature'

View File

@ -1,9 +1,9 @@
= t '.body', subject: @orga.name != t '.body', subject: @orga.name
= surround '<'.html_safe, '>'.html_safe do = surround '<'.html_safe, '>'.html_safe do
= edit_orga_url @orga, secret: @orga.secret = edit_orga_url @orga, secret: @orga.secret
\ \
= t '.delete_link' != t '.delete_link'
= surround '<'.html_safe, '>'.html_safe do = surround '<'.html_safe, '>'.html_safe do
= cancel_orga_url @orga, secret: @orga.secret = cancel_orga_url @orga, secret: @orga.secret
\ \
= t '.signature' != t '.signature'

View File

@ -1,10 +1,10 @@
= t '.body', author: @current_user != t '.body', author: @current_user
\ \
= @reason = @reason
\ \
= t '.reclamation' != t '.reclamation'
\ \
= t '.reminder' != t '.reminder'
= render file: '/orgas/show' = render file: '/orgas/show'
\ \
= t '.signature' != t '.signature'

View File

@ -1,5 +1,5 @@
= t '.body', subject: @orga.name, author: @current_user || t('.submitter') != t '.body', subject: @orga.name, author: @current_user || t('.submitter')
\
:ruby :ruby
new = render file: '/orgas/show' new = render file: '/orgas/show'
@ -11,9 +11,9 @@
require 'differ/format/patch' require 'differ/format/patch'
Differ.format = Differ::Format::Patch Differ.format = Differ::Format::Patch
= Differ.diff new, prev != Differ.diff new, prev
\ \
= surround '<'.html_safe, '>'.html_safe do = surround '<'.html_safe, '>'.html_safe do
= edit_orga_url @orga, secret: @orga.secret = edit_orga_url @orga, secret: @orga.secret
\ \
= t '.signature' != t '.signature'

View File

@ -1,18 +1,18 @@
============================================================================== ==============================================================================
= display_attr @orga, :kind, t("activerecord.attributes.kind.name_#{@orga.kind.name}") != display_attr @orga, :kind, t("activerecord.attributes.kind.name_#{@orga.kind.name}")
= display_attr @orga, :name != display_attr @orga, :name
= display_attr @orga, :place_name != display_attr @orga, :place_name
= display_attr @orga, :address != display_attr @orga, :address
= display_attr @orga, :city != display_attr @orga, :city
= display_attr @orga, :department != display_attr @orga, :department
= display_attr @orga, :region, @orga.region != display_attr @orga, :region, @orga.region
= display_attr @orga, :url != display_attr @orga, :url
= display_attr @orga, :diaspora != display_attr @orga, :diaspora
= display_attr @orga, :feed != display_attr @orga, :feed
= display_attr @orga, :contact != display_attr @orga, :contact
= display_attr @orga, :submitter != display_attr @orga, :submitter
= display_attr @orga, :tag_list, @orga.tag_list != display_attr @orga, :tag_list, @orga.tag_list
= display_attr @orga, :active, t(@orga.active.to_s) != display_attr @orga, :active, t(@orga.active.to_s)
\ \
= to_markdown @orga.description, 78 != to_markdown @orga.description, 78
============================================================================== ==============================================================================

View File

@ -19,11 +19,13 @@ module Differ
private private
def as_insert(change) def as_insert(change)
"+ #{change.insert}" change.insert[0] = '+'
change.insert
end end
def as_delete(change) def as_delete(change)
"- #{change.delete}" change.delete[0] = '-'
change.delete
end end
def as_change(change) def as_change(change)

View File

@ -12,6 +12,18 @@ class EventMailerPreview < ActionMailer::Preview
EventMailer.accept Event.last EventMailer.accept Event.last
end end
# Preview this email at http://localhost:3000/rails/mailers/event_mailer/update
def update
ActionMailer::Base.default_url_options[:host] = 'localhost:3000'
event = Event.first
event.start_time += 1.day
event.description = event.description + '
hello world'
EventMailer.update event
end
# Preview this email at http://localhost:3000/rails/mailers/event_mailer/destroy # Preview this email at http://localhost:3000/rails/mailers/event_mailer/destroy
def destroy def destroy
ActionMailer::Base.default_url_options[:host] = 'localhost:3000' ActionMailer::Base.default_url_options[:host] = 'localhost:3000'

View File

@ -11,7 +11,6 @@ class ModerationMailerPreview < ActionMailer::Preview
ActionMailer::Base.default_url_options[:host] = 'localhost:3000' ActionMailer::Base.default_url_options[:host] = 'localhost:3000'
event = Event.first event = Event.first
event.tags += ' ho'
event.start_time += 1.day event.start_time += 1.day
event.description = event.description + ' event.description = event.description + '
hello world' hello world'

View File

@ -11,8 +11,8 @@ class ModerationorgaMailerPreview < ActionMailer::Preview
ActionMailer::Base.default_url_options[:host] = 'localhost:3000' ActionMailer::Base.default_url_options[:host] = 'localhost:3000'
orga = Orga.first orga = Orga.first
orga.tags += ' ho'
orga.save! orga.save!
orga.name += ' et hop!'
orga.description = orga.description + ' orga.description = orga.description + '
hello world' hello world'