AutoCommit Mit Aug 26 12:03:05 CEST 2015
This commit is contained in:
@@ -3,9 +3,7 @@
|
||||
class NewsMailer < ActionMailer::Base
|
||||
default from: "salzamt@fet.at"
|
||||
helper :plugins
|
||||
def current_user
|
||||
@user
|
||||
end
|
||||
|
||||
def neuigkeit_mail(email, neuigkeit_id)
|
||||
@neuigkeit= Neuigkeit.find(neuigkeit_id)
|
||||
@user=User.first
|
||||
@@ -27,10 +25,20 @@ render locals: {current_user: User.first}
|
||||
|
||||
def daily_reminder(user_id)
|
||||
user=User.find(user_id)
|
||||
@user=user
|
||||
self.message.perform_deliveries = false unless user.flag_getemails
|
||||
ability = Ability.new(user)
|
||||
@calentries = Calentry.limit(10)
|
||||
@ability = Ability.new(user)
|
||||
@calentries = Calentry.limit(100)
|
||||
# @neuigkeiten=Neuigkeit.accessiblße_by(ability).published_scope.where("cache_order<2")
|
||||
mail(to: user.email, content_type: "text/html", subject: "sdf")
|
||||
render locals: {c_user: user}
|
||||
end
|
||||
private
|
||||
include CanCan::ControllerAdditions
|
||||
def current_user
|
||||
@user
|
||||
end
|
||||
def current_ability
|
||||
@ability
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
1
app/views/calentries/_mail.html.erb
Normal file
1
app/views/calentries/_mail.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= mail.icon_text %>
|
||||
10
app/views/neuigkeiten/_mail.html.erb
Normal file
10
app/views/neuigkeiten/_mail.html.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<h1>
|
||||
<%= mail.title%>
|
||||
</h1>
|
||||
<%= content_tag(:img,"",src: "http://" + ActionMailer::Base.default_url_options[:host].to_s + mail.picture.big_thumb.url.to_s) %>
|
||||
<%=url_for controller: "neuigkeiten",action: :show, :id=>mail.id, only_path: false %>
|
||||
<%= raw(mail.text) %>
|
||||
<% mail.questions.each do |q| %>
|
||||
<%= render partial:"survey/questions/mail", object: q %>
|
||||
<% end %>
|
||||
<%= link_to "Auf Fet.at weiterlesen", rubrik_neuigkeit_url(mail.rubrik, mail,:locale=>:de, :theme=>nil) %>
|
||||
@@ -1,3 +1,11 @@
|
||||
<%= @calentries.each do |ce| %>
|
||||
<%= render @calentry%>
|
||||
<%= stylesheet_link_tag "http://"+ActionMailer::Base.default_url_options[:host].to_s + "/assets/themes/blue2/application.css", :media=>"all" %>
|
||||
|
||||
<% @calentries.each do |ce| %>
|
||||
<hr/>
|
||||
<% if can?(:show , ce.object) %>
|
||||
<%= render partial: "calentries/mail", object: ce %>
|
||||
<%= render partial: "neuigkeiten/mail", object: ce.object if ce.object.kind_of?(Neuigkeit)%>
|
||||
<% end %>
|
||||
<hr/>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ Fetsite::Application.configure do
|
||||
# Don't care if the mailer can't send
|
||||
config.action_mailer.raise_delivery_errors = true
|
||||
config.action_mailer.delivery_method =:sendmail
|
||||
config.action_mailer.default_url_options = {}#{:host=> "localhost", :port=>3000} # :host => 'glonass.htu.tuwien.ac.at' }
|
||||
config.action_mailer.default_url_options = {:host=> "localhost", :port=>3000} # :host => 'glonass.htu.tuwien.ac.at' }
|
||||
# Print deprecation notices to the Rails logger
|
||||
config.active_support.deprecation = :log
|
||||
|
||||
|
||||
Reference in New Issue
Block a user