integrate calendar with meetings
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
module ApplicationHelper
|
||||
|
||||
def clean_calendar(cal)
|
||||
cal.rubrik.meetingtyps.each do |mt|
|
||||
mt.meetings.each do |m|
|
||||
m.calentry.calendar=cal
|
||||
end
|
||||
end
|
||||
end
|
||||
def strip_control_chars(value)
|
||||
value.chars.inject("") do |str, char|
|
||||
unless char.ascii_only? && (char.ord < 32 || char.ord == 127)
|
||||
|
||||
@@ -32,6 +32,7 @@ class Calentry < ActiveRecord::Base
|
||||
|
||||
resourcify
|
||||
def get_public
|
||||
self.calendar=self.object.calendar unless object.nil? || object.calendar.nil?
|
||||
self.public = (self.try(:object).nil?)? (self.calendar.try(:public?)) : object.try(:public?)
|
||||
true
|
||||
end
|
||||
|
||||
@@ -8,12 +8,16 @@ class Meeting < ActiveRecord::Base
|
||||
has_one :protocol, :class_name=>'Document', :conditions=>{:typ=>10}, :as=>:parent
|
||||
has_one :agenda , :as=>:parent,:conditions=>{:typ=>11}, :class_name=>'Document'
|
||||
has_one :calentry, as: :object
|
||||
has_one :calendar, :through=>:meetingtyp
|
||||
has_one :rubrik, :through=>:meetingtyp
|
||||
|
||||
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 title
|
||||
self.text
|
||||
end
|
||||
@@ -39,6 +43,7 @@ class Meeting < ActiveRecord::Base
|
||||
end
|
||||
def fix_calentry
|
||||
self.calentry.object=self unless self.calentry.nil?
|
||||
self.calentry.calendar = self.meetingtyp.rubrik.calendar
|
||||
end
|
||||
def public?
|
||||
! (self.intern)
|
||||
|
||||
@@ -2,5 +2,6 @@ class Meetingtyp < ActiveRecord::Base
|
||||
attr_accessible :agendaintern, :desc, :name, :protocolintern
|
||||
belongs_to :rubrik
|
||||
validate :rubrik, :presence=>true
|
||||
|
||||
has_many :meetings
|
||||
has_one :calendar, through: :rubrik
|
||||
end
|
||||
|
||||
@@ -20,7 +20,7 @@ class Neuigkeit < ActiveRecord::Base
|
||||
validates :rubrik, :presence=>true
|
||||
validates :author, :presence=>true
|
||||
translates :title,:text, :versioning=>{:gem=>:paper_trail, :options=>{:fallbacks_for_empty_translations => true}}
|
||||
|
||||
has_one :calendar, through: :rubrik
|
||||
has_many :calentries, as: :object
|
||||
has_many :nlinks
|
||||
has_one :meeting
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: themen
|
||||
|
||||
Reference in New Issue
Block a user