diff --git a/app/mailers/news_mailer.rb b/app/mailers/news_mailer.rb
index 9d8e30d..9a283f6 100644
--- a/app/mailers/news_mailer.rb
+++ b/app/mailers/news_mailer.rb
@@ -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
diff --git a/app/views/calentries/_mail.html.erb b/app/views/calentries/_mail.html.erb
new file mode 100644
index 0000000..9c75a7e
--- /dev/null
+++ b/app/views/calentries/_mail.html.erb
@@ -0,0 +1 @@
+<%= mail.icon_text %>
diff --git a/app/views/neuigkeiten/_mail.html.erb b/app/views/neuigkeiten/_mail.html.erb
new file mode 100644
index 0000000..543eea2
--- /dev/null
+++ b/app/views/neuigkeiten/_mail.html.erb
@@ -0,0 +1,10 @@
+
+ <%= mail.title%>
+
+<%= 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) %>
diff --git a/app/views/news_mailer/daily_reminder.html.erb b/app/views/news_mailer/daily_reminder.html.erb
index 98ccbcd..5b18aeb 100644
--- a/app/views/news_mailer/daily_reminder.html.erb
+++ b/app/views/news_mailer/daily_reminder.html.erb
@@ -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| %>
+
+<% 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 %>
+
<% end %>
+
diff --git a/config/environments/development.rb b/config/environments/development.rb
index e82fc64..c4acee2 100755
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -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