From f009a1c942a2d26a8844e557fe9f26d3ac7907e4 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Thu, 13 Sep 2012 18:31:44 +0800 Subject: [PATCH 01/17] startup for config --- lib/orbit_app.rb | 10 +++++ lib/orbit_app/backend_side_bar.rb | 15 +++++++ lib/orbit_app/dsl.rb | 16 +++++++ lib/orbit_app/module/module_summary.rb | 20 +++++++++ lib/orbit_app/plugin/plugin_summary.rb | 10 +++++ lib/orbit_app/summary.rb | 46 ++++++++++++++++++++ vendor/built_in_modules/announcement/init.rb | 17 ++++++++ vendor/built_in_modules/news/init.rb | 21 +++++++++ 8 files changed, 155 insertions(+) create mode 100644 lib/orbit_app.rb create mode 100644 lib/orbit_app/backend_side_bar.rb create mode 100644 lib/orbit_app/dsl.rb create mode 100644 lib/orbit_app/module/module_summary.rb create mode 100644 lib/orbit_app/plugin/plugin_summary.rb create mode 100644 lib/orbit_app/summary.rb create mode 100644 vendor/built_in_modules/announcement/init.rb create mode 100644 vendor/built_in_modules/news/init.rb diff --git a/lib/orbit_app.rb b/lib/orbit_app.rb new file mode 100644 index 00000000..d171a5a6 --- /dev/null +++ b/lib/orbit_app.rb @@ -0,0 +1,10 @@ +require "orbit_app/summary" +require "orbit_app/dsl" +require "orbit_app/backend_side_bar" +require "orbit_app/plugin/plugin_summary" +require "orbit_app/module/module_summary" + +module OrbitApp + extend DSL + +end diff --git a/lib/orbit_app/backend_side_bar.rb b/lib/orbit_app/backend_side_bar.rb new file mode 100644 index 00000000..a4f3728e --- /dev/null +++ b/lib/orbit_app/backend_side_bar.rb @@ -0,0 +1,15 @@ +module OrbitApp + class BackendSideBar + attr_reader :name + + def initialize(name, &block) + @name = name + block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? + end + + def item(*args) + + end + + end +end \ No newline at end of file diff --git a/lib/orbit_app/dsl.rb b/lib/orbit_app/dsl.rb new file mode 100644 index 00000000..c414d663 --- /dev/null +++ b/lib/orbit_app/dsl.rb @@ -0,0 +1,16 @@ +module OrbitApp + module DSL + def backend_side_bar(name,&block) + BackendSideBar.new(name,&block) + end + + def plugin_summary(name,&block) + # Plugin::PluginSummary.new(name,&block) + end + + def module_summary(name,&block) + Module::ModuleSummary.new(name,&block) + end + + end +end \ No newline at end of file diff --git a/lib/orbit_app/module/module_summary.rb b/lib/orbit_app/module/module_summary.rb new file mode 100644 index 00000000..746e1205 --- /dev/null +++ b/lib/orbit_app/module/module_summary.rb @@ -0,0 +1,20 @@ +#encoding: utf-8 +require "orbit_app/summary" + +module OrbitApp + module Module + module ModuleSummary + include Summary + + class Item + def initialize() + @top = {:label => "全部內容有",:value=> "2071"} + @items = [{:label => "新聞",:value=> "20"}] + end + + + end + + end + end +end \ No newline at end of file diff --git a/lib/orbit_app/plugin/plugin_summary.rb b/lib/orbit_app/plugin/plugin_summary.rb new file mode 100644 index 00000000..55e05120 --- /dev/null +++ b/lib/orbit_app/plugin/plugin_summary.rb @@ -0,0 +1,10 @@ +require "orbit_app/summary" + +module OrbitApp + module Plugin + module PluginSummary + include OrbitApp::Summary + + end + end +end \ No newline at end of file diff --git a/lib/orbit_app/summary.rb b/lib/orbit_app/summary.rb new file mode 100644 index 00000000..05c22f89 --- /dev/null +++ b/lib/orbit_app/summary.rb @@ -0,0 +1,46 @@ +module OrbitApp + module Summary + Version = "0.1" + + module ClassMethods + @@summaries = [] + + def new( name ,&block) + @@summaries << Item.new(name,&block) + binding.pry + end + + def all + return @@summaries + end + end + + extend ClassMethods + def self.included( other ) + other.extend( ClassMethods ) + end + + + + + + # def initialize( k ) + # @@summaries += 1 + # binding.pry + # end + + + class Item + @name ="" + def initialize(name = "test",&block) + @name = name + block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? + end + + def get_name + return @name + end + end + + end +end \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/init.rb b/vendor/built_in_modules/announcement/init.rb new file mode 100644 index 00000000..a9a24c5f --- /dev/null +++ b/vendor/built_in_modules/announcement/init.rb @@ -0,0 +1,17 @@ +OrbitApp.module_summary "Announcement" do + +end + +# OrbitApp.backend_side_bar 'News' do + +# block :available_for => [:admin,:guest,:manager,:sub_manager], +# :active_for_controllers=> ['news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals'], +# :active_for_ob_auths_object => ['NewsBulletinCategory'], +# :head_link => panel_news_back_end_news_bulletins_path , +# :head_label=> I18n.t('admin.news') + +# context_link :link=>new_panel_news_back_end_news_bulletin_path , +# :priority=>1,:label=>I18n.t('announcement.add_new'), +# :active_for_action=>{:news_bulletins=>:new} + +# end \ No newline at end of file diff --git a/vendor/built_in_modules/news/init.rb b/vendor/built_in_modules/news/init.rb new file mode 100644 index 00000000..ec20495f --- /dev/null +++ b/vendor/built_in_modules/news/init.rb @@ -0,0 +1,21 @@ +# OrbitApp.module_summary "News" do + +# end + +# OrbitApp.plugin_summary "News" do + +# end + +# OrbitApp.backend_side_bar 'News' do + +# block :available_for => [:admin,:guest,:manager,:sub_manager], +# :active_for_controllers=> ['news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals'], +# :active_for_ob_auths_object => ['NewsBulletinCategory'], +# :head_link => panel_news_back_end_news_bulletins_path , +# :head_label=> I18n.t('admin.news') + +# context_link :link=>new_panel_news_back_end_news_bulletin_path , +# :priority=>1,:label=>I18n.t('announcement.add_new'), +# :active_for_action=>{:news_bulletins=>:new} + +# end \ No newline at end of file From 84205379c105dcddfba90ca7cc19f4261d5bd104 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Mon, 17 Sep 2012 21:36:40 +0800 Subject: [PATCH 02/17] GPRS and CALENDAR --- app/uploaders/gprs_uploader.rb | 61 +++++++++++++++++++ app/views/layouts/_side_bar.html.erb | 13 +++- config/locales/en.yml | 1 + .../app/assets/javascripts/calendarAPI.js.erb | 54 ++++++++++++---- .../app/assets/stylesheets/calendar.css | 2 +- .../calendar/back_end/cals_controller.rb | 5 +- .../calendar/back_end/events_controller.rb | 14 ++++- .../panel/calendar/back_end/cals_helper.rb | 5 ++ .../calendar/back_end/cals/index.html.erb | 2 +- .../calendar/back_end/events/show.html.erb | 11 +++- vendor/built_in_modules/gprs/.gitignore | 6 ++ vendor/built_in_modules/gprs/Gemfile | 17 ++++++ vendor/built_in_modules/gprs/MIT-LICENSE | 20 ++++++ vendor/built_in_modules/gprs/README.rdoc | 3 + vendor/built_in_modules/gprs/Rakefile | 39 ++++++++++++ .../gprs/app/assets/images/gprs/.gitkeep | 0 .../gprs/app/assets/javascripts/gprs/.gitkeep | 0 .../gprs/app/assets/stylesheets/gprs/.gitkeep | 0 .../gprs/app/controllers/.gitkeep | 0 .../gprs/back_end/locations_controller.rb | 16 +++++ .../gprs/app/helpers/.gitkeep | 0 .../gprs/app/mailers/.gitkeep | 0 .../built_in_modules/gprs/app/models/.gitkeep | 0 .../gprs/app/models/location.rb | 12 ++++ .../built_in_modules/gprs/app/views/.gitkeep | 0 .../gprs/back_end/locations/index.html.erb | 41 +++++++++++++ vendor/built_in_modules/gprs/config/routes.rb | 12 ++++ vendor/built_in_modules/gprs/gprs.gemspec | 23 +++++++ vendor/built_in_modules/gprs/lib/gprs.rb | 4 ++ .../built_in_modules/gprs/lib/gprs/engine.rb | 4 ++ .../built_in_modules/gprs/lib/gprs/version.rb | 3 + .../gprs/lib/tasks/gprs_tasks.rake | 4 ++ vendor/built_in_modules/gprs/script/rails | 6 ++ .../built_in_modules/gprs/test/dummy/Rakefile | 7 +++ .../app/assets/javascripts/application.js | 9 +++ .../app/assets/stylesheets/application.css | 7 +++ .../app/controllers/application_controller.rb | 3 + .../dummy/app/helpers/application_helper.rb | 2 + .../gprs/test/dummy/app/mailers/.gitkeep | 0 .../gprs/test/dummy/app/models/.gitkeep | 0 .../app/views/layouts/application.html.erb | 14 +++++ .../gprs/test/dummy/config.ru | 4 ++ .../gprs/test/dummy/config/application.rb | 45 ++++++++++++++ .../gprs/test/dummy/config/boot.rb | 10 +++ .../gprs/test/dummy/config/database.yml | 25 ++++++++ .../gprs/test/dummy/config/environment.rb | 5 ++ .../dummy/config/environments/development.rb | 30 +++++++++ .../dummy/config/environments/production.rb | 60 ++++++++++++++++++ .../test/dummy/config/environments/test.rb | 39 ++++++++++++ .../initializers/backtrace_silencers.rb | 7 +++ .../dummy/config/initializers/inflections.rb | 10 +++ .../dummy/config/initializers/mime_types.rb | 5 ++ .../dummy/config/initializers/secret_token.rb | 7 +++ .../config/initializers/session_store.rb | 8 +++ .../config/initializers/wrap_parameters.rb | 14 +++++ .../gprs/test/dummy/config/locales/en.yml | 5 ++ .../gprs/test/dummy/config/routes.rb | 58 ++++++++++++++++++ .../gprs/test/dummy/lib/assets/.gitkeep | 0 .../gprs/test/dummy/log/.gitkeep | 0 .../gprs/test/dummy/public/404.html | 26 ++++++++ .../gprs/test/dummy/public/422.html | 26 ++++++++ .../gprs/test/dummy/public/500.html | 26 ++++++++ .../gprs/test/dummy/public/favicon.ico | 0 .../gprs/test/dummy/script/rails | 6 ++ .../built_in_modules/gprs/test/gprs_test.rb | 7 +++ .../gprs/test/integration/navigation_test.rb | 10 +++ .../built_in_modules/gprs/test/test_helper.rb | 10 +++ 67 files changed, 841 insertions(+), 22 deletions(-) create mode 100644 app/uploaders/gprs_uploader.rb create mode 100644 vendor/built_in_modules/gprs/.gitignore create mode 100644 vendor/built_in_modules/gprs/Gemfile create mode 100644 vendor/built_in_modules/gprs/MIT-LICENSE create mode 100644 vendor/built_in_modules/gprs/README.rdoc create mode 100644 vendor/built_in_modules/gprs/Rakefile create mode 100644 vendor/built_in_modules/gprs/app/assets/images/gprs/.gitkeep create mode 100644 vendor/built_in_modules/gprs/app/assets/javascripts/gprs/.gitkeep create mode 100644 vendor/built_in_modules/gprs/app/assets/stylesheets/gprs/.gitkeep create mode 100644 vendor/built_in_modules/gprs/app/controllers/.gitkeep create mode 100644 vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb create mode 100644 vendor/built_in_modules/gprs/app/helpers/.gitkeep create mode 100644 vendor/built_in_modules/gprs/app/mailers/.gitkeep create mode 100644 vendor/built_in_modules/gprs/app/models/.gitkeep create mode 100644 vendor/built_in_modules/gprs/app/models/location.rb create mode 100644 vendor/built_in_modules/gprs/app/views/.gitkeep create mode 100644 vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/index.html.erb create mode 100644 vendor/built_in_modules/gprs/config/routes.rb create mode 100644 vendor/built_in_modules/gprs/gprs.gemspec create mode 100644 vendor/built_in_modules/gprs/lib/gprs.rb create mode 100644 vendor/built_in_modules/gprs/lib/gprs/engine.rb create mode 100644 vendor/built_in_modules/gprs/lib/gprs/version.rb create mode 100644 vendor/built_in_modules/gprs/lib/tasks/gprs_tasks.rake create mode 100755 vendor/built_in_modules/gprs/script/rails create mode 100644 vendor/built_in_modules/gprs/test/dummy/Rakefile create mode 100644 vendor/built_in_modules/gprs/test/dummy/app/assets/javascripts/application.js create mode 100644 vendor/built_in_modules/gprs/test/dummy/app/assets/stylesheets/application.css create mode 100644 vendor/built_in_modules/gprs/test/dummy/app/controllers/application_controller.rb create mode 100644 vendor/built_in_modules/gprs/test/dummy/app/helpers/application_helper.rb create mode 100644 vendor/built_in_modules/gprs/test/dummy/app/mailers/.gitkeep create mode 100644 vendor/built_in_modules/gprs/test/dummy/app/models/.gitkeep create mode 100644 vendor/built_in_modules/gprs/test/dummy/app/views/layouts/application.html.erb create mode 100644 vendor/built_in_modules/gprs/test/dummy/config.ru create mode 100644 vendor/built_in_modules/gprs/test/dummy/config/application.rb create mode 100644 vendor/built_in_modules/gprs/test/dummy/config/boot.rb create mode 100644 vendor/built_in_modules/gprs/test/dummy/config/database.yml create mode 100644 vendor/built_in_modules/gprs/test/dummy/config/environment.rb create mode 100644 vendor/built_in_modules/gprs/test/dummy/config/environments/development.rb create mode 100644 vendor/built_in_modules/gprs/test/dummy/config/environments/production.rb create mode 100644 vendor/built_in_modules/gprs/test/dummy/config/environments/test.rb create mode 100644 vendor/built_in_modules/gprs/test/dummy/config/initializers/backtrace_silencers.rb create mode 100644 vendor/built_in_modules/gprs/test/dummy/config/initializers/inflections.rb create mode 100644 vendor/built_in_modules/gprs/test/dummy/config/initializers/mime_types.rb create mode 100644 vendor/built_in_modules/gprs/test/dummy/config/initializers/secret_token.rb create mode 100644 vendor/built_in_modules/gprs/test/dummy/config/initializers/session_store.rb create mode 100644 vendor/built_in_modules/gprs/test/dummy/config/initializers/wrap_parameters.rb create mode 100644 vendor/built_in_modules/gprs/test/dummy/config/locales/en.yml create mode 100644 vendor/built_in_modules/gprs/test/dummy/config/routes.rb create mode 100644 vendor/built_in_modules/gprs/test/dummy/lib/assets/.gitkeep create mode 100644 vendor/built_in_modules/gprs/test/dummy/log/.gitkeep create mode 100644 vendor/built_in_modules/gprs/test/dummy/public/404.html create mode 100644 vendor/built_in_modules/gprs/test/dummy/public/422.html create mode 100644 vendor/built_in_modules/gprs/test/dummy/public/500.html create mode 100644 vendor/built_in_modules/gprs/test/dummy/public/favicon.ico create mode 100755 vendor/built_in_modules/gprs/test/dummy/script/rails create mode 100644 vendor/built_in_modules/gprs/test/gprs_test.rb create mode 100644 vendor/built_in_modules/gprs/test/integration/navigation_test.rb create mode 100644 vendor/built_in_modules/gprs/test/test_helper.rb diff --git a/app/uploaders/gprs_uploader.rb b/app/uploaders/gprs_uploader.rb new file mode 100644 index 00000000..4ce41321 --- /dev/null +++ b/app/uploaders/gprs_uploader.rb @@ -0,0 +1,61 @@ +class GprsUploader < CarrierWave::Uploader::Base + + # Include RMagick or ImageScience support: + # include CarrierWave::RMagick + # include CarrierWave::ImageScience + include CarrierWave::MiniMagick + + # Choose what kind of storage to use for this uploader: + # storage :file + # storage :s3 + + # Override the directory where uploaded files will be stored. + # This is a sensible default for uploaders that are meant to be mounted: + def store_dir + "gprs/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" + end + + # Provide a default URL as a default if there hasn't been a file uploaded: + # def default_url + # "/images/fallback/" + [version_name, "default.png"].compact.join('_') + # end + + # Process files as they are uploaded: + # process :scale => [200, 300] + # + # def scale(width, height) + # # do something + # end + + # Create different versions of your uploaded files: + # version :thumb do + # process :scale => [50, 50] + # end + + version :thumb do + process :resize_to_fill => [150, 120] + end + + # Add a white list of extensions which are allowed to be uploaded. + # For images you might use something like this: + # def extension_white_list + # %w(jpg jpeg gif png) + # end + + # Override the filename of the uploaded files: + # def filename + # "something.jpg" if original_filename + # end + +# def manipulate! +# raise current_path.inspect +# image = ::MiniMagick::Image.open(current_path) +# image = yield(image) +# image.write(current_path) +# ::MiniMagick::Image.open(current_path) +# rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e +# raise CarrierWave::ProcessingError.new("Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: #{e}") +# end + +end + diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index cc6daf73..fbc7e4a6 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -105,7 +105,7 @@ <% end -%> <% end -%> -<%= content_tag :li, :class => active_for_controllers('cals','calendar_categories') || active_for_app_auth("calendar") do -%> +<%= content_tag :li, :class => active_for_controllers('cals') || active_for_app_auth("calendar") do -%> <%= link_to content_tag(:i, nil, :class => 'icons-calendar') + content_tag(:span, t('admin.calendar')), panel_calendar_back_end_cals_path %> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('cals','calendar_categories') ) do -%> <%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %> @@ -116,6 +116,17 @@ <%#= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "gallery"}))), :class => active_for_app_auth('gallery') if (is_admin? rescue nil) %> <% end -%> <% end %> +<%= content_tag :li, :class => active_for_controllers('locations') || active_for_app_auth("gprs") do -%> + <%= link_to content_tag(:i, nil, :class => 'icons-link') + content_tag(:span, t('admin.gprs')), panel_gprs_back_end_locations_path %> + <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('locations') ) do -%> + <%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %> + <%#= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %> + <%#= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %> + <%#= content_tag :li, link_to((t('calendar.calendars') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_panel_calendar_back_end_cal_path), :class => active_for_action('cals','new') %> + <%#= content_tag :li, link_to(t('gallery.tags'), panel_gallery_back_end_tags_path), :class => active_for_action('/panel/gallery/back_end/tags', 'index') %> + <%#= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "gallery"}))), :class => active_for_app_auth('gallery') if (is_admin? rescue nil) %> + <% end -%> +<% end %> <%= content_tag :li, :class => (active_for_controllers('writing_journals', '/panel/personal_journal/back_end/tags', 'writing_journal_categorys', 'approvals') || active_for_app_auth('PersonalJournal') ) do -%> <%= link_to content_tag(:i, nil, :class => 'icons-personal_journal') + t('admin.personal_journal'), panel_personal_journal_back_end_writing_journals_path %> diff --git a/config/locales/en.yml b/config/locales/en.yml index efe8612a..b638ccb1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -130,6 +130,7 @@ en: attributes: Attributes author: Author calendar: Calendar + gprs: GPRS cant_delete_self: You can not delete yourself. cant_revoke_self_admin: You can not revoke your admin role yourself. category: Category 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 2b8b2b02..78089ac7 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 @@ -15,7 +15,7 @@ var calendarAPI = function(){ }) var bindHandlers = function(){ $(".event").live("click",function(){ - c.displayEvent(); + c.displayEvent($(this)); }) $("#create_event_btn").click(function(){ @@ -115,6 +115,8 @@ var calendarAPI = function(){ $.getJSON("cals/getEvents",{"type":"monthview","month":month,"year":year},function(events){ var $eventrow = $(""); var nos = new Array(); + var currow = 0; + var lastno = 0; nos.push(0); $.each(events,function(i,evnt){ var daydom = $("#calendar_month td[date="+evnt.start_date+"]"); @@ -124,28 +126,51 @@ var calendarAPI = function(){ var thisno = daydom.attr("no"); var index = "new"; + var smallcount = 0; + for(x in nos){ - if(thisno < nos[x]){ - $eventrow = null; - $eventrow = $(""); + if(thisno > nos[x]){ + smallcount++; + } + if(smallcount > 0){ index = x; break; } } + if(index == "new"){ + nos=[] + $eventrow = null; + $eventrow = $(""); + } + + if(thisrow!=currow){ + $eventrow = null; + $eventrow = $(""); + + } + if(index!="new"){ - nos[index] = (thisno + evnt.total_days) - 1; + nos[index] = (parseInt(thisno) + parseInt(evnt.total_days)) - 1; }else{ - nos.push((thisno + evnt.total_days) - 1); + nos.push((parseInt(thisno) + parseInt(evnt.total_days)) - 1); } if(pos == 1){ - $eventrow.html('
'+evnt.title+'
'); + $eventrow.html('
'+evnt.title+'
'); }else{ if($eventrow.html()==""){ $eventrow.append(''); + }else{ + if((lastno+1)!=thisno){ + var inposition = $eventrow.find("td.main_td").attr("pos"); + var colspan = parseInt(pos) - parseInt(inposition); + colspan--; + $eventrow.append(''); + } } - $eventrow.append('
'+evnt.title+'
'); + $eventrow.append('
'+evnt.title+'
'); } - + lastno = (parseInt(thisno) + parseInt(evnt.total_days)) - 1; + currow = thisrow; curparent.append($eventrow); }) }) @@ -195,9 +220,14 @@ var calendarAPI = function(){ $("tr[for="+domfor+"]").remove(); }) } - this.displayEvent = function(){ - - c.event_quick_view_div.show() + this.displayEvent = function(dom){ + var url = dom.attr("link"); + c.event_quick_view_div.load(url,function(){ + c.event_quick_view_div.show() + c.event_quick_view_div.find(".event-close-btn").click(function(){ + c.event_quick_view_div.empty().hide(); + }) + }) } c.initialize(); } 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 421f8334..85b0390f 100644 --- a/vendor/built_in_modules/calendar/app/assets/stylesheets/calendar.css +++ b/vendor/built_in_modules/calendar/app/assets/stylesheets/calendar.css @@ -265,7 +265,7 @@ /* Event Controller */ .event_controller { - width: 300px; + width: 350px; } .event_controller .row-fluid { margin-bottom: 6px; 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 4c42e0d4..6330e95b 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 @@ -58,7 +58,7 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController def get_events month = params[:month] year = params[:year] - events = Event.where(:start_month => month).and(:start_year => year) + events = Event.where(:start_month => month).and(:start_year => year).asc(:start_date) @events = Array.new events.each do |event| # @temp = Array.new @@ -66,8 +66,9 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController no_of_days = no_of_days.to_i no_of_days += 1 color = Cal.find(event.cal_id).color - @events << {"start_date"=>event.start_date, "total_days" => no_of_days, "title" => event.title,"color"=>color} + @events << {"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 = @events.sort{|k,v| v[:total_days] <=> k[:total_days]} render :json => @events.to_json end 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 0dca026f..ea319cdb 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 @@ -1,5 +1,5 @@ class Panel::Calendar::BackEnd::EventsController < OrbitBackendController - + include Panel::Calendar::BackEnd::CalsHelper def new @calendars = Cal.all @event = Event.new @@ -55,4 +55,14 @@ class Panel::Calendar::BackEnd::EventsController < OrbitBackendController h.js end end -end \ No newline at end of file + 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 +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 60a14ffa..3f937552 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 @@ -61,5 +61,10 @@ module Panel::Calendar::BackEnd::CalsHelper monthsdays << 31 return monthsdays end + def getDayName(date,month,year) + dt = Date.new(year,month,date) + name = Date::ABBR_DAYNAMES[dt.wday] + return name + end 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 98a237af..96701aaf 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 @@ -62,7 +62,7 @@ - + diff --git a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/events/show.html.erb b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/events/show.html.erb index 0791c7bd..c65a2fa6 100644 --- a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/events/show.html.erb +++ b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/events/show.html.erb @@ -1,10 +1,15 @@ -
- <% #binding.pry%> - <%= render :partial=> 'plugin_summary'%> - <%= render :partial=> 'plugin_summary'%> - <%= render :partial=> 'plugin_summary'%> -
+ <%=render :partial=> @right_partial%>