forked from bofh/fetsite
AutoCommit Sam Aug 1 15:03:01 CEST 2015
This commit is contained in:
@@ -7,7 +7,10 @@ class NeuigkeitenController < ApplicationController
|
||||
|
||||
|
||||
load_and_authorize_resource
|
||||
|
||||
def default_url_options
|
||||
super
|
||||
# super.merge({host: request.host_with_port})
|
||||
end
|
||||
def show
|
||||
@neuigkeit = Neuigkeit.find(params[:id])
|
||||
@rubrik=@neuigkeit.rubrik
|
||||
@@ -86,6 +89,9 @@ class NeuigkeitenController < ApplicationController
|
||||
end
|
||||
end
|
||||
def mail_to_fet
|
||||
|
||||
ActionMailer::Base.default_url_options[:host] = request.host_with_port
|
||||
|
||||
@neuigkeit = Neuigkeit.find(params[:id])
|
||||
authorize! :publish, @neuigkeit
|
||||
unless @neuigkeit.published?
|
||||
@@ -98,6 +104,9 @@ class NeuigkeitenController < ApplicationController
|
||||
end
|
||||
def mail_preview
|
||||
@neuigkeit = Neuigkeit.find(params[:id])
|
||||
@user=current_user
|
||||
@ability=Ability.new(@user)
|
||||
|
||||
authorize! :publish, @neuigkeit
|
||||
render template: "news_mailer/neuigkeit_mail", layout: false
|
||||
end
|
||||
|
||||
0
app/helpers/mailer_helper.erb
Normal file
0
app/helpers/mailer_helper.erb
Normal file
3
app/helpers/mailer_helper.rb
Normal file
3
app/helpers/mailer_helper.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
module MailerHelper
|
||||
|
||||
end
|
||||
@@ -1,9 +1,19 @@
|
||||
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)
|
||||
email = "" if Rails.env=="development"
|
||||
mail(to: email, subject: @neuigkeit.title)
|
||||
@user=User.first
|
||||
@ability=Ability.new(@user)
|
||||
subject = @neuigkeit.title
|
||||
subject = subject + " email: " + email if Rails.env=="development"
|
||||
email = "andis@fet.at" if Rails.env=="development"
|
||||
email="andis@fet.at"
|
||||
mail(to: email, subject: subject)
|
||||
render locals: {current_user: User.first}
|
||||
end
|
||||
def daily_newsletter(user_id)
|
||||
user=User.find(user_id)
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<div class="media">
|
||||
<% unless neuigkeit_view.picture_robust.big_thumb.to_s.empty? %>
|
||||
<div class="pull-left" href="#">
|
||||
<p><br><%= link_to image_tag(neuigkeit_view.picture_robust.big_thumb.url),neuigkeit_view.picture_robust.try(:url) %>
|
||||
<p><br><%= link_to image_tag(neuigkeit_view.picture_robust.big_thumb),neuigkeit_view.picture_robust.try(:url) %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<h1>
|
||||
<%= @neuigkeit.title%>
|
||||
</h1>
|
||||
<%= image_tag @neuigkeit.picture.big_thumb.url(only_path:false) %>
|
||||
<%= content_tag(:img,"",src: "http://"+ActionMailer::Base.default_url_options[:host].to_s+@neuigkeit.picture.big_thumb.url) %>
|
||||
<%=url_for controller: "neuigkeiten",action: :show, :id=>@neuigkeit.id, only_path: false %>
|
||||
<%= raw(@neuigkeit.text) %>
|
||||
<%= render partial:"survey/questions/mail", object: @neuigkeit.questions.first unless @neuigkeit.questions.empty?%>
|
||||
|
||||
15
app/views/survey/choices/_mail.html.erb
Normal file
15
app/views/survey/choices/_mail.html.erb
Normal file
@@ -0,0 +1,15 @@
|
||||
<% choice=mail %>
|
||||
<%= div_tag_for(choice) do %>
|
||||
|
||||
<%
|
||||
if @user.nil?
|
||||
t=choice.text
|
||||
else
|
||||
value=(@user.id.nil?)? false : choice.answers.where(user_id: @user.id).count>0
|
||||
cstyle=(value) ? "true" :"false"
|
||||
t= link_to(raw("" + choice.html+ (( choice.picture.nil? || choice.picture.to_s.empty?) ? "":image_tag(choice.picture.thumb.url))), answer_survey_question_url(choice.question, params: {survey_question: {selected: [choice.id]}}),class: "choice-"+cstyle )
|
||||
end
|
||||
|
||||
%>
|
||||
<%= t %>
|
||||
<% end %>
|
||||
@@ -2,5 +2,6 @@
|
||||
<div class="contentbox">
|
||||
<b><%= question.title%></b> <%=question.text%></div>
|
||||
<% question.choices.each do |c| %>
|
||||
<li><%= render c %></li>
|
||||
<li><%= render partial:"survey/choices/mail",object: c %></li>
|
||||
<% 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
|
||||
|
||||
@@ -37,4 +37,8 @@ Fetsite::Application.configure do
|
||||
config.assets.debug = false
|
||||
|
||||
config.facebookconfig_enabled=true
|
||||
|
||||
# config.action_controller.asset_host = Proc.new{|source, request|
|
||||
#(request? request.protocol :'http://')+ "localhost:3000"
|
||||
#}
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user