forked from bofh/fetsite
meetingtyp management
This commit is contained in:
@@ -50,26 +50,32 @@ class Meeting < ActiveRecord::Base
|
||||
end
|
||||
def create_protocol
|
||||
if self.protocol.nil?
|
||||
d=Document.new
|
||||
d.typ=10
|
||||
d=Document.new
|
||||
d.typ=10
|
||||
d.name="Protokoll"
|
||||
d.save
|
||||
self.protocol=d
|
||||
end
|
||||
unless self.meetingtyp.protocol.nil?
|
||||
d.text=self.meetingtyp.protocol.text
|
||||
end
|
||||
d.save
|
||||
self.protocol=d
|
||||
end
|
||||
|
||||
end
|
||||
def create_calentry
|
||||
if self.calentry.nil?
|
||||
ce =Calentry.new
|
||||
ce.typ=2
|
||||
self.calentry=ce
|
||||
end
|
||||
end
|
||||
ce =Calentry.new
|
||||
ce.typ=2
|
||||
self.calentry=ce
|
||||
end
|
||||
end
|
||||
def create_agenda
|
||||
if self.agenda.nil?
|
||||
d=Document.new
|
||||
d.typ=11
|
||||
d.name="Agenda"
|
||||
unless self.meetingtyp.agenda.nil?
|
||||
d.text=self.meetingtyp.agenda.text
|
||||
end
|
||||
d.save
|
||||
self.agenda=d
|
||||
end
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
class Meetingtyp < ActiveRecord::Base
|
||||
attr_accessible :agendaintern, :desc, :name, :protocolintern
|
||||
attr_accessible :agendaintern, :desc, :name, :protocolintern, :rubrik_id
|
||||
belongs_to :rubrik
|
||||
validate :rubrik, :presence=>true
|
||||
has_many :meetings
|
||||
has_one :calendar, through: :rubrik
|
||||
has_one :protocol, :class_name=>'Document', :conditions=>{:typ=>10}, :as=>:parent
|
||||
has_one :agenda , :as=>:parent, :conditions=>{:typ=>11}, :class_name=>'Document'
|
||||
def text
|
||||
self.name
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ class Neuigkeit < ActiveRecord::Base
|
||||
scope :intern, ->{includes(:rubrik).where("rubriken.public"=>false)}
|
||||
|
||||
# scope :search, ->(query) {where("text like ? or title like ?", "%#{query}%", "%#{query}%")}
|
||||
LINKTYPES=["Thema", "Gallery", "Lva","Studium","Fetprofile", "Gremium"]
|
||||
LINKTYPES=["Thema", "Themengruppe", "Gallery", "Lva","Studium","Fetprofile", "Gremium"]
|
||||
accepts_nested_attributes_for :calentries, :allow_destroy=>true , :reject_if=> lambda{|a| a[:start].blank?}
|
||||
before_validation :sanitize
|
||||
|
||||
|
||||
Reference in New Issue
Block a user