selection mail pour newsletters
This commit is contained in:
parent
db02919983
commit
9c7039d551
@ -9,7 +9,12 @@ class NewsletterMails < ActionMailer::Base
|
||||
@email = email
|
||||
@title = @newsletter.title
|
||||
@content = @newsletter.content
|
||||
mail(:to => @email, :from => "Le Pic Vert <contact@lepicvert.asso.fr>", :subject => @title)
|
||||
if @newsletter.email_from?
|
||||
@from = @newsletter.email_from.to_s
|
||||
else
|
||||
@from = "Le Pic Vert <contact@lepicvert.asso.fr>"
|
||||
end
|
||||
mail(:to => @email, :from => @from, :subject => @title)
|
||||
end
|
||||
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
class Newsletter < ActiveRecord::Base
|
||||
validates_presence_of :title
|
||||
|
||||
attr_accessible :title, :content
|
||||
attr_accessible :title, :content, :email_from
|
||||
|
||||
EMAIL_FROMS=["Le Pic Vert <contact@lepicvert.asso.fr>", "Le Pic Vert <s.montchalin@lepicvert.asso.fr>"]
|
||||
end
|
||||
|
@ -3,6 +3,10 @@
|
||||
%p
|
||||
Sujet :
|
||||
=f.text_field :title, :class => "inputText"
|
||||
|
||||
%p
|
||||
Sujet :
|
||||
=f.select :email_from, Newsletter::EMAIL_FROMS,:class => "inputText"
|
||||
|
||||
|
||||
|
||||
|
@ -4,14 +4,17 @@
|
||||
%table.admin_table#newsletters-list
|
||||
|
||||
%tr
|
||||
%th Expéditeur
|
||||
%th Sujet
|
||||
%th
|
||||
%th
|
||||
|
||||
|
||||
-for u in @newsletter
|
||||
- klass = cycle("a","b")
|
||||
|
||||
%tr
|
||||
%td
|
||||
=u.email_from
|
||||
%td
|
||||
= u.title
|
||||
%td
|
||||
|
@ -0,0 +1,5 @@
|
||||
class AddEmailFromToNewsletter < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :newsletters, :email_from, :string
|
||||
end
|
||||
end
|
@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20130318194918) do
|
||||
ActiveRecord::Schema.define(:version => 20130319095715) do
|
||||
|
||||
create_table "admins", :force => true do |t|
|
||||
t.string "email", :default => "", :null => false
|
||||
@ -146,6 +146,7 @@ ActiveRecord::Schema.define(:version => 20130318194918) do
|
||||
t.boolean "archive"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "email_from"
|
||||
end
|
||||
|
||||
create_table "note_files", :force => true do |t|
|
||||
|
Loading…
x
Reference in New Issue
Block a user