From 608180646b76871282d58d9c06459f523b5ad8a6 Mon Sep 17 00:00:00 2001 From: chris2tof Date: Wed, 24 Aug 2011 01:39:28 +0800 Subject: [PATCH 1/4] Clean code and add 'name' in theme.rb --- Gemfile | 2 +- Gemfile.lock | 4 +- app/controllers/admin/pages_controller.rb | 20 +---- app/helpers/admin/item_helper.rb | 1 - app/models/design/theme.rb | 12 +++ app/models/page.rb | 15 +--- app/views/admin/pages/_edit_code.html.erb | 8 -- app/views/admin/pages/_form.html.erb | 10 ++- app/views/admin/pages/_form_code.html.erb | 3 - app/views/admin/pages/edit.html.erb | 15 ---- app/views/admin/pages/edit.js.erb | 1 - app/views/admin/pages/show.html.erb | 2 +- app/views/admin/pages/update.js.erb | 2 - lib/fraisier/themes/red.css | 1 + lib/parser.rb | 104 +--------------------- lib/tasks/dev.rake | 36 ++++++-- 16 files changed, 59 insertions(+), 177 deletions(-) delete mode 100644 app/views/admin/pages/_edit_code.html.erb delete mode 100644 app/views/admin/pages/_form_code.html.erb delete mode 100644 app/views/admin/pages/edit.html.erb delete mode 100644 app/views/admin/pages/edit.js.erb delete mode 100644 app/views/admin/pages/update.js.erb create mode 100644 lib/fraisier/themes/red.css diff --git a/Gemfile b/Gemfile index a9813caa..1e6ce8fc 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.6' +gem 'carrierwave', '0.5.4' gem 'ckeditor' gem 'devise' gem 'mini_magick' diff --git a/Gemfile.lock b/Gemfile.lock index 7177ff7e..74e4c8c1 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.6) + carrierwave (0.5.4) activesupport (~> 3.0) chronic (0.6.2) ckeditor (3.6.1) @@ -171,7 +171,7 @@ PLATFORMS DEPENDENCIES bson_ext - carrierwave (= 0.5.6) + carrierwave (= 0.5.4) 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 d6992c71..a0f4231e 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -21,14 +21,11 @@ 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 @@ -51,19 +48,6 @@ 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 7994cb25..e91265fc 100644 --- a/app/helpers/admin/item_helper.rb +++ b/app/helpers/admin/item_helper.rb @@ -12,7 +12,6 @@ module Admin::ItemHelper ret << "