Merge branch 'master' into 'master'

Master



See merge request !11
This commit is contained in:
echarp 2016-10-30 01:06:20 +02:00
commit 83f803d5fb
16 changed files with 190 additions and 10 deletions

View File

@ -5,7 +5,7 @@ img.favicon
form#orga_search
right: 5%
width: 12em
width: 15em
position: absolute
font-size: larger
text-align: right
@ -23,6 +23,7 @@ form#orga_search
padding-left: 1.5em
padding-right: 1.2em
background-color: transparent
width: 14em
button.search
color: #258

View File

@ -12,6 +12,18 @@ class EventMailer < ApplicationMailer
subject: event.title}"
end
# Send email to submitter too. Before, only moderators were receiving emails when an event was updated
def update(event)
@event = event
@current_user = User.find_by id: event.paper_trail.originator
mail 'In-Reply-To' =>
"<event-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
to: event.submitter,
subject: "#{t 'mail_prefix'}#{t 'event_mailer.update.subject',
subject: event.title}"
end
def accept(event)
@event = event
@current_user = User.find_by id: event.paper_trail.originator

View File

@ -0,0 +1,64 @@
# Send mails to check on organisations life cycle
class ModerationorgaMailer < ApplicationMailer
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)
@orga = orga
mail 'Message-ID' =>
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
subject: "#{t 'mail_prefix'}#{t 'moderationorga_mailer.create.subject',
subject: orga.name}"
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)
@orga = orga
@current_user = User.find_by id: orga.paper_trail.originator
mail 'In-Reply-To' =>
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
subject: "#{t 'mail_prefix'}#{t 'moderationorga_mailer.update.subject',
subject: orga.name}"
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)
@orga = orga
@current_user = User.find_by id: orga.paper_trail.originator
mail 'In-Reply-To' =>
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
subject: "#{t 'mail_prefix'}#{t 'moderationorga_mailer.accept.subject',
subject: orga.name}"
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 = '')
@orga = orga
@current_user = User.find_by id: orga.paper_trail.originator
@reason = reason
mail 'In-Reply-To' =>
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
subject: "#{t 'mail_prefix'}#{t 'moderationorga_mailer.destroy.subject',
subject: orga.name}"
end
end

View File

@ -39,6 +39,9 @@ class EventCallbacks
elsif ActionMailer::Base.default_url_options[:host]
# Send an update mail to moderators
ModerationMailer.update(event).deliver_now
# Included to Send an update mail to its author
EventMailer.update(event).deliver_now
end
end

View File

@ -51,18 +51,26 @@ class Orga < ActiveRecord::Base
if moderated_changed?
OrgaMailer.accept(self).deliver_now!
# Send email to moderators when an orga is accepted
ModerationorgaMailer.accept(self).deliver_now!
else
OrgaMailer.update(self).deliver_now!
# Send email to moderators when an orga is updated
ModerationorgaMailer.update(self).deliver_now!
end
end
end
before_destroy do
OrgaMailer.destroy(self).deliver_now! unless submitter.blank?
# Send email to moderators when an orga is deleted
ModerationorgaMailer.destroy(self).deliver_now! unless submitter.blank?
end
def send_secret
OrgaMailer.create(self).deliver_now!
# Send email to moderators when an new orga is received
ModerationorgaMailer.create(self).deliver_now!
end
def name_as_tag

View File

@ -19,6 +19,7 @@
= surround '<'.html_safe, '>'.html_safe do
= cancel_event_url e, secret: e.secret
\
= t '.reminder'
= render file: '/events/show'
\
= t '.signature'

View File

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

View File

@ -1,5 +1,6 @@
= t '.body', author: @current_user
\
= t '.reminder'
= render file: '/events/show'
\
= t '.access'

View File

@ -14,9 +14,6 @@
= Differ.diff new, prev
\
= surround '<'.html_safe, '>'.html_safe do
- if @current_user
= edit_moderation_url @event
- else
= edit_event_url @event, secret: @event.secret
\
= t '.signature'

View File

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

View File

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

View File

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

View File

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

View File

@ -12,9 +12,8 @@
require 'differ/format/patch'
Differ.format = Differ::Format::Patch
= Differ.diff new, prev
= t '.access'
\
= surround '<'.html_safe, '>'.html_safe do
= orga_url @orga
= edit_orga_url @orga, secret: @orga.secret
\
= t '.signature'

View File

@ -28,7 +28,7 @@ module AgendaDuLibreRails
Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
# config.i18n.default_locale = :de
config.i18n.default_locale = :fr
config.i18n.available_locales = [:fr, :en]
config.i18n.available_locales = [:fr, :en, :'pt-BR']
config.action_mailer.default_options = {
from: 'moderateurs@agendadulibre.org',

View File

@ -36,6 +36,7 @@ pt-BR:
index:
calendar_in: Este calendário em %{rss}, %{webcal} ou %{ical}
nb_events: "%{count} eventos"
filter: Busca avançada
show:
orga-list: Organizações no estado
add_to_calendar: Adicionar ao meu calendário
@ -367,7 +368,7 @@ descrição mais completa."
body: "O evento foi aprovado por %{author}."
access: "Você pode consultá-lo aqui:"
reminder: "Detalhes do evento:"
signature: "Abraços,."
signature: "Abraços,"
destroy:
subject: "O evento '%{subject}' foi recusado"
body: "O evento '%{subject}' foi recusado por %{author} ou cancelado pelo remetente,
@ -453,3 +454,31 @@ do evento no seguinte endereço:"
update_html: <em class='fa fa-exchange'></em>
destroy_html: <em class='fa fa-trash'></em>
feed: feed RSS
application:
filter:
title: Busca Avançada
helper: Os parâmetros podem ser usados na agenda para consulta, ou integração em outro site
past: Passado
past_helper: Também inclui eventos passados em RSS feed, mapa e geojson
period_year: Ano
period_year_helper: Para definir o resumo semana/ano
period_week: Semana
near_location: Próximo a
near_location_helper: cidade ou local
near_distance: Distância de
near_distance_helper: cidade ou local
region: Estado
tag: Tag
iframe: Sem bordas
iframe_helper: Remove cabeçalho e rodapé para integração com um iframe
events: Agenda
map: Mapa
geojson: GeoJSON
json: JSON
rss: RSS
ics: iCal
xml: XML
digest: Resumo
orgas: Organizações