Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show different Event date attributes based on param #74

Open
marclipovsky opened this issue Apr 4, 2012 · 1 comment
Open

Show different Event date attributes based on param #74

marclipovsky opened this issue Apr 4, 2012 · 1 comment

Comments

@marclipovsky
Copy link

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!

@sufleR
Copy link

sufleR commented Oct 31, 2012

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants