removed old calendar and updated new calendar event category

Conflicts:
	vendor/built_in_modules/calendar/app/assets/javascripts/calendarAPI.js.erb
	vendor/built_in_modules/calendar/app/controllers/panel/calendar/back_end/cals_controller.rb
	vendor/built_in_modules/calendar/app/controllers/panel/calendar/back_end/events_controller.rb
This commit is contained in:
saurabhbhatia 2013-07-22 16:00:19 +08:00
parent 8924d4f047
commit 7e3993b67f
89 changed files with 33 additions and 3656 deletions

View File

@ -1,6 +0,0 @@
.bundle/
log/*.log
pkg/
test/dummy/db/*.sqlite3
test/dummy/log/*.log
test/dummy/tmp/

View File

@ -1,17 +0,0 @@
source "http://rubygems.org"
# Declare your gem's dependencies in calendar.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
# jquery-rails is used by the dummy application
gem "jquery-rails"
# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

View File

@ -1,20 +0,0 @@
Copyright 2012 YOURNAME
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,3 +0,0 @@
= Calendar
This project rocks and uses MIT-LICENSE.

View File

@ -1,39 +0,0 @@
#!/usr/bin/env rake
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
begin
require 'rdoc/task'
rescue LoadError
require 'rdoc/rdoc'
require 'rake/rdoctask'
RDoc::Task = Rake::RDocTask
end
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'Calendar'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
load 'rails/tasks/engine.rake'
Bundler::GemHelper.install_tasks
require 'rake/testtask'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = false
end
task :default => :test

View File

@ -1,770 +0,0 @@
//created on sep 14 2012
Date.prototype.getWeek = function (dowOffset) {
/*getWeek() was developed by Nick Baicoianu at MeanFreePath: http://www.epoch-calendar.com */
dowOffset = typeof(dowOffset) == 'int' ? dowOffset : 0; //default dowOffset to zero
var newYear = new Date(this.getFullYear(),0,1);
var day = newYear.getDay() - dowOffset; //the day of week the year begins on
day = (day >= 0 ? day : day + 7);
var daynum = Math.floor((this.getTime() - newYear.getTime() - (this.getTimezoneOffset()-newYear.getTimezoneOffset())*60000)/86400000) + 1;
var weeknum;
//if the year starts before the middle of a week
if(day < 4) {
weeknum = Math.floor((daynum+day-1)/7) + 1;
if(weeknum > 52) {
nYear = new Date(this.getFullYear() + 1,0,1);
nday = nYear.getDay() - dowOffset;
nday = nday >= 0 ? nday : nday + 7;
/*if the next year starts before the middle of
the week, it is week #1 of that year*/
weeknum = nday < 4 ? 1 : 53;
}
}
else {
weeknum = Math.floor((daynum+day-1)/7);
}
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;
this.event_create_div = $("#event_create");
this.event_quick_view_div = $("#event_quick_view");
this.today = new Date();
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.calendars = new Array();
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.loadDayView(c.cur_date,c.cur_month,c.cur_year);
agenda_end_month = c.cur_month + 5;
agenda_end_year = c.cur_year;
if(agenda_end_month > 12){
agenda_end_month = agenda_end_month - 12;
agenda_end_year++;
}
c.loadAgendaView(c.cur_month,c.cur_year,agenda_end_month,agenda_end_year);
$(".calendar-filter-btn").each(function(){
c.calendars.push($(this).attr("href"));
})
bindHandlers();
})
var bindHandlers = function(){
$(".event").live("click",function(e){
var pos = {"x":e.clientX,"y":e.clientY};
c.displayEvent($(this),pos);
})
$("#create_event_btn").click(function(){
if(!$(this).hasClass("active")){
c.newEvent($(this).attr("href"),$(this).attr("ref"),c.today.getDate(),c.today.getMonth()+1,c.today.getFullYear(),10.5,"AM");
}else{
c.event_create_div.hide().empty();
}
$(this).toggleClass("active");
return false;
})
$(".click_event").live("click",function(e){
var dt = $(this).attr("date");
if(!dt){
var w = $("td.week_day_body").width();
var parentOffset = $("table.cell_map").offset();
var relX = e.pageX - parentOffset.left;
var t = 60;
for (var i = 0; i <= 6; i++) {
if(relX > t && relX < (t + w)){
console.log(i);
dt = $("td.week_day_body").eq(i).attr("date");
break;
}
t = t + w;
};
}
var time = $(this).attr("time");
var ses = $(this).attr("ses");
if (!time)
time = 10.5;
if(!ses)
ses = "AM";
c.newEvent($(this).attr("link"),$(this).attr("ref"),dt,c.cur_month,c.cur_year,time,ses);
$("#create_event_btn").toggleClass("active");
e.stopPropagation();
})
$(".calendar-filter-btn").click(function(){
$(this).toggleClass("active");
c.calendars = [];
$(".calendar-filter-btn").each(function(){
if($(this).hasClass("active"))
c.calendars.push($(this).attr("href"));
})
c.refresh();
})
$("#edit_event_btn").live("ajax:success",function(evt,form){
c.event_quick_view_div.empty().hide();
c.updateEvent(form);
})
$("#refresh_btn").click(function(){
c.refresh();
})
$('.mode_switch').click(function(){
var target = $(this).text();
switch(target){
case 'month':
c.loadMonthView(c.cur_month,c.cur_year);
break;
case 'week':
c.loadWeekView(c.cur_week,c.cur_year);
break;
case 'day':
c.loadDayView(c.cur_date,c.cur_month,c.cur_year);
break;
case 'agenda':
c.loadAgendaView(c.cur_month,c.cur_year,agenda_end_month,agenda_end_year);
break;
}
})
$("button#prev_month_btn").click(function(){
switch (c.view){
case "month":
var m,y;
if(c.cur_month == 1){
m = 12;
y = c.cur_year-1;
}else{
m = c.cur_month-1;
y = c.cur_year;
}
c.loadMonthView(m,y);
break;
case "week":
var w,y;
if(c.cur_week == 1){
w = 52;
y = c.cur_year - 1;
}else{
w = c.cur_week - 1;
y = c.cur_year;
}
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;
}
})
$("button#next_month_btn").click(function(){
switch (c.view){
case "month":
var m,y;
if(c.cur_month == 12){
m = 1;
y = c.cur_year+1;
}else{
m = c.cur_month+1;
y = c.cur_year;
}
c.loadMonthView(m,y);
break;
case "week":
var w,y;
if(c.cur_week == 52){
w = 1;
y = c.cur_year + 1;
}else{
w = c.cur_week + 1;
y = c.cur_year;
}
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(){
switch (c.view){
case "week":
c.loadWeekView();
break;
case "month":
c.loadMonthView();
break;
case "day":
c.loadDayView();
break;
}
})
}
}
this.loadMonthView = function(month,year){
$("#range_selection").hide();
$("#navigation").show();
$("#sec1").removeClass("span7").addClass("span3");
$("#sec3").removeClass("span5").addClass("span4");
$("#sec2").show();
c.view = "month";
if(!month){
var dt = new Date();
month = dt.getMonth()+1;
year = dt.getFullYear();
}
// month = 10;
// year = 2008;
c.cur_month = month;
c.cur_year = year;
$('#view_holder').load("cals/month_view?month="+month+"&year="+year, function() {
c.getEventsForMonth(month,year);
$('.current_day_title').text(c.monthlist[c.cur_month]+" "+c.cur_year);
if($('#calendar_month').length > 0){
var $c_table = $('#calendar_month');
var sum_h = 0;
var context_h = $(window).height() - $('#orbit-bar').height();
$('#main-wrap > *').not('#orbit_calendar, .modal').each(function(){
sum_h += $(this).outerHeight();
});
$c_table
// .height(context_h-sum_h-64)
.find('.month_row')
.not('.month_row.header')
.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);
});
}
})
}
this.getEventsForMonth = function(month,year){
$.getJSON("cals/getMonthEvents",{"month":month,"year":year,"calendars":c.calendars},function(events){
makerow(events);
})
var doneEventArray = new Array();
var makerow = function(events){
var $eventrow =null;
var currow = 0;
var curdate = 0;
var allow = false;
var curparent = null;
var lastno = 0;
var indexcount = events.length;
$.each(events,function(i,evnt){
indexcount++;
if($.inArray(evnt.index,doneEventArray) == -1){
var daydom = $("#calendar_month td[date="+evnt.start_date+"]");
var thisparent = daydom.parent().parent().parent();
var thisrow = thisparent.attr("row");
var pos = parseInt(daydom.attr("position"));
var thisno = daydom.attr("no");
if(thisrow != currow){
if(curparent){
curparent.append($eventrow);
}
$eventrow = null;
$eventrow = $("<tr class='event_row destroy'></tr>");
allow = true;
}else if(evnt.start_date > curdate){
allow = true;
}
var recordcurdate = true;
if(allow){
if(pos == 1){
var colspan = 0;
if(evnt.total_days>7){
colspan = 7;
var totaldays = parseInt(evnt.total_days) - colspan;
var stardate = parseInt(evnt.start_date) + colspan;
var index = i + 1;
var tempArray = {"index":indexcount,"id":evnt.id,"start_date":stardate,"total_days":totaldays,"title":evnt.title,"color":evnt.color,"show_link":evnt.show_link};
events.splice(index,0,tempArray);
//recordcurdate = false;
}else{
colspan = evnt.total_days;
}
$eventrow.html('<td colspan="'+colspan+'" class="main_td" pos="'+pos+'"><div class="event" link="'+evnt.show_link+'" style="background-color: '+evnt.color+';">'+evnt.title+'</div></td>');
}else{
if($eventrow.html()==""){
$eventrow.append('<td colspan="'+(pos-1)+'"></td>');
}else{
if((lastno+1)!=thisno){
var inposition = parseInt($eventrow.find("td.main_td:last").attr("pos"));
var curcolspan = $eventrow.find("td.main_td:last").attr("colspan");
var colspan = pos - (inposition+parseInt(curcolspan));
$eventrow.append('<td colspan="'+colspan+'"></td>');
}
}
var colspan = 0;
if((pos + parseInt(evnt.total_days))-1 > 7){
colspan = 7-(pos-1);
var totaldays = parseInt(evnt.total_days) - colspan;
var stardate = parseInt(evnt.start_date) + colspan;
var index = i + 1;
var tempArray = {"index":indexcount,"id":evnt.id,"start_date":stardate,"total_days":totaldays,"title":evnt.title,"color":evnt.color,"show_link":evnt.show_link};
events.splice(index,0,tempArray);
// recordcurdate = false;
}else{
colspan = evnt.total_days;
}
// if(evnt.title == "Again")
// console.log(colspan);
$eventrow.append('<td colspan="'+colspan+'" class="main_td" pos="'+pos+'"><div link="'+evnt.show_link+'" class="event" style="background-color: '+evnt.color+';">'+evnt.title+'</div></td>');
}
lastno = (parseInt(thisno) + parseInt(evnt.total_days)) - 1;
currow = thisrow;
curdate =(evnt.start_date + evnt.total_days) - 1;
allow = false;
curparent = thisparent;
if(recordcurdate)
doneEventArray.push(evnt.index);
}
}
})
if(curparent){
curparent.append($eventrow);
}
if(events.length != doneEventArray.length){
makerow(events);
}
}
}
this.loadWeekView = function(week,year){
$("#range_selection").hide();
$("#navigation").show();
$("#sec1").removeClass("span7").addClass("span3");
$("#sec3").removeClass("span5").addClass("span4");
$("#sec2").show();
c.view = "week";
if(!week){
var dt = new Date();
week = dt.getWeek();
year = dt.getFullYear();
}
c.cur_week = week;
c.cur_year = year;
$('#view_holder').load("cals/week_view?week="+week+"&year="+year, function() {
$('.current_day_title').text($("#week_range").text());
c.getEventsForWeek(week,year);
})
}
this.getEventsForWeek = function(week,year){
$.getJSON("cals/getWeekEvents",{"week":week,"year":year,"calendars":c.calendars},function(events){
var height = 15;
var full_day_count = 0;
var rowcount = 7;
var tr = $("<tr class='destroy'></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 class="destroy"></tr>');
pre = true;
}
if(evnt.all_day){
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{
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="event '+halfhour+' destroy" 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(day,month,year){
$("#range_selection").hide();
$("#navigation").show();
$("#sec1").removeClass("span7").addClass("span3");
$("#sec3").removeClass("span5").addClass("span4");
$("#sec2").show();
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,"calendars":c.calendars},function(events){
$.each(events,function(i,evnt){
if(evnt.all_day){
$(".all_day_event").append('<div class="event destroy" 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+' destroy" 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(start_month,start_year,end_month,end_year){
c.view = "agenda";
var url = "cals/agenda_view";
$(".mode_switch").removeClass("active");
$(".mode_switch:eq(3)").addClass("active");
if(start_month && start_year && end_month && end_year)
var url = "cals/agenda_view?s_month="+start_month+"&s_year="+start_year+"&e_month="+end_month+"&e_year="+end_year ;
$('#view_holder').load(url, function() {
$("#navigation").hide();
$("#range_selection").html($("#agenda_date_range").html()).show();
$("#sec1").removeClass("span3").addClass("span7");
$("#sec3").removeClass("span4").addClass("span5");
$("#sec2").hide();
bindHandlers();
})
var bindHandlers = function(){
$("select[name=start_year]").change(function(){
var x = parseInt($(this).val()) - parseInt($(this).find("option").eq(0).val());
$("select[name=end_year] option").removeAttr("disabled");
for(i=0;i<x;i++){
$("select[name=end_year] option").eq(i).attr("disabled","disabled");
}
})
$("#range_selection .bt-filter").click(function(){
var start_month = $("select[name=start_month]").val();
var start_year = $("select[name=start_year]").val();
var end_year = $("select[name=end_year]").val();
var end_month = $("select[name=end_month]").val();
c.loadAgendaView(start_month,start_year,end_month,end_year);
})
}
}
this.newEvent = function(url,ref,date,month,year,time,ses){
var bindHandlers = function(){
c.event_create_div.find("button.btn-close").click(function(){
c.event_create_div.hide().empty();
$("#create_event_btn").removeClass("active");
})
c.event_create_div.find("input[for=all_day][type=checkbox]").click(function(){
if($(this).is(":checked"))
c.event_create_div.find("#non_all_day").hide()
else
c.event_create_div.find("#non_all_day").show()
})
$( "#dpfrom" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 3,
onSelect: function( selectedDate ) {
$( "#dpto" ).datepicker( "option", "minDate", selectedDate );
}
});
$( "#dpto" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 3,
onSelect: function( selectedDate ) {
$( "#dpfrom" ).datepicker( "option", "maxDate", selectedDate );
}
});
$('#open_tags_panel').click(function(){
$('#tags_panel').toggle();
$('.my_scroll').tinyscrollbar();
return false;
});
}
c.event_create_div.load(url+"?ref="+ref+"&date="+date+"&month="+month+"&year="+year+"&time="+time+"&ses="+ses,function(){
c.event_create_div.show();
bindHandlers();
})
}
this.updateEvent = function(form){
var bindHandlers = function(){
c.event_create_div.find("button.btn-close").click(function(){
c.event_create_div.hide().empty();
$("#create_event_btn").removeClass("active");
$("#create_event_btn").show();
})
c.event_create_div.find("input[for=all_day][type=checkbox]").click(function(){
if($(this).is(":checked"))
c.event_create_div.find("#non_all_day").hide()
else
c.event_create_div.find("#non_all_day").show()
})
$( "#dpfrom" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 3,
onSelect: function( selectedDate ) {
$( "#dpto" ).datepicker( "option", "minDate", selectedDate );
}
});
$( "#dpto" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 3,
onSelect: function( selectedDate ) {
$( "#dpfrom" ).datepicker( "option", "maxDate", selectedDate );
}
});
}
c.event_create_div.html(form);
$("#create_event_btn").hide();
c.event_create_div.show();
bindHandlers();
}
this.newCalendars = function(){
if($('.color-picker').length > 0){
$('.color-picker').miniColors(); // just in category view
}
$(".btn-del-a").live("ajax:success",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,pos){
var url = dom.attr("link");
c.event_quick_view_div.load(url,function(){
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();
})
c.event_quick_view_div.find(".bt-del").bind("ajax:success",function(){
c.event_quick_view_div.empty().hide();
dom.remove();
})
})
}
this.refresh = function(){
$(".destroy").remove();
switch (c.view){
case "week":
c.loadWeekView(c.cur_week,c.cur_year);
break;
case "month":
c.loadMonthView(c.cur_month,c.cur_year);
break;
case "day":
c.loadDayView(c.cur_date,c.cur_month,c.cur_year);
break;
}
}
c.initialize();
}

View File

@ -1,9 +0,0 @@
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery-ui
//= require basic/bootstrap
//= require calendarAPI

View File

@ -1,375 +0,0 @@
/* orbit calendar */
#orbit_calendar {
padding: 10px 8px;
min-width: 960px;
transition: all 0.3s ease;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
}
.calendar_color_tag {
display: inline-block;
width: 18px;
height: 18px;
margin-right: 4px;
vertical-align: bottom;
}
.current_day_title {
text-align: center;
line-height: 28px;
}
.calendar_mode {
z-index: 2;
}
.mode_switch {
text-transform: capitalize;
}
.today {
background-color: #D9EDF7;
}
.event {
font-size: 12px;
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;
}
.modal-body {
max-height: 450px;
}
.event_list_wrapper {
position: relative;
}
.event_list .cell {
height: 39px;
border: solid 1px #ddd;
border-top: 0;
}
.event_list .divide {
height: 19px;
margin-bottom: 18px;
border-bottom: solid 1px #eee;
}
.event_list .day_time {
height: 31px;
border-bottom: solid 1px #ddd;
border-left: solid 1px #ddd;
text-align: right;
padding: 4px;
}
.event dl, .event dt, .event dd {
margin: 0;
padding: 0;
}
.event dl {
padding: 3px;
}
.event dt {
font-size: 11px;
font-weight: normal;
line-height: 12px;
}
#calendar_day .event_holder {
width: 100%;
/*height: 100%;*/
position: absolute;
top: 0;
z-index: 1;
}
.event_holder .inner {
position: relative;
margin: 0 16px 0 2px;
}
.event_holder .event {
padding: 0px;
position: absolute;
width: 100%;
}
.event_holder .event.half {
}
.event_holder .event.over {
border: solid 1px #fff;
}
/* month view */
#calendar_month {
border-bottom: solid 1px #ddd;
}
#calendar_month .month_row {
position: relative;
border: solid 1px #ddd;
border-bottom: 0;
height: 60px;
overflow: hidden;
}
#calendar_month .month_row .table {
table-layout: fixed;
margin-bottom: 0;
width: 100%;
position: absolute;
}
#calendar_month .month_row .table td {
border: 0;
border-left: solid 1px #ddd;
padding: 2px 4px 0 4px;
}
#calendar_month .month_row .table td:first-child {
border-left: 0;
}
#calendar_month .month_row.header {
height: 28px;
border: 0;
}
#calendar_month .month_row.header th {
font-size: 12px;
padding: 4px;
border: 0;
}
#calendar_month .month_row .month_table {
height: 100%;
}
#calendar_month .month_row .month_date {
color: #666;
font-size: 11px;
cursor: pointer;
}
#calendar_month .month_row .month_date td {
border-left: 0
}
#calendar_month .month_row .month_date .day_title:hover {
text-decoration: underline;
}
#calendar_month .month_row td.today {
border-bottom: solid 1px #fff;
border-top: solid 1px #fff;
}
#calendar_month .month_row .event {
margin: 0 -2px;
position: relative;
color: #000;
}
#calendar_month .month_row .month_date .event:hover {
text-decoration: none !important;
}
#calendar_month .month_row td.disable {
background-color: #f6f6f6;
color: #ccc;
border-left: solid 1px #ddd;
}
#calendar_month .event.single {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
/* agenda view */
#calendar_agenda {
margin-top: 20px;
}
#calendar_agenda .table {
margin-bottom: 0;
}
#calendar_agenda .tiny_calendar {
border: solid 1px #eee;
}
#calendar_agenda .tiny_calendar .table th {
border-top: 0;
}
#calendar_agenda .tiny_calendar .table td {
text-align: center;
}
#calendar_agenda .event {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
#calendar_agenda .row-fluid {
margin-top: 20px;
padding-top: 20px;
border-top: dashed 1px #ddd;
}
#calendar_agenda .row-fluid:first-child {
border-top: 0;
padding-top: 0;
margin-top: 0;
}
#calendar_agenda .table.event_list .span2, #calendar_agenda .table.event_list thead th {
min-height: 0 !important;
height: 0 !important;
line-height: 0;
padding: 0;
}
.event_time {
font-family: Tahoma, sans-serif;
}
.has_event {
background-color: #08c;
color: #fff;
}
/* day view */
#calendar_day .header {
margin-bottom: 10px;
}
#calendar_day .header th {
text-align: center;
}
#calendar_day td {
border: 0;
}
#calendar_day .event {
margin-bottom: 2px;
}
#calendar_day .all_day_event {
background: #eee;
border: solid 1px #ddd;
}
#calendar_day .event_list .table {
border-top: solid 1px #ddd;
}
#calendar_day .event_list td {
padding: 0;
}
/* week view */
#calendar_week {
}
#calendar_week .cell_wrapper {
position: absolute;
width: 100%;
}
#calendar_week td {
padding: 0;
}
#calendar_week .table {
margin-bottom: 0;
}
#calendar_week .header {
margin-bottom: 12px;
border-top: 0;
table-layout: fixed;
}
#calendar_week .header th {
text-align: center;
font-size: 12px;
}
#calendar_week .header td {
border: solid 1px #ddd;
/*background-color: #eee;*/
}
#calendar_week .week_day {
padding: 0 2px;
border: solid 1px #ddd;
}
#calendar_week .header .week_day {
padding: 2px 4px 0px 2px;
}
#calendar_week .event_list .event {
position: absolute;
width: 100%;
margin-bottom: 2px;
}
#calendar_week .cell_map {
margin-bottom: 18px;
}
#calendar_week .cell_map td {
border-top: 0;
border-bottom: 0;
}
#calendar_week .cell_map tr:first-child td {
border-top: solid 1px #ddd;
}
#calendar_week .event_holder .inner {
margin: 0 8px 0 0;
}
#calendar_week .all_day_event_holder {
position: relative;
width: 100%;
table-layout: fixed;
}
#calendar_week .all_day_event_holder td {
border: 0;
background-color: transparent;
}
#calendar_week .all_day_event {
background: #eee;
}
/* calendars(category) */
.calendars_color_tag {
width: 20px;
height: 20px;
display: inline-block;
border-radius: 3px;
box-shadow: inset 0 -1px 0 rgba(0,0,0,0.2);
}
/* Event Controller */
.event_controller {
width: 350px;
}
.event_controller .row-fluid {
margin-bottom: 6px;
}
.event_controller .row-fluid .control-label {
line-height: 30px;
}
.close {
border: 0;
background: none;
}
/* miniColors tweak */
.miniColors-trigger {
width: 20px;
height: 20px;
margin-bottom: 10px;
margin-left: 10px;
border-color: #f1f1f1;
}
.miniColors-selector {
float: none;
margin: 4px 0 0 0;
}
/* category edit */
.edit_cal {
margin: -8px;
background-color: whitesmoke;
}
.edit_cal .table td, .edit_cal .table {
border: 0 !important;
background-color: transparent !important;
margin: 0 !important;
}
.main-list td {
border-top: solid 1px #ddd;
}
/* create / edit event panel */
#tags_panel {
top: auto;
bottom: 34px;
width: 258px;
height: 170px;
padding: 8px 0;
overflow: hidden;
position: absolute;
clear: none;
}
#tags_panel .viewport {
height: 170px;
}
#tags_panel .scrollbar {
top: 8px;
}
#tags_list {
padding: 8px;
}

