Merge branch 'gallery_orbit' of github.com:Rulingcom/orbit into gallery_orbit

This commit is contained in:
Christophe Vilayphiou 2012-09-17 13:32:11 +08:00
commit 6b6d8ac967
2 changed files with 21 additions and 13 deletions

View File

@ -114,19 +114,28 @@ var calendarAPI = function(){
var getEvents = function(month,year){ var getEvents = function(month,year){
$.getJSON("cals/getEvents",{"type":"monthview","month":month,"year":year},function(events){ $.getJSON("cals/getEvents",{"type":"monthview","month":month,"year":year},function(events){
var $eventrow = $("<tr></tr>"); var $eventrow = $("<tr></tr>");
var currow = 1; var nos = new Array();
var curpos = 1; nos.push(0);
$.each(events,function(i,evnt){ $.each(events,function(i,evnt){
var daydom = $("#calendar_month td[date="+evnt.start_date+"]"); var daydom = $("#calendar_month td[date="+evnt.start_date+"]");
var curparent = daydom.parent().parent().parent(); var curparent = daydom.parent().parent().parent();
var thisrow = curparent.attr("row"); var thisrow = curparent.attr("row");
var pos = daydom.attr("position"); var pos = daydom.attr("position");
if(thisrow != currow){ var thisno = daydom.attr("no");
$eventrow = null;
$eventrow = $("<tr></tr>"); var index = "new";
}else if(pos == curpos){ for(x in nos){
$eventrow = null; if(thisno < nos[x]){
$eventrow = $("<tr></tr>"); $eventrow = null;
$eventrow = $("<tr></tr>");
index = x;
break;
}
}
if(index!="new"){
nos[index] = (thisno + evnt.total_days) - 1;
}else{
nos.push((thisno + evnt.total_days) - 1);
} }
if(pos == 1){ if(pos == 1){
$eventrow.html('<td colspan="'+evnt.total_days+'"><div class="event" style="background-color: '+evnt.color+';">'+evnt.title+'</div></td>'); $eventrow.html('<td colspan="'+evnt.total_days+'"><div class="event" style="background-color: '+evnt.color+';">'+evnt.title+'</div></td>');
@ -136,8 +145,7 @@ var calendarAPI = function(){
} }
$eventrow.append('<td colspan="'+evnt.total_days+'"><div class="event" style="background-color: '+evnt.color+';">'+evnt.title+'</div></td>'); $eventrow.append('<td colspan="'+evnt.total_days+'"><div class="event" style="background-color: '+evnt.color+';">'+evnt.title+'</div></td>');
} }
currow = thisrow;
curpos = pos;
curparent.append($eventrow); curparent.append($eventrow);
}) })
}) })

View File

@ -41,11 +41,11 @@
<% x = 0 %> <% x = 0 %>
<% while x < 7 %> <% while x < 7 %>
<% if day_count_for_title < @pre_disabled_days %> <% if day_count_for_title < @pre_disabled_days %>
<td class="day_title disable"><%= @dateset[day_count_for_title] %></td> <td class="day_title disable" no="<%= day_count_for_title+1 %>"><%= @dateset[day_count_for_title] %></td>
<% elsif day_count_for_title >= @post_disabled_days %> <% elsif day_count_for_title >= @post_disabled_days %>
<td class="day_title disable"><%= @dateset[day_count_for_title] %></td> <td class="day_title disable" no="<%= day_count_for_title+1 %>"><%= @dateset[day_count_for_title] %></td>
<% else %> <% else %>
<td class="day_title click_event" ref="day-btn" link="<%= new_panel_calendar_back_end_event_path %>" date="<%= @dateset[day_count_for_title] %>" position="<%= x+1 %>"><%= @dateset[day_count_for_title] %></td> <td class="day_title click_event" ref="day-btn" link="<%= new_panel_calendar_back_end_event_path %>" date="<%= @dateset[day_count_for_title] %>" position="<%= x+1 %>" no="<%= day_count_for_title+1 %>"><%= @dateset[day_count_for_title] %></td>
<% end %> <% end %>
<% day_count_for_title += 1 %> <% day_count_for_title += 1 %>
<% x += 1 %> <% x += 1 %>