Merge branch 'gallery_orbit' into desktop_devin
This commit is contained in:
commit
974849b85a
|
@ -27,6 +27,13 @@ Date.prototype.getWeek = function (dowOffset) {
|
|||
return weeknum;
|
||||
};
|
||||
|
||||
Date.prototype.daysInMonth = function(){
|
||||
var daysArray = [31,28,31,30,31,30,31,31,30,31,30,31];
|
||||
if(this.getFullYear()%4 == 0)
|
||||
daysArray[1] = 29;
|
||||
|
||||
return daysArray[this.getMonth()];
|
||||
}
|
||||
|
||||
var calendarAPI = function(){
|
||||
c = this;
|
||||
|
@ -36,17 +43,20 @@ var calendarAPI = function(){
|
|||
this.cur_month = c.today.getMonth()+1;
|
||||
this.cur_year = c.today.getFullYear();
|
||||
this.cur_week = c.today.getWeek();
|
||||
this.cur_date = c.today.getDate();
|
||||
this.view = null;
|
||||
this.monthlist = ["","January","February","March","April","May","June","July","August","September","October","November","December"];
|
||||
this.initialize = function(){
|
||||
$(window).load(function(){
|
||||
// c.loadMonthView(c.cur_month,c.cur_year);
|
||||
c.loadWeekView(c.cur_week,c.cur_year);
|
||||
// c.loadWeekView(c.cur_week,c.cur_year);
|
||||
c.loadDayView(c.cur_date,c.cur_month,c.cur_year);
|
||||
bindHandlers();
|
||||
})
|
||||
var bindHandlers = function(){
|
||||
$(".event").live("click",function(){
|
||||
c.displayEvent($(this));
|
||||
$(".event").live("click",function(e){
|
||||
var pos = {"x":e.clientX,"y":e.clientY};
|
||||
c.displayEvent($(this),pos);
|
||||
})
|
||||
|
||||
$("#create_event_btn").click(function(){
|
||||
|
@ -73,7 +83,7 @@ var calendarAPI = function(){
|
|||
c.loadWeekView(c.cur_week,c.cur_year);
|
||||
break;
|
||||
case 'day':
|
||||
c.loadDayView();
|
||||
c.loadDayView(c.cur_date,c.cur_month,c.cur_year);
|
||||
break;
|
||||
case 'agenda':
|
||||
c.loadAgendaView();
|
||||
|
@ -104,6 +114,22 @@ var calendarAPI = function(){
|
|||
}
|
||||
c.loadWeekView(w,y);
|
||||
break;
|
||||
case "day":
|
||||
var d,w,y;
|
||||
d = c.cur_date - 1;
|
||||
m = c.cur_month;
|
||||
y = c.cur_year;
|
||||
if(d == 0){
|
||||
var dx = new Date(c.cur_year,c.cur_month-2);
|
||||
d = dx.daysInMonth();
|
||||
m--;
|
||||
}
|
||||
if(m == 0){
|
||||
m = 12;
|
||||
y = y - 1;
|
||||
}
|
||||
c.loadDayView(d,m,y);
|
||||
break;
|
||||
}
|
||||
|
||||
})
|
||||
|
@ -132,6 +158,26 @@ var calendarAPI = function(){
|
|||
}
|
||||
c.loadWeekView(w,y);
|
||||
break;
|
||||
case "day":
|
||||
var d,w,y;
|
||||
var dx = new Date(c.cur_year,c.cur_month-1);
|
||||
if(c.cur_date == dx.daysInMonth()){
|
||||
d = 1;
|
||||
m = c.cur_month + 1;
|
||||
}else{
|
||||
d = c.cur_date + 1;
|
||||
m = c.cur_month;
|
||||
}
|
||||
|
||||
if(m == 13){
|
||||
m = 1;
|
||||
y = c.cur_year + 1;
|
||||
}else{
|
||||
y = c.cur_year;
|
||||
}
|
||||
|
||||
c.loadDayView(d,m,y);
|
||||
break;
|
||||
}
|
||||
})
|
||||
$("button#today_btn").click(function(){
|
||||
|
@ -142,6 +188,9 @@ var calendarAPI = function(){
|
|||
case "month":
|
||||
c.loadMonthView();
|
||||
break;
|
||||
case "day":
|
||||
c.loadDayView();
|
||||
break;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -222,6 +271,8 @@ var calendarAPI = function(){
|
|||
var recordcurdate = true;
|
||||
|
||||
if(allow){
|
||||
if(evnt.title=="Navratri")
|
||||
console.log(pos);
|
||||
if(pos == 1){
|
||||
var colspan = 0;
|
||||
if(evnt.total_days>7){
|
||||
|
@ -304,19 +355,69 @@ var calendarAPI = function(){
|
|||
}
|
||||
this.getEventsForWeek = function(week,year){
|
||||
$.getJSON("cals/getWeekEvents",{"week":week,"year":year},function(events){
|
||||
var height = 15;
|
||||
var full_day_count = 0;
|
||||
var rowcount = 7;
|
||||
var tr = $("<tr></tr>");
|
||||
var pre = true;
|
||||
$.each(events,function(i,evnt){
|
||||
// console.log("rowcount: "+rowcount);
|
||||
// console.log("start:"+evnt.start);
|
||||
if(rowcount >= (7 - evnt.total_days)){
|
||||
if(tr.html()!=""){
|
||||
if(rowcount != 7){
|
||||
tr.append("<td colspan='"+(7-rowcount)+"'></td>");
|
||||
}
|
||||
$("table.all_day_event_holder").append(tr);
|
||||
}
|
||||
tr = null;
|
||||
tr = $('<tr></tr>');
|
||||
pre = true;
|
||||
}
|
||||
|
||||
if(evnt.all_day){
|
||||
$(".week_day_header[date="+evnt.start_date+"]").append('<div class="event half" link="'+evnt.show_link+'" style="background-color: '+evnt.color+';color:#fff;"><dl><dt>'+evnt.title+'</dt><dd></dd></dl></div>');
|
||||
full_day_count++;
|
||||
|
||||
var precountspan = 7 - evnt.total_days;
|
||||
if(pre){
|
||||
height+=20;
|
||||
$(".head_event_wrapper").height(height);
|
||||
$(".head_event_wrapper table").eq(0).height(height);
|
||||
tr.append('<td rowspan="1" style="width:60px;"> </td>');
|
||||
if(precountspan != 0){
|
||||
tr.append('<td colspan="'+precountspan+'"></td>');
|
||||
pre = false;
|
||||
}
|
||||
}
|
||||
var colcount = evnt.total_days;
|
||||
if(evnt.colcount != 0){
|
||||
colcount = evnt.colcount;
|
||||
}
|
||||
|
||||
rowcount = precountspan + colcount;
|
||||
|
||||
tr.append('<td colspan="'+colcount+'" class="all_day_event week_day" ><div class="event half" style="background-color: '+evnt.color+' ;color:#fff;" link="'+evnt.show_link+'"><dl><dt>'+evnt.title+'</dt><dd></dd></dl></div></td>');
|
||||
|
||||
// $(".week_day_header[date="+evnt.start_date+"]").append('<div class="event half" link="'+evnt.show_link+'" style="background-color: '+evnt.color+';color:#fff;"><dl><dt>'+evnt.title+'</dt><dd></dd></dl></div>');
|
||||
}else{
|
||||
|
||||
var starttime,endtime,displaystarttime,displayendtime;
|
||||
if(evnt.start_am_pm == "AM")
|
||||
if(evnt.start_am_pm == "AM"){
|
||||
starttime = evnt.start_time;
|
||||
else
|
||||
if(starttime == 12)
|
||||
starttime = 0;
|
||||
if(starttime == 12.5)
|
||||
starttime = 0.5;
|
||||
}else
|
||||
starttime = evnt.start_time + 12;
|
||||
|
||||
if(evnt.end_am_pm == "AM")
|
||||
if(evnt.end_am_pm == "AM"){
|
||||
endtime = evnt.end_time;
|
||||
else
|
||||
if(endtime == 12)
|
||||
endtime = 0;
|
||||
if(endtime == 12.5)
|
||||
endtime = 0.5;
|
||||
}else
|
||||
endtime = evnt.end_time + 12;
|
||||
|
||||
var temp = parseInt(evnt.start_time);
|
||||
|
@ -333,17 +434,99 @@ var calendarAPI = function(){
|
|||
else
|
||||
displayendtime = temp + ":00 " + evnt.end_am_pm;
|
||||
|
||||
var toppx = ((starttime * 2) * 19) + starttime;
|
||||
var eventdom = $('<div class="event" link="'+evnt.show_link+'" style="background-color: '+evnt.color+';color:#fff; top:'+toppx+'px;"><dl><dt>'+displaystarttime+' - '+displayendtime+'</dt><dd>'+evnt.title+'</dd></dl></div>');
|
||||
var toppx = ((starttime * 2) * 20) + 1;
|
||||
var h = endtime - starttime;
|
||||
var halfhour = "";
|
||||
if(h == 0.5)
|
||||
halfhour = "half";
|
||||
h = 17 + 20 + (((h-1) * 2) * 20) + 1;
|
||||
var eventdom = $('<div class="event '+halfhour+'" link="'+evnt.show_link+'" style="background-color: '+evnt.color+';color:#fff; top:'+toppx+'px; height:'+h+'px;"><dl><dt>'+displaystarttime+' - '+displayendtime+'</dt><dd>'+evnt.title+'</dd></dl></div>');
|
||||
$(".week_day_body[date="+evnt.start_date+"] .inner").append(eventdom);
|
||||
}
|
||||
if(full_day_count == 0){
|
||||
tr.append('<td rowspan="1" style="width:60px;">');
|
||||
$("table.all_day_event_holder").append(tr);
|
||||
}
|
||||
|
||||
})
|
||||
if(tr.html()!=""){
|
||||
if(rowcount != 7){
|
||||
tr.append("<td colspan='"+(7-rowcount)+"'></td>");
|
||||
}
|
||||
$("table.all_day_event_holder").append(tr);
|
||||
}
|
||||
})
|
||||
}
|
||||
this.loadDayView = function(){
|
||||
$('#view_holder').load("cals/day_view", function() {
|
||||
$('.current_day_title').text('September 2, 2012');
|
||||
this.loadDayView = function(day,month,year){
|
||||
c.view = "day";
|
||||
if(!day){
|
||||
var dt = new Date();
|
||||
week = dt.getWeek();
|
||||
year = dt.getFullYear();
|
||||
day = dt.getDate();
|
||||
month = dt.getMonth()+1;
|
||||
}
|
||||
|
||||
c.cur_date = day;
|
||||
c.cur_month = month;
|
||||
c.cur_year = year;
|
||||
|
||||
$('#view_holder').load("cals/day_view?date="+day+"&month="+month+"&year="+year, function() {
|
||||
$('.current_day_title').text($("#day_header").text());
|
||||
c.getEventsForDay(day,month,year);
|
||||
})
|
||||
}
|
||||
this.getEventsForDay = function(day,month,year){
|
||||
$.getJSON("cals/getDayEvents",{"date":day,"month":month,"year":year},function(events){
|
||||
$.each(events,function(i,evnt){
|
||||
if(evnt.all_day){
|
||||
$(".all_day_event").append('<div class="event" link="'+evnt.show_link+'" style="background-color: '+evnt.color+';color:#fff;">'+evnt.title+'</div>')
|
||||
}else{
|
||||
var starttime,endtime,displaystarttime,displayendtime;
|
||||
if(evnt.start_am_pm == "AM"){
|
||||
starttime = evnt.start_time;
|
||||
if(starttime == 12)
|
||||
starttime = 0;
|
||||
if(starttime == 12.5)
|
||||
starttime = 0.5;
|
||||
}else
|
||||
starttime = evnt.start_time + 12;
|
||||
|
||||
if(evnt.end_am_pm == "AM"){
|
||||
endtime = evnt.end_time;
|
||||
if(endtime == 12)
|
||||
endtime = 0;
|
||||
if(endtime == 12.5)
|
||||
endtime = 0.5;
|
||||
}else
|
||||
endtime = evnt.end_time + 12;
|
||||
|
||||
var temp = parseInt(evnt.start_time);
|
||||
|
||||
if (evnt.start_time > temp)
|
||||
displaystarttime = temp + ":30 " + evnt.start_am_pm;
|
||||
else
|
||||
displaystarttime = temp + ":00 " + evnt.start_am_pm;
|
||||
|
||||
temp = parseInt(evnt.end_time);
|
||||
|
||||
if (evnt.end_time > temp)
|
||||
displayendtime = temp + ":30 " + evnt.end_am_pm;
|
||||
else
|
||||
displayendtime = temp + ":00 " + evnt.end_am_pm;
|
||||
|
||||
var toppx = ((starttime * 2) * 20) + 1;
|
||||
var h = endtime - starttime;
|
||||
var halfhour = "";
|
||||
if(h == 0.5)
|
||||
halfhour = "half";
|
||||
h = 17 + 20 + (((h-1) * 2) * 20) + 1;
|
||||
var eventdom = $('<div class="inner"><div class="event '+halfhour+'" link="'+evnt.show_link+'" style="background-color: '+evnt.color+';color:#fff; top:'+toppx+'px; height:'+h+'px;"><dl><dt>'+displaystarttime+' - '+displayendtime+'</dt><dd>'+evnt.title+'</dd></dl></div></div>');
|
||||
$(".event_holder").append(eventdom);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
this.loadAgendaView = function(){
|
||||
|
@ -379,11 +562,27 @@ var calendarAPI = function(){
|
|||
var domfor = $(this).attr("data-content");
|
||||
$("tr[for="+domfor+"]").remove();
|
||||
})
|
||||
$(".btn-edit-a").live("ajax:success",function(evt,form){
|
||||
$("#edit_area_" + $(this).attr("for")).html(form).slideDown();
|
||||
$("#edit_area_" + $(this).attr("for")).find(".color-picker").miniColors();
|
||||
})
|
||||
$(".bt-cancel").live("click",function(){
|
||||
$("#edit_area_" + $(this).attr("for")).html("").slideUp();
|
||||
})
|
||||
}
|
||||
this.displayEvent = function(dom){
|
||||
this.displayEvent = function(dom,pos){
|
||||
var url = dom.attr("link");
|
||||
c.event_quick_view_div.load(url,function(){
|
||||
c.event_quick_view_div.show()
|
||||
var x = pos.x;
|
||||
var y = pos.y;
|
||||
var winheight = $(window).height()
|
||||
if((x+c.event_quick_view_div.width()) > $(window).width()){
|
||||
x = x - c.event_quick_view_div.width();
|
||||
}
|
||||
if((y+c.event_quick_view_div.height()) > winheight){
|
||||
y = y - c.event_quick_view_div.height();
|
||||
}
|
||||
c.event_quick_view_div.css({"left":x+"px","top":y+"px"}).show()
|
||||
c.event_quick_view_div.find(".event-close-btn").click(function(){
|
||||
c.event_quick_view_div.empty().hide();
|
||||
})
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
padding: 1px 3px;
|
||||
font-weight: bold;
|
||||
box-shadow: inset 0 0 1px black;
|
||||
-webkit-box-shadow: inset 0 0 1px black;
|
||||
-moz-box-shadow: inset 0 0 1px black;
|
||||
|
|
|
@ -11,6 +11,19 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController
|
|||
@calendars = Cal.all
|
||||
end
|
||||
|
||||
def edit
|
||||
@calendar = Cal.find(params[:id])
|
||||
render :layout=>false
|
||||
end
|
||||
|
||||
def update
|
||||
@calendar = Cal.find(params[:id])
|
||||
@calendar.update_attributes(params[:cal])
|
||||
respond_to do |h|
|
||||
h.js
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@calendar = Cal.new(params[:cal])
|
||||
@calendar.save!
|
||||
|
@ -26,6 +39,11 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController
|
|||
end
|
||||
|
||||
def day_view
|
||||
date = params[:date].to_i
|
||||
month = params[:month].to_i
|
||||
year = params[:year].to_i
|
||||
@cur_day = getDayName(date,month,year) + " " + month.to_s + "/" + date.to_s + " - " + year.to_s
|
||||
@hours = getHours(12)
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
|
@ -70,38 +88,84 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController
|
|||
end
|
||||
|
||||
def get_month_events
|
||||
month = params[:month]
|
||||
year = params[:year]
|
||||
month = month.to_i
|
||||
year = year.to_i
|
||||
events = Event.where(:start_month.lt => month).and(:start_year => year).and(:end_month.gte => month).asc(:start_date).desc(:total_days)
|
||||
month = params[:month].to_i
|
||||
year = params[:year].to_i
|
||||
|
||||
# events = Event.where(:start_month.lt => month).and(:start_year => year).and(:end_month.gte => month).asc(:start_date).desc(:total_days)
|
||||
@events = Array.new
|
||||
no_of_days_in_month = getMonthDays(year)
|
||||
events.each_with_index do |event,i|
|
||||
no_of_days = event.total_days
|
||||
# events.each_with_index do |event,i|
|
||||
# no_of_days = event.total_days
|
||||
|
||||
# if event.end_month > month
|
||||
# no_of_days = no_of_days_in_month[month]
|
||||
# elsif event.end_month == month
|
||||
# no_of_days = event.end_date
|
||||
# end
|
||||
|
||||
# no_of_days = no_of_days.to_i
|
||||
|
||||
# color = Cal.find(event.cal_id).color
|
||||
# @events << {"id"=>event.id,"index"=>i,"start_date"=>"1", "total_days" => no_of_days, "title" => event.title,"color"=>color,"show_link"=>panel_calendar_back_end_event_path(event)}
|
||||
# end
|
||||
# events = Event.where(:start_month => month).and(:start_year => year).asc(:start_date).desc(:total_days)
|
||||
# events.each_with_index do |event,i|
|
||||
# # @temp = Array.new
|
||||
# no_of_days = event.total_days
|
||||
# if event.end_month > month
|
||||
# no_of_days = no_of_days_in_month[month] - event.start_date
|
||||
# end
|
||||
# no_of_days = no_of_days.to_i
|
||||
# no_of_days += 1
|
||||
|
||||
# color = Cal.find(event.cal_id).color
|
||||
# @events << {"id"=>event.id,"index"=>i,"start_date"=>event.start_date, "total_days" => no_of_days, "title" => event.title,"color"=>color,"show_link"=>panel_calendar_back_end_event_path(event)}
|
||||
# end
|
||||
events = Event.all.asc(:start_date).desc(:total_days)
|
||||
events.each_with_index do |event,i|
|
||||
# @temp = Array.new
|
||||
startdt = Date.new(event.start_year,event.start_month)
|
||||
enddt = Date.new(event.end_year,event.end_month)
|
||||
range = startdt..enddt
|
||||
|
||||
dt = Date.new(year,month)
|
||||
if range === dt
|
||||
no_of_days = event.total_days
|
||||
start_date = event.start_date
|
||||
|
||||
if event.start_year < year
|
||||
no_of_days = no_of_days_in_month[month] - event.start_date
|
||||
no_of_days += 1
|
||||
temp = month + 12
|
||||
if event.start_month < temp
|
||||
start_date = 1
|
||||
end
|
||||
end
|
||||
if event.end_year > year
|
||||
no_of_days = no_of_days_in_month[month] - event.start_date
|
||||
no_of_days += 1
|
||||
temp = month + 12
|
||||
end
|
||||
if event.end_month > month
|
||||
no_of_days = no_of_days_in_month[month]
|
||||
no_of_days = no_of_days_in_month[month] - event.start_date
|
||||
no_of_days += 1
|
||||
elsif event.end_month == month
|
||||
no_of_days = event.end_date
|
||||
end
|
||||
|
||||
no_of_days = no_of_days.to_i
|
||||
if event.start_month == month && event.end_month == month
|
||||
no_of_days = event.total_days
|
||||
no_of_days += 1
|
||||
end
|
||||
|
||||
if event.start_month < month
|
||||
start_date = 1
|
||||
end
|
||||
|
||||
color = Cal.find(event.cal_id).color
|
||||
@events << {"id"=>event.id,"index"=>i,"start_date"=>"1", "total_days" => no_of_days, "title" => event.title,"color"=>color,"show_link"=>panel_calendar_back_end_event_path(event)}
|
||||
@events << {"start_year"=>event.start_year, "id"=>event.id,"index"=>i,"start_date"=>start_date, "total_days" => no_of_days, "title" => event.title,"color"=>color,"show_link"=>panel_calendar_back_end_event_path(event)}
|
||||
end
|
||||
events = Event.where(:start_month => month).and(:start_year => year).asc(:start_date).desc(:total_days)
|
||||
events.each_with_index do |event,i|
|
||||
# @temp = Array.new
|
||||
no_of_days = event.total_days
|
||||
if event.end_month > month
|
||||
no_of_days = no_of_days_in_month[month] - event.start_date
|
||||
end
|
||||
no_of_days = no_of_days.to_i
|
||||
no_of_days += 1
|
||||
color = Cal.find(event.cal_id).color
|
||||
@events << {"id"=>event.id,"index"=>i,"start_date"=>event.start_date, "total_days" => no_of_days, "title" => event.title,"color"=>color,"show_link"=>panel_calendar_back_end_event_path(event)}
|
||||
|
||||
end
|
||||
|
||||
render :json => @events.to_json
|
||||
|
@ -111,26 +175,83 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController
|
|||
week = params[:week].to_i
|
||||
year = params[:year].to_i
|
||||
@d = getWeekDataSet(week,year)
|
||||
events = Event.where(:start_week.lte => week).and(:start_year => year).and(:end_week.gte => week).and(:start_year => year)
|
||||
events = Event.where(:start_week.lte => week).and(:start_year => year).and(:end_week.gte => week).and(:start_year => year).asc(:start_week).asc(:start_date)
|
||||
@events = Array.new
|
||||
events.each_with_index do |event,i|
|
||||
# @temp = Array.new
|
||||
no_of_days = event.total_days
|
||||
days = event.total_days.to_i + 1
|
||||
colcount = 0
|
||||
startdt = event.start_date
|
||||
if event.start_week < week
|
||||
startdt = @d[0].to_i
|
||||
event.all_day = true
|
||||
end
|
||||
|
||||
no_of_days = no_of_days.to_i
|
||||
no_of_days += 1
|
||||
all_day = event.all_day
|
||||
if no_of_days > 1
|
||||
|
||||
if days > 1
|
||||
all_day = true
|
||||
end
|
||||
|
||||
if event.end_week > week && event.start_week < week
|
||||
days = 7
|
||||
end
|
||||
|
||||
if event.end_week == week
|
||||
days = @d.index(event.end_date.to_s).to_i
|
||||
end
|
||||
|
||||
if event.start_week == week
|
||||
days = 7 - @d.index(event.start_date.to_s).to_i
|
||||
end
|
||||
|
||||
|
||||
if event.start_week == week && event.end_week == week
|
||||
x = @d.index(event.end_date.to_s).to_i
|
||||
y = @d.index(event.start_date.to_s).to_i
|
||||
colcount = x - y
|
||||
colcount+=1
|
||||
|
||||
end
|
||||
|
||||
if event.start_week < week
|
||||
startdt = @d[0].to_i
|
||||
event.all_day = true
|
||||
if event.end_week == week
|
||||
colcount = 7 - @d.index(event.end_date.to_s).to_i
|
||||
days = 7;
|
||||
startdt = event.start_date
|
||||
end
|
||||
end
|
||||
|
||||
color = Cal.find(event.cal_id).color
|
||||
@events << {"id"=>event.id,"index"=>i,"start_date"=>startdt,"all_day"=>all_day, "start_week" => event.start_week, "end_week" => event.end_week, "total_days" => no_of_days, "title" => event.title,"color"=>color,"show_link"=>panel_calendar_back_end_event_path(event),"start_time"=>event.start_time,"end_time"=>event.end_time,"start_am_pm"=>event.start_am_pm,"end_am_pm"=>event.end_am_pm}
|
||||
@events << {"id"=>event.id,"index"=>i,"start_date"=>startdt,"end_date"=>event.end_date ,"all_day"=>all_day, "start_week" => event.start_week, "end_week" => event.end_week, "total_days" => days, "title" => event.title,"color"=>color,"show_link"=>panel_calendar_back_end_event_path(event),"start_time"=>event.start_time,"end_time"=>event.end_time,"start_am_pm"=>event.start_am_pm,"end_am_pm"=>event.end_am_pm,"colcount"=>colcount}
|
||||
end
|
||||
render :json => @events.to_json
|
||||
end
|
||||
|
||||
def get_day_events
|
||||
day = params[:date].to_i
|
||||
month = params[:month].to_i
|
||||
year = params[:year].to_i
|
||||
dt = Date.new(year,month,day)
|
||||
week = dt.strftime("%U")
|
||||
events = Event.where(:start_month.lte => month).and(:start_year => year).and(:end_month.gte => month)
|
||||
@events = Array.new
|
||||
events.each_with_index do |event,i|
|
||||
days = event.total_days.to_i + 1
|
||||
colcount = 0
|
||||
|
||||
all_day = event.all_day
|
||||
|
||||
if days > 1
|
||||
all_day = true
|
||||
end
|
||||
startdt = Date.new(event.start_year,event.start_month,event.start_date)
|
||||
enddt = Date.new(event.end_year,event.end_month,event.end_date)
|
||||
|
||||
range = startdt..enddt
|
||||
|
||||
if range === dt
|
||||
color = Cal.find(event.cal_id).color
|
||||
@events << {"id"=>event.id,"index"=>i,"start_date"=>event.start_date,"end_date"=>event.end_date ,"all_day"=>all_day, "start_week" => event.start_week, "end_week" => event.end_week, "total_days" => days, "title" => event.title,"color"=>color,"show_link"=>panel_calendar_back_end_event_path(event),"start_time"=>event.start_time,"end_time"=>event.end_time,"start_am_pm"=>event.start_am_pm,"end_am_pm"=>event.end_am_pm}
|
||||
end
|
||||
end
|
||||
render :json => @events.to_json
|
||||
end
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
<tr class="with_action" for="<%= calendar.id.to_s %>">
|
||||
<td>
|
||||
<span class="calendars_color_tag" style="background-color: <%= calendar.color %>"></span>
|
||||
<div id="edit_area_<%= calendar.id %>" style="display:hidden;"></div>
|
||||
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<li><a href="">Edit</a></li>
|
||||
<li><%= link_to t("calendar.delete"), panel_calendar_back_end_cal_path(calendar), :method => "delete",:remote => true, :confirm => t("gallery.sure?"),:class=>"btn-del-a", "data-content"=>calendar.id.to_s %></li>
|
||||
<li><%= link_to t("calendar.edit"), edit_panel_calendar_back_end_cal_path(calendar), :remote => true, :class=>"btn-edit-a", :for => calendar.id %></li>
|
||||
<li><%= link_to t("calendar.delete"), panel_calendar_back_end_cal_path(calendar), :method => "delete",:remote => true, :confirm => t("calendar.sure?"),:class=>"btn-del-a", "data-content"=>calendar.id.to_s %></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- <div id="calendar_agenda">
|
||||
<div id="calendar_agenda">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -45,8 +45,8 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div> -->
|
||||
<div id="calendar_week">
|
||||
</div>
|
||||
<!-- <div id="calendar_week">
|
||||
<table class="table header">
|
||||
<tr>
|
||||
<th style="width: 44px;"></th>
|
||||
|
@ -264,3 +264,4 @@
|
|||
</table>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
|
@ -3,14 +3,14 @@
|
|||
<tr>
|
||||
<th class="span1"></th>
|
||||
<th>
|
||||
<h2>Sunday 9/2</h2>
|
||||
<h2 id="day_header" style="display:none;"><%= @cur_day %></h2>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="all_day_event">
|
||||
<div class="event" style="background-color: #ffcc00;">event1</div>
|
||||
<div class="event" style="background-color: #ffcc00;">event2</div>
|
||||
<!-- <div class="event" style="background-color: #ffcc00;">event1</div>
|
||||
<div cla ss="event" style="background-color: #ffcc00;">event2</div> -->
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -18,107 +18,25 @@
|
|||
<table class="table">
|
||||
<tr>
|
||||
<td style="width: 60px;">
|
||||
<div class="day_time">12am</div>
|
||||
<div class="day_time">1am</div>
|
||||
<div class="day_time">2am</div>
|
||||
<div class="day_time">3am</div>
|
||||
<div class="day_time">4am</div>
|
||||
<div class="day_time">5am</div>
|
||||
<div class="day_time">6am</div>
|
||||
<div class="day_time">7am</div>
|
||||
<div class="day_time">8am</div>
|
||||
<div class="day_time">9am</div>
|
||||
<div class="day_time">10am</div>
|
||||
<div class="day_time">11am</div>
|
||||
<div class="day_time">12am</div>
|
||||
<div class="day_time">1pm</div>
|
||||
<div class="day_time">2pm</div>
|
||||
<div class="day_time">3pm</div>
|
||||
<div class="day_time">4pm</div>
|
||||
<div class="day_time">5pm</div>
|
||||
<div class="day_time">6pm</div>
|
||||
<div class="day_time">7pm</div>
|
||||
<div class="day_time">8pm</div>
|
||||
<div class="day_time">9pm</div>
|
||||
<div class="day_time">10pm</div>
|
||||
<div class="day_time">11pm</div>
|
||||
<% @hours.each do |hour| %>
|
||||
<div class="day_time"><%= hour %>am</div>
|
||||
<% end %>
|
||||
<% @hours.each do |hour| %>
|
||||
<div class="day_time"><%= hour %>pm</div>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<div class="event_list_wrapper">
|
||||
<% @hours.each do |hour| %>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="divide"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="event_holder">
|
||||
<div class="inner">
|
||||
<!-- <div class="inner">
|
||||
<div class="event" style="background-color: #66cc00; top: 0;">
|
||||
<dl>
|
||||
<dt>10:30am - 11:00am</dt>
|
||||
|
@ -149,7 +67,7 @@
|
|||
<dd>template</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
|
26
vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/edit.html.erb
vendored
Normal file
26
vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/edit.html.erb
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
<%= form_for @calendar, :url => panel_calendar_back_end_cal_path(@calendar), :remote => true do |f| %>
|
||||
<h4>Edit</h4>
|
||||
<div class="row-fluid">
|
||||
<div class="span2">
|
||||
<%= label_tag("color", t("calendar.color")) %>
|
||||
<%= f.text_field :color, :class => "color-picker miniColors", :size => "5", :maxlength => "5", :autocomplete=>"off",:value=>@calendar.color %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= f.fields_for :name_translations do |name| %>
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
<div class="control-group">
|
||||
<%= label_tag(locale, t("calendar.name")+"-"+I18nVariable.from_locale(locale)) %>
|
||||
<div class="controls">
|
||||
<%= name.text_field locale, :class => "input-xxlarge", :size=>"30", :value=>@calendar.name_translations[locale] %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="">
|
||||
<%= f.submit t("calendar.save"), :class=>"btn btn-primary" %>
|
||||
<button class="btn btn-primary bt-cancel" for="<%= @calendar.id %>">Cancel</button>
|
||||
</div>
|
||||
<% end %>
|
|
@ -64,7 +64,7 @@
|
|||
</div>
|
||||
<div id="event_create" class="modal" style="right: 8px; bottom: 50px; left: auto; top: auto; width: 380px; margin: 0;display:none;"></div>
|
||||
|
||||
<div id="event_quick_view" class="modal" style="width: 300px; top: 60%;display:none"></div>
|
||||
<div id="event_quick_view" class="modal" style="width: 300px; display:none; margin:0 0 0 0;"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var calendar = new calendarAPI();
|
||||
|
|
2
vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/update.js.erb
vendored
Normal file
2
vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/update.js.erb
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
var tr = $("<%= j render :partial=>'calendar', :object=>@calendar %>");
|
||||
$("#calendar_list tr[for=<%= @calendar.id %>]").empty().html(tr.html());
|
|
@ -3,12 +3,20 @@
|
|||
<table class="table header">
|
||||
<tr>
|
||||
<th style="width: 44px;"></th>
|
||||
<% @dates.each do |day| %>
|
||||
<% @dates.each_with_index do |day,i| %>
|
||||
<% if @today == i %>
|
||||
<th class='today'><%= day %></th>
|
||||
<% else %>
|
||||
<th><%= day %></th>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 0; background: none;"></td>
|
||||
<td colspan="8" style="border:0;">
|
||||
<div class="event_list_wrapper head_event_wrapper" style="height:50px;">
|
||||
<table style="position: absolute; width: 100%; height: 50px; top: 0;">
|
||||
<tr>
|
||||
<td style="border: 0; background: none; width: 60px;"></td>
|
||||
<% @d.each_with_index do |dt,i| %>
|
||||
<% if @today == i %>
|
||||
<td class="all_day_event week_day week_day_header today" date='<%= dt %>'></td>
|
||||
|
@ -16,6 +24,14 @@
|
|||
<td class="all_day_event week_day week_day_header" date='<%= dt %>'></td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="all_day_event_holder">
|
||||
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
<!-- <div class="event half" style="background-color: #ccffee;">
|
||||
<dl>
|
||||
<dt>10:30am - template</dt>
|
||||
|
|
|
@ -7,3 +7,5 @@ en:
|
|||
delete: Delete
|
||||
select_calendar: "Select Calendar"
|
||||
create: Create
|
||||
sure?: "Are you sure?"
|
||||
edit: Edit
|
|
@ -1,4 +1,11 @@
|
|||
zh_tw:
|
||||
calendar:
|
||||
calendars: Calendars
|
||||
color: Color
|
||||
name: Name
|
||||
save: Save
|
||||
delete: Delete
|
||||
select_calendar: "Select Calendar"
|
||||
create: Create
|
||||
sure?: "Are you sure?"
|
||||
edit: Edit
|
|
@ -9,6 +9,7 @@ Rails.application.routes.draw do
|
|||
match 'cals/week_view' => 'cals#week_view', :via => :get
|
||||
match 'cals/getMonthEvents' => 'cals#get_month_events', :via => :get
|
||||
match 'cals/getWeekEvents' => 'cals#get_week_events', :via => :get
|
||||
match 'cals/getDayEvents' => 'cals#get_day_events', :via => :get
|
||||
|
||||
resources :cals
|
||||
resources :events
|
||||
|
|
Loading…
Reference in New Issue