View File

@ -1,8 +0,0 @@
/*
*This is a manifest file that'll automatically include all the stylesheets available in this directory
*and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
*the top of the compiled file, but it's generally better to create a new file per style scope.
*= font-awesome
*= calendar
*= bootstrap-responsive
*/

View File

@ -1,402 +0,0 @@
class Panel::Calendar::BackEnd::CalsController < OrbitBackendController
include AdminHelper
include Panel::Calendar::BackEnd::CalsHelper
before_filter :force_order_for_visitor,:except=>[:new,:edit,:update,:create,:destroy]
before_filter :force_order_for_user,:only => [:new,:edit,:update,:create,:destroy]
before_filter :for_app_sub_manager,:only => [:new,:edit,:update,:create,:destroy]
def index
@calendars = Cal.all
end
def new
@calendar = Cal.new
@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!
respond_to do |h|
h.js
end
end
def destroy
calendar = Cal.find(params[:id])
calendar.delete
render :json => {"success"=>"true"}.to_json
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
def week_view
week = params[:week].to_i
year = params[:year].to_i
@dates = week_dates(week,year)
@range = week_range(week,year)
@d = getWeekDataSet(week,year)
t = Time.now
dt = Date.new(t.year,t.month,t.day)
today_cur_week = dt.strftime("%U").to_i
if week == today_cur_week && t.year == year
@today = @d.index(t.day.to_s)
else
@today = 20
end
@hours = getHours(12)
render :layout => false
end
def month_view
month = params[:month].to_i
year = params[:year].to_i
t = Time.now
startday = monthStartDay(month,year)
@pre_disabled_days = startday - 1
if t.month == month && t.year == year
@today = @pre_disabled_days + t.day
else
@today = 50
end
cur_month_days = getMonthDays(year)
@post_disabled_days = @pre_disabled_days + cur_month_days[month]
@dateset = getDateSet(month,year,true)
render :layout => false
end
def agenda_view
@start_year = params[:s_year].to_i
@start_month = params[:s_month].to_i
@end_year = params[:e_year].to_i
@end_month = params[:e_month].to_i
t = Time.now
if !params[:s_year]
@start_year = t.year
end
if !params[:s_month]
@start_month = t.month
@end_month = t.month + 3
if @end_month > 12
@end_month = @end_month - 12
@end_year = @start_year + 1
end
end
startdt = Date.new(@start_year,@start_month,1)
temp = getMonthDays(@end_year)
enddt = Date.new(@end_year,@end_month,temp[@end_month])
diff = enddt - startdt
diff = diff.to_i / 30
@d_s_year = @start_year - 5
@datesets = Array.new
@calendartitle = Array.new
@events = Array.new
events = Event.all.asc(:start_date).desc(:total_days)
@calevents = Array.new
y = @start_year
m = @start_month
for i in 0..diff-1
if m == 13
m = 1
y = y + 1
end
@calendartitle << [m,y]
@datesets << getDateSet(m,y,false)
e = Array.new
h = Array.new
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(y,m)
if range === dt
no_of_days = event.total_days
start_date = event.start_date
if event.start_year < y
no_of_days = temp[m] - event.start_date
no_of_days += 1
temp = m + 12
if event.start_month < temp
start_date = 1
end
end
if event.end_year > y
no_of_days = temp[m] - event.start_date
no_of_days += 1
temp = m + 12
end
if event.end_month > m
no_of_days = temp[m] - event.start_date
no_of_days += 1
elsif event.end_month == m
no_of_days = event.end_date
end
if event.start_month == m && event.end_month == m
no_of_days = event.total_days
no_of_days += 1
end
if event.start_month < m
start_date = 1
end
if event.start_date == event.end_date
display_date = getDayName(event.start_date,event.start_month,event.start_year) + ", " + Date::ABBR_MONTHNAMES[event.start_month] + " " + event.start_date.to_s
else
display_date = getDayName(event.start_date,event.start_month,event.start_year) + ", " + Date::ABBR_MONTHNAMES[event.start_month].to_s + " " + event.start_date.to_s + " - " + getDayName(event.end_date,event.end_month,event.end_year) + ", " + Date::ABBR_MONTHNAMES[event.end_month] + " " + event.end_date.to_s
end
if event.all_day
display_time = "All Day"
else
x = event.start_time.to_i
if event.start_time > x
est = x.to_s + ":30"
else
est = x.to_s
end
x = event.end_time.to_i
if event.end_time > x
eet = x.to_s + ":30"
else
eet = x.to_s
end
display_time = est + " " + event.start_am_pm + " - " + eet + " " + event.end_am_pm
end
for c in start_date..(start_date + no_of_days - 1)
if h.index(c) == nil
h << c
end
end
color = Cal.find(event.cal_id).color
e << {"display_date"=>display_date,"show_link"=>panel_calendar_back_end_event_path(event), "display_time"=>display_time, "start_date"=>start_date,"end_date"=>event.end_date,"start_month"=>event.start_month,"end_month"=>event.end_month,"title" => event.title,"color"=>color}
end
end
@events << e
@calevents << h
m = m + 1
end
render :layout => false
end
def get_month_events
month = params[:month].to_i
year = params[:year].to_i
fromcalendars = params[:calendars]
# 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
# 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.where(:cal_id.in=>fromcalendars).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] - event.start_date
no_of_days += 1
elsif event.end_month == month
no_of_days = event.end_date
end
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 << {"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
render :json => @events.to_json
end
def get_week_events
week = params[:week].to_i
year = params[:year].to_i
fromcalendars = params[:calendars]
@d = getWeekDataSet(week,year)
events = Event.where(:cal_id.in=>fromcalendars).and(:start_week.lte => week).and(:start_year => year).and(:end_week.gte => week).asc(:start_week).asc(:start_date)
@events = Array.new
events.each_with_index do |event,i|
# @temp = Array.new
days = event.total_days.to_i + 1
colcount = 0
startdt = event.start_date
all_day = event.all_day
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 = @d.index(event.end_date.to_s).to_i + 1
days = 7;
startdt = event.start_date
end
end
color = Cal.find(event.cal_id).color
@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
fromcalendars = params[:calendars]
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
def week_number_test
events = Event.all
events.each do |event|
dt = Date.new(event.start_year,event.start_month,event.start_date)
sweeknumber = dt.strftime("%U")
dt = Date.new(event.end_year,event.end_month,event.end_date)
eweeknumber = dt.strftime("%U")
event.start_week = sweeknumber
event.end_week = eweeknumber
event.save!
end
dt = Date.new(2012,10,4)
@week = dt.strftime("%U")
render :text => @week.to_s
end
end

View File

@ -1,222 +0,0 @@
class Panel::Calendar::BackEnd::EventsController < OrbitBackendController
include Panel::Calendar::BackEnd::CalsHelper
def new
@calendars = Cal.all
@event = Event.new
if params[:ref] == "add-btn"
@all_day_disabled = true
else
@all_day_disabled = false
end
@hours = getHoursForForm
if params[:time]
@hours.each_with_index do |h,i|
if h['val'].to_s == params[:time].to_s
@sindex = i
@eindex = i + 2
break
end
end
else
@sindex = 16
@eindex = 18
end
@ampm = Array.new
@ampm << "AM"
@ampm << "PM"
if params[:ses]
@sampm = params[:ses]
@eampm = params[:ses]
if @eindex >= 22
@eampm = "PM"
end
end
@placeholder = params[:month]+"/"+params[:date]+"/"+params[:year]
render :layout => false
end
def edit
@calendars = Cal.all
@event = Event.find(params[:id])
if @event.all_day
@all_day_disabled = true
else
@all_day_disabled = false
end
@hours = getHoursForForm
@ampm = Array.new
@ampm << "AM"
@ampm << "PM"
render :layout => false
end
def create
title = params[:event][:title]
note = params[:event][:note]
$start = params[:start_date]
$end = params[:end_date]
$starttime = params[:start_time]
$endtime = params[:end_time]
temp = $start.split("/")
start_month = temp[0]
start_date = temp[1]
start_year = temp[2]
@m = start_month
@y = start_year
temp = $end.split("/")
end_month = temp[0]
end_date = temp[1]
end_year = temp[2]
start_am_pm = params[:start_am_pm]
end_am_pm = params[:end_am_pm]
if params[:event][:cal_id]
cal_id = params[:event][:cal_id]
else
cal_id = Cal.first.id.to_s
end
# if start_am_pm == "PM"
# temp_start_time = $starttime + 12
# end
# if end_am_pm == "PM"
# temp_end_time = $endtime + 12
# end
if params[:all_day]
all_day = true
$starttime = 0
$endtime = 0
else
all_day = false
end
final_start_time = Date.new(start_year.to_i,start_month.to_i,start_date.to_i)
final_end_time = Date.new(end_year.to_i,end_month.to_i,end_date.to_i)
start_week = final_start_time.strftime("%U")
start_week = start_week.to_i + 1
end_week = final_end_time.strftime("%U")
end_week = end_week.to_i + 1
total_days = final_end_time - final_start_time
@event = Event.new
@event.title = title
@event.note = note
@event.start_year = start_year
@event.end_year = end_year
@event.start_month = start_month
@event.end_month = end_month
@event.start_date = start_date
@event.end_date = end_date
@event.start_time = $starttime
@event.start_am_pm = start_am_pm
@event.end_time = $endtime
@event.end_am_pm = end_am_pm
@event.cal_id = cal_id
@event.final_start_time = final_start_time
@event.final_end_time = final_end_time
@event.total_days = total_days
@event.start_week = start_week
@event.end_week = end_week
@event.all_day = all_day
@event.save!
respond_to do |h|
h.js
end
end
def update
title = params[:event][:title]
note = params[:event][:note]
$start = params[:start_date]
$end = params[:end_date]
$starttime = params[:start_time]
$endtime = params[:end_time]
temp = $start.split("/")
start_month = temp[0]
start_date = temp[1]
start_year = temp[2]
@m = start_month
@y = start_year
temp = $end.split("/")
end_month = temp[0]
end_date = temp[1]
end_year = temp[2]
start_am_pm = params[:start_am_pm]
end_am_pm = params[:end_am_pm]
cal_id = params[:event][:cal_id]
# if start_am_pm == "PM"
# temp_start_time = $starttime + 12
# end
# if end_am_pm == "PM"
# temp_end_time = $endtime + 12
# end
if params[:event][:cal_id]
cal_id = params[:event][:cal_id]
else
cal_id = Cal.first.id.to_s
end
if params[:all_day]
all_day = true
$starttime = 0
$endtime = 0
else
all_day = false
end
final_start_time = Date.new(start_year.to_i,start_month.to_i,start_date.to_i)
final_end_time = Date.new(end_year.to_i,end_month.to_i,end_date.to_i)
start_week = final_start_time.strftime("%U")
start_week = start_week.to_i + 1
end_week = final_end_time.strftime("%U")
end_week = end_week.to_i + 1
total_days = final_end_time - final_start_time
@event = Event.find(params[:id])
@event.title = title
@event.note = note
@event.start_year = start_year
@event.end_year = end_year
@event.start_month = start_month
@event.end_month = end_month
@event.start_date = start_date
@event.end_date = end_date
@event.start_time = $starttime
@event.start_am_pm = start_am_pm
@event.end_time = $endtime
@event.end_am_pm = end_am_pm
@event.cal_id = cal_id
@event.final_start_time = final_start_time
@event.final_end_time = final_end_time
@event.total_days = total_days
@event.start_week = start_week
@event.end_week = end_week
@event.all_day = all_day
@event.save!
respond_to do |h|
h.js
end
end
def show
@event = Event.find(params[:id])
@start_month_name = Date::ABBR_MONTHNAMES[@event.start_month]
@end_month_name = Date::ABBR_MONTHNAMES[@event.end_month]
@start_day_name = getDayName(@event.start_date,@event.start_month,@event.start_year)
@end_day_name = getDayName(@event.end_date,@event.end_month,@event.end_year)
render :layout=>false
end
def destroy
event = Event.find(params[:id])
event.delete
render :json => {"success"=>"true"}.to_json
end
end

View File

@ -1,211 +0,0 @@
module Panel::Calendar::BackEnd::CalsHelper
def monthStartDay(month,year)
dt = Date.new(year,month,1)
startday = dt.wday + 1
return startday
end
def getDateSet(month,year,prepost)
dateset = Array.new
startday = monthStartDay(month,year)
monthsdays = getMonthDays(year)
cur_month_days = monthsdays[month]
next_month_days = monthsdays[month+1]
prev_month_days = monthsdays[month-1]
prev_month_days_to_add = startday - 1
i = prev_month_days_to_add
while i > 0 do
i -= 1
if prepost
dateset << prev_month_days - i
else
dateset << "NaN"
end
end
i = 0
while i < cur_month_days do
dateset << i + 1
i += 1
end
total_days = 42
if !prepost
if (prev_month_days_to_add + cur_month_days) < 35
total_days = 35
end
end
next_month_days_to_add = total_days - (prev_month_days_to_add + cur_month_days)
i = 0
while i < next_month_days_to_add do
if prepost
dateset << i + 1
else
dateset << "NaN"
end
i += 1
end
return dateset
end
def getMonthDays(year)
monthsdays = Array.new
monthsdays << 0
monthsdays << 31
if Date.new(year).leap?
monthsdays << 29
else
monthsdays << 28
end
monthsdays << 31
monthsdays << 30
monthsdays << 31
monthsdays << 30
monthsdays << 31
monthsdays << 31
monthsdays << 30
monthsdays << 31
monthsdays << 30
monthsdays << 31
return monthsdays
end
def getDayName(date,month,year)
date = date.to_i
month = month.to_i
year = year.to_i
dt = Date.new(year,month,date)
name = Date::ABBR_DAYNAMES[dt.wday]
return name
end
def week_dates(week_num,year)
year = year.to_i
week_num = week_num.to_i
dates = Array.new
if week_num == 1
weekstartday = monthStartDay(1,year)
d = 31
x = 0
for i in d - (weekstartday - 2)..d
dates << Date::ABBR_DAYNAMES[x] + " 12/" + i.to_s
x = x + 1
end
for i in 1..8 - weekstartday
dates << Date::ABBR_DAYNAMES[x] + " 1/" + i.to_s
x = x + 1
end
else
week_start = Date.commercial(year, week_num-1, 7)
month = week_start.strftime("%m")
month_days = getMonthDays(year)
date = week_start.strftime("%d")
x = date.to_i
for i in 0..6
d = x + i
if d > month_days[month.to_i]
d = d - month_days[month.to_i]
end
dates << Date::ABBR_DAYNAMES[i] + " " + month + "/" + d.to_s
end
end
dates
end
def week_range(week_num,year)
year = year.to_i
week_num = week_num.to_i
if week_num == 1
weekstartday = monthStartDay(1,year)
start_date = 31 - (weekstartday - 2)
start_year = year - 1
end_date = 8 - weekstartday
range = "Dec " + start_date.to_s + ", " + start_year.to_s + " - " + "Jan " + end_date.to_s + ", " + year.to_s
else
week_start = Date.commercial(year, week_num-1, 7)
week_end = Date.commercial(year, week_num, 7)
week_end = week_end - 1
start_date = week_start.strftime("%d")
end_date = week_end.strftime("%d")
start_month = week_start.strftime("%m")
end_month = week_end.strftime("%m")
if end_month == start_month
range = Date::ABBR_MONTHNAMES[start_month.to_i] + " " + start_date.to_s + " - " + end_date.to_s + ", " + week_start.strftime("%Y").to_s
else
range = Date::ABBR_MONTHNAMES[start_month.to_i] + " " + start_date.to_s + " - " + Date::ABBR_MONTHNAMES[end_month.to_i] + " " + end_date.to_s + ", " + week_start.strftime("%Y").to_s
end
end
range
end
def getWeekDataSet(week_num,year)
year = year.to_i
week_num = week_num.to_i
dates = Array.new
if week_num == 1
weekstartday = monthStartDay(1,year)
d = 31
x = 0
for i in d - (weekstartday - 2)..d
dates << i.to_s
x = x + 1
end
for i in 1..8 - weekstartday
dates << i.to_s
x = x + 1
end
else
week_start = Date.commercial(year, week_num-1, 7)
month = week_start.strftime("%m")
month_days = getMonthDays(year)
date = week_start.strftime("%d")
x = date.to_i
for i in 0..6
d = x + i
if d > month_days[month.to_i]
d = d - month_days[month.to_i]
end
dates << d.to_s
end
end
dates
end
def getHours(format)
hours = Array.new
if format == 12
hours << 12
for i in 1..11
hours << i
end
elsif format == 24
for i in 0..23
hours << i
end
end
hours
end
def getHoursForForm
hours = Array.new
for i in 1..12
hours << {"val"=>i,"title"=>i.to_s+":00"}
hours << {"val"=>i+0.5,"title"=>i.to_s+":30"}
end
hours
end
end

View File

@ -1,11 +0,0 @@
class Cal
include Mongoid::Document
include Mongoid::Timestamps
include OrbitTag::Taggable
field :name, localize: true
field :color
has_many :events, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :events, :allow_destroy => true
end

View File

@ -1,26 +0,0 @@
class Event
include Mongoid::Document
include Mongoid::Timestamps
field :title
field :note
field :start_year, type: Integer
field :end_year, type: Integer
field :start_month, type: Integer
field :end_month, type: Integer
field :start_date, type: Integer
field :end_date, type: Integer
field :start_time, type: Float
field :start_am_pm
field :end_time, type: Float
field :end_am_pm
field :start_week, type: Integer
field :end_week, type: Integer
field :final_start_time, type: Date
field :final_end_time, type: Date
field :total_days, type: Integer
field :all_day, type: Boolean
belongs_to :cal
end

View File

@ -1,19 +0,0 @@
<tr class="with_action" for="<%= calendar.id.to_s %>">
<td>
<span class="calendars_color_tag" style="background-color: <%= calendar.color %>"></span>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t(:edit), edit_panel_calendar_back_end_cal_path(calendar), :remote => true, :class=>"btn-edit-a", :for => calendar.id %></li>
<li><%= link_to t(:delete_), panel_calendar_back_end_cal_path(calendar), :method => "delete",:remote => true, :confirm => t("sure?"),:class=>"btn-del-a", "data-content"=>calendar.id.to_s %></li>
</ul>
</div>
</td>
<% @site_valid_locales.each do |locale| %>
<td>
<%= calendar.name_translations[locale] %>
</td>
<% end %>
</tr>
<tr class="with_action">
<td colspan="3" id="edit_area_<%= calendar.id %>" style="display:none;"></td>
</tr>

View File

@ -1,110 +0,0 @@
<div id="agenda_date_range" style="display:none;">
<label>From</label> <select name="start_month" class='input-small'>
<% for i in 1..12 %>
<% if i == @start_month %>
<option value="<%= i %>" selected="selected"><%= Date::MONTHNAMES[i] %></option>
<% else %>
<option value="<%= i %>"><%= Date::MONTHNAMES[i] %></option>
<% end %>
<% end %>
</select>
<select name="start_year" class='input-small'>
<% for i in 1..10 %>
<% if (@d_s_year + i) == @start_year %>
<option value="<%= @d_s_year + i %>" selected="selected"><%= @d_s_year + i %></option>
<% else %>
<option value="<%= @d_s_year + i %>"><%= @d_s_year + i %></option>
<% end %>
<% end %>
</select>
<label>To</label> <select name="end_month" class='input-small'>
<% for i in 1..12 %>
<% if i == @end_month %>
<option value="<%= i %>" selected="selected"><%= Date::MONTHNAMES[i] %></option>
<% else %>
<option value="<%= i %>"><%= Date::MONTHNAMES[i] %></option>
<% end %>
<% end %>
</select>
<select name="end_year" class='input-small'>
<% for i in 1..10 %>
<% if (@d_s_year + i) == @end_year %>
<option value="<%= @d_s_year + i %>" selected="selected"><%= @d_s_year + i %></option>
<% elsif (@d_s_year + i) <= @start_year %>
<option value="<%= @d_s_year + i %>" disabled='disabled'><%= @d_s_year + i %></option>
<% else %>
<option value="<%= @d_s_year + i %>"><%= @d_s_year + i %></option>
<% end %>
<% end %>
</select>
<button class="btn bt-filter">Show Events</button>
</div>
<div id="calendar_agenda">
<% @datesets.each_with_index do |dateset,i| %>
<div class="row-fluid">
<div class="span4">
<h4><%= Date::MONTHNAMES[@calendartitle[i][0]] + " - " + @calendartitle[i][1].to_s %></h4>
<div class="tiny_calendar">
<table class="table">
<tr>
<th class="week_title">Sun</th>
<th class="week_title">Mon</th>
<th class="week_title">Tue</th>
<th class="week_title">Wed</th>
<th class="week_title">Thu</th>
<th class="week_title">Fri</th>
<th class="week_title">Sat</th>
</tr>
<% x = 0 %>
<% dateset.each do |date| %>
<% x = x + 1 %>
<% if x == 1 %>
<tr>
<% end %>
<td <%= (@calevents[i].index(date.to_i) != nil ? "class=has_event" : "") %> ><%= (date=="NaN"? "" : date ) %></td>
<% if x == 7 %>
<% x = 0 %>
</tr>
<% end %>
<% end %>
<!-- <td class="has_event">13</td> -->
</table>
</div>
</div>
<div class="span8">
<table class="table event_list">
<thead>
<tr height="0">
<th class="span3"></th>
<th class="span2"></th>
<th class=""></th>
</tr>
</thead>
<tbody>
<% lastday = "" %>
<% if @events[i].count > 0 %>
<% @events[i].each do |event| %>
<tr>
<th>
<% if event['display_date'] != lastday %>
<%= event['display_date'] %>
<% end %>
</th>
<td class="event_time"><%= event['display_time'] %></td>
<td>
<div class="event" link="<%= event['show_link'] %>" style="color: <%= event['color'] %>;"><%= event['title'] %></div>
</td>
</tr>
<% lastday = event['display_date'] %>
<% end %>
<% else %>
<tr>
<td colspan='3'>No events for this month.</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
<% end %>
</div>

View File

@ -1 +0,0 @@
$("#calendar_list").prepend("<%= j render :partial=>'calendar', :object=>@calendar %>");

View File

@ -1,79 +0,0 @@
<div id="calendar_day">
<table class="table header">
<tr>
<th class="span1"></th>
<th>
<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 cla ss="event" style="background-color: #ffcc00;">event2</div> -->
</td>
</tr>
</table>
<div class="event_list">
<table class="table">
<tr>
<td style="width: 60px;">
<% @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 click_event" time="<%= hour.to_s+".5" %>" ref="add-btn" link="<%= new_panel_calendar_back_end_event_path %>" date="<%= @date.to_s %>" ses="AM">
<div class="divide click_event" time="<%= hour %>" ref="add-btn" link="<%= new_panel_calendar_back_end_event_path %>" date="<%= @date.to_s %>" ses="AM"></div>
</div>
<% end %>
<% @hours.each do |hour| %>
<div class="cell click_event" time="<%= hour.to_s+".5" %>" ref="add-btn" link="<%= new_panel_calendar_back_end_event_path %>" date="<%= @date.to_s %>" ses="PM">
<div class="divide click_event" time="<%= hour %>" ref="add-btn" link="<%= new_panel_calendar_back_end_event_path %>" date="<%= @date.to_s %>" ses="PM"></div>
</div>
<% end %>
<div class="event_holder">
<!-- <div class="inner">
<div class="event" style="background-color: #66cc00; top: 0;">
<dl>
<dt>10:30am - 11:00am</dt>
<dd>template</dd>
</dl>
</div>
<div class="event" style="background-color: #00aacc; top: 39px;">
<dl>
<dt>10:30am - 11:00am</dt>
<dd>template</dd>
</dl>
</div>
<div class="event half" style="background-color: #ccffee; top: 117px;">
<dl>
<dt>10:30am - template</dt>
<dd></dd>
</dl>
</div>
<div class="event" style="background-color: #00ffee; top: 195px; width: 85%;">
<dl>
<dt>10:30am - 11:00am</dt>
<dd>template</dd>
</dl>
</div>
<div class="event over" style="background-color: #00ccee; top: 214px; left: 50%; width: 50%;">
<dl>
<dt>10:30am - 11:00am</dt>
<dd>template</dd>
</dl>
</div>
</div> -->
</div>
</div>
</td>
</tr>
</table>
</div>
</div>

View File

@ -1,23 +0,0 @@
<%= form_for @calendar, :url => panel_calendar_back_end_cal_path(@calendar), :remote => true do |f| %>
<table class="table" style="table-layout: fixed;">
<tr>
<td>
<!--<%= label_tag("color", t("calendar.color")) %>-->
<%= f.text_field :color, :class => "color-picker miniColors input-small", :maxlength => "5", :autocomplete=>"off",:value=>@calendar.color %>
</td>
<%= f.fields_for :name_translations do |name| %>
<% @site_valid_locales.each_with_index do |locale, i| %>
<td class="form-inline">
<%= name.text_field locale, :class => "input-large", :value=>@calendar.name_translations[locale] %>
</td>
<% end %>
<% end %>
</tr>
<tr>
<td colspan="3">
<%= f.submit t("calendar.save"), :class=>"btn btn-primary" %>
<button class="btn btn-primary bt-cancel" for="<%= @calendar.id %>">Cancel</button>
</td>
</tr>
</table>
<% end %>

View File

@ -1,82 +0,0 @@
<%= stylesheet_link_tag "font-awesome" %>
<%= stylesheet_link_tag "bootstrap-responsive" %>
<%= stylesheet_link_tag "calendar" %>
<%= javascript_include_tag "cals" %>
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.9.0/themes/cupertino/jquery-ui.css">
<div id="filter" class="subnav">
<ul class="nav nav-pills filter">
<li class="accordion-group">
<div class="accordion-heading">
<a href="#collapse-categories" data-toggle="collapse" data-parent=".filters" class="accordion-toggle"><span class="" title="">Calendar</span> <b class="web-symbol"></b></a>
</div>
</li>
</ul>
<div class="filters">
<div class="accordion-body collapse" id="collapse-categories">
<div class="accordion-inner filter_btns cats" data-toggle="buttons-checkbox">
<% @calendars.each do |calendar| %>
<a href="<%= calendar.id.to_s %>" class="btn active calendar-filter-btn" onclick="return false;"><span class="calendar_color_tag" style="background-color: <%= calendar.color %>;" ></span><%= calendar.name %></a>
<% end %>
</div>
<div class="filter-clear">
<a href="" class="btn" onclick="return false;" for="cats"><i class="icons-cycle"></i>Clear</a>
</div>
</div>
</div>
</div>
<div id="orbit_calendar" class="month_view">
<div class="row-fluid cal-fn">
<div class="span3" id='sec1'>
<div class="btn-toolbar" id="navigation" style="margin:0;">
<div class="btn-group">
<button class="btn" id="today_btn">Today</button>
</div>
<div class="btn-group">
<button class="btn" id="prev_month_btn"><span class="icon-chevron-left"></span></button>
<button class="btn" id="next_month_btn"><span class="icon-chevron-right"></span></button>
</div>
</div>
<div class="form-inline" id="range_selection" style="display:none;margin:0;">
</div>
</div>
<div class="span5" id='sec2'>
<h4 class="current_day_title"></h4>
</div>
<div class="span4" id='sec3'>
<div class="btn-toolbar" style="margin:0; text-align:right;">
<div class="btn-group calendar_mode" data-toggle="buttons-radio">
<button class="btn mode_switch">day</button>
<button class="btn mode_switch">week</button>
<button class="btn active mode_switch">month</button>
<button class="btn mode_switch">agenda</button>
</div>
<div class="btn-group">
<button id="refresh_btn" class="btn icon-refresh"></button>
</div>
</div>
</div>
</div>
<div id="view_holder"></div>
</div>
<% if is_manager? %>
<div class="form-actions form-fixed">
<div class="row-fluid">
<div class="span8">
</div>
<%if is_manager?%>
<div class="span4">
<%= link_to "Add", new_panel_calendar_back_end_event_path, :class => "btn btn-primary pull-right", :id=>"create_event_btn", :ref=>"add-btn" %>
</div>
</div>
</div>
<%end%>
<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; display:none; margin:0 0 0 0;"></div>
<script type="text/javascript">
var calendar = new calendarAPI();
</script>
<%end%>

View File

@ -1,58 +0,0 @@
<div id="calendar_month">
<div class="month_row header">
<table class="table">
<tr>
<th>Sun</th>
<th>Mon</th>
<th>Tue</th>
<th>Wed</th>
<th>Thu</th>
<th>Fri</th>
<th>Sat</th>
</tr>
</table>
</div>
<% i = 0 %>
<% day_count_for_title = 0 %>
<% day_count_for_space = 0 %>
<% while i < 6 %>
<div class="month_row">
<table class="table month_table">
<tr>
<% x = 0 %>
<% while x < 7 %>
<% if day_count_for_space < @pre_disabled_days %>
<td class="disable"></td>
<% elsif day_count_for_space >= @post_disabled_days %>
<td class="disable"></td>
<% elsif day_count_for_space == @today-1 %>
<td class="today"></td>
<% else %>
<td></td>
<% end %>
<% day_count_for_space += 1 %>
<% x += 1 %>
<% end %>
</tr>
</table>
<table class="table month_date" row="<%= i+1 %>">
<tr>
<% x = 0 %>
<% while x < 7 %>
<% if day_count_for_title < @pre_disabled_days %>
<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 %>
<td class="day_title disable" no="<%= day_count_for_title+1 %>"><%= @dateset[day_count_for_title] %></td>
<% 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 %>" no="<%= day_count_for_title+1 %>"><%= @dateset[day_count_for_title] %></td>
<% end %>
<% day_count_for_title += 1 %>
<% x += 1 %>
<% end %>
</tr>
</table>
</div>
<% i += 1 %>
<% end %>
</div>

View File

@ -1,69 +0,0 @@
<%= stylesheet_link_tag "jquery.miniColors" %>
<%= stylesheet_link_tag "calendar" %>
<%= stylesheet_link_tag "bootstrap-responsive" %>
<%= javascript_include_tag "jquery.miniColors.min" %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "calendarAPI" %>
<% end %>
<div id="filter" class="subnav">
<div class="filters">
<div id="sort_headers" class="table-label">
<table class="table main-list">
<thead>
<tr>
<th class="span2"><span class="" title="">Color</span></th>
<th class="span2">English</th>
<th class="span2">Chinese</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
<table id="calendars" class="table main-list">
<thead>
<tr>
<th class="span2"></th>
<th class="span2"></th>
<th class="span2"></th>
</tr>
</thead>
<tbody id="calendar_list">
<%= render :partial => "calendar", :collection => @calendars %>
</tbody>
</table>
<div id="form">
<%= form_for @calendar, :url => {:action => "create"}, :remote => true do |f| %>
<h2>Add</h2>
<div class="row-fluid">
<div class="span2">
<%= label_tag("color", t("calendar.color")) %>
<%= f.text_field :color, :class => "color-picker miniColors span5", :size => "7", :maxlength => "7", :autocomplete=>"off",:value=>"9100FF" %>
</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" %>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="form-actions form-fixed pagination-right">
<%= f.submit t("calendar.save"), :class=>"btn btn-primary" %>
</div>
<% end %>
</div>
<script type="text/javascript">
var calendar = new calendarAPI()
calendar.newCalendars();
</script>

View File

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

View File

@ -1,169 +0,0 @@
<div id="week_range" style="display:none;" ><%= @range %></div>
<div id="calendar_week">
<table class="table header">
<tr>
<th style="width: 44px;"></th>
<% @dates.each_with_index do |day,i| %>
<% if @today == i %>
<th class='today'><%= day %></th>
<% else %>
<th><%= day %></th>
<% end %>
<% end %>
</tr>
<tr>
<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>
<% else %>
<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>
<dd></dd>
</dl>
</div> -->
<!-- <td class="all_day_event week_day">
</td>
<td class="all_day_event week_day"></td>
<td class="all_day_event week_day">
<div class="event half" style="background-color: #ccffee;">
<dl>
<dt>10:30am - template</dt>
<dd></dd>
</dl>
</div>
</td>
<td class="all_day_event week_day"></td>
<td class="all_day_event week_day"></td>
<td class="all_day_event week_day"></td> -->
</tr>
</table>
<div class="event_list">
<table class="table cell_map">
<tr height="0">
<td style="width: 60px;"></td>
<td colspan="7">
<div class="event_list_wrapper">
<div class="cell_wrapper">
<% @hours.each do |hour| %>
<div class="cell click_event" time="<%= hour.to_s+".5" %>" ref="add-btn" link="<%= new_panel_calendar_back_end_event_path %>" date="<%= @date.to_s %>" ses="AM">
<div class="divide click_event" time="<%= hour %>" ref="add-btn" link="<%= new_panel_calendar_back_end_event_path %>" date="<%= @date.to_s %>" ses="AM"></div>
</div>
<% end %>
<% @hours.each do |hour| %>
<div class="cell click_event" time="<%= hour.to_s+".5" %>" ref="add-btn" link="<%= new_panel_calendar_back_end_event_path %>" date="<%= @date.to_s %>" ses="PM">
<div class="divide click_event" time="<%= hour %>" ref="add-btn" link="<%= new_panel_calendar_back_end_event_path %>" date="<%= @date.to_s %>" ses="PM"></div>
</div>
<% end %>
</div>
</div>
</td>
</tr>
<tr>
<td>
<% @hours.each do |hour| %>
<div class="day_time"><%= hour %>am</div>
<% end %>
<% @hours.each do |hour| %>
<div class="day_time"><%= hour %>pm</div>
<% end %>
<!-- <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">12pm</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>
<% @d.each_with_index do |dt,i| %>
<% if i == @today %>
<td class="week_day today week_day_body" date='<%= dt %>'>
<% else %>
<td class="week_day week_day_body" date='<%= dt %>'>
<% end %>
<div class="event_holder">
<div class="inner">
</div>
</div>
</td>
<% end %>
<!-- <td class="week_day">
<div class="event_holder">
<div class="inner">
</div>
</div>
</td>
<td class="week_day today">
<div class="event_holder">
<div class="inner">
<div class="event" style="background-color: #ccffee; top: 117px;">
<dl>
<dt>10:30am - 11:00am</dt>
<dd>template</dd>
</dl>
</div>
</div>
</div>
</td>
<td class="week_day">
<div class="event_holder">
<div class="inner">
</div>
</div>
</td>
<td class="week_day">
<div class="event_holder">
<div class="inner">
</div>
</div>
</td>
<td class="week_day">
<div class="event_holder">
<div class="inner">
</div>
</div>
</td>
<td class="week_day">
<div class="event_holder">
<div class="inner">
</div>
</div>
</td> -->
</tr>
</table>
</div>
</div>

View File

@ -1,14 +0,0 @@
$("#event_create").empty().hide();
$("#create_event_btn").removeClass("active");
$(".destroy").remove();
switch (c.view){
case "week":
c.loadWeekView(c.cur_week,c.cur_year);
break;
case "month":
c.loadMonthView(c.cur_month,c.cur_year);
break;
case "day":
c.loadDayView(c.cur_date,c.cur_month,c.cur_year);
break;
}

View File

@ -1,133 +0,0 @@
<div class="modal-body">
<div class="event_controller">
<!-- <form class="form-horizontal"> -->
<%= form_for @event, :url =>panel_calendar_back_end_event_path(@event), :class=>"form-horizontal", :remote => true do |f| %>
<div class="row-fluid">
<button type="button" class="close btn-close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="row-fluid">
<%= f.text_field :title, :class=>"span12", :placeholder => "Event Name",:value=>@event.title %>
</div>
<div class="row-fluid">
<label class="checkbox inline">
<input type="checkbox" name="all_day" for="all_day" <%= @event.all_day == true ? "checked='checked'" : "" %> > All day
</label>
<label class="checkbox inline">
<input type="checkbox"> Repeat
</label>
</div>
<% if !@event.all_day %>
<div id="non_all_day">
<div class="row-fluid">
<label class="control-label span3">From</label>
<div class="row-fluid span9">
<input class="span5" id="dpfrom" type="text" value="<%= @event.start_month.to_s + "/" + @event.start_date.to_s + "/" + @event.start_year.to_s %>" name="start_date">
<select name="start_time" class="span4">
<% @hours.each_with_index do |hour,i| %>
<% if hour['val'] == @event.start_time %>
<option value="<%= hour['val'] %>" selected="selected"><%= hour['title'] %></option>
<% else %>
<option value="<%= hour['val'] %>" ><%= hour['title'] %></option>
<% end %>
<% end %>
</select>
<select name="start_am_pm" class="span3">
<% @ampm.each do |a| %>
<% if @event.start_am_pm == a %>
<option value="<%= a %>" selected="selected"><%= a %></option>
<% else %>
<option value="<%= a %>"><%= a %></option>
<% end %>
<% end %>
</select>
</div>
</div>
<div class="row-fluid">
<label class="control-label span3">To</label>
<div class="row-fluid span9">
<input class="span5" id="dpto" type="text" value="<%= @event.end_month.to_s + "/" + @event.end_date.to_s + "/" + @event.end_year.to_s %>" name="end_date">
<select name="end_time" class="span4">
<% @hours.each_with_index do |hour,i| %>
<% if hour['val'] == @event.end_time %>
<option value="<%= hour['val'] %>" selected="selected"><%= hour['title'] %></option>
<% else %>
<option value="<%= hour['val'] %>" ><%= hour['title'] %></option>
<% end %>
<% end %>
</select>
<select name="end_am_pm" class="span3">
<% @ampm.each do |a| %>
<% if @event.end_am_pm == a %>
<option value="<%= a %>" selected="selected"><%= a %></option>
<% else %>
<option value="<%= a %>"><%= a %></option>
<% end %>
<% end %>
</select>
</div>
</div>
</div>
<% else %>
<div id="non_all_day" style="display:none;">
<div class="row-fluid">
<label class="control-label span3">From</label>
<div class="row-fluid span9">
<input class="span5" id="dpfrom" type="text" value="" name="start_date">
<select name="start_time" class="span4">
<% @hours.each_with_index do |hour,i| %>
<% if i == 16 %>
<option value="<%= hour['val'] %>" selected="selected"><%= hour['title'] %></option>
<% else %>
<option value="<%= hour['val'] %>" ><%= hour['title'] %></option>
<% end %>
<% end %>
</select>
<select name="start_am_pm" class="span3">
<option value="AM">AM</option>
<option value="PM">PM</option>
</select>
</div>
</div>
<div class="row-fluid">
<label class="control-label span3">To</label>
<div class="row-fluid span9">
<input class="span5" id="dpto" type="text" name="end_date" value="<%= @placeholder %>" placeholder="<%= @placeholder %>">
<select name="start_time" class="span4">
<% @hours.each_with_index do |hour,i| %>
<% if i == 18 %>
<option value="<%= hour['val'] %>" selected="selected"><%= hour['title'] %></option>
<% else %>
<option value="<%= hour['val'] %>" ><%= hour['title'] %></option>
<% end %>
<% end %>
</select>
<select name="end_am_pm" class="span3">
<option value="AM">AM</option>
<option value="PM">PM</option>
</select>
</div>
</div>
</div>
<% end %>
<div class="row-fluid">
<label for="" class="control-label span3">Calendars</label>
<div class="row-fluid span9">
<%= f.select(:cal_id, Cal.all.collect {|p| [ p.name, p.id ] },{:prompt => t("calendar.select_calendar")},:class => "validate", :selected => @event.cal_id) %>
</div>
</div>
<div class="row-fluid">
<label for="" class="control-label span3">Note</label>
<div class="row-fluid span9">
<%= f.text_area :note, :class=>"span12", :cols=>"30", :rows=>"3", :value => @event.note %>
</div>
</div>
<div class="row-fluid">
<div class="span9 offset3">
<button class="btn btn-close">Cancel</button>
<%= f.submit t("calendar.save"), :class=>"btn" %>
</div>
</div>
<% end %>
<!-- </form> -->
</div>
</div>

View File

@ -1,121 +0,0 @@
<div class="modal-body">
<div class="event_controller">
<!-- <form class="form-horizontal"> -->
<%= form_for @event, :url =>{:action => :create}, :class=>"form-horizontal", :remote => true do |f| %>
<div class="row-fluid">
<button type="button" class="close btn-close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="row-fluid">
<%= f.text_field :title, :class=>"span12", :placeholder => "Event Name" %>
</div>
<div class="row-fluid">
<% if !@all_day_disabled %>
<label class="checkbox inline">
<input type="checkbox" name="all_day" for="all_day"> All day
</label>
<% end %>
<label class="checkbox inline">
<input type="checkbox"> Repeat
</label>
</div>
<div id="non_all_day">
<div class="row-fluid">
<label class="control-label span3">From</label>
<div class="row-fluid span9">
<input class="span5" id="dpfrom" type="text" value="<%= @placeholder %>" name="start_date" placeholder="<%= @placeholder %>">
<select name="start_time" class="span4">
<% @hours.each_with_index do |hour,i| %>
<% if i == @sindex %>
<option value="<%= hour['val'] %>" selected="selected"><%= hour['title'] %></option>
<% else %>
<option value="<%= hour['val'] %>" ><%= hour['title'] %></option>
<% end %>
<% end %>
</select>
<select name="start_am_pm" class="span3">
<% @ampm.each do |a| %>
<% if @sampm == a %>
<option value="<%= a %>" selected="selected"><%= a %></option>
<% else %>
<option value="<%= a %>"><%= a %></option>
<% end %>
<% end %>
</select>
</div>
</div>
<div class="row-fluid">
<label class="control-label span3">To</label>
<div class="row-fluid span9">
<input class="span5" id="dpto" type="text" name="end_date" value="<%= @placeholder %>" placeholder="<%= @placeholder %>">
<select name="end_time" class="span4">
<% @hours.each_with_index do |hour,i| %>
<% if i == @eindex %>
<option value="<%= hour['val'] %>" selected="selected"><%= hour['title'] %></option>
<% else %>
<option value="<%= hour['val'] %>" ><%= hour['title'] %></option>
<% end %>
<% end %>
</select>
<select name="end_am_pm" class="span3">
<% @ampm.each do |a| %>
<% if @eampm == a %>
<option value="<%= a %>" selected="selected"><%= a %></option>
<% else %>
<option value="<%= a %>"><%= a %></option>
<% end %>
<% end %>
</select>
</div>
</div>
</div>
<div class="row-fluid">
<label for="" class="control-label span3">Calendars</label>
<div class="row-fluid span9">
<%= f.select(:cal_id, Cal.all.collect {|p| [ p.name, p.id ] },{:prompt => t("calendar.select_calendar")},:class => "validate") %>
</div>
</div>
<div class="row-fluid">
<label for="" class="control-label span3">Tags</label>
<div class="row-fluid span9 dropdown">
<button id="open_tags_panel" class="btn">Choose Tags</button>
<div id="tags_panel" class="dropdown-menu my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<ul id="tags_list" class="unstyled">
<li><label for="" class="checkbox"><input type="checkbox"> tag1</label></li>
<li><label for="" class="checkbox"><input type="checkbox"> tag2</label></li>
<li><label for="" class="checkbox"><input type="checkbox"> tag3</label></li>
<li><label for="" class="checkbox"><input type="checkbox"> tag4</label></li>
<li><label for="" class="checkbox"><input type="checkbox"> tag5</label></li>
<li><label for="" class="checkbox"><input type="checkbox"> tag6</label></li>
<li><label for="" class="checkbox"><input type="checkbox"> tag7</label></li>
<li><label for="" class="checkbox"><input type="checkbox"> tag8</label></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<label for="" class="control-label span3">Note</label>
<div class="row-fluid span9">
<%= f.text_area :note, :class=>"span12", :cols=>"30", :rows=>"3" %>
</div>
</div>
<div class="row-fluid">
<div class="span9 offset3">
<button class="btn btn-close">Cancel</button>
<%= f.submit t(:create_), :class=>"btn" %>
</div>
</div>
<% end %>
<!-- </form> -->
</div>
</div>

View File

@ -1,18 +0,0 @@
<div class="modal-header">
<button type="button" class="close event-close-btn" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3><%= @event.title %></h3>
</div>
<div class="modal-body">
<div class="event_summary">
<!-- Thu, September 13 -->
<% if @event.start_date == @event.end_date %>
<%= @start_day_name+", "+@event.start_date.to_s+"-"+@start_month_name %>
<% else %>
<%= @start_day_name+", "+@event.start_date.to_s+"-"+@start_month_name %> to <%= @end_day_name+", "+@event.end_date.to_s + "-" + @end_month_name %>
<% end %>
</div>
</div>
<div class="modal-footer">
<%= link_to t(:delete_), panel_calendar_back_end_event_path(@event),:class => "btn bt-del", :method => :delete, :remote => true %>
<%= link_to t(:edit), edit_panel_calendar_back_end_event_path(@event),:class => "btn btn-primary",:id=>"edit_event_btn" ,:remote => true %>
</div>

View File

@ -1,15 +0,0 @@
$("#event_create").empty().hide();
$("#create_event_btn").removeClass("active");
$(".destroy").remove();
$("#create_event_btn").show();
switch (c.view){
case "week":
c.loadWeekView(c.cur_week,c.cur_year);
break;
case "month":
c.loadMonthView(c.cur_month,c.cur_year);
break;
case "day":
c.loadDayView(c.cur_date,c.cur_month,c.cur_year);
break;
}

View File

@ -1,23 +0,0 @@
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "calendar/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "calendar"
s.version = Calendar::VERSION
s.authors = ["TODO: Your name"]
s.email = ["TODO: Your email"]
s.homepage = "TODO"
s.summary = "TODO: Summary of Calendar."
s.description = "TODO: Description of Calendar."
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
s.test_files = Dir["test/**/*"]
s.add_dependency "rails", "~> 3.1.4"
# s.add_dependency "jquery-rails"
s.add_development_dependency "sqlite3"
end

View File

@ -1,14 +0,0 @@
{
"title": "calendar",
"version": "0.1",
"organization": "Rulingcom",
"author": "Visual dep",
"intro": "A simple and amazing calendar",
"update_info": "Some info",
"create_date": "11-08-2012",
"app_pages": ["calendar"],
"widgets": [],
"category": [],
"widget_fields":[],
"enable_frontend": true
}

View File

@ -1,8 +0,0 @@
en:
calendar:
calendar: Calendar
calendars: Calendars
color: Color
name: Name
save: Save
select_calendar: "Select Calendar"

View File

@ -1,8 +0,0 @@
zh_tw:
calendar:
calendar: 行事曆
calendars: 我的行事曆
color: 顏色
name: 名稱
save: 儲存
select_calendar: 選取行事曆

View File

@ -1,21 +0,0 @@
Rails.application.routes.draw do
namespace :panel do
namespace :calendar do
namespace :back_end do
match 'cals/agenda_view' => 'cals#agenda_view', :via => :get
match 'cals/month_view' => 'cals#month_view', :via => :get
match 'cals/day_view' => 'cals#day_view', :via => :get
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
resources :tags
end
end
end
end

View File

@ -1,36 +0,0 @@
module Calendar
OrbitApp.registration "Calendar",:type=> 'ModuleApp' do
module_label 'calendar.calendar'
base_url File.expand_path File.dirname(__FILE__)
# personal_plugin :enable => true,:path=>"panel/calendar/plugin/profile",:i18n=>'admin.calendar'
version "0.1"
organization "Rulingcom"
author "RD dep"
intro "I am intro"
update_info 'some update_info'
taggable
side_bar do
head_label_i18n 'calendar.calendar',:icon_class=>"icons-calendar"
available_for [:admin,:guest,:manager,:sub_manager]
active_for_controllers ({:private=>['cals','calendar_categories'],:public=>['panel/calendar/back_end/tags']})
head_link_path "panel_calendar_back_end_cals_path"
context_link 'categories',
:link_path=>"new_panel_calendar_back_end_cal_path" ,
:priority=>1,
:active_for_action=>{:cals=>:new},
:available_for => [:manager]
context_link 'tags',
:link_path=>"admin_module_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'Calendar'}))" ,
:priority=>4,
:active_for_tag => 'Calendar',
:available_for => [:manager]
end
end
end

View File

@ -1,4 +0,0 @@
require "calendar/engine"
module Calendar
end

View File

@ -1,4 +0,0 @@
module Calendar
class Engine < Rails::Engine
end
end

View File

@ -1,3 +0,0 @@
module Calendar
VERSION = "0.0.1"
end

View File

@ -1,4 +0,0 @@
# desc "Explaining what the task does"
# task :calendar do
# # Task goes here
# end

View File

@ -1,6 +0,0 @@
#!/usr/bin/env ruby
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
ENGINE_PATH = File.expand_path('../..', __FILE__)
load File.expand_path('../../test/dummy/script/rails', __FILE__)

View File

@ -1,7 +0,0 @@
require 'test_helper'
class CalendarTest < ActiveSupport::TestCase
test "truth" do
assert_kind_of Module, Calendar
end
end

View File

@ -1,7 +0,0 @@
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
Dummy::Application.load_tasks

View File

@ -1,9 +0,0 @@
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require_tree .

View File

@ -1,7 +0,0 @@
/*
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require_self
*= require_tree .
*/

View File

@ -1,3 +0,0 @@
class ApplicationController < ActionController::Base
protect_from_forgery
end

View File

@ -1,2 +0,0 @@
module ApplicationHelper
end

View File

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Dummy</title>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
</body>
</html>

View File

@ -1,4 +0,0 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Dummy::Application

View File

@ -1,45 +0,0 @@
require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require
require "calendar"
module Dummy
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
# Enable the asset pipeline
config.assets.enabled = true
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
end
end

View File

@ -1,10 +0,0 @@
require 'rubygems'
gemfile = File.expand_path('../../../../Gemfile', __FILE__)
if File.exist?(gemfile)
ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
Bundler.setup
end
$:.unshift File.expand_path('../../../../lib', __FILE__)

View File

@ -1,25 +0,0 @@
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000

View File

@ -1,5 +0,0 @@
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Dummy::Application.initialize!

View File

@ -1,30 +0,0 @@
Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
end

View File

@ -1,60 +0,0 @@
Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true
# Defaults to Rails.root.join("public/assets")
# config.assets.manifest = YOUR_PATH
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# See everything in the log (default is :info)
# config.log_level = :debug
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
end

View File

@ -1,39 +0,0 @@
Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true
config.static_cache_control = "public, max-age=3600"
# Log error messages when you accidentally call methods on nil
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Use SQL instead of Active Record's schema dumper when creating the test database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
end

View File

@ -1,7 +0,0 @@
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!

View File

@ -1,10 +0,0 @@
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end

View File

@ -1,5 +0,0 @@
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone

View File

@ -1,7 +0,0 @@
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
Dummy::Application.config.secret_token = '51389313d40e5a40269583258f5a6734ca9764cd65e633594119a8cb165b4058f032d11407e10634acd50965e156a9c7f894b9e617526afe373506699bf6c2ee'

View File

@ -1,8 +0,0 @@
# Be sure to restart your server when you modify this file.
Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
# Dummy::Application.config.session_store :active_record_store

View File

@ -1,14 +0,0 @@
# Be sure to restart your server when you modify this file.
#
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json]
end
# Disable root element in JSON by default.
ActiveSupport.on_load(:active_record) do
self.include_root_in_json = false
end

