meeting views

This commit is contained in:
Andreas Stephanides
2014-12-04 00:00:57 +01:00
parent b259c1080a
commit ab396c002e
20 changed files with 129 additions and 37 deletions

View File

@@ -1,9 +1,14 @@
class Document < ActiveRecord::Base
attr_accessible :etherpadkey, :name, :parent, :text, :typ
attr_accessible :etherpadkey, :name, :parent, :text, :typ, :parent_id, :parent_type
belongs_to :parent, :polymorphic => true
validate :name, :length=>{minimum:3}
validate :text, :presence=>true
validate :typ, :presence=>true
validate :parent, :presence=>true
def self.new_divid_for(parent)
"document_new_parent_" + parent.class.to_s + "_" + parent.id.to_s
end
def divid
"document_"+self.id.to_s
end
end

View File

@@ -1,12 +1,21 @@
class Meeting < ActiveRecord::Base
belongs_to :parent, :polymorphic=>true
belongs_to :meetingtyp
attr_accessible :desc, :intern, :name
attr_accessible :desc, :intern, :name, :parent_id, :parent_type, :calentry,:calentry_attributes
has_one :protocol, :class_name=>'Document', :conditions=>{:typ=>10}, :as=>:parent
has_one :agenda , :as=>:parent,:conditions=>{:typ=>11}, :class_name=>'Document'
validate :agenda, :presence=>true
validate :protocol, :presence=>true
has_one :calentry, :as=>:object
has_one :calentry, as: :object
accepts_nested_attributes_for :calentry
# validate :agenda, :presence=>true
# validate :protocol, :presence=>true
validate :parent, :presence=>true
validate :calentry, :presence=>true
before_validation :fix_calentry
def fix_calentry
self.calentry.object=self unless self.calentry.nil?
end
def public?
! (self.intern)
end
@@ -29,4 +38,12 @@ class Meeting < ActiveRecord::Base
self.agenda=d
end
end
def self.new_divid_for(parent)
"meeting_new_parent_" + parent.class.to_s + "_" + parent.id.to_s
end
def divid
"meeting_"+self.id.to_s
end
end