Merge branch 'gallery_orbit' into desktop_devin

This commit is contained in:
Harry Bomrah 2012-10-24 19:11:12 +08:00
commit 974849b85a
14 changed files with 470 additions and 174 deletions

View File

@ -27,6 +27,13 @@ Date.prototype.getWeek = function (dowOffset) {
return weeknum; 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(){ var calendarAPI = function(){
c = this; c = this;
@ -36,17 +43,20 @@ var calendarAPI = function(){
this.cur_month = c.today.getMonth()+1; this.cur_month = c.today.getMonth()+1;
this.cur_year = c.today.getFullYear(); this.cur_year = c.today.getFullYear();
this.cur_week = c.today.getWeek(); this.cur_week = c.today.getWeek();
this.cur_date = c.today.getDate();
this.view = null; this.view = null;
this.monthlist = ["","January","February","March","April","May","June","July","August","September","October","November","December"]; this.monthlist = ["","January","February","March","April","May","June","July","August","September","October","November","December"];
this.initialize = function(){ this.initialize = function(){
$(window).load(function(){ $(window).load(function(){
// c.loadMonthView(c.cur_month,c.cur_year); // 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(); bindHandlers();
}) })
var bindHandlers = function(){ var bindHandlers = function(){
$(".event").live("click",function(){ $(".event").live("click",function(e){
c.displayEvent($(this)); var pos = {"x":e.clientX,"y":e.clientY};
c.displayEvent($(this),pos);
}) })
$("#create_event_btn").click(function(){ $("#create_event_btn").click(function(){
@ -73,7 +83,7 @@ var calendarAPI = function(){
c.loadWeekView(c.cur_week,c.cur_year); c.loadWeekView(c.cur_week,c.cur_year);
break; break;
case 'day': case 'day':
c.loadDayView(); c.loadDayView(c.cur_date,c.cur_month,c.cur_year);
break; break;
case 'agenda': case 'agenda':
c.loadAgendaView(); c.loadAgendaView();
@ -104,6 +114,22 @@ var calendarAPI = function(){
} }
c.loadWeekView(w,y); c.loadWeekView(w,y);
break; 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); c.loadWeekView(w,y);
break; 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(){ $("button#today_btn").click(function(){
@ -142,6 +188,9 @@ var calendarAPI = function(){
case "month": case "month":
c.loadMonthView(); c.loadMonthView();
break; break;
case "day":
c.loadDayView();
break;
} }
}) })
} }
@ -222,6 +271,8 @@ var calendarAPI = function(){
var recordcurdate = true; var recordcurdate = true;
if(allow){ if(allow){
if(evnt.title=="Navratri")
console.log(pos);
if(pos == 1){ if(pos == 1){
var colspan = 0; var colspan = 0;
if(evnt.total_days>7){ if(evnt.total_days>7){
@ -304,19 +355,69 @@ var calendarAPI = function(){
} }
this.getEventsForWeek = function(week,year){ this.getEventsForWeek = function(week,year){
$.getJSON("cals/getWeekEvents",{"week":week,"year":year},function(events){ $.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){ $.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){ 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;">&nbsp;</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{ }else{
var starttime,endtime,displaystarttime,displayendtime; var starttime,endtime,displaystarttime,displayendtime;
if(evnt.start_am_pm == "AM") if(evnt.start_am_pm == "AM"){
starttime = evnt.start_time; starttime = evnt.start_time;
else if(starttime == 12)
starttime = 0;
if(starttime == 12.5)
starttime = 0.5;
}else
starttime = evnt.start_time + 12; starttime = evnt.start_time + 12;
if(evnt.end_am_pm == "AM") if(evnt.end_am_pm == "AM"){
endtime = evnt.end_time; endtime = evnt.end_time;
else if(endtime == 12)
endtime = 0;
if(endtime == 12.5)
endtime = 0.5;
}else
endtime = evnt.end_time + 12; endtime = evnt.end_time + 12;
var temp = parseInt(evnt.start_time); var temp = parseInt(evnt.start_time);
@ -333,17 +434,99 @@ var calendarAPI = function(){
else else
displayendtime = temp + ":00 " + evnt.end_am_pm; displayendtime = temp + ":00 " + evnt.end_am_pm;
var toppx = ((starttime * 2) * 19) + starttime; var toppx = ((starttime * 2) * 20) + 1;
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 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); $(".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(){ this.loadDayView = function(day,month,year){
$('#view_holder').load("cals/day_view", function() { c.view = "day";
$('.current_day_title').text('September 2, 2012'); 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(){ this.loadAgendaView = function(){
@ -379,11 +562,27 @@ var calendarAPI = function(){
var domfor = $(this).attr("data-content"); var domfor = $(this).attr("data-content");
$("tr[for="+domfor+"]").remove(); $("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"); var url = dom.attr("link");
c.event_quick_view_div.load(url,function(){ 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.find(".event-close-btn").click(function(){
c.event_quick_view_div.empty().hide(); c.event_quick_view_div.empty().hide();
}) })

View File

@ -32,6 +32,7 @@
border-radius: 3px; border-radius: 3px;
cursor: pointer; cursor: pointer;
padding: 1px 3px; padding: 1px 3px;
font-weight: bold;
box-shadow: inset 0 0 1px black; box-shadow: inset 0 0 1px black;
-webkit-box-shadow: inset 0 0 1px black; -webkit-box-shadow: inset 0 0 1px black;
-moz-box-shadow: inset 0 0 1px black; -moz-box-shadow: inset 0 0 1px black;

View File

@ -11,6 +11,19 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController
@calendars = Cal.all @calendars = Cal.all
end 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 def create
@calendar = Cal.new(params[:cal]) @calendar = Cal.new(params[:cal])
@calendar.save! @calendar.save!
@ -26,6 +39,11 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController
end end
def day_view 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 render :layout => false
end end
@ -70,38 +88,84 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController
end end
def get_month_events def get_month_events
month = params[:month] month = params[:month].to_i
year = params[:year] year = params[:year].to_i
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)
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 @events = Array.new
no_of_days_in_month = getMonthDays(year) no_of_days_in_month = getMonthDays(year)
events.each_with_index do |event,i| # events.each_with_index do |event,i|
no_of_days = event.total_days # 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 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 elsif event.end_month == month
no_of_days = event.end_date no_of_days = event.end_date
end 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 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 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 end
render :json => @events.to_json render :json => @events.to_json
@ -111,26 +175,83 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController
week = params[:week].to_i week = params[:week].to_i
year = params[:year].to_i year = params[:year].to_i
@d = getWeekDataSet(week,year) @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 = Array.new
events.each_with_index do |event,i| events.each_with_index do |event,i|
# @temp = Array.new # @temp = Array.new
no_of_days = event.total_days days = event.total_days.to_i + 1
colcount = 0
startdt = event.start_date 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 all_day = event.all_day
if no_of_days > 1
if days > 1
all_day = true all_day = true
end 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 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 end
render :json => @events.to_json render :json => @events.to_json
end end

View File

@ -1,10 +1,12 @@
<tr class="with_action" for="<%= calendar.id.to_s %>"> <tr class="with_action" for="<%= calendar.id.to_s %>">
<td> <td>
<span class="calendars_color_tag" style="background-color: <%= calendar.color %>"></span> <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"> <div class="quick-edit">
<ul class="nav nav-pills hide"> <ul class="nav nav-pills hide">
<li><a href="">Edit</a></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("gallery.sure?"),:class=>"btn-del-a", "data-content"=>calendar.id.to_s %></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> </ul>
</div> </div>
</td> </td>

View File

@ -1,4 +1,4 @@
<!-- <div id="calendar_agenda"> <div id="calendar_agenda">
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
@ -45,8 +45,8 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> --> </div>
<div id="calendar_week"> <!-- <div id="calendar_week">
<table class="table header"> <table class="table header">
<tr> <tr>
<th style="width: 44px;"></th> <th style="width: 44px;"></th>
@ -264,3 +264,4 @@
</table> </table>
</div> </div>
</div> </div>
-->

View File

@ -3,14 +3,14 @@
<tr> <tr>
<th class="span1"></th> <th class="span1"></th>
<th> <th>
<h2>Sunday 9/2</h2> <h2 id="day_header" style="display:none;"><%= @cur_day %></h2>
</th> </th>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td class="all_day_event"> <td class="all_day_event">
<div class="event" style="background-color: #ffcc00;">event1</div> <!-- <div class="event" style="background-color: #ffcc00;">event1</div>
<div class="event" style="background-color: #ffcc00;">event2</div> <div cla ss="event" style="background-color: #ffcc00;">event2</div> -->
</td> </td>
</tr> </tr>
</table> </table>
@ -18,107 +18,25 @@
<table class="table"> <table class="table">
<tr> <tr>
<td style="width: 60px;"> <td style="width: 60px;">
<div class="day_time">12am</div> <% @hours.each do |hour| %>
<div class="day_time">1am</div> <div class="day_time"><%= hour %>am</div>
<div class="day_time">2am</div> <% end %>
<div class="day_time">3am</div> <% @hours.each do |hour| %>
<div class="day_time">4am</div> <div class="day_time"><%= hour %>pm</div>
<div class="day_time">5am</div> <% end %>
<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>
</td> </td>
<td> <td>
<div class="event_list_wrapper"> <div class="event_list_wrapper">
<% @hours.each do |hour| %>
<div class="cell"> <div class="cell">
<div class="divide"></div> <div class="divide"></div>
</div> </div>
<div class="cell"> <div class="cell">
<div class="divide"></div> <div class="divide"></div>
</div> </div>
<div class="cell"> <% end %>
<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="event_holder"> <div class="event_holder">
<div class="inner"> <!-- <div class="inner">
<div class="event" style="background-color: #66cc00; top: 0;"> <div class="event" style="background-color: #66cc00; top: 0;">
<dl> <dl>
<dt>10:30am - 11:00am</dt> <dt>10:30am - 11:00am</dt>
@ -149,7 +67,7 @@
<dd>template</dd> <dd>template</dd>
</dl> </dl>
</div> </div>
</div> </div> -->
</div> </div>
</div> </div>
</td> </td>

View 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 %>

View File

@ -64,7 +64,7 @@
</div> </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_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"> <script type="text/javascript">
var calendar = new calendarAPI(); var calendar = new calendarAPI();

View File

@ -0,0 +1,2 @@
var tr = $("<%= j render :partial=>'calendar', :object=>@calendar %>");
$("#calendar_list tr[for=<%= @calendar.id %>]").empty().html(tr.html());

View File

@ -3,12 +3,20 @@
<table class="table header"> <table class="table header">
<tr> <tr>
<th style="width: 44px;"></th> <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> <th><%= day %></th>
<% end %> <% end %>
<% end %>
</tr> </tr>
<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| %> <% @d.each_with_index do |dt,i| %>
<% if @today == i %> <% if @today == i %>
<td class="all_day_event week_day week_day_header today" date='<%= dt %>'></td> <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> <td class="all_day_event week_day week_day_header" date='<%= dt %>'></td>
<% end %> <% end %>
<% end %> <% end %>
</tr>
</table>
<table class="all_day_event_holder">
</table>
</div>
</td>
<!-- <div class="event half" style="background-color: #ccffee;"> <!-- <div class="event half" style="background-color: #ccffee;">
<dl> <dl>
<dt>10:30am - template</dt> <dt>10:30am - template</dt>

View File

@ -7,3 +7,5 @@ en:
delete: Delete delete: Delete
select_calendar: "Select Calendar" select_calendar: "Select Calendar"
create: Create create: Create
sure?: "Are you sure?"
edit: Edit

View File

@ -1,4 +1,11 @@
zh_tw: zh_tw:
calendar: calendar:
calendars: Calendars calendars: Calendars
color: Color
name: Name
save: Save
delete: Delete
select_calendar: "Select Calendar"
create: Create create: Create
sure?: "Are you sure?"
edit: Edit

View File

@ -9,6 +9,7 @@ Rails.application.routes.draw do
match 'cals/week_view' => 'cals#week_view', :via => :get match 'cals/week_view' => 'cals#week_view', :via => :get
match 'cals/getMonthEvents' => 'cals#get_month_events', :via => :get match 'cals/getMonthEvents' => 'cals#get_month_events', :via => :get
match 'cals/getWeekEvents' => 'cals#get_week_events', :via => :get match 'cals/getWeekEvents' => 'cals#get_week_events', :via => :get
match 'cals/getDayEvents' => 'cals#get_day_events', :via => :get
resources :cals resources :cals
resources :events resources :events