Permalink
Browse files

admin can send out newsletter via admin interface

  • Loading branch information...
1 parent 291deb7 commit f432f6371d235c8020aa351f6f829954230ad387 @wolli2710 wolli2710 committed Mar 6, 2012
@@ -1,3 +1,2 @@
ActiveAdmin.register NewsletterSubscriber do
-
end
View
@@ -3,8 +3,13 @@
index do
column :title
column :body
- column :sent
-
+ column :sent do |newsletter|
+ if newsletter.sent
+ newsletter.updated_at
+ else
+ link_to "Send Newsletter", newsletter_path(newsletter.id), :method => :put
+ end
+ end
default_actions
end
end
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Deleted file not rendered
@@ -9,12 +9,6 @@
#welcome-page {
- #logo {
- margin: 0 auto;
- width: 450px;
- height: 343px;
- }
-
#newsletter-box {
form {
@extend .well;
@@ -34,4 +28,4 @@
margin: 10px auto 0 auto;
}
}
-}
+}
@@ -1,7 +1,13 @@
class NewslettersController < ApplicationController
def update
- Newsletter.spread params[:newsletter_id]
+ if Newsletter.spread_newsletter params[:id]
+ flash[:info] = I18n.t('newsletter.update.success')
+ redirect_to :back
+ else
+ flash[:error] = I18n.t('newsletter.update.fail')
+ redirect_to :back
+ end
end
end
View
@@ -8,8 +8,7 @@ def self.spread_newsletter(newsletter_id = self.last.id)
NewsletterSubscriber.all.each do |subscriber|
SystemMailer.news(subscriber.email, newsletter.body).deliver
end
- newsletter.sent = true
- newsletter.save
+ newsletter.update_attribute(:sent, true)
end
end
@@ -1,6 +1,7 @@
#welcome-page
- #logo
- = image_tag 'logo.jpg'
+ .row
+ .span12
+ = image_tag 'logo.jpg'
#newsletter-box
=form_for @subscriber do |f|
View
@@ -215,6 +215,11 @@ de:
success: "Sie haben sich erfolgreich vom wissenteilen.com Newsletter abgemeldet"
fail: "Bei Ihrer Abmeldung vom wissenteilen.com Newsletter ist ein Fehler aufgetreten"
+ newsletter:
+ update:
+ success: "Newsletter erfolgreich versendet"
+ fail: "Newsletter versendung fehlgeschlagen"
+
devise:
failure:
already_authenticated: "Du bist schon angemeldet."

0 comments on commit f432f63

Please sign in to comment.