diff --git a/Gemfile b/Gemfile index 17373085..eb1f5434 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 a34c3634..8889b1d5 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 ef4acc85..98405564 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 13909a27..6206b115 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 af5f412a..07d7261c 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 db75619b..d7a3455b 100644 --- a/app/helpers/admin/item_helper.rb +++ b/app/helpers/admin/item_helper.rb @@ -11,7 +11,7 @@ module Admin::ItemHelper end ret << "