Skip to content
This repository

Show different Event date attributes based on param #74

Open
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 & @ticket.target). 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?

Thanks!

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 = Model.select("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 = Model.select("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.