From 70b4c83cf5f7bd58c64999ccfde618e25074fb7d Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Fri, 24 Feb 2012 19:11:51 +0800 Subject: [PATCH] Fix bugs and changes for nccu --- Gemfile | 1 + Gemfile.lock | 8 +- app/assets/javascripts/site_editor.js | 3 +- app/controllers/admin/pages_controller.rb | 4 +- app/controllers/pages_controller.rb | 2 +- app/helpers/admin/item_helper.rb | 2 +- app/models/design/design.rb | 2 +- app/views/admin/designs/index.html.erb | 2 +- app/views/layouts/_orbit_bar.html.erb | 2 +- app/views/layouts/_side_bar.html.erb | 20 +- lib/parsers/parser_back_end.rb | 2 +- lib/parsers/parser_common.rb | 6 +- lib/parsers/parser_front_end.rb | 2 +- lib/tasks/page_content.rake | 11 + .../front_end/bulletins_controller.rb | 4 +- .../back_end/bulletins/_form.html.erb | 394 +----------------- .../front_end/bulletins/index.html.erb | 40 +- .../front_end/bulletins/show.html.erb | 30 +- .../widget/bulletins/index.html.erb | 2 +- .../front_end/page_contexts/index.html.erb | 4 +- .../widget/web_links_controller.rb | 4 +- .../widget/web_links/_web_links.html.erb | 10 + .../widget/web_links/reload_web_links.js.erb | 1 + 23 files changed, 100 insertions(+), 456 deletions(-) create mode 100644 lib/tasks/page_content.rake create mode 100644 vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/_web_links.html.erb create mode 100644 vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/reload_web_links.js.erb diff --git a/Gemfile b/Gemfile index 17373085d..eb1f5434f 100644 --- a/Gemfile +++ b/Gemfile @@ -20,6 +20,7 @@ gem 'rubyzip' gem 'sinatra' gem 'sprockets' gem 'tinymce-rails' +gem 'therubyracer' # Gems used only for assets and not required # in production environments by default. diff --git a/Gemfile.lock b/Gemfile.lock index a34c36349..8889b1d5e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -84,10 +84,7 @@ GEM railties (~> 3.0) thor (~> 0.14) json (1.6.5) - kaminari (0.13.0) - actionpack (>= 3.0.0) - activesupport (>= 3.0.0) - railties (>= 3.0.0) + libv8 (3.3.10.4) linecache19 (0.5.12) ruby_core_source (>= 0.1.4) mail (2.3.0) @@ -183,6 +180,8 @@ GEM rack (~> 1.0) tilt (~> 1.1, != 1.3.0) subexec (0.2.1) + therubyracer (0.9.9) + libv8 (~> 3.3.10) thor (0.14.6) tilt (1.3.3) tinymce-rails (3.4.8) @@ -238,6 +237,7 @@ DEPENDENCIES sinatra spork sprockets + therubyracer tinymce-rails uglifier watchr diff --git a/app/assets/javascripts/site_editor.js b/app/assets/javascripts/site_editor.js index ef4acc855..98405564c 100644 --- a/app/assets/javascripts/site_editor.js +++ b/app/assets/javascripts/site_editor.js @@ -7,5 +7,4 @@ //= require jquery //= require jquery_ujs //= require page_edit -//= require side_bar_history -//= require rc \ No newline at end of file +//= require side_bar_history \ No newline at end of file diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index 13909a27f..6206b115b 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -61,9 +61,9 @@ class Admin::PagesController < ApplicationController def update @item = Page.find(params[:id]) - if @item.module_app.key == 'page_content' && @item.page_contexts.blank? + if @item.module_app && @item.module_app.key == 'page_content' && @item.page_contexts.blank? @item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id ) - end + end if @item.update_attributes(params[:page]) flash[:notice] = t('admin.update_success_page') diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index af5f412a7..07d7261c1 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -14,7 +14,7 @@ class PagesController < ApplicationController def show #begin @item = Item.first(:conditions => {:full_name => params[:page_name]}) - if @item.is_published + if @item && @item.is_published case @item._type when 'Page' render_page(params[:id]) diff --git a/app/helpers/admin/item_helper.rb b/app/helpers/admin/item_helper.rb index db75619be..d7a3455b7 100644 --- a/app/helpers/admin/item_helper.rb +++ b/app/helpers/admin/item_helper.rb @@ -11,7 +11,7 @@ module Admin::ItemHelper end ret << "