From 3e3699c873d582c770c5c2c1dfc7935c1336d7aa Mon Sep 17 00:00:00 2001 From: devin Date: Thu, 13 Sep 2012 18:06:18 +0800 Subject: [PATCH] calendar update --- .../app/assets/javascripts/calendarAPI.js.erb | 88 +++++-- .../app/assets/stylesheets/calendar.css | 102 +++++++- .../calendar/back_end/cals_controller.rb | 16 ++ .../back_end/cals/agenda_view.html.erb | 48 ++++ .../calendar/back_end/cals/day_view.html.erb | 155 +++++++++++++ .../calendar/back_end/cals/index.html.erb | 217 ++---------------- .../back_end/cals/month_view.html.erb | 182 +++++++++++++++ .../panel/calendar/back_end/cals/new.html.erb | 3 + .../calendar/back_end/cals/week_view.html.erb | 1 + .../calendar/config/routes.rb | 4 + 10 files changed, 594 insertions(+), 222 deletions(-) create mode 100644 vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/agenda_view.html.erb create mode 100644 vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/day_view.html.erb create mode 100644 vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/month_view.html.erb create mode 100644 vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/week_view.html.erb diff --git a/vendor/built_in_modules/calendar/app/assets/javascripts/calendarAPI.js.erb b/vendor/built_in_modules/calendar/app/assets/javascripts/calendarAPI.js.erb index 8a23d4284..d5999917d 100644 --- a/vendor/built_in_modules/calendar/app/assets/javascripts/calendarAPI.js.erb +++ b/vendor/built_in_modules/calendar/app/assets/javascripts/calendarAPI.js.erb @@ -3,31 +3,81 @@ $(window).load(function(){ $('.color-picker').miniColors(); // just in category view } + var view_url = 'http://localhost:3000/panel/calendar/back_end/cals/'; + // below calendar start - // month view - if($('#calendar_month').length > 0){ - var $c_table = $('#calendar_month'); - var sum_h = 0; - var context_h = $('#main-sidebar').outerHeight(); - $('#main-wrap > *').not('#orbit_calendar, .modal').each(function(){ - sum_h += $(this).outerHeight(); + $.get(view_url+'month_view', function(data) { + $('#view_holder').html(data); + month_fn(); }); + $.get(view_url+'new', function(data) { + $('#create .modal-body').html(data); + }); + + // view switch (for view test) + $('.mode_switch').click(function(){ + var target = $(this).text(); + $.get(view_url+target+'_view', function(data) { + $('#view_holder').html(data); + switch(target){ + case 'month': + month_fn(); + break; + case 'week': + week_fn(); + break; + case 'day': + day_fn(); + break; + case 'agenda': + agenda_fn(); + break; + } + }); + }); + + // month fn + var month_fn = function(){ + $('.current_day_title').text('September 2012'); + + // month view + if($('#calendar_month').length > 0){ + var $c_table = $('#calendar_month'); + var sum_h = 0; + var context_h = $('#main-sidebar').outerHeight(); + $('#main-wrap > *').not('#orbit_calendar, .modal').each(function(){ + sum_h += $(this).outerHeight(); + }); - $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 + // .height(context_h-sum_h-64) .find('.month_row') .not('.month_row.header') - .height(($('#main-sidebar').outerHeight()-sum_h-92) / 6); - }); + .height((context_h-sum_h-92) / 6); + + $(window).resize(function(){ + $c_table + .find('.month_row') + .not('.month_row.header') + .height(($('#main-sidebar').outerHeight()-sum_h-92) / 6); + }); + } + }; + + // week fn + var week_fn = function(){ + $('.current_day_title').text('September 2 - 8, 2012'); } - $.get('http://localhost:3000/panel/calendar/back_end/cals/new', function(data) { - $('#create .modal-body').html(data); - }); + + // day fn + var day_fn = function(){ + $('.current_day_title').text('September 2, 2012'); + } + + // agenda fn + var agenda_fn = function(){ + $('.current_day_title').text('September 2, 2012'); + } + }); \ No newline at end of file diff --git a/vendor/built_in_modules/calendar/app/assets/stylesheets/calendar.css b/vendor/built_in_modules/calendar/app/assets/stylesheets/calendar.css index 0af3323dd..e7d3e35c2 100644 --- a/vendor/built_in_modules/calendar/app/assets/stylesheets/calendar.css +++ b/vendor/built_in_modules/calendar/app/assets/stylesheets/calendar.css @@ -13,9 +13,25 @@ margin-right: 4px; vertical-align: bottom; } +.current_day_title { + text-align: center; + line-height: 28px; +} .calendar_mode { float: right; } +.mode_switch { + text-transform: capitalize; +} +.today { + background-color: #D9EDF7; +} +.event { + font-size: 12px; + border-radius: 3px; + cursor: pointer; + padding: 1px 3px; +} /* month view */ #calendar_month { border-bottom: solid 1px #ddd; @@ -65,16 +81,11 @@ text-decoration: underline; } #calendar_month .month_row td.today { - background-color: #D9EDF7; border-bottom: solid 1px #fff; border-top: solid 1px #fff; } #calendar_month .month_row .event { - padding: 1px 3px; margin: 0 -2px; - font-size: 12px; - border-radius: 3px; - cursor: pointer; position: relative; color: #000; } @@ -87,6 +98,87 @@ border-left: solid 1px #ddd; } +/* agenda view */ +#calendar_agenda { + border-bottom: solid 1px #ddd; +} +#calendar_agenda .table { + margin-bottom: 0; +} +.event_time { + font-family: Tahoma, sans-serif; +} + +/* 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; +} +#calendar_day .event_list .day_time { + height: 30px; + border-bottom: solid 1px #ddd; + border-left: solid 1px #ddd; + text-align: right; + padding: 4px; +} +#calendar_day .event_list .cell { + height: 38px; + border: solid 1px #ddd; + border-top: 0; +} +#calendar_day .event_list .divide { + height: 18px; + margin-bottom: 18px; + border-bottom: solid 1px #eee; +} +#calendar_day .event_holder { + width: 100%; + height: 100%; + position: absolute; + top: 0; +} +#calendar_day .event_holder .event { + padding: 0px; + position: absolute; + width: 100%; +} +#calendar_day .event_holder .event.half { + +} +#calendar_day .event_holder .event.over { + outline: solid 1px #fff; +} +#calendar_day .event dl, #calendar_day .event dt, #calendar_day .event dd { + margin: 0; + padding: 0; +} +#calendar_day .event dl { + padding: 3px; +} +#calendar_day .event dt { + font-size: 11px; + font-weight: normal; + line-height: 12px; +} + /* calendars(category) */ .calendars_color_tag { diff --git a/vendor/built_in_modules/calendar/app/controllers/panel/calendar/back_end/cals_controller.rb b/vendor/built_in_modules/calendar/app/controllers/panel/calendar/back_end/cals_controller.rb index d44cd3be3..b55f5a35c 100644 --- a/vendor/built_in_modules/calendar/app/controllers/panel/calendar/back_end/cals_controller.rb +++ b/vendor/built_in_modules/calendar/app/controllers/panel/calendar/back_end/cals_controller.rb @@ -8,5 +8,21 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController def new render :layout => false end + + def day_view + render :layout => false + end + + def week_view + render :layout => false + end + + def month_view + render :layout => false + end + + def agenda_view + render :layout => false + end end \ No newline at end of file diff --git a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/agenda_view.html.erb b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/agenda_view.html.erb new file mode 100644 index 000000000..b7726e4c5 --- /dev/null +++ b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/agenda_view.html.erb @@ -0,0 +1,48 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Thu, Sep 69:00am - 9:30am +
Commuting time, from home to RD
+
9:30am - 12:00am +
Work on Thu project, and ask ika for help if possible
+
13:30pm - 18:00pm +
Template design, at least finish 2 template
+
Fri, Sep 79:00am - 18:00pm +
Take a day off
+
Sat, Sep 87:00am - 7:50pm +
Work out with Joseph
+
+
\ No newline at end of file diff --git a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/day_view.html.erb b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/day_view.html.erb new file mode 100644 index 000000000..047be06f3 --- /dev/null +++ b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/day_view.html.erb @@ -0,0 +1,155 @@ +
+ + + + + + + + + +
+

Sunday 9/2

+
+
event1
+
event2
+
+
+ + + + + +
+
12am
+
1am
+
2am
+
3am
+
4am
+
5am
+
6am
+
7am
+
8am
+
9am
+
10am
+
11am
+
12am
+
1pm
+
2pm
+
3pm
+
4pm
+
5pm
+
6pm
+
7pm
+
8pm
+
9pm
+
10pm
+
11pm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
10:30am - 11:00am
+
template
+
+
+
+
+
10:30am - 11:00am
+
template
+
+
+
+
+
10:30am - template
+
+
+
+
+
+
10:30am - 11:00am
+
template
+
+
+
+
+
10:30am - 11:00am
+
template
+
+
+
+
+
+
\ No newline at end of file diff --git a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/index.html.erb b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/index.html.erb index ee6c71262..2dc897000 100644 --- a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/index.html.erb +++ b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/index.html.erb @@ -28,189 +28,7 @@
-
-

Semptember 2012

-
-
-
- - - - -
-
-
-
-
- - - - - - - - - - -
SunMonTueWedThuFriSat
-
-
- - - - - - - - - - -
- - - - - - - - - - -
Aug 262728293031Sep 1
-
-
- - - - - - - - - - -
- - - - - - - - - - -
2345678
-
-
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
9101112131415
7pm - 9pm test event
7pm - 9pm test event
-
-
- - - - - - - - - - -
- - - - - - - - - - -
16171819202122
-
-
- - - - - - - - - - -
- - - - - - - - - - -
23242526272829
-
-
- - - - - - - - - - -
- - - - - - - - - - -
30Nov 123456
-
-
-
-
-
-
+
@@ -221,6 +39,24 @@
+
+

Semptember 2012

+
+
+
+ + + + +
+
+
+
+
+
+
+
+
Add
@@ -228,19 +64,4 @@
- \ No newline at end of file diff --git a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/month_view.html.erb b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/month_view.html.erb new file mode 100644 index 000000000..bff812b0f --- /dev/null +++ b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/month_view.html.erb @@ -0,0 +1,182 @@ +
+
+ + + + + + + + + + +
SunMonTueWedThuFriSat
+
+
+ + + + + + + + + + +
+ + + + + + + + + + +
Aug 262728293031Sep 1
+
+
+ + + + + + + + + + +
+ + + + + + + + + + +
2345678
+
+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
9101112131415
7pm - 9pm test event
7pm - 9pm test event
+
+
+ + + + + + + + + + +
+ + + + + + + + + + +
16171819202122
+
+
+ + + + + + + + + + +
+ + + + + + + + + + +
23242526272829
+
+
+ + + + + + + + + + +
+ + + + + + + + + + +
30Nov 123456
+
+
+ \ No newline at end of file diff --git a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/new.html.erb b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/new.html.erb index 25de617a6..9611b1212 100644 --- a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/new.html.erb +++ b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/new.html.erb @@ -1,5 +1,8 @@
+
+ +
diff --git a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/week_view.html.erb b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/week_view.html.erb new file mode 100644 index 000000000..359237f13 --- /dev/null +++ b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/week_view.html.erb @@ -0,0 +1 @@ +week \ No newline at end of file diff --git a/vendor/built_in_modules/calendar/config/routes.rb b/vendor/built_in_modules/calendar/config/routes.rb index 39d9b60a5..36aa3e6f3 100644 --- a/vendor/built_in_modules/calendar/config/routes.rb +++ b/vendor/built_in_modules/calendar/config/routes.rb @@ -3,6 +3,10 @@ Rails.application.routes.draw 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 resources :cals resources :calendar_categories