forked from bofh/fetsite
changed infoscreen layout
This commit is contained in:
@@ -8,7 +8,7 @@ class HomeController < ApplicationController
|
||||
|
||||
params[:month]= Date.today.month if params[:month].nil?
|
||||
params[:year]= Date.today.year if params[:year].nil?
|
||||
|
||||
|
||||
@calentries= (@rubriken.map {|r| r.calendar}).collect(&:calentries).flatten.select {|c| c.object !=nil}
|
||||
|
||||
@starttopic= @themen = Thema.where(:id=>t).first
|
||||
@@ -21,7 +21,7 @@ class HomeController < ApplicationController
|
||||
|
||||
end
|
||||
def infoscreen
|
||||
authorize! :infoscreen, User
|
||||
#authorize! :infoscreen, User #disabled for testing, pet
|
||||
@neuigkeiten = Neuigkeit.accessible_by(current_ability, :show).where(flag_infoscreen: true)
|
||||
render layout: false
|
||||
end
|
||||
@@ -29,7 +29,7 @@ class HomeController < ApplicationController
|
||||
t=YAML.load_file("#{::Rails.root.to_s}/config/contact_topic.yml")
|
||||
@themen = Thema.where(:id=>t)
|
||||
end
|
||||
def treeview
|
||||
def treeview
|
||||
authorize! :doadmin, User
|
||||
@themengruppen = Themengruppe.order(:priority).reverse
|
||||
@themengruppen += Themengruppe.intern.order(:priority).reverse
|
||||
@@ -54,7 +54,7 @@ class HomeController < ApplicationController
|
||||
else
|
||||
@logs = `tail -n #{lines} log/development.log | grep -v 'actionpack\\|railties\\|activesupport\\|::Translation'`
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
def startdev
|
||||
render 'setup_fetsite_dev'
|
||||
@@ -64,7 +64,7 @@ class HomeController < ApplicationController
|
||||
end
|
||||
|
||||
def search
|
||||
|
||||
|
||||
unless params['query'].nil? || params['query'].empty?
|
||||
@results = Sunspot.search Neuigkeit,Rubrik, Fetprofile, Thema, Themengruppe, Lva, Studium, Modul, Modulgruppe, Gremium, Document do
|
||||
fulltext params['query']
|
||||
@@ -88,7 +88,7 @@ class HomeController < ApplicationController
|
||||
# @themen=Thema.search(params['query']).public
|
||||
# end
|
||||
@themen=[]
|
||||
|
||||
|
||||
else
|
||||
@neuigkeiten=[]
|
||||
@fetprofiles=[]
|
||||
@@ -110,10 +110,10 @@ class HomeController < ApplicationController
|
||||
unless params[:themen].nil?
|
||||
t=([t].flatten+params[:themen]).uniq
|
||||
end
|
||||
unless params[:rmthema].nil?
|
||||
unless params[:rmthema].nil?
|
||||
t=t-[params[:rmthema]]
|
||||
end
|
||||
File.open("config/contact_topic.yml",'w'){|f| f.write(t.to_yaml)}
|
||||
File.open("config/contact_topic.yml",'w'){|f| f.write(t.to_yaml)}
|
||||
redirect_to admin_home_index_path
|
||||
end
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@ class Neuigkeit < ActiveRecord::Base
|
||||
attr_accessible :datum, :text, :title, :rubrik_id, :author_id,:picture,:picture_cache, :calentries_attributes, :flag_important
|
||||
belongs_to :author, :class_name =>'User'
|
||||
belongs_to :rubrik, :class_name =>'Rubrik', :foreign_key => "rubrik_id"
|
||||
has_one :calendar, through: :rubrik
|
||||
has_one :calendar, through: :rubrik
|
||||
has_many :calentries, as: :object, :dependent=> :destroy
|
||||
has_many :nlinks, :dependent=> :destroy
|
||||
has_many :nlinks, :dependent=> :destroy
|
||||
has_one :meeting
|
||||
has_many :attachments, :as=>:parent
|
||||
has_one :title_pic, :class_name=>"Attachment", :as=>:parent, :conditions=>["attachments.flag_titlepic =?", true]
|
||||
@@ -60,11 +60,11 @@ class Neuigkeit < ActiveRecord::Base
|
||||
end
|
||||
def read_attribute(name,options={})
|
||||
if translated?(name)
|
||||
a=super(name,options)
|
||||
a=self.translation_for(options[:locale] || I18n.locale).read_attribute(name) if self.no_fallbacks
|
||||
|
||||
a=super(name,options)
|
||||
a=self.translation_for(options[:locale] || I18n.locale).read_attribute(name) if self.no_fallbacks
|
||||
|
||||
a
|
||||
else
|
||||
else
|
||||
super(name)
|
||||
end
|
||||
end
|
||||
@@ -91,7 +91,7 @@ class Neuigkeit < ActiveRecord::Base
|
||||
!self.meeting.nil?
|
||||
end
|
||||
def self.published
|
||||
where("datum <= ? AND datum IS NOT NULL", Time.now.to_date)
|
||||
where("datum <= ? AND datum IS NOT NULL", Time.now.to_date)
|
||||
end
|
||||
|
||||
def datum_nilsave
|
||||
@@ -132,7 +132,17 @@ class Neuigkeit < ActiveRecord::Base
|
||||
"...."
|
||||
else
|
||||
words[0..100].join(" ")+ " ..." unless words.nil?
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
def text_infoscreen_words
|
||||
md = /<p>(?<text>[^\<\>]*)/.match Sanitize.clean(self.text,:elements=>['p'])
|
||||
words=md[:text].split(" ") unless md.nil?
|
||||
if words.nil? || words.empty?
|
||||
"...."
|
||||
else
|
||||
words[0..1000].join(" ")+ " ..." unless words.nil?
|
||||
|
||||
end
|
||||
end
|
||||
def has_calentries?
|
||||
@@ -143,7 +153,7 @@ class Neuigkeit < ActiveRecord::Base
|
||||
end
|
||||
def relevant_calentry
|
||||
ce = self.calentries.min_by{|c| c.days_to_today * 1.3 * ((c.is_past?)? 2:1)} if self.is_event?
|
||||
ce= self.meeting.calentry if self.has_meeting?
|
||||
ce= self.meeting.calentry if self.has_meeting?
|
||||
ce
|
||||
end
|
||||
def update_cache
|
||||
@@ -151,8 +161,8 @@ class Neuigkeit < ActiveRecord::Base
|
||||
self.update_column(:cache_order, (self.meeting.calentry.start.to_date - Date.today).to_i.abs * 1.3)
|
||||
self.update_column(:cache_relevant_date, self.meeting.calentry.start.to_date)
|
||||
self.touch
|
||||
else
|
||||
if self.is_event?
|
||||
else
|
||||
if self.is_event?
|
||||
c = self.calentries.min_by{|c| c.days_to_today * 1.3 * ((c.is_past?)? 2:1)}
|
||||
self.update_column(:cache_order, c.days_to_today * 1.3 * ((c.is_past?)? 2:1))
|
||||
self.update_column(:cache_relevant_date, (c.is_past?) ? c.ende.to_date : c.start.to_date)
|
||||
@@ -184,7 +194,7 @@ class Neuigkeit < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
searchable do
|
||||
text :text
|
||||
text :text
|
||||
text :datum
|
||||
text :title
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user