View File

@ -1,5 +0,0 @@
# Sample localization file for English. Add more files in this directory for other locales.
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
en:
hello: "Hello world"

View File

@ -1,58 +0,0 @@
Dummy::Application.routes.draw do
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => 'welcome#index'
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
end

View File

@ -1,26 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>The page you were looking for doesn't exist (404)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>
<body>
<!-- This file lives in public/404.html -->
<div class="dialog">
<h1>The page you were looking for doesn't exist.</h1>
<p>You may have mistyped the address or the page may have moved.</p>
</div>
</body>
</html>

View File

@ -1,26 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>The change you wanted was rejected (422)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>
<body>
<!-- This file lives in public/422.html -->
<div class="dialog">
<h1>The change you wanted was rejected.</h1>
<p>Maybe you tried to change something you didn't have access to.</p>
</div>
</body>
</html>

View File

@ -1,26 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>We're sorry, but something went wrong (500)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>
<body>
<!-- This file lives in public/500.html -->
<div class="dialog">
<h1>We're sorry, but something went wrong.</h1>
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
</div>
</body>
</html>

View File

@ -1,6 +0,0 @@
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'

View File

@ -1,10 +0,0 @@
require 'test_helper'
class NavigationTest < ActionDispatch::IntegrationTest
fixtures :all
# test "the truth" do
# assert true
# end
end

