AutoCommit Don Aug 27 16:03:04 CEST 2015
This commit is contained in:
@@ -1,7 +1,18 @@
|
||||
class EmailsController < ApplicationController
|
||||
load_and_authorize_resource
|
||||
before_filter :authorize
|
||||
|
||||
def index
|
||||
|
||||
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
|
||||
|
||||
@@ -228,7 +228,7 @@ end
|
||||
end
|
||||
|
||||
if user.has_role?("fetadmin")
|
||||
|
||||
can :emails,User
|
||||
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() %>
|
||||
@@ -4,9 +4,10 @@
|
||||
|
||||
<% if can?(:show , ce.object) %>
|
||||
<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)%>
|
||||
<% end %>
|
||||
<hr/>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
<hr/>
|
||||
|
||||
@@ -28,7 +28,9 @@
|
||||
resources :home, :only=>[:index] do
|
||||
end
|
||||
resources :emails, :only=>[:index] do
|
||||
|
||||
collection do
|
||||
get :daily_reminder
|
||||
end
|
||||
end
|
||||
get ':locale', constraints: {locale: /en|de/}, action: :language,controller: :home, as: "language"
|
||||
scope '(:locale)/admin' do
|
||||
|
||||
Reference in New Issue
Block a user