Skip to content
This repository

Show different Event date attributes based on param #74

marclipovsky opened this Issue April 04, 2012 · 1 comment

2 participants

Marc Lipovsky Szymon Frącczak
Marc Lipovsky

Currently I have two date attributes in the same model (@ticket.starts & I want to be able to show just the target dates on the calendar and just the start dates without spanning them over multiple days. I'm able to do it for one of them:

has_event_calendar :start_at_field  => 'target', :end_at_field => 'target'

I'd like to have them show up as different colors as well, as shown in the screenshot that linked in the readme.

How would I go about getting this to work?


Szymon Frącczak

You can do whatever you want combining with sql.
Remove or comment ":start_at_field => 'target', :end_at_field => 'target'" part and in calendar controller:

@events = Event.events_for_date_range(start_d, end_d)
@events_model_green ="id, 'some string or column name' as name, target as start_at, target as end_at , 'true'::boolean as all_day, 'green'::text as color ").where(" target >= ? and target <=", start_d, end_d)
@events_model_red ="id, 'some string or column name' as name, starts as start_at, starts as end_at , 'true'::boolean as all_day, 'red'::text as color ").where("starts >=? and starts <=?",start_d, end_d)
@event_strips = Event.create_event_strips(start_d, end_d, @events + @events_model_green +  @events_model_red)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.