diff --git a/Gemfile b/Gemfile index 1e6ce8fc..a9813caa 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ gem 'rails', '>=3.1.0.rc4' gem 'yajl-ruby', :require => 'yajl' gem 'bson_ext' -gem 'carrierwave', '0.5.4' +gem 'carrierwave', '0.5.6' gem 'ckeditor' gem 'devise' gem 'mini_magick' diff --git a/Gemfile.lock b/Gemfile.lock index 74e4c8c1..7177ff7e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -36,7 +36,7 @@ GEM bson (1.3.1) bson_ext (1.3.1) builder (3.0.0) - carrierwave (0.5.4) + carrierwave (0.5.6) activesupport (~> 3.0) chronic (0.6.2) ckeditor (3.6.1) @@ -171,7 +171,7 @@ PLATFORMS DEPENDENCIES bson_ext - carrierwave (= 0.5.4) + carrierwave (= 0.5.6) ckeditor coffee-rails (~> 3.1.0.rc) delorean diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index a0f4231e..d6992c71 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -21,11 +21,14 @@ class Admin::PagesController < ApplicationController @item = Page.new @item.is_published = true @item.parent_id = @parent_item.id rescue nil - @designs = Design.all.entries - @default_design = @designs.detect {|d| d.title.to_s == 'Bob' } end def edit + @item = Page.find(params[:id]) + # @item.content = parse_content(@item.content, {:locale => 'show'}) + @item.content = parse_page_code(@item) + @i18n_variable = @item.i18n_variable + @code = params[:code] end def create @@ -48,6 +51,19 @@ class Admin::PagesController < ApplicationController end def update + @item = Page.find(params[:id]) + parse_content_update_code(@item, params[:page][:content]) + if @item.update_attributes(params[:item]) + flash[:notice] = t('admin.update_success_page') + respond_to do |format| + format.html { + redirect_to admin_page_url(@item) + } + format.js {} + end + else + render :action => "edit" + end end def destroy diff --git a/app/helpers/admin/item_helper.rb b/app/helpers/admin/item_helper.rb index e91265fc..7994cb25 100644 --- a/app/helpers/admin/item_helper.rb +++ b/app/helpers/admin/item_helper.rb @@ -12,6 +12,7 @@ module Admin::ItemHelper ret << "