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