layout newsletter

This commit is contained in:
Nicolas Bally 2013-06-29 12:00:32 +02:00
parent e5db15b783
commit 6f09437e16
7 changed files with 130 additions and 44 deletions

View File

@ -51,7 +51,11 @@ class NewslettersController < ApplicationController
end
end
def show
@newsletter = Newsletter.find(params[:id])
render :layout => "mail"
end
def destroy
@newsletter = Newsletter.find(params[:id])

View File

@ -1,8 +1,6 @@
# -*- encoding : utf-8 -*-
class PetitionsController < ApplicationController
before_filter :authenticate_admin!
def show
@petition = Petition.find_by_slug(params[:id])
@ -10,14 +8,6 @@ class PetitionsController < ApplicationController
@title = "Le Pic Vert - "+@petition.name
end
def new
@petition = Petition.new
end
def edit
@petition = Petition.find(params[:id])
end
def create
@signator = PetitionSignator.new(params[:petition_signator])

View File

@ -1,7 +1,21 @@
# -*- encoding : utf-8 -*-
class Newsletter < ActiveRecord::Base
validates_presence_of :title
attr_accessible :title, :content, :email_from
EMAIL_FROMS=["Le Pic Vert <contact@lepicvert.asso.fr>", "Le Pic Vert <s.montchalin@lepicvert.asso.fr>"]
#EMAIL_FROMS=["Le Pic Vert <contact@lepicvert.asso.fr>", "Le Pic Vert <s.montchalin@lepicvert.asso.fr>"]
EMAIL_FROMS=["contact@lepicvert.asso.fr","m.botton@lepicvert.asso.fr","s.montchalin@lepicvert.asso.fr","c.paul@lepicvert.asso.fr","b.cambon@lepicvert.asso.fr"]
EMAIL_TEXTES= {
"contact@lepicvert.asso.fr" => ["Le Pic Vert",""],
"s.montchalin@lepicvert.asso.fr" => ["Sonia - Le Pic Vert","Sonia Montchalin", "Animatrice nature et environnement"],
"m.botton@lepicvert.asso.fr" => ["Martial - Le Pic Vert","Martial Botton","Coordinateur"],
"c.paul@lepicvert.asso.fr" => ["Camille - Le Pic Vert","Camille Paul","Apprentie BTSA Gestion et Protection de la Nature"],
"b.cambon@lepicvert.asso.fr" => ["Bastien - Le Pic Vert","Bastien Cambon","Engagé service civique"]
}
end

View File

@ -1,9 +1,62 @@
!!!
%html
%head
%meta{ :"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8" }
%head
%meta{ :"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8" }
:css
a {
color: #0088cc;
text-decoration: none;
}
a:hover, a:focus {
color: #005580;
text-decoration: underline;
}
*{
line-height:1.3em;
}
%body
= yield
%body{:style => "font-family: Helvetica,Arial;padding:0px;margin:0px;font-size:15px;"}
%table{:style => "max-width:1000px !important;width:100%;border-collapse:collapse;"}
%tr
%td{:colspan => "3", :style => "padding:20px;"}= yield
//#5bb1f3
//#e16b13
//%tr{:style => "background:#5bb1f3;"}
// %td{:colspan => "3", :style => "padding:10px;text-align:center;color:white;"}
// Consultez toutes nos actualités sur notre site internet.
%tr{:style => "background:#f4f3ef"}
%td{:style => "width:185px;padding:20px;padding-top:22px;padding-bottom:28px;padding-left:30px;"}
=link_to image_tag("logo.png", :style => "width:185px;border:0px;"),"http://www.lepicvert.asso.fr"
%td{:style => "padding-top:20px;vertical-align:top;padding-left:20px;color:#2d2d2d;"}
%p
=link_to "Association Le Pic Vert","http://www.lepicvert.asso.fr", :style => "color:#47a000;text-decoration:none;"
%br
24 place de la mairie
%br
38140 REAUMONT
%p
=link_to "www.lepicvert.asso.fr","http://www.lepicvert.asso.fr", :style => "color:black;text-decoration:none;border-bottom:1px solid #f4f3ef;"
%p
04 76 91 34 33
%td{:style => "padding-top:20px;vertical-align:top;padding-right:30px;color:#2d2d2d;width:300px;text-align:right;"}
%p
%tr{:style => "background:#393939;color:#f6f6f6;text-align:center;"}
%td{:colspan => 3, :style => "padding:10px;font-size:12px;"} Vous recevez ce mail car vous êtes adhérent ou sympatisant de l'association Le Pic Vert. Si vous ne souhaitez plus recevoir de mail de notre part n'hésitez pas à nous contacter.

View File

@ -1 +1,12 @@
=raw @content
=raw @content
-if @email_from? and @email_from != "contact@lepicvert.asso.fr"
%br
%p
%strong=Newsletter::EMAIL_TEXTES[@email_from][1]
%br
=Newsletter::EMAIL_TEXTES[@email_from][2]
%br
%br
=link_to @email_from, "mailto:#{@email_from}"

View File

@ -1,30 +1,32 @@
.links
=link_to "Créer une newsletter", new_newsletter_path
=link_to "Créer une newsletter", new_newsletter_path
%table.admin_table#newsletters-list
%table.admin_table#newsletters-list.table.table-stripped.table-bordered
%tr
%th Expéditeur
%th Sujet
%th
%th
%tr
%th Expéditeur
%th Sujet
%th
%th
-for u in @newsletter
%tr
%td
=u.email_from
%td
= u.title
%td
- if has_permission?('newsletter.send')
=form_tag send_test_newsletter_path(u) do
= text_field_tag :email
= submit_tag "Envoyer un email de test", :class => "lien"
%td.link-column{:style => "width:200px;"}
= link_to "Editer", edit_newsletter_path(u)
= link_to "Effacer", u, :method => :delete, :confirm => 'Voulez-vous vraiment supprimer cette newsletter ?'
= link_to "Envoyer", select_recipients_newsletter_path(u)
-for u in @newsletter
%tr
%td
=u.email_from
%td
= u.title
%td
- if has_permission?('newsletter.send')
=form_tag send_test_newsletter_path(u) do
= text_field_tag :email
= submit_tag "Envoyer un email de test", :class => "lien"
%td.link-column{:style => "width:200px;"}
= link_to "Prévualiser", newsletter_path(u)
= link_to "Editer", edit_newsletter_path(u)
= link_to "Effacer", u, :method => :delete, :confirm => 'Voulez-vous vraiment supprimer cette newsletter ?'
= link_to "Envoyer", select_recipients_newsletter_path(u)

View File

@ -0,0 +1,12 @@
=raw @newsletter.content
-if @newsletter.email_from? and @newsletter.email_from != "contact@lepicvert.asso.fr"
%br
%p
%strong=Newsletter::EMAIL_TEXTES[@newsletter.email_from][1]
%br
=Newsletter::EMAIL_TEXTES[@newsletter.email_from][2]
%br
%br
=link_to @newsletter.email_from, "mailto:#{@newsletter.email_from}"