orbit-basic/vendor/built_in_modules/calendar/app/assets/javascripts/calendarAPI.js.erb

83 lines
1.8 KiB
Plaintext
Raw Normal View History

2012-09-12 08:16:01 +00:00
$(window).load(function(){
if($('.color-picker').length > 0){
$('.color-picker').miniColors(); // just in category view
}
2012-09-14 07:20:01 +00:00
var view_url = 'http://localhost:3000/panel/calendar/back_end/cals/';
2012-09-12 08:16:01 +00:00
// below calendar start
2012-09-14 07:20:01 +00:00
$.get(view_url+'month_view', function(data) {
$('#view_holder').html(data);
month_fn();
});
$.get(view_url+'new', function(data) {
$('#create .modal-body').html(data);
});
// view switch (for view test)
$('.mode_switch').click(function(){
var target = $(this).text();
$.get(view_url+target+'_view', function(data) {
$('#view_holder').html(data);
switch(target){
case 'month':
month_fn();
break;
case 'week':
week_fn();
break;
case 'day':
day_fn();
break;
case 'agenda':
agenda_fn();
break;
}
2012-09-12 08:16:01 +00:00
});
2012-09-14 07:20:01 +00:00
});
// month fn
var month_fn = function(){
$('.current_day_title').text('September 2012');
// month view
if($('#calendar_month').length > 0){
var $c_table = $('#calendar_month');
var sum_h = 0;
var context_h = $('#main-sidebar').outerHeight();
$('#main-wrap > *').not('#orbit_calendar, .modal').each(function(){
sum_h += $(this).outerHeight();
});
2012-09-12 08:16:01 +00:00
$c_table
2012-09-14 07:20:01 +00:00
// .height(context_h-sum_h-64)
2012-09-12 08:16:01 +00:00
.find('.month_row')
.not('.month_row.header')
2012-09-14 07:20:01 +00:00
.height((context_h-sum_h-92) / 6);
$(window).resize(function(){
$c_table
.find('.month_row')
.not('.month_row.header')
.height(($('#main-sidebar').outerHeight()-sum_h-92) / 6);
});
}
};
// week fn
var week_fn = function(){
$('.current_day_title').text('September 2 - 8, 2012');
2012-09-12 08:16:01 +00:00
}
2012-09-14 07:20:01 +00:00
// day fn
var day_fn = function(){
$('.current_day_title').text('September 2, 2012');
}
// agenda fn
var agenda_fn = function(){
$('.current_day_title').text('September 2, 2012');
}
2012-09-12 08:16:01 +00:00
});