View File

@ -1,10 +0,0 @@
# Configure Rails Environment
ENV["RAILS_ENV"] = "test"
require File.expand_path("../dummy/config/environment.rb", __FILE__)
require "rails/test_help"
Rails.backtrace_cleaner.remove_silencers!
# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }

View File

@ -27,6 +27,7 @@ class Panel::CalendarNew::BackEnd::EventCategoriesController < OrbitBackendContr
# GET /events/new.json
def new
@event_category = EventCategory.new
@categories = get_categories_for_index
respond_to do |format|
format.html # new.html.erb

View File

@ -1,6 +1,7 @@
class EventCategory
include Mongoid::Document
include Mongoid::Timestamps
include OrbitCategory::Categorizable
field :name, localize: true
field :color

View File

@ -1,9 +1,28 @@
<h3>Event Categories</h3>
<% @event_categories.each do |ec|%>
<ul>
<li><%= ec.name%> <%= ec.color%> <%= link_to 'Show', panel_calendar_new_back_end_event_category_path(ec)%> <%= link_to 'Destroy', panel_calendar_new_back_end_event_category_path(ec), method: :delete, data: { confirm: 'Are you sure?' }%></li>
</ul>
<%end%>
<p>
<%= link_to "add new category", new_panel_calendar_new_back_end_event_category_path %>
<% set_default_index do
objects @event_categories
quick_edit_link type: 'edit',
link: 'edit_panel_calendar_new_back_end_event_category_path'
quick_edit_link type: 'detail'
quick_edit_link type: 'delete',
link: 'panel_calendar_new_back_end_event_category_path'
quick_edit_link type: 'approval',
link: 'panel_calendar_new_back_end_event_category_path'
quick_edit_link type: 'reject_reason'
field type: 'field',
associated_value: 'name',
db_field: 'name',
translation: 'name',
hide: 'phone'
field type: 'field',
db_field: 'color',
translation: 'color',
hide: 'phone'
end %>
<%= render 'admin/default_index/index' %>
<%= link_to "Add", new_panel_calendar_new_back_end_event_category_path, :class => "btn btn-primary pull-right", :id=>"create_event_btn", :ref=>"add-btn" %>
</p>

View File

@ -0,0 +1 @@
$("#form > form").replaceWith("<%= j render "form" %>");

View File

@ -0,0 +1 @@
$("#form > form").replaceWith("<%= j render "form" %>");

View File

@ -0,0 +1 @@
$("#form > form").replaceWith("<%= j render "form" %>");

View File

@ -0,0 +1 @@
$("#form > form").replaceWith("<%= j render "form" %>");