Sha256: cdd271e271d5d41b94fc0a025c5c50f684cc75f40b56f0b5336e404b63444fdf
Contents?: true
Size: 998 Bytes
Versions: 23
Compression:
Stored size: 998 Bytes
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]} 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
23 entries across 23 versions & 1 rubygems