meeting style

This commit is contained in:
Andreas Stephanides
2015-03-15 13:09:05 +01:00
parent 3cc9de7d29
commit 34c0374877
11 changed files with 55 additions and 24 deletions

View File

@@ -85,9 +85,17 @@ end
summary
end
end
def text
I18n.l(self.start) +" "+ I18n.t("cal.bis")+" "+ I18n.l(self.ende)
end
def icon_text
ApplicationController.helpers.fa_icon("calendar 2x") + self.text
end
def text
if (self.start.to_date - self.ende.to_date) < 1.day
format=:timeonly
else
format =:default
end
I18n.l(self.start) +" "+ I18n.t("cal.bis")+" "+ I18n.l(self.ende, :format=>format)
end
scope :public, -> { where(:public => :true) }
# scope :upcoming, -> { where("start >= ?" , Time.now).where("start <= ?", 28.days.from_now) }
end

View File

@@ -21,6 +21,7 @@ class Meeting < ActiveRecord::Base
def title
self.text
end
def text
unless self.meetingtyp.try(:name).to_s.empty?
t = self.meetingtyp.name.to_s+", "
@@ -29,17 +30,22 @@ class Meeting < ActiveRecord::Base
t = parent.title.to_s + ", " if self.name.empty?
end
t= t+ self.name.to_s
t = t + " " + I18n.l(self.calentry.start) unless self.calentry.nil?
# t = t + " " + I18n.l(self.calentry.start) unless self.calentry.nil?
t = t +" am "+ self.calentry.text unless self.calentry.nil?
t
end
def create_announcement(user)
if self.neuigkeit.nil?
n = Neuigkeit.new
n.title=self.text
n.text ="Agenda im Anhang"
n.rubrik = self.meetingtyp.rubrik
n.author=user
n.save
self.neuigkeit= n
end
end
def fix_calentry
self.calentry.object=self unless self.calentry.nil?

View File

@@ -1,12 +1,15 @@
class Meetingtyp < ActiveRecord::Base
attr_accessible :agendaintern, :desc, :name, :protocolintern, :rubrik_id
attr_accessible :agendaintern, :desc, :name, :protocolintern, :rubrik_id, :picture
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
mount_uploader :picture, PictureUploader
def text
self.name
end
end

View File

@@ -39,7 +39,17 @@ class Neuigkeit < ActiveRecord::Base
before_validation :sanitize
after_save :update_cache
def picture_robust
unless self.picture.url.nil?
return self.picture
else
if self.has_meeting?
return self.meeting.meetingtyp.picture
else
return self.picture
end
end
end
def is_annoncement?
!self.meeting.nil?
end