calendar/app/views/calendars/_calendar_variable.html.erb

44 lines
2.2 KiB
Plaintext

<script>
if(window.calendar_variable == undefined){
window.calendar_variable = {};
window.calendar_variable.from = "<%=t('calendar.from')%>";
window.calendar_variable.to = "<%=t('calendar.to')%>";
<% if @calendar_setting && (@calendar_setting.enable rescue false) %>
window.calendar_variable.sunday_first = <%=@calendar_setting.sunday_first%>;
window.calendar_variable.week_title = <%=@calendar_setting.week_title.to_s.html_safe%>;
window.calendar_variable.date_type = <%=@calendar_setting.date_type%>;
window.calendar_variable.time_type = <%=@calendar_setting.time_type%>;
window.calendar_variable.dayNames = <%=@calendar_setting.days.to_s.html_safe%>;
<% if I18n.locale == :zh_tw %>
window.calendar_variable.dayNamesShort = <%=@calendar_setting.days.map{|d| d[-1]}.to_s.html_safe%>;
<% else %>
window.calendar_variable.dayNamesShort = <%=@calendar_setting.days.map{|d| d[0...3]}.to_s.html_safe%>;
<% end %>
<% end %>
}
</script>
<style>
<% @calendar_types.each do |c| %>
.widget-calendar-1 .w-calendar-table .w-calendar-event[data-calendar-id="<%=c.id%>"]:not(:hover){
background: <%= c.color %>;
}
.widget-calendar-2.w-calendar .w-calendar-table td.w-calendar-event[data-calendar-id="<%=c.id%>"] div{
border-color: <%= c.color %>;
}
.has_event[data-calendar-id="<%=c.id%>"]{
background: <%= c.color %>;
}
.event[data-calendar-id="<%=c.id%>"], .event[data-calendar-id="<%=c.id%>"] a{
color: <%= c.color %>;
}
<% darken_color = CalendarsHelper.lighten_color(c.color, -45) %>
.widget-calendar-1 .w-calendar-table .w-calendar-event[data-calendar-id="<%=c.id%>"]:hover, .widget-calendar-1 .w-calendar-table .w-calendar-event[data-calendar-id="<%=c.id%>"].w-calendar-toggle
{
background: <%= darken_color %>;
}
.widget-calendar-2.w-calendar table.w-calendar-table td.w-calendar-toggle[data-calendar-id="<%=c.id%>"] div{
border-color: <%= darken_color %>;
background: <%= darken_color %>;
}
<% end if @calendar_types %>
</style>