Sha256: b8e41b2c7a3da8bb82e8fb848dd3b7cc44cb7f2e0f1673286375422a44846b2a
Contents?: true
Size: 1.03 KB
Versions: 12
Compression:
Stored size: 1.03 KB
Contents
module EventPresenter module ClassMethods # Presents events for a select tag in the views def options_for_select_by_organization(organization) where(organization_id: organization.id).collect do |event| [event.name, event.id] end.sort{|a, b| a[0] <=> b[0]} #.unshift([Event::ANY_EVENT_TEXT, Event::ANY_EVENT_ID]) end end module InstanceMethods def to_s self.name || "" end ### JSON Methods def as_widget_json(options = {}) as_json(options.merge(:methods => ['shows', 'charts', 'venue'])).merge('performances' => upcoming_public_shows.as_json) end def as_full_calendar_json shows.collect do |p| { :title => '', :start => p.datetime_local_to_event, :allDay => false, :color => '#077083', :id => p.id } end end def as_json(options = {}) super(options) end end def self.included(receiver) receiver.extend ClassMethods receiver.send :include, InstanceMethods end end
Version data entries
12 entries across 12 versions & 1 rubygems