From 0971e00511ed8db1d74ecef64fd7d13d8f0a82ec Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Tue, 16 Oct 2012 21:50:46 +0800 Subject: [PATCH 1/6] calendar updated for week --- .../app/assets/javascripts/calendarAPI.js.erb | 51 ++++- .../calendar/back_end/cals_controller.rb | 44 +++- .../calendar/back_end/events_controller.rb | 14 ++ .../panel/calendar/back_end/cals_helper.rb | 49 +++++ .../calendar/app/models/event.rb | 1 + .../back_end/cals/agenda_view.html.erb | 202 +++++++++++++++++- .../calendar/back_end/cals/week_view.html.erb | 130 ++++------- .../calendar/back_end/events/new.html.erb | 50 ++--- .../calendar/back_end/events/show.html.erb | 2 +- .../gprs/back_end/locations/index.html.erb | 1 + 10 files changed, 417 insertions(+), 127 deletions(-) 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 64eb8f8a..da3d0d32 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 @@ -135,7 +135,14 @@ var calendarAPI = function(){ } }) $("button#today_btn").click(function(){ - c.loadMonthView(); + switch (c.view){ + case "week": + c.loadWeekView(); + break; + case "month": + c.loadMonthView(); + break; + } }) } } @@ -231,13 +238,13 @@ var calendarAPI = function(){ $eventrow.html('
'+evnt.title+'
'); }else{ if($eventrow.html()==""){ - $eventrow.append(''); + $eventrow.append(''); }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(''); + $eventrow.append(''); } } var colspan = 0; @@ -297,7 +304,41 @@ var calendarAPI = function(){ } this.getEventsForWeek = function(week,year){ $.getJSON("cals/getWeekEvents",{"week":week,"year":year},function(events){ - + $.each(events,function(i,evnt){ + if(evnt.all_day){ + $(".week_day_header[date="+evnt.start_date+"]").append('
'+evnt.title+'
'); + }else{ + var starttime,endtime,displaystarttime,displayendtime; + if(evnt.start_am_pm == "AM") + starttime = evnt.start_time; + else + starttime = evnt.start_time + 12; + + if(evnt.end_am_pm == "AM") + endtime = evnt.end_time; + 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) * 19) + starttime; + var eventdom = $('
'+displaystarttime+' - '+displayendtime+'
'+evnt.title+'
'); + $(".week_day_body[date="+evnt.start_date+"] .inner").append(eventdom); + } + + }) }) } this.loadDayView = function(){ @@ -306,7 +347,7 @@ var calendarAPI = function(){ }) } this.loadAgendaView = function(){ - $('#view_holder').load("cals/week_view", function() { + $('#view_holder').load("cals/agenda_view", function() { $('.current_day_title').text('September 2, 2012'); }) } 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 2c171895..8e67117b 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 @@ -30,10 +30,21 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController end def week_view - week = params[:week] - year = params[:year] + 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 @@ -97,10 +108,31 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController end def get_week_events - week = params[:week] - year = params[:year] - events = Event.where(:start_week => week).and(:start_year => year) - render :json => events.to_json + week = params[:week].to_i + year = params[:year].to_i + @d = getWeekDataSet(week,year) + events = Event.where(:start_week.lte => week).and(:start_year => year).and(:end_week.gte => week).and(:start_year => year) + @events = Array.new + events.each_with_index do |event,i| + # @temp = Array.new + no_of_days = event.total_days + startdt = event.start_date + if event.start_week < week + startdt = @d[0].to_i + event.all_day = true + end + + no_of_days = no_of_days.to_i + no_of_days += 1 + all_day = event.all_day + if no_of_days > 1 + all_day = true + end + + color = Cal.find(event.cal_id).color + @events << {"id"=>event.id,"index"=>i,"start_date"=>startdt,"all_day"=>all_day, "start_week" => event.start_week, "end_week" => event.end_week, "total_days" => no_of_days, "title" => event.title,"color"=>color,"show_link"=>panel_calendar_back_end_event_path(event),"start_time"=>event.start_time,"end_time"=>event.end_time,"start_am_pm"=>event.start_am_pm,"end_am_pm"=>event.end_am_pm} + end + render :json => @events.to_json end def week_number_test diff --git a/vendor/built_in_modules/calendar/app/controllers/panel/calendar/back_end/events_controller.rb b/vendor/built_in_modules/calendar/app/controllers/panel/calendar/back_end/events_controller.rb index 519d84f4..41ffa151 100644 --- a/vendor/built_in_modules/calendar/app/controllers/panel/calendar/back_end/events_controller.rb +++ b/vendor/built_in_modules/calendar/app/controllers/panel/calendar/back_end/events_controller.rb @@ -42,6 +42,13 @@ class Panel::Calendar::BackEnd::EventsController < OrbitBackendController # 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) @@ -67,6 +74,7 @@ class Panel::Calendar::BackEnd::EventsController < OrbitBackendController @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| @@ -81,6 +89,12 @@ class Panel::Calendar::BackEnd::EventsController < OrbitBackendController @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 diff --git a/vendor/built_in_modules/calendar/app/helpers/panel/calendar/back_end/cals_helper.rb b/vendor/built_in_modules/calendar/app/helpers/panel/calendar/back_end/cals_helper.rb index 8b4d61d8..fc349ecd 100644 --- a/vendor/built_in_modules/calendar/app/helpers/panel/calendar/back_end/cals_helper.rb +++ b/vendor/built_in_modules/calendar/app/helpers/panel/calendar/back_end/cals_helper.rb @@ -131,6 +131,55 @@ module Panel::Calendar::BackEnd::CalsHelper 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 end diff --git a/vendor/built_in_modules/calendar/app/models/event.rb b/vendor/built_in_modules/calendar/app/models/event.rb index cff01fcc..5c53b1c1 100644 --- a/vendor/built_in_modules/calendar/app/models/event.rb +++ b/vendor/built_in_modules/calendar/app/models/event.rb @@ -19,6 +19,7 @@ class Event 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 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 index b7726e4c..a8577212 100644 --- 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 @@ -1,4 +1,4 @@ -
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Sun 9/11Mon 9/12Tue 9/13Wed 9/14Thu 9/15Fri 9/16Sat 9/17
+
+
+
10:30am - template
+
+
+
+
+ +
+
+
10:30am - template
+
+
+
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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 index dc27b736..f7400608 100644 --- 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 @@ -9,28 +9,33 @@ - + <% @d.each_with_index do |dt,i| %> + <% if @today == i %> + + <% else %> + + <% end %> + <% end %> - - + +
- + -->
@@ -39,84 +44,26 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ <% @hours.each do |hour| %> +
+
+
+
+
+
+ <% end %>
-
12am
+ <% @hours.each do |hour| %> +
<%= hour %>am
+ <% end %> + <% @hours.each do |hour| %> +
<%= hour %>pm
+ <% end %> + - -
-
+ <% @d.each_with_index do |dt,i| %> + <% if i == @today %> + + <% else %> + + <% end %> +
+
+ +
-
- - + + <% end %> +
diff --git a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/events/new.html.erb b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/events/new.html.erb index 48e18efa..5fd5870e 100644 --- a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/events/new.html.erb +++ b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/events/new.html.erb @@ -11,7 +11,7 @@
<% if !@all_day_disabled %> <% end %>
+
+ + + + + + + + +<% content_for :page_specific_css do %> + <%= stylesheet_link_tag "item" %> +<% end %> \ No newline at end of file diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_filter.html.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_filter.html.erb new file mode 100644 index 00000000..63882b8f --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_filter.html.erb @@ -0,0 +1,11 @@ + + +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "sort_header" %> +<% end %> \ No newline at end of file diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_form.html.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_form.html.erb new file mode 100644 index 00000000..22022c21 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_form.html.erb @@ -0,0 +1,209 @@ +<% # encoding: utf-8 %> + + <%= f.error_messages %> + + + +
+ +
+
+ +
+

Tags

+
+ <% @tags.each do |tag| %> + <%= content_tag :label,:class => "checkbox inline" do -%> + <%= check_box_tag 'writing_patent[tag_ids][]', tag.id, @writing_patent.tag_ids.include?(tag.id)%> + <%= tag[I18n.locale] %> + <%= hidden_field_tag 'writing_patent[tag_ids][]', '' %> + <% end %> + <% end %> +
+
+ +
+ + + + + +
+
+ +
+ <%= f.label :year ,t("personal_patent.year")%> + <%= select_year((@writing_patent.year ? @writing_patent.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_patent[year]'} ) %> +
+ +
+ <%= f.label :writing_patent_category ,t("personal_patent.writing_patent_category")%> + <%= f.select :writing_patent_category_id, @writing_patent_categorys.collect {|t| [ t.title, t.id ]} %> +
+ +
+ <%= f.label :period_start_date ,t("personal_patent.period_start_date")%> + <%= f.date_select :period_start_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month], :discard_day => true }, {:class => 'span1'} %> +
+ +
+ <%= f.label :period_end_date ,t("personal_patent.period_end_date")%> + <%= f.date_select :period_end_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month], :discard_day => true }, {:class => 'span1'} %> +
+ + + +
+ + <% @site_valid_locales.each_with_index do |locale, i| %> + +
"> + +
+ <%= f.label :writing_patent_title ,t("personal_patent.writing_patent_title")%> + <%= f.fields_for :writing_patent_title_translations do |f| %> + <%= I18nVariable.from_locale(locale) %> + <%= f.text_field locale, :class=>'post-title', :value => (@writing_patent.writing_patent_title_translations[locale] rescue nil) %> + <% end %> +
+ +
+ <%= f.label :job_title ,t("personal_patent.job_title")%> + <%= f.fields_for :job_title_translations do |f| %> + <%= I18nVariable.from_locale(locale) %> + <%= f.text_field locale, :class=>'post-title', :value => (@writing_patent.job_title_translations[locale] rescue nil) %> + <% end %> +
+ +
+ <%= f.label :participator ,t("personal_patent.participator")%> + <%= f.fields_for :participator_translations do |f| %> + <%= I18nVariable.from_locale(locale) %> + <%= f.text_field locale, :class=>'post-title', :value => (@writing_patent.participator_translations[locale] rescue nil) %> + <% end %> +
+ +
+ <%= f.label :unit ,t("personal_patent.unit")%> + <%= f.fields_for :unit_translations do |f| %> + <%= I18nVariable.from_locale(locale) %> + <%= f.text_field locale, :class=>'post-title', :value => (@writing_patent.unit_translations[locale] rescue nil) %> + <% end %> +
+ +
+ + <% end %> + +
+ +
+ <%= f.label :url, t("personal_patent.url") %> + <%= f.text_field :url %> +
+ +
+ <%= f.label :keywords, t("personal_patent.keywords") %> + <%= f.text_field :keywords %> +
+ +
+ <%= f.label :abstract, t("personal_patent.abstract") %> + <%= f.text_field :abstract %> +
+ +
+ <%= f.label :language, t("personal_patent.language") %> + <%= f.radio_button :language, "Chinese" %> <%= t("personal_patent.Chinese") %> + <%= f.radio_button :language, "English" %> <%= t("personal_patent.English") %> +
+ +
+ <%= f.label :note, t("personal_patent.note") %> + <%= f.text_area :note, :size => "60x3" %> +
+ +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + + <% @writing_patent.writing_patent_files.each_with_index do |writing_patent_file, i| %> + <%= f.fields_for :writing_patent_files, writing_patent_file do |f| %> + <%= render :partial => 'form_file', :object => writing_patent_file, :locals => {:f => f, :i => i} %> + <% end %> + <% end %> + +
FileFile Name
+
+ <%= hidden_field_tag 'plugin_file_field_count', @writing_patent.writing_patent_files.count %> + ADD/新增 +
+
+ +
+ +
+ + + + + + +
+ + + + +
+ <%= f.submit t('submit'), :class=>'btn btn-primary' %> + <%= link_to t('cancel'), get_go_back, :class=>"btn" %> +
+ + +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "archive_plugin_form" %> + +<% end %> \ No newline at end of file diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_form_file.html.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_form_file.html.erb new file mode 100644 index 00000000..a91d6a85 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_form_file.html.erb @@ -0,0 +1,50 @@ +<% # encoding: utf-8 %> + + " class='list_item'> + +
+
+ <%= f.file_field :file %> + <%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %> +
+
+ + + +
+ + <% @site_valid_locales.each_with_index do |locale, i| %> + +
"> + <%#= f.fields_for :i18n_variable, (form_file.new_record? ? form_file.build_i18n_variable : form_file.i18n_variable ) do |f| %> + <%= f.fields_for :file_title_translations do |f| %> +
+ +
+ <%= f.text_field locale, :class=>'post-file_title', :value => (form_file.file_title_translations[locale] rescue nil) %> +
+
+ <% end %> + +
+ + <% end %> + +
+ + + + + + <% if form_file.new_record? %> + + <% else %> + <%= f.hidden_field :id %> + + <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> + <% end %> + + + + + diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_sort_headers.html.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_sort_headers.html.erb new file mode 100644 index 00000000..9caebecc --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_sort_headers.html.erb @@ -0,0 +1,7 @@ +<%= render_sort_bar(true, delete_panel_personal_patent_back_end_writing_patents_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]), + ['publish_date', 'publish_date', 'span1', 'writing_patent.publish_date'], + ['patent_title', 'patent_title','span3', 'writing_patent.patent_title'], + ['patent_no', 'patent_no','span3', 'writing_patent.patent_no'], + ['patent_country', 'patent_country','span3', 'writing_patent.patent_country'], + ['authors', 'authors','span3', 'writing_patent.authors'], + ['url', 'url','span3', 'writing_patent.url']).html_safe %> \ No newline at end of file diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_writing_patent.html.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_writing_patent.html.erb new file mode 100644 index 00000000..3bd0fa74 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/_writing_patent.html.erb @@ -0,0 +1,24 @@ + + + <% if (writing_patent.create_user_id == current_user.id) || is_manager? %> + <%= check_box_tag 'to_delete[]', writing_patent.id, false, :class => "checkbox_in_list" %> + <% end -%> + + <%= writing_patent.period_start_date.strftime("%Y.%m") %> ~ <%= writing_patent.period_end_date.strftime("%Y.%m") %> + + <%= link_to writing_patent.writing_patent_title, panel_personal_patent_front_end_writing_patent_path(writing_patent) %> +
+ +
+ + <%= writing_patent.participator %> + <%= writing_patent.job_title %> + <%= writing_patent.unit %> + <%= User.from_id(writing_patent.create_user_id).name rescue ''%> + + diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/destroy.js.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/destroy.js.erb new file mode 100644 index 00000000..0443940f --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/destroy.js.erb @@ -0,0 +1 @@ +$("#<%= dom_id @writing_patent %>").remove(); \ No newline at end of file diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/edit.html.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/edit.html.erb new file mode 100644 index 00000000..98cf411a --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/edit.html.erb @@ -0,0 +1,5 @@ +

<%= t('personal_patent.editing_personal_patent') %>

+ +<%= form_for @writing_patent, :url => panel_personal_patent_plugin_writing_patent_path(@writing_patent), :html => {:class => 'clear'} do |f| %> + <%= render :partial => 'form', :locals => {:f => f} %> +<% end %> diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/index.html.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/index.html.erb new file mode 100644 index 00000000..53c077a0 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/index.html.erb @@ -0,0 +1,22 @@ +<%= render 'filter' %> + + + + + + + + + + + + <%= render :partial => 'writing_patent', :collection => @writing_patents %> + +
+ +
+ <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_personal_patent_plugin_writing_patent_path, :class => 'btn btn-primary pull-right' %> +
+ <%= paginate @writing_patents, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %> +
+
diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/index.js.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/index.js.erb new file mode 100644 index 00000000..8b9ad8e1 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/index.js.erb @@ -0,0 +1,3 @@ +$("#sort_headers").html("<%= j render 'sort_headers' %>"); +$("#tbody_writing_patents").html("<%= j render :partial => 'writing_patent', :collection => @writing_patents %>"); +$("#writing_patent_pagination").html("<%= j paginate @writing_patents, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>"); \ No newline at end of file diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/new.html.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/new.html.erb new file mode 100644 index 00000000..71524776 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/new.html.erb @@ -0,0 +1,10 @@ + +<%= flash_messages %> +
+

<%= t('writing_patent.new_personal_patent') %>

+<%= form_for @writing_patent, :url => panel_personal_patent_plugin_writing_patents_path, :html => {:class => 'clear'} do |f| %> + <%= render :partial => 'form', :locals => {:f => f} %> +<% end %> +
+<%#= link_back %> + diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/show.html.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/show.html.erb new file mode 100644 index 00000000..e69de29b diff --git a/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/toggle_enable.js.erb b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/toggle_enable.js.erb new file mode 100644 index 00000000..b00cfa07 --- /dev/null +++ b/vendor/built_in_modules/personal_patent/app - %BDƻs/views/panel/personal_patent/plugin/writing_patents/toggle_enable.js.erb @@ -0,0 +1,3 @@ +$("#enable_<%= @bulletin.id %>").toggle(); +$("#disable_<%= @bulletin.id %>").toggle(); +$("#bulletin_<%= @bulletin.id %>").toggleClass('disable'); \ No newline at end of file From 47df69f8cfcb56a66d6db1a92683919a4bec7f96 Mon Sep 17 00:00:00 2001 From: devin Date: Wed, 17 Oct 2012 17:35:30 +0800 Subject: [PATCH 3/6] shit calendar update --- .../app/assets/javascripts/calendarAPI.js.erb | 2 +- .../app/assets/stylesheets/calendar.css | 28 ++- .../back_end/cals/agenda_view.html.erb | 210 ++++++++++-------- .../calendar/back_end/cals/day_view.html.erb | 210 +++++++++--------- .../calendar/back_end/cals/week_view.html.erb | 24 +- 5 files changed, 256 insertions(+), 218 deletions(-) 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 da3d0d32..41c2fc12 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 @@ -163,7 +163,7 @@ var calendarAPI = function(){ if($('#calendar_month').length > 0){ var $c_table = $('#calendar_month'); var sum_h = 0; - var context_h = $('#main-sidebar').outerHeight(); + var context_h = $(window).height() - $('#orbit-bar').height(); $('#main-wrap > *').not('#orbit_calendar, .modal').each(function(){ sum_h += $(this).outerHeight(); }); 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 85b0390f..86df5516 100644 --- a/vendor/built_in_modules/calendar/app/assets/stylesheets/calendar.css +++ b/vendor/built_in_modules/calendar/app/assets/stylesheets/calendar.css @@ -36,18 +36,21 @@ -webkit-box-shadow: inset 0 0 1px black; -moz-box-shadow: inset 0 0 1px black; } +.event_list_wrapper { + position: relative; +} .event_list .cell { - height: 38px; + height: 39px; border: solid 1px #ddd; border-top: 0; } .event_list .divide { - height: 18px; + height: 19px; margin-bottom: 18px; border-bottom: solid 1px #eee; } .event_list .day_time { - height: 30px; + height: 31px; border-bottom: solid 1px #ddd; border-left: solid 1px #ddd; text-align: right; @@ -189,7 +192,7 @@ } #calendar_day .all_day_event { background: #eee; - border: solid 1px #ddd + border: solid 1px #ddd; } #calendar_day .event_list .table { border-top: solid 1px #ddd; @@ -223,14 +226,14 @@ } #calendar_week .header td { border: solid 1px #ddd; - background-color: #eee; + /*background-color: #eee;*/ } #calendar_week .week_day { padding: 0 2px; border: solid 1px #ddd; } #calendar_week .header .week_day { - padding: 1px 2px 10px 2px; + padding: 2px 4px 0px 2px; } #calendar_week .event_list .event { position: absolute; @@ -250,7 +253,18 @@ #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; +} 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 index a8577212..98d716c1 100644 --- 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 @@ -59,108 +59,128 @@ Sat 9/17 - - -
-
-
10:30am - template
-
-
+ +
+ + + + + + + + + + + +
+ + + + + + + + + + +
+
+
+
10:30am - template
+
+
+
+
+
+
+
10:30am - template
+
+
+
+
- - - - -
-
-
10:30am - template
-
-
-
- - - -
- + - 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 index cdbc1c47..46fc0a16 100644 --- 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 @@ -43,110 +43,112 @@
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
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
10:30am - 11:00am
+
template
+
+
+
+
+
10:30am - 11:00am
+
template
+
+
+
+
+
10:30am - template
+
+
+
+
+
+
10:30am - 11:00am
+
template
+
+
+
+
+
10:30am - 11:00am
+
template
+
+
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 index f7400608..461c7b01 100644 --- 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 @@ -40,18 +40,20 @@
- + - From a810312da4ae4fee566481c9d7c0bc82e76faf18 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Thu, 18 Oct 2012 22:21:13 +0800 Subject: [PATCH 4/6] week view updates --- .../app/assets/javascripts/calendarAPI.js.erb | 84 +++++++++++++++++-- .../calendar/back_end/cals_controller.rb | 47 ++++++++--- .../back_end/cals/agenda_view.html.erb | 2 +- .../calendar/back_end/cals/week_view.html.erb | 36 +++++--- 4 files changed, 141 insertions(+), 28 deletions(-) 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 41c2fc12..744fc9ba 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 @@ -304,19 +304,74 @@ var calendarAPI = function(){ } this.getEventsForWeek = function(week,year){ $.getJSON("cals/getWeekEvents",{"week":week,"year":year},function(events){ + var height = 15; + var full_day_count = 0; + var rowcount = 7; + var tr = $(""); + var pre = true; $.each(events,function(i,evnt){ + // console.log("rowcount: "+rowcount); + // console.log("start:"+evnt.start); + console.log(rowcount); + if(rowcount >= (7 - evnt.total_days)){ + if(tr.html()!=""){ + if(rowcount != 7){ + tr.append(""); + } + $("table.all_day_event_holder").append(tr); + } + tr = null; + tr = $(''); + pre = true; + } + if(evnt.all_day){ - $(".week_day_header[date="+evnt.start_date+"]").append('
'+evnt.title+'
'); + 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(''); + if(precountspan != 0){ + tr.append(''); + pre = false; + } + } + var colcount = evnt.total_days; + if(evnt.colcount != 0){ + colcount = evnt.colcount; + } + + rowcount = precountspan + colcount; + if(evnt.title == "Yeah"){ + console.log("rowcount: "+rowcount); + console.log("start:"+evnt.total_days); + } + + tr.append(''); + + // $(".week_day_header[date="+evnt.start_date+"]").append('
'+evnt.title+'
'); }else{ + var starttime,endtime,displaystarttime,displayendtime; - if(evnt.start_am_pm == "AM") + if(evnt.start_am_pm == "AM"){ starttime = evnt.start_time; - else + if(starttime == 12) + starttime = 0; + if(starttime == 12.5) + starttime = 0.5; + }else starttime = evnt.start_time + 12; - if(evnt.end_am_pm == "AM") + if(evnt.end_am_pm == "AM"){ endtime = evnt.end_time; - else + if(endtime == 12) + endtime = 0; + if(endtime == 12.5) + endtime = 0.5; + }else endtime = evnt.end_time + 12; var temp = parseInt(evnt.start_time); @@ -333,12 +388,27 @@ var calendarAPI = function(){ else displayendtime = temp + ":00 " + evnt.end_am_pm; - var toppx = ((starttime * 2) * 19) + starttime; - var eventdom = $('
'+displaystarttime+' - '+displayendtime+'
'+evnt.title+'
'); + 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 = $('
'+displaystarttime+' - '+displayendtime+'
'+evnt.title+'
'); $(".week_day_body[date="+evnt.start_date+"] .inner").append(eventdom); } + if(full_day_count == 0){ + tr.append('"); + } + $("table.all_day_event_holder").append(tr); + } }) } this.loadDayView = function(){ 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 8e67117b..d70d6833 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 @@ -111,26 +111,53 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController week = params[:week].to_i year = params[:year].to_i @d = getWeekDataSet(week,year) - events = Event.where(:start_week.lte => week).and(:start_year => year).and(:end_week.gte => week).and(:start_year => year) + events = Event.where(:start_week.lte => week).and(:start_year => year).and(:end_week.gte => week).and(:start_year => year).asc(:start_week).asc(:start_date) @events = Array.new events.each_with_index do |event,i| # @temp = Array.new - no_of_days = event.total_days + days = event.total_days.to_i + 1 + colcount = 0 startdt = event.start_date - if event.start_week < week - startdt = @d[0].to_i - event.all_day = true - end - no_of_days = no_of_days.to_i - no_of_days += 1 all_day = event.all_day - if no_of_days > 1 + + 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 = 7 - @d.index(event.end_date.to_s).to_i + days = 7; + startdt = event.start_date + end + end + color = Cal.find(event.cal_id).color - @events << {"id"=>event.id,"index"=>i,"start_date"=>startdt,"all_day"=>all_day, "start_week" => event.start_week, "end_week" => event.end_week, "total_days" => no_of_days, "title" => event.title,"color"=>color,"show_link"=>panel_calendar_back_end_event_path(event),"start_time"=>event.start_time,"end_time"=>event.end_time,"start_am_pm"=>event.start_am_pm,"end_am_pm"=>event.end_am_pm} + @events << {"id"=>event.id,"index"=>i,"start_date"=>startdt,"end_date"=>event.end_date ,"all_day"=>all_day, "start_week" => event.start_week, "end_week" => event.end_week, "total_days" => days, "title" => event.title,"color"=>color,"show_link"=>panel_calendar_back_end_event_path(event),"start_time"=>event.start_time,"end_time"=>event.end_time,"start_am_pm"=>event.start_am_pm,"end_am_pm"=>event.end_am_pm,"colcount"=>colcount} end render :json => @events.to_json end 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 index 98d716c1..3b2626a7 100644 --- 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 @@ -84,7 +84,7 @@ - +
-
- <% @hours.each do |hour| %> -
-
-
-
-
-
- <% end %> +
+
+
+ <% @hours.each do |hour| %> +
+
+
+
+
+
+ <% end %> +
 
'+evnt.title+'
'); + $("table.all_day_event_holder").append(tr); + } }) + if(tr.html()!=""){ + if(rowcount != 7){ + tr.append("
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 index 461c7b01..62b28113 100644 --- 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 @@ -3,19 +3,35 @@ - <% @dates.each do |day| %> - + <% @dates.each_with_index do |day,i| %> + <% if @today == i %> + + <% else %> + + <% end %> <% end %> - - <% @d.each_with_index do |dt,i| %> - <% if @today == i %> - - <% else %> - - <% end %> - <% end %> + -
+
+ \ 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 index 46fc0a16..709437c7 100644 --- 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 @@ -3,14 +3,14 @@
<%= day %><%= day %><%= day %>
+
+ + + + <% @d.each_with_index do |dt,i| %> + <% if @today == i %> + + <% else %> + + <% end %> + <% end %> + +
+ + + +
+
+
-

Sunday 9/2

+
-
event1
-
event2
+
@@ -18,107 +18,25 @@ diff --git a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/edit.html.erb b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/edit.html.erb new file mode 100644 index 00000000..9cf6b355 --- /dev/null +++ b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/edit.html.erb @@ -0,0 +1,26 @@ +<%= form_for @calendar, :url => panel_calendar_back_end_cal_path(@calendar), :remote => true do |f| %> +

Edit

+
+
+ <%= label_tag("color", t("calendar.color")) %> + <%= f.text_field :color, :class => "color-picker miniColors", :size => "5", :maxlength => "5", :autocomplete=>"off",:value=>@calendar.color %> +
+
+ +
+ <%= f.fields_for :name_translations do |name| %> + <% @site_valid_locales.each_with_index do |locale, i| %> +
+ <%= label_tag(locale, t("calendar.name")+"-"+I18nVariable.from_locale(locale)) %> +
+ <%= name.text_field locale, :class => "input-xxlarge", :size=>"30", :value=>@calendar.name_translations[locale] %> +
+
+ <% end %> + <% end %> +
+
+ <%= f.submit t("calendar.save"), :class=>"btn btn-primary" %> + +
+<% end %> \ 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 96701aaf..791cfe19 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 @@ -64,7 +64,7 @@ - +
-
12am
-
1am
-
2am
-
3am
-
4am
-
5am
-
6am
-
7am
-
8am
-
9am
-
10am
-
11am
-
12am
-
1pm
-
2pm
-
3pm
-
4pm
-
5pm
-
6pm
-
7pm
-
8pm
-
9pm
-
10pm
-
11pm
+ <% @hours.each do |hour| %> +
<%= hour %>am
+ <% end %> + <% @hours.each do |hour| %> +
<%= hour %>pm
+ <% end %>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ <% @hours.each do |hour| %> +
+
+
+
+
+
+ <% end %>
-
+