forked from bofh/fetsite
merge
This commit is contained in:
@@ -114,14 +114,13 @@ class Ability
|
|||||||
unless user.has_role?("fetadmin")
|
unless user.has_role?("fetadmin")
|
||||||
cannot :delete, Rubrik
|
cannot :delete, Rubrik
|
||||||
cannot :delete, Neuigkeit
|
cannot :delete, Neuigkeit
|
||||||
|
|
||||||
end
|
end
|
||||||
# Calendar
|
# Calendar
|
||||||
if( user.has_role?("fetuser") || user.has_role?("fetadmin"))
|
if( user.has_role?("fetuser") || user.has_role?("fetadmin"))
|
||||||
can :manage, Document
|
can :manage, Document
|
||||||
can :manage, Meeting
|
can :manage, Meeting
|
||||||
can :manage, Meetingtyp
|
can :manage, Meetingtyp
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# Rechteverwaltung Kalender
|
# Rechteverwaltung Kalender
|
||||||
@@ -130,8 +129,6 @@ class Ability
|
|||||||
can [:show], Calentry
|
can [:show], Calentry
|
||||||
|
|
||||||
if( user.has_role?("fetuser") || user.has_role?("fetadmin"))
|
if( user.has_role?("fetuser") || user.has_role?("fetadmin"))
|
||||||
|
|
||||||
|
|
||||||
can [:show,:index], Calendar
|
can [:show,:index], Calendar
|
||||||
can [:edit, :update,:new,:create,:verwalten], Calendar
|
can [:edit, :update,:new,:create,:verwalten], Calendar
|
||||||
can [:edit, :update,:new,:create,:verwalten,:delete], Calentry
|
can [:edit, :update,:new,:create,:verwalten,:delete], Calentry
|
||||||
|
|||||||
@@ -25,22 +25,20 @@ include Rails.application.routes.url_helpers
|
|||||||
has_many :documents, :as=>:parent
|
has_many :documents, :as=>:parent
|
||||||
scope :public, where(:isdraft=>false).includes(:themengruppe).where("themengruppen.public"=>true)
|
scope :public, where(:isdraft=>false).includes(:themengruppe).where("themengruppen.public"=>true)
|
||||||
default_scope order("themen.priority").reverse_order
|
default_scope order("themen.priority").reverse_order
|
||||||
# scope :search, ->(query) {where("themen.text like ? or themen.title like ?", "%#{query}%", "%#{query}%")}
|
# scope :search, ->(query) {where("themen.text like ? or themen.title like ?", "%#{query}%", "%#{query}%")}
|
||||||
searchable do
|
searchable do
|
||||||
text :text
|
text :text
|
||||||
text :title, :boost=>4.0
|
text :title, :boost=>4.0
|
||||||
end
|
end
|
||||||
|
scope :outdated, -> {includes(:translations).where("thema_translations.updated_at<?",2.month.ago).where("thema_translations.locale"=>I18n.t.locale)
|
||||||
|
}
|
||||||
scope :outdated, -> {includes(:translations).where("thema_translations.updated_at<?",2.month.ago).where("thema_translations.locale"=>I18n.t.locale)
|
|
||||||
}
|
|
||||||
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
|
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
|
||||||
def is_outdated?
|
def is_outdated?
|
||||||
unless translation.try(:updated_at).nil?
|
unless translation.try(:updated_at).nil?
|
||||||
translation.updated_at < 2.month.ago
|
translation.updated_at < 2.month.ago
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def text_first_words
|
def text_first_words
|
||||||
@@ -50,16 +48,13 @@ scope :outdated, -> {includes(:translations).where("thema_translations.updated_a
|
|||||||
"...."
|
"...."
|
||||||
else
|
else
|
||||||
words[0..100].join(" ")+ " ..." unless words.nil?
|
words[0..100].join(" ")+ " ..." unless words.nil?
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def fix_links(host)
|
def fix_links(host)
|
||||||
full_url= URI.parse(root_url(:host=>host))
|
full_url= URI.parse(root_url(:host=>host))
|
||||||
self.text.gsub!(/src="[\.\/]*uploads\/attachment\/datei\/(\d+)\/thumb_big[^"]*"/){|s| full_url.path=Attachment.find($1.to_i).datei.thumb_big.url; 'src="'+full_url.to_s+'"'}
|
self.text.gsub!(/src="[\.\/]*uploads\/attachment\/datei\/(\d+)\/thumb_big[^"]*"/){|s| full_url.path=Attachment.find($1.to_i).datei.thumb_big.url; 'src="'+full_url.to_s+'"'}
|
||||||
self.text.gsub!(/src="[\.\/^"]*uploads\/attachment\/datei\/(\d+)\/[^"]*"/){|s| full_url.path=Attachment.find($1.to_i).datei.url; 'src="'+full_url.to_s+'"'}
|
self.text.gsub!(/src="[\.\/^"]*uploads\/attachment\/datei\/(\d+)\/[^"]*"/){|s| full_url.path=Attachment.find($1.to_i).datei.url; 'src="'+full_url.to_s+'"'}
|
||||||
|
|
||||||
self.text.gsub!(/href="[^"]*themen\/(\d+)[^"]*"/){|s| full_url.path=thema_path(Thema.find($1.to_i)); 'href="'+full_url.to_s+'"'}
|
self.text.gsub!(/href="[^"]*themen\/(\d+)[^"]*"/){|s| full_url.path=thema_path(Thema.find($1.to_i)); 'href="'+full_url.to_s+'"'}
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user