Add repeat week setting feature.
Fix bug. Apply color setting to all calendar templates. Add recurring note.
This commit is contained in:
parent
876434e6a5
commit
4d0925767b
|
@ -902,6 +902,7 @@ var AgendaView = function(calendar){
|
||||||
});
|
});
|
||||||
$.each(data,function(i,e){
|
$.each(data,function(i,e){
|
||||||
var ed = eventDom(e),
|
var ed = eventDom(e),
|
||||||
|
calendar_id = e.calendar,
|
||||||
s = new Date(e.start),
|
s = new Date(e.start),
|
||||||
e = new Date(e.end),
|
e = new Date(e.end),
|
||||||
e_m = ((e.getMonth() > s.getMonth() || s.getMonth() == e.getMonth()) && s.getFullYear() == e.getFullYear() ? e.getMonth() : e.getMonth() + 12)
|
e_m = ((e.getMonth() > s.getMonth() || s.getMonth() == e.getMonth()) && s.getFullYear() == e.getFullYear() ? e.getMonth() : e.getMonth() + 12)
|
||||||
|
@ -921,7 +922,7 @@ var AgendaView = function(calendar){
|
||||||
}
|
}
|
||||||
if(s.getDate() == e.getDate() && s.getMonth() == s.getMonth() && e.getFullYear() == e.getFullYear()){
|
if(s.getDate() == e.getDate() && s.getMonth() == s.getMonth() && e.getFullYear() == e.getFullYear()){
|
||||||
var td = agenda_space.find("td[data-date-node="+s.getDate()+"-"+s.getMonth()+"-"+s.getFullYear()+"]");
|
var td = agenda_space.find("td[data-date-node="+s.getDate()+"-"+s.getMonth()+"-"+s.getFullYear()+"]");
|
||||||
td.addClass("has_event");
|
td.addClass("has_event").attr("data-calendar-id", calendar_id);
|
||||||
}else{
|
}else{
|
||||||
var timeDiff = Math.abs(e.getTime() - s.getTime()),
|
var timeDiff = Math.abs(e.getTime() - s.getTime()),
|
||||||
diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24)),
|
diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24)),
|
||||||
|
@ -929,10 +930,9 @@ var AgendaView = function(calendar){
|
||||||
c_d = s.getDate(),
|
c_d = s.getDate(),
|
||||||
c_y = s.getFullYear(),
|
c_y = s.getFullYear(),
|
||||||
end_of_c_month = new Date(s.getFullYear(),s.getMonth()+1,0).getDate();
|
end_of_c_month = new Date(s.getFullYear(),s.getMonth()+1,0).getDate();
|
||||||
|
|
||||||
for(var i = 0; i <= diffDays; i++){
|
for(var i = 0; i <= diffDays; i++){
|
||||||
var td = agenda_space.find("td[data-date-node="+c_d+"-"+c_m+"-"+c_y+"]");
|
var td = agenda_space.find("td[data-date-node="+c_d+"-"+c_m+"-"+c_y+"]");
|
||||||
td.addClass("has_event");
|
td.addClass("has_event").attr("data-calendar-id", calendar_id);
|
||||||
c_d++;
|
c_d++;
|
||||||
if(c_d > end_of_c_month){
|
if(c_d > end_of_c_month){
|
||||||
c_d = 1;
|
c_d = 1;
|
||||||
|
@ -949,6 +949,11 @@ var AgendaView = function(calendar){
|
||||||
if($(this).find("tr").length > 1)
|
if($(this).find("tr").length > 1)
|
||||||
$(this).find("td.no_events").parent().remove();
|
$(this).find("td.no_events").parent().remove();
|
||||||
})
|
})
|
||||||
|
$(".edit_event_btn").on("click", function(){
|
||||||
|
var _this = $(this);
|
||||||
|
_calendar.editEvent(_this.data('edit-url'), _this.data('allDay'));
|
||||||
|
return false;
|
||||||
|
});
|
||||||
// nano scroller here
|
// nano scroller here
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -971,7 +976,11 @@ var AgendaView = function(calendar){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
e_t.find("td.event_datetime").text(datetimeFormat);
|
e_t.find("td.event_datetime").text(datetimeFormat);
|
||||||
e_t.find("div.event").html(event.title).css("color",event.color);
|
var tmp_html = event.title;
|
||||||
|
if(event.edit_url){
|
||||||
|
tmp_html = '<a href="javascript:void(0)" class="edit_event_btn" data-edit-url="'+event.edit_url+'" data-allDay="'+event.allDay+'">' + tmp_html + '</a>';
|
||||||
|
}
|
||||||
|
e_t.find("div.event").html(tmp_html).css("color",event.color).attr("data-calendar-id", event.calendar);
|
||||||
return e_t;
|
return e_t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -734,6 +734,7 @@ var AgendaView = function(calendar){
|
||||||
});
|
});
|
||||||
$.each(data,function(i,e){
|
$.each(data,function(i,e){
|
||||||
var ed = eventDom(e),
|
var ed = eventDom(e),
|
||||||
|
calendar_id = e.calendar,
|
||||||
s = new Date(e.start),
|
s = new Date(e.start),
|
||||||
e = new Date(e.end),
|
e = new Date(e.end),
|
||||||
e_m = ((e.getMonth() > s.getMonth() || s.getMonth() == e.getMonth()) && s.getFullYear() == e.getFullYear() ? e.getMonth() : e.getMonth() + 12)
|
e_m = ((e.getMonth() > s.getMonth() || s.getMonth() == e.getMonth()) && s.getFullYear() == e.getFullYear() ? e.getMonth() : e.getMonth() + 12)
|
||||||
|
@ -753,7 +754,7 @@ var AgendaView = function(calendar){
|
||||||
}
|
}
|
||||||
if(s.getDate() == e.getDate() && s.getMonth() == s.getMonth() && e.getFullYear() == e.getFullYear()){
|
if(s.getDate() == e.getDate() && s.getMonth() == s.getMonth() && e.getFullYear() == e.getFullYear()){
|
||||||
var td = agenda_space.find("td[data-date-node="+s.getDate()+"-"+s.getMonth()+"-"+s.getFullYear()+"]");
|
var td = agenda_space.find("td[data-date-node="+s.getDate()+"-"+s.getMonth()+"-"+s.getFullYear()+"]");
|
||||||
td.addClass("has_event");
|
td.addClass("has_event").attr("data-calendar-id", calendar_id);
|
||||||
}else{
|
}else{
|
||||||
var timeDiff = Math.abs(e.getTime() - s.getTime()),
|
var timeDiff = Math.abs(e.getTime() - s.getTime()),
|
||||||
diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24)),
|
diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24)),
|
||||||
|
@ -764,7 +765,7 @@ var AgendaView = function(calendar){
|
||||||
|
|
||||||
for(var i = 0; i <= diffDays; i++){
|
for(var i = 0; i <= diffDays; i++){
|
||||||
var td = agenda_space.find("td[data-date-node="+c_d+"-"+c_m+"-"+c_y+"]");
|
var td = agenda_space.find("td[data-date-node="+c_d+"-"+c_m+"-"+c_y+"]");
|
||||||
td.addClass("has_event");
|
td.addClass("has_event").attr("data-calendar-id", calendar_id);
|
||||||
c_d++;
|
c_d++;
|
||||||
if(c_d > end_of_c_month){
|
if(c_d > end_of_c_month){
|
||||||
c_d = 1;
|
c_d = 1;
|
||||||
|
|
|
@ -451,7 +451,7 @@ var CalendarModuleMonth1 = function(date,dom,subpart,url,index_flag){
|
||||||
events[dt]=[]
|
events[dt]=[]
|
||||||
}
|
}
|
||||||
events[dt].push(eve)
|
events[dt].push(eve)
|
||||||
td.addClass("w-calendar-event");
|
td.addClass("w-calendar-event").attr("data-calendar-id", eve.calendar);
|
||||||
if(events[dt] && events[dt].length==1){
|
if(events[dt] && events[dt].length==1){
|
||||||
td.click(function(){
|
td.click(function(){
|
||||||
toggle_event(this,'show')
|
toggle_event(this,'show')
|
||||||
|
@ -474,7 +474,7 @@ var CalendarModuleMonth1 = function(date,dom,subpart,url,index_flag){
|
||||||
toggle_event(this,'show')
|
toggle_event(this,'show')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
td.addClass("w-calendar-event");
|
td.addClass("w-calendar-event").attr("data-calendar-id", eve.calendar);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (!toggle_data){
|
if (!toggle_data){
|
||||||
|
|
|
@ -591,7 +591,7 @@ var CalendarModuleMonth2 = function(date,dom,subpart,url,index_flag){
|
||||||
events[dt]=[]
|
events[dt]=[]
|
||||||
}
|
}
|
||||||
events[dt].push(eve)
|
events[dt].push(eve)
|
||||||
td.addClass("w-calendar-event");
|
td.addClass("w-calendar-event").attr("data-calendar-id", eve.calendar);
|
||||||
if(events[dt] && events[dt].length==1){
|
if(events[dt] && events[dt].length==1){
|
||||||
td.click(function(){
|
td.click(function(){
|
||||||
toggle_event(this,'show')
|
toggle_event(this,'show')
|
||||||
|
@ -614,7 +614,7 @@ var CalendarModuleMonth2 = function(date,dom,subpart,url,index_flag){
|
||||||
toggle_event(this,'show')
|
toggle_event(this,'show')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
td.addClass("w-calendar-event");
|
td.addClass("w-calendar-event").attr("data-calendar-id", eve.calendar);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (!toggle_data){
|
if (!toggle_data){
|
||||||
|
|
|
@ -3,6 +3,7 @@ class Admin::CalendarsController < OrbitAdminController
|
||||||
# GET /events.json
|
# GET /events.json
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@calendar_types = CalendarType.all
|
||||||
@calendar_setting = CalendarSetting.first
|
@calendar_setting = CalendarSetting.first
|
||||||
@events = []
|
@events = []
|
||||||
tags = @module_app.tags
|
tags = @module_app.tags
|
||||||
|
@ -17,7 +18,7 @@ class Admin::CalendarsController < OrbitAdminController
|
||||||
@monthly_events = Event.monthly_event(sdt,edt).with_categories(filters("category"))
|
@monthly_events = Event.monthly_event(sdt,edt).with_categories(filters("category"))
|
||||||
.with_tags(filters("tag")).convert_front
|
.with_tags(filters("tag")).convert_front
|
||||||
@re = Event.with_categories(filters("category")).with_tags(filters("tag")).recurring_event(sdt,edt)
|
@re = Event.with_categories(filters("category")).with_tags(filters("tag")).recurring_event(sdt,edt)
|
||||||
allevents = @monthly_events.inject(@re, :<<)
|
allevents = @monthly_events.inject(@re, :<<).sort_by{|e| e[:start]}
|
||||||
events = allevents.to_json
|
events = allevents.to_json
|
||||||
events = JSON.parse(events)
|
events = JSON.parse(events)
|
||||||
events.each_with_index do |e,i|
|
events.each_with_index do |e,i|
|
||||||
|
@ -51,7 +52,7 @@ class Admin::CalendarsController < OrbitAdminController
|
||||||
def agenda
|
def agenda
|
||||||
agenda_start = Time.at(params[:unix_start].to_i).utc
|
agenda_start = Time.at(params[:unix_start].to_i).utc
|
||||||
agenda_end = Time.at(params[:unix_end].to_i).utc
|
agenda_end = Time.at(params[:unix_end].to_i).utc
|
||||||
@events = Event.agenda_events(agenda_start,agenda_end)
|
@events = Event.agenda_events(agenda_start,agenda_end).sort_by{|e| e[:start]}
|
||||||
# re = Event.recurring_event(Time.at(params[:unix_start].to_i), Time.at(params[:unix_end].to_i))
|
# re = Event.recurring_event(Time.at(params[:unix_start].to_i), Time.at(params[:unix_end].to_i))
|
||||||
# @events = @events.inject(re, :<<)
|
# @events = @events.inject(re, :<<)
|
||||||
render :json=>@events.to_json
|
render :json=>@events.to_json
|
||||||
|
|
|
@ -6,6 +6,11 @@ class CalendarsController < ApplicationController
|
||||||
def index
|
def index
|
||||||
page = Page.where(page_id: OrbitHelper.params[:page_id]).first
|
page = Page.where(page_id: OrbitHelper.params[:page_id]).first
|
||||||
style_file = page.layout=='index3' ? '/assets/calendar_widget2' : '/assets/calendar_widget1'
|
style_file = page.layout=='index3' ? '/assets/calendar_widget2' : '/assets/calendar_widget1'
|
||||||
|
cat_ids = page.categories
|
||||||
|
if cat_ids.include?('all')
|
||||||
|
cat_ids = []
|
||||||
|
end
|
||||||
|
@calendar_types = cat_ids.blank? ? CalendarType.all : CalendarType.where(:id.in => cat_ids)
|
||||||
@calendar_setting = CalendarSetting.first
|
@calendar_setting = CalendarSetting.first
|
||||||
{
|
{
|
||||||
"modes_info" => @calendar_setting.get_modes_info.map.with_index{|(trans, mode),i| {trans: trans, mode: mode, active_class: (i ==
|
"modes_info" => @calendar_setting.get_modes_info.map.with_index{|(trans, mode),i| {trans: trans, mode: mode, active_class: (i ==
|
||||||
|
@ -34,12 +39,9 @@ class CalendarsController < ApplicationController
|
||||||
def widget
|
def widget
|
||||||
part = OrbitHelper.get_current_widget
|
part = OrbitHelper.get_current_widget
|
||||||
@calendar_setting = CalendarSetting.first
|
@calendar_setting = CalendarSetting.first
|
||||||
begin
|
cat_ids = part.custom_array_field
|
||||||
extra_before_html = render_to_string(partial: 'calendars/calendar_variable', locals: {:@calendar_setting=>@calendar_setting})
|
@calendar_types = cat_ids.blank? ? CalendarType.all : CalendarType.where(:id.in => cat_ids)
|
||||||
rescue => e
|
extra_before_html = render_to_string(partial: 'calendars/calendar_variable', locals: {:@calendar_setting=>@calendar_setting,:@calendar_types=>@calendar_types})
|
||||||
extra_before_html = ""
|
|
||||||
puts e, e.backtrace
|
|
||||||
end
|
|
||||||
{
|
{
|
||||||
"modes_info" => @calendar_setting.get_modes_info.map.with_index{|(trans, mode),i| {trans: trans, mode: mode, active_class: (i ==
|
"modes_info" => @calendar_setting.get_modes_info.map.with_index{|(trans, mode),i| {trans: trans, mode: mode, active_class: (i ==
|
||||||
2 ? 'active' : '')}},
|
2 ? 'active' : '')}},
|
||||||
|
@ -97,7 +99,7 @@ class CalendarsController < ApplicationController
|
||||||
agenda_start = Time.at(params[:unix_start].to_i).utc
|
agenda_start = Time.at(params[:unix_start].to_i).utc
|
||||||
agenda_end = Time.at(params[:unix_end].to_i).utc
|
agenda_end = Time.at(params[:unix_end].to_i).utc
|
||||||
event = Event.where("title_translations.#{locale}".to_sym.ne=>"")
|
event = Event.where("title_translations.#{locale}".to_sym.ne=>"")
|
||||||
events = event.with_categories(calendar_types).agenda_events(agenda_start,agenda_end)
|
events = event.with_categories(calendar_types).agenda_events(agenda_start,agenda_end).sort_by{|e| e[:start]}
|
||||||
end
|
end
|
||||||
render json: {"events" => events,"calendar_title"=>get_calendar_title(Time.at(params[:month_start].to_i).utc)}.to_json({"frontend" => true})
|
render json: {"events" => events,"calendar_title"=>get_calendar_title(Time.at(params[:month_start].to_i).utc)}.to_json({"frontend" => true})
|
||||||
end
|
end
|
||||||
|
@ -118,7 +120,7 @@ class CalendarsController < ApplicationController
|
||||||
agenda_start = Time.at(params[:unix_start].to_i).utc
|
agenda_start = Time.at(params[:unix_start].to_i).utc
|
||||||
agenda_end = Time.at(params[:unix_end].to_i).utc
|
agenda_end = Time.at(params[:unix_end].to_i).utc
|
||||||
event = Event.where("title_translations.#{locale}".to_sym.ne=>"")
|
event = Event.where("title_translations.#{locale}".to_sym.ne=>"")
|
||||||
events = event.with_categories(calendar_types).agenda_events(agenda_start,agenda_end)
|
events = event.with_categories(calendar_types).agenda_events(agenda_start,agenda_end).sort_by{|e| e[:start]}
|
||||||
end
|
end
|
||||||
render json: {"events" => events,"calendar_title"=>get_calendar_title(Time.at(params[:month_start].to_i).utc)}.to_json({"frontend" => true})
|
render json: {"events" => events,"calendar_title"=>get_calendar_title(Time.at(params[:month_start].to_i).utc)}.to_json({"frontend" => true})
|
||||||
end
|
end
|
||||||
|
|
|
@ -109,35 +109,75 @@ class Event
|
||||||
]
|
]
|
||||||
|
|
||||||
def as_json(options = {})
|
def as_json(options = {})
|
||||||
if options["frontend"]
|
tmp_note = self.note || ""
|
||||||
{
|
if self.recurring
|
||||||
:id => self.id.to_s,
|
freq = self.frequency.to_i
|
||||||
:title => self.title,
|
if @week_titles.nil?
|
||||||
:note => self.note || "",
|
@week_titles = CalendarSetting.first.week_title
|
||||||
:start => self.start.to_json.gsub('"',''),
|
@weekdayst = I18n.t("calendar.weekdays")
|
||||||
:end => self.end.to_json.gsub('"',''),
|
@dailyt = I18n.t("calendar.daily")
|
||||||
:allDay => self.all_day,
|
@weeklyt = I18n.t("calendar.weekly")
|
||||||
:recurring => self.recurring,
|
@monthlyt = I18n.t("calendar.monthly")
|
||||||
:calendar => self.calendar_type_id.to_s,
|
@yearlyt = I18n.t("calendar.yearly")
|
||||||
:color => (self.calendar_type.color rescue nil),
|
@conjt = I18n.t('calendar.conj')
|
||||||
:diff_day => self.all_day
|
@andt = I18n.t('calendar.and')
|
||||||
}
|
end
|
||||||
else
|
case self.period
|
||||||
{
|
when 'Daily'
|
||||||
:id => self.id.to_s,
|
every_n_days = (freq == 1 ? @dailyt : I18n.t("calendar.every_n_days", {:num=>self.frequency}))
|
||||||
:title => self.title,
|
tmp_note = every_n_days + "<br>" + tmp_note
|
||||||
:note => self.note || "",
|
when 'Weekly'
|
||||||
:start => self.start.to_json.gsub('"',''),
|
if self.is_weekdays
|
||||||
:end => self.end.to_json.gsub('"',''),
|
days = @weekdayst
|
||||||
:allDay => self.all_day,
|
elsif self.weekdays.present?
|
||||||
:recurring => self.recurring,
|
days = self.weekdays.map{|i| @week_titles[i]}
|
||||||
:calendar => self.calendar_type_id.to_s,
|
if days.count > 1
|
||||||
:color => (self.calendar_type.color rescue nil),
|
days = days[0...-1].join(@conjt) + @andt + days[-1]
|
||||||
:diff_day => self.all_day,
|
else
|
||||||
:edit_url => Rails.application.routes.url_helpers.edit_admin_calendar_path(:locale=>I18n.locale, :id=>self.id),
|
days = days[0]
|
||||||
:delete_url => Rails.application.routes.url_helpers.admin_calendar_path(:locale=>I18n.locale, :id=>self.id)
|
end
|
||||||
}
|
end
|
||||||
end
|
every_n_weeks = (freq == 1 ? @weeklyt : I18n.t("calendar.every_n_weeks", {:num=>self.frequency}))
|
||||||
|
tmp_note = I18n.t("calendar.every_week_day", {:every_n_weeks=>every_n_weeks,:days=>days}) + "<br>" + tmp_note
|
||||||
|
when 'Monthly'
|
||||||
|
days = self.start.day
|
||||||
|
every_n_months = (freq == 1 ? @monthlyt : I18n.t("calendar.every_n_months", {:num=>self.frequency}))
|
||||||
|
tmp_note = I18n.t("calendar.every_month_day", {:every_n_months=>every_n_months,:days=>days}) + "<br>" + tmp_note
|
||||||
|
when 'Yearly'
|
||||||
|
date = self.start.strftime('%m/%d')
|
||||||
|
every_n_years = (freq == 1 ? @yearlyt : I18n.t("calendar.every_n_years", {:num=>self.frequency}))
|
||||||
|
tmp_note = I18n.t("calendar.every_year_day", {:every_n_years=>every_n_years,:date=>date}) + "<br>" + tmp_note
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if options["frontend"]
|
||||||
|
{
|
||||||
|
:id => self.id.to_s,
|
||||||
|
:title => self.title,
|
||||||
|
:note => tmp_note,
|
||||||
|
:start => self.start.to_json.gsub('"',''),
|
||||||
|
:end => (self.all_day ? [self.start, self.end - 1.day].max : self.end).to_json.gsub('"',''),
|
||||||
|
:allDay => self.all_day,
|
||||||
|
:recurring => self.recurring,
|
||||||
|
:calendar => self.calendar_type_id.to_s,
|
||||||
|
:color => (self.calendar_type.color rescue nil),
|
||||||
|
:diff_day => self.all_day
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
:id => self.id.to_s,
|
||||||
|
:title => self.title,
|
||||||
|
:note => tmp_note,
|
||||||
|
:start => self.start.to_json.gsub('"',''),
|
||||||
|
:end => (self.all_day ? [self.start, self.end - 1.day].max : self.end).to_json.gsub('"',''),
|
||||||
|
:allDay => self.all_day,
|
||||||
|
:recurring => self.recurring,
|
||||||
|
:calendar => self.calendar_type_id.to_s,
|
||||||
|
:color => (self.calendar_type.color rescue nil),
|
||||||
|
:diff_day => self.all_day,
|
||||||
|
:edit_url => Rails.application.routes.url_helpers.edit_admin_calendar_path(:locale=>I18n.locale, :id=>self.id),
|
||||||
|
:delete_url => Rails.application.routes.url_helpers.admin_calendar_path(:locale=>I18n.locale, :id=>self.id)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -146,9 +186,7 @@ class Event
|
||||||
end
|
end
|
||||||
def self.convert_front
|
def self.convert_front
|
||||||
self.all.collect do |re|
|
self.all.collect do |re|
|
||||||
edit_url = Rails.application.routes.url_helpers.edit_admin_calendar_path(:locale=>I18n.locale, :id=>re.id)
|
re.as_json
|
||||||
delete_url = Rails.application.routes.url_helpers.admin_calendar_path(:locale=>I18n.locale, :id=>re.id)
|
|
||||||
{:id => re.id.to_s, :title=>re.title, :note=>re.note || "", :allDay => re.all_day, :recurring => re.recurring, :calendar => re.calendar_type.id.to_s, :color => (re.calendar_type.color rescue nil), :edit_url => edit_url, :delete_url => delete_url, :url_linked => re.url_to_fronted, :start => re.start, :end => re.end}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def self.get_diff_month(date1,date2)
|
def self.get_diff_month(date1,date2)
|
||||||
|
@ -187,7 +225,7 @@ class Event
|
||||||
if period_str
|
if period_str
|
||||||
org_start = re.start
|
org_start = re.start
|
||||||
@start_date = re.start
|
@start_date = re.start
|
||||||
@end_date = re.end
|
@end_date = (re.all_day ? [re.start, re.end - 1.day].max : re.end)
|
||||||
freq = re.frequency.to_i
|
freq = re.frequency.to_i
|
||||||
interval = freq.send(period_str)
|
interval = freq.send(period_str)
|
||||||
if is_month
|
if is_month
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
window.calendar_variable = {};
|
window.calendar_variable = {};
|
||||||
window.calendar_variable.from = "<%=t('calendar.from')%>";
|
window.calendar_variable.from = "<%=t('calendar.from')%>";
|
||||||
window.calendar_variable.to = "<%=t('calendar.to')%>";
|
window.calendar_variable.to = "<%=t('calendar.to')%>";
|
||||||
<% if @calendar_setting && @calendar_setting.enable %>
|
<% if @calendar_setting && (@calendar_setting.enable rescue false) %>
|
||||||
window.calendar_variable.sunday_first = <%=@calendar_setting.sunday_first%>;
|
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.week_title = <%=@calendar_setting.week_title.to_s.html_safe%>;
|
||||||
window.calendar_variable.date_type = <%=@calendar_setting.date_type%>;
|
window.calendar_variable.date_type = <%=@calendar_setting.date_type%>;
|
||||||
|
@ -16,4 +16,23 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
}
|
}
|
||||||
</script>
|
</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 %>;
|
||||||
|
}
|
||||||
|
.widget-calendar-2.w-calendar table.w-calendar-table td.w-calendar-toggle[data-calendar-id="<%=c.id%>"] div, .widget-calendar-2.w-calendar table.w-calendar-table td.w-calendar-toggle[data-calendar-id="<%=c.id%>"] div{
|
||||||
|
background: <%= 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 %>;
|
||||||
|
}
|
||||||
|
<% end if @calendar_types %>
|
||||||
|
</style>
|
|
@ -1,5 +1,14 @@
|
||||||
en:
|
en:
|
||||||
calendar:
|
calendar:
|
||||||
|
conj: ", "
|
||||||
|
and: " and "
|
||||||
|
every_n_years: "Every %{num} years"
|
||||||
|
every_n_months: "Every %{num} months"
|
||||||
|
every_n_weeks: "Every %{num} weeks"
|
||||||
|
every_n_days: "Every %{num} days"
|
||||||
|
every_year_day: "%{every_n_years} on %{date}"
|
||||||
|
every_month_day: "%{every_n_months} on day %{days}"
|
||||||
|
every_week_day: "%{every_n_weeks} on %{days}"
|
||||||
type: Type
|
type: Type
|
||||||
custom: Custom
|
custom: Custom
|
||||||
weekdays: Weekdays
|
weekdays: Weekdays
|
||||||
|
|
|
@ -1,5 +1,14 @@
|
||||||
zh_tw:
|
zh_tw:
|
||||||
calendar:
|
calendar:
|
||||||
|
conj: "、"
|
||||||
|
and: "與"
|
||||||
|
every_n_years: "每%{num}年"
|
||||||
|
every_n_months: "每%{num}個月"
|
||||||
|
every_n_weeks: "每%{num}週"
|
||||||
|
every_n_days: "每%{num}天"
|
||||||
|
every_year_day: "%{every_n_years}的%{date}"
|
||||||
|
every_month_day: "%{every_n_months}的第%{days}天"
|
||||||
|
every_week_day: "%{every_n_weeks}的%{days}"
|
||||||
type: 類型
|
type: 類型
|
||||||
custom: 自訂
|
custom: 自訂
|
||||||
weekdays: 平日
|
weekdays: 平日
|
||||||
|
|
Loading…
Reference in New Issue