selection mail pour newsletters
This commit is contained in:
parent
db02919983
commit
9c7039d551
@ -9,7 +9,12 @@ class NewsletterMails < ActionMailer::Base
|
|||||||
@email = email
|
@email = email
|
||||||
@title = @newsletter.title
|
@title = @newsletter.title
|
||||||
@content = @newsletter.content
|
@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
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
class Newsletter < ActiveRecord::Base
|
class Newsletter < ActiveRecord::Base
|
||||||
validates_presence_of :title
|
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
|
end
|
||||||
|
@ -4,6 +4,10 @@
|
|||||||
Sujet :
|
Sujet :
|
||||||
=f.text_field :title, :class => "inputText"
|
=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
|
%table.admin_table#newsletters-list
|
||||||
|
|
||||||
%tr
|
%tr
|
||||||
|
%th Expéditeur
|
||||||
%th Sujet
|
%th Sujet
|
||||||
%th
|
%th
|
||||||
%th
|
%th
|
||||||
|
|
||||||
|
|
||||||
-for u in @newsletter
|
-for u in @newsletter
|
||||||
- klass = cycle("a","b")
|
|
||||||
%tr
|
%tr
|
||||||
|
%td
|
||||||
|
=u.email_from
|
||||||
%td
|
%td
|
||||||
= u.title
|
= u.title
|
||||||
%td
|
%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.
|
# 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|
|
create_table "admins", :force => true do |t|
|
||||||
t.string "email", :default => "", :null => false
|
t.string "email", :default => "", :null => false
|
||||||
@ -146,6 +146,7 @@ ActiveRecord::Schema.define(:version => 20130318194918) do
|
|||||||
t.boolean "archive"
|
t.boolean "archive"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
|
t.string "email_from"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "note_files", :force => true do |t|
|
create_table "note_files", :force => true do |t|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user