AutoCommit Don Aug 27 16:03:04 CEST 2015
This commit is contained in:
@@ -1,7 +1,18 @@
|
|||||||
class EmailsController < ApplicationController
|
class EmailsController < ApplicationController
|
||||||
load_and_authorize_resource
|
before_filter :authorize
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
||||||
end
|
end
|
||||||
|
def daily_reminder
|
||||||
|
@mail =NewsMailer.daily_reminder(current_user.id)
|
||||||
|
if params[:send]
|
||||||
|
@mail.deliver
|
||||||
|
end
|
||||||
|
render layout: false
|
||||||
|
end
|
||||||
|
protected
|
||||||
|
def authorize
|
||||||
|
authorize! :emails,User
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ end
|
|||||||
end
|
end
|
||||||
|
|
||||||
if user.has_role?("fetadmin")
|
if user.has_role?("fetadmin")
|
||||||
|
can :emails,User
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
3
app/views/emails/daily_reminder.html.erb
Normal file
3
app/views/emails/daily_reminder.html.erb
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<%=link_to "reminder", daily_reminder_emails_path(params: {send: true}) %>
|
||||||
|
<hr>Subject: <b><%= @mail.subject %></b><br>
|
||||||
|
<%= raw(@mail.body) %>
|
||||||
1
app/views/emails/index.html.erb
Normal file
1
app/views/emails/index.html.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<%=link_to "reminder", daily_reminder_emails_path() %>
|
||||||
@@ -1,12 +1,13 @@
|
|||||||
<%= stylesheet_link_tag "http://"+ActionMailer::Base.default_url_options[:host].to_s + "/assets/themes/blue2/application.css", :media=>"all" %>
|
<%= stylesheet_link_tag "http://"+ActionMailer::Base.default_url_options[:host].to_s + "/assets/themes/blue2/application.css", :media=>"all" %>
|
||||||
|
|
||||||
<% @calentries.each do |ce| %>
|
<% @calentries.each do |ce| %>
|
||||||
|
|
||||||
<% if can?(:show , ce.object) %>
|
<% if can?(:show , ce.object) %>
|
||||||
<hr/>
|
<hr/>
|
||||||
<%= render partial: "calentries/mail", object: ce %>
|
<h1> <%= render partial: "calentries/mail", object: ce %>
|
||||||
|
</h1>
|
||||||
<%= render partial: "neuigkeiten/mail", object: ce.object if ce.object.kind_of?(Neuigkeit)%>
|
<%= render partial: "neuigkeiten/mail", object: ce.object if ce.object.kind_of?(Neuigkeit)%>
|
||||||
<% end %>
|
<% end %>
|
||||||
<hr/>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
<hr/>
|
||||||
|
|||||||
@@ -28,7 +28,9 @@
|
|||||||
resources :home, :only=>[:index] do
|
resources :home, :only=>[:index] do
|
||||||
end
|
end
|
||||||
resources :emails, :only=>[:index] do
|
resources :emails, :only=>[:index] do
|
||||||
|
collection do
|
||||||
|
get :daily_reminder
|
||||||
|
end
|
||||||
end
|
end
|
||||||
get ':locale', constraints: {locale: /en|de/}, action: :language,controller: :home, as: "language"
|
get ':locale', constraints: {locale: /en|de/}, action: :language,controller: :home, as: "language"
|
||||||
scope '(:locale)/admin' do
|
scope '(:locale)/admin' do
|
||||||
|
|||||||
Reference in New Issue
Block a user