First , in css , the classes are defined with "." before name them , then 
it's so : .trainning , .project_work ....

With this answer 
: 
http://stackoverflow.com/questions/31322105/full-calendar-rails-adding-custom-css-classes-to-events/33894043#33894043

It's possible to use a custom function in javascript to handle events of 
calendar, by example:

To create classes:

.meeting{ 
background-color: green;
 border-color: black;
 color: #fff;
}

.training{
 background-color: green;
 border-color: black;
 color: #fff;

}

.project_work{
background-color: blue;
 border-color: black;
 color: #fff;
}

with classes created you should capture type of event via javascript:

$('#calendar').fullCalendar({
    ...
    eventRender: eventRenderCallback,
    ...});
function eventRenderCallback(event, element){

    if (event.type == "TRAINING"){

        element.addClass('training');

    }else if (event.type == "MEETING"){

        element.addClass('meeting');

    }else if (event.type == 'PROJECT_WORK'){

        element.addClass('project_work');

    }
    }


How you already have classes created , on event javascript get each event 
of calendar and will make verification of type ( here use variable of event 
that represent the type his ) and add class respective.

Anyway just call me , I think that I added a lot of things.


Em domingo, 2 de outubro de 2016 16:50:09 UTC-3, Peter escreveu:
>
>
> Thanks Marlysson,
>
>
>
> Assuming   row.task.task_type    can be  one of   [ 'TRAINING' , 
> 'MEETING'  , 'PROJECT_WORK'']
>
> I want the event background to be RED GREEN or BLUE respectively.
>
>
> Do I add code something like this to the CSS file 
>
>  .myclass,
>  .fc-agenda .myclass .fc-event-time,
>  .myclass TRAINING {
>     background-color: red;
>     border-color: black;
>     color: #fff;
>  }
>
>  .myclass,
>  .fc-agenda .myclass .fc-event-time,
>  .myclass MEETING {
>      background-color: green;
>      border-color: black;
>      color: #fff;
>  }
>
>  .myclass,
>  .fc-agenda .myclass .fc-event-time,
>  .myclass PROJECT_WORK {
>      background-color: blue;
>      border-color: black;
>      color: #fff;
>  }
>
>
>  
> then how to I call it from the calendar view included (see original post)?
>
>
> Peter
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to