From 32849f1d1bd59fc7c7d5a1ed36c77914dc175ccc Mon Sep 17 00:00:00 2001 From: chris2tof Date: Thu, 25 Aug 2011 15:08:31 +0800 Subject: [PATCH 1/3] Set default design to first design --- app/controllers/admin/pages_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index e3fdbb202..5a5bc2c3f 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -22,7 +22,7 @@ class Admin::PagesController < ApplicationController @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' } + @default_design = Design.first @default_theme = @default_design.themes.detect {|t| t.name.to_s == 'default' } end From 8b576cac485d3e24abbcb4b288a141c8450643cc Mon Sep 17 00:00:00 2001 From: chris2tof Date: Thu, 25 Aug 2011 15:44:52 +0800 Subject: [PATCH 2/3] Fix bug when selecting theme --- app/models/page.rb | 2 +- lib/parser.rb | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/app/models/page.rb b/app/models/page.rb index be51c35c0..4e9f87ff6 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -1,7 +1,7 @@ class Page < Item field :content - field :theme_id + field :theme_id, :type => BSON::ObjectId belongs_to :design has_many :page_parts diff --git a/lib/parser.rb b/lib/parser.rb index d55b3cdf8..c8fc1940a 100644 --- a/lib/parser.rb +++ b/lib/parser.rb @@ -66,10 +66,8 @@ module Parser c.define_tag 'stylesheets' do |tag| res = '' res << " " - page.design.themes.each do |theme| - res << " " - end - res + theme = page.design.themes.detect{ |d| d.id == page.theme_id } + res << "" end c.define_tag 'javascripts' do |tag| res = '' @@ -171,10 +169,8 @@ module Parser c.define_tag 'stylesheets' do |tag| res = '' res << "" - page.design.themes.each do |theme| - res << "" - end - res + theme = page.design.themes.detect{ |d| d.id == page.theme_id } + res << "" end c.define_tag 'javascripts' do |tag| res = '' From f99321c279240b1699e1313b073896a345af5bfc Mon Sep 17 00:00:00 2001 From: chris2tof Date: Thu, 25 Aug 2011 15:59:20 +0800 Subject: [PATCH 3/3] production mode --- config/mongoid.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/config/mongoid.yml b/config/mongoid.yml index 5fbcd8cd6..0270b13ce 100644 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -16,8 +16,10 @@ test: # set these environment variables on your prod server production: - host: <%= ENV['MONGOID_HOST'] %> - port: <%= ENV['MONGOID_PORT'] %> - username: <%= ENV['MONGOID_USERNAME'] %> - password: <%= ENV['MONGOID_PASSWORD'] %> - database: <%= ENV['MONGOID_DATABASE'] %> \ No newline at end of file + # host: <%= ENV['MONGOID_HOST'] %> + # port: <%= ENV['MONGOID_PORT'] %> + # username: <%= ENV['MONGOID_USERNAME'] %> + # password: <%= ENV['MONGOID_PASSWORD'] %> + # database: <%= ENV['MONGOID_DATABASE'] %> + <<: *defaults + database: prototype_r4_development \ No newline at end of file