pic_vert_app/app/models/newsletter.rb
2015-02-20 08:30:02 +01:00

44 lines
2.0 KiB
Ruby
Executable File

# -*- encoding : utf-8 -*-
class Newsletter < ActiveRecord::Base
validates_presence_of :title
has_one :block, :as => :blockable
after_create :after_creation
def after_creation
@block = Block.new(:block_name => "Contenu")
@block.blockable = self
@block.save
end
def alloweds_types
self.block.allow_types :TitleContent, :TextContent, :ImageContent, :LinkContent, :GalleryContent, :HtmlContent, :DownloadContent
end
#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=["contact@lepicvert.asso.fr","m.botton@lepicvert.asso.fr","s.montchalin@lepicvert.asso.fr","g.chmargounof@lepicvert.asso.fr","m.perrot@lepicvert.asso.fr","s.chaudet@lepicvert.asso.fr","c.chauvet@lepicvert.asso.fr","c.paul@lepicvert.asso.fr","m.coulot@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"],
"g.chmargounof@lepicvert.asso.fr" => ["Gaëlle - Le Pic Vert","Gaëlle Chmargounof", "Animatrice nature et environnement"],
"m.botton@lepicvert.asso.fr" => ["Martial - Le Pic Vert","Martial Botton","Coordinateur"],
"s.chaudet@lepicvert.asso.fr" => ["Solenn - Le Pic Vert","Solenn Chaudet","Engagé service civique"],
"c.chauvet@lepicvert.asso.fr" => ["Clément - Le Pic Vert","Clément Chauvet","Engagé service civique"],
"c.paul@lepicvert.asso.fr" => ["Camille - Le Pic Vert","Camille Paul","Chargée d'études"],
"m.coulot@lepicvert.asso.fr" => ["Méline - Le Pic Vert","Méline Coulot","Engagée en service civique"],
"b.cambon@lepicvert.asso.fr" => ["Bastien - Le Pic Vert","Bastien Cambon","Engagé service civique"],
"m.perrot@lepicvert.asso.fr" => ["Mathilde - Le Pic Vert", "Mathilde Perrot", "Chargée de vie associative"]
}
end