This commit is contained in:
2015-06-21 16:01:30 +02:00
29 changed files with 453 additions and 63 deletions

View File

@@ -145,7 +145,7 @@ end
# Calendar
if( user.has_role?("fetuser") || user.has_role?("fetadmin"))
can [:show, :edit, :update,:new,:create,:write, :write_etherpad, :read_from_etherpad, :dump_to_etherpad], Document
can [:show, :edit, :update,:new,:create,:write, :write_etherpad, :read_from_etherpad, :dump_to_etherpad, :search], Document
can :manage, Meeting
can :manage, Meetingtyp
end

View File

@@ -15,9 +15,15 @@ class Beispiel < ActiveRecord::Base
has_paper_trail
attr_accessible :desc, :name, :lva_id, :beispieldatei, :beispieldatei_cache, :datum
acts_as_votable
acts_as_flagable
belongs_to :lva
mount_uploader :beispieldatei, AttachmentUploader
FLAG_ICONS = {"badquality"=>"fa fa-flag","goodquality"=>"fa fa-flag", "delete"=>"fa fa-trash"}
scope :not_flag_badquality, ->{where("flag_badquality IS NULL OR flag_badquality=?",false)}
scope :flag_badquality, ->{where("flag_badquality=?",true)}
scope :not_flag_delete, ->{where("flag_delete IS NULL OR flag_delete=?",false)}
scope :flag_delete, ->{where("flag_delete=?",true)}
mount_uploader :beispieldatei, AttachmentUploader
validates :beispieldatei, :presence => true
validates :name, :presence => true
validates :lva_id, :presence => true

View File

@@ -15,7 +15,7 @@ class Crawlobject < ActiveRecord::Base
end
end
def move_to_neuigkeit(user,rubrik)
if self.objtype == 5 and self.something.nil?
if ( self.objtype == 5 || self.objtype == 6 )and self.something.nil?
n=Neuigkeit.new
n.title=self.name
n.text=self.text
@@ -27,7 +27,7 @@ class Crawlobject < ActiveRecord::Base
self.something=n
self.save
return n
elsif self.objtype == 5
elsif ( self.objtype == 5 || self.objtype==6)
n=self.something
n.title=self.name
n.text=self.text

View File

@@ -21,7 +21,7 @@ class Neuigkeit < ActiveRecord::Base
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]
validates :rubrik, :presence=>true
@@ -29,7 +29,7 @@ class Neuigkeit < ActiveRecord::Base
translates :title,:text, :versioning=>{:gem=>:paper_trail, :options=>{:fallbacks_for_empty_translations => true}}
mount_uploader :picture, PictureUploader
default_scope order(:cache_order)
default_scope order(:cache_order).includes(:calentries).includes(:title_pic)
scope :recent, -> { published.limit(10)}
scope :unpublished, -> {where("datum > ? OR datum IS NULL", Time.now)}
scope :published_scope, ->{where("datum <= ? AND datum IS NOT NULL", Time.now)}
@@ -66,8 +66,9 @@ class Neuigkeit < ActiveRecord::Base
if self.has_meeting?
return self.meeting.meetingtyp.picture
else
unless self.attachments.where(flag_titlepic: true).first.nil?
return self.attachments.where(flag_titlepic: true).first.datei
unless self.title_pic.nil?
# return self.attachments.where(flag_titlepic: true).first.datei
return self.title_pic.datei
else
return self.picture
end