radiant / radiant-event-calendar-extension

Create, organise and display calendar events in your radiant site. Read, aggregate and serve ical subscriptions.
37 stars 13 forks source link

Problem with calendars:each tag #20

Closed radixhound closed 13 years ago

radixhound commented 13 years ago

I was having a problem with the calendars:each tag. Trying to loop through each calendar and display the first event. Turns out that the calendars tag is setting tag.locals.calendars to all calendars and then later on when you go to get events, it's using:

tag.locals.calendars ||= set_calendars(tag)

So it's always getting events for all calendars rather than the current calendar in the cycle.

My simple solution was to change these tags:

 tag 'calendars' do |tag|
   #  -removed- tag.locals.calendars ||= set_calendars(tag)
   tag.expand
 end

 tag 'calendars:each' do |tag|
   result = []
   set_calendars(tag).each do |cal|  #changed this line
     tag.locals.calendar = cal
     result << tag.expand
   end
   result
 end

now it works for me.

spanner commented 13 years ago

Thanks. Silly of me. At the moment radius doesn't pass attributes to the stem tag (calendars: here) so it was setting calendars to [].