Sha256: d55088f06b47db76e46ccbfed8e55bdc9485f1845239b8edccbf276c71693107

Contents?: true

Size: 1.1 KB

Versions: 18

Compression:

Stored size: 1.1 KB

Contents

module Orange
  class CalendarResource < ModelResource
    use OrangeCalendar
    call_me :calendar
    def stack_init
      orange[:admin, true].add_link("Settings", :resource => @my_orange_name, :text => 'Calendars')
      orange[:radius].define_tag "calendar" do |tag|
     	  template = tag.attr["template"] || false
     	  if tag.attr["name"]
     	    calendars = tag.attr["name"].split.map{|x| model_class.first(:name => x)}
          unless tag.attr["main"] && tag.attr["main"] == "false"
            calendars << model_class.all(:main => true)
          end
        else
          calendars = model_class.all
        end
        events = OrangeEvent.all(:calendar => calendars, :order => [:starts.asc], :limit => 10)
        orange[:calendar].calendar(tag.locals.packet, {:list => events, :template => template})
      end
    end
    
    def calendar(packet, opts = {})
      template = (opts[:template] || "calendar").to_sym
      do_list_view(packet, template, opts)
    end
    
    def afterNew(packet, obj, opts = {})
      obj.orange_site = packet['site'] unless obj.orange_site
    end
    
    
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
orange-0.5.3 lib/orange-more/events/resources/calendar_resource.rb
orange-0.5.2 lib/orange-more/events/resources/calendar_resource.rb
orange-0.5.1 lib/orange-more/events/resources/calendar_resource.rb
orange-0.4.0 lib/orange-more/events/resources/calendar_resource.rb
orange-0.3.9 lib/orange-more/events/resources/calendar_resource.rb
orange-0.3.8 lib/orange-more/events/resources/calendar_resource.rb
orange-0.3.7 lib/orange-more/events/resources/calendar_resource.rb
orange-0.3.6 lib/orange-more/events/resources/calendar_resource.rb
orange-0.3.5 lib/orange-more/events/resources/calendar_resource.rb
orange-0.3.4 lib/orange-more/events/resources/calendar_resource.rb
orange-0.3.3 lib/orange-more/events/resources/calendar_resource.rb
orange-0.3.2 lib/orange-more/events/resources/calendar_resource.rb
orange-0.3.1 lib/orange-more/events/resources/calendar_resource.rb
orange-0.3.0 lib/orange-more/events/resources/calendar_resource.rb
orange-0.2.11 lib/orange-more/events/resources/calendar_resource.rb
orange-0.2.9 lib/orange-more/events/resources/calendar_resource.rb
orange-0.2.8 lib/orange-more/events/resources/calendar_resource.rb
orange-0.2.7 lib/orange-more/events/resources/calendar_resource.rb