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

setting event-color #63

Open
chewmanfoo opened this issue Nov 5, 2011 · 4 comments
Open

setting event-color #63

chewmanfoo opened this issue Nov 5, 2011 · 4 comments

Comments

@chewmanfoo
Copy link

How do you set the color of the event bar in the calendar? All my events are #9aa4ad, but in your example jpeg, the events all have different colors.

@sufleR
Copy link

sufleR commented May 1, 2012

I am using color (string) column.
Just add this column to events table and put there string with color name.

For different classes then Event I am selecting columns manualy:
Post.select("id, title as name, ...some_other_columns... 'blue' as color")

It's ugly but works.

@mzaragoza
Copy link

sufleR

Thanks that seems to be really reasonable but can you give a bit more info like where is "Post.select("id, title as name, ...some_other_columns... 'blue' as color")" at.

I create a new migration to my model add a color field but i dont know where to call it

@sufleR
Copy link

sufleR commented Aug 6, 2012

In calendar controller postgresql example:

def index
@month = (params[:month] || (Time.zone || Time).now.month).to_i
@year = (params[:year] || (Time.zone || Time).now.year).to_i
@shown_month = Date.civil(@year, @month)
start_d, end_d = Event.get_start_and_end_dates(@shown_month)
@events = Event.accessible_by(current_ability).events_for_date_range(start_d, end_d)
@posts = Post.select("id, title as name, event_time , true as all_day, 'goldenrod'::text as color").events_for_date_range(start_d, end_d)
@event_strips = Event.create_event_strips(start_d, end_d, @events + @posts)
end

@mzaragoza
Copy link

Thanks you i will try this out

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

3 participants