From c5692aeb2ae56bf2801e3077537269aeccf479bf Mon Sep 17 00:00:00 2001 From: did Date: Fri, 27 Jan 2012 02:27:26 +0100 Subject: [PATCH] fix errors when deploying a new brand new engine instance --- Gemfile | 2 +- Gemfile.lock | 4 +-- .../not_logged_in/installation.css.scss | 8 +++-- app/cells/locomotive/menu_cell.rb | 11 +++--- .../locomotive/api/base_controller.rb | 9 +++++ .../layouts/not_logged_in.html.haml | 2 +- .../locomotive/install/install_generator.rb | 2 ++ .../locomotive/install/templates/mongoid.yml | 34 +++++++++++++++++++ locomotive_cms.gemspec | 2 +- 9 files changed, 61 insertions(+), 13 deletions(-) create mode 100644 lib/generators/locomotive/install/templates/mongoid.yml diff --git a/Gemfile b/Gemfile index 530d332c..408d63de 100644 --- a/Gemfile +++ b/Gemfile @@ -32,7 +32,7 @@ gem 'flash_cookie_session', '~> 1.1.1' gem 'locomotive_liquid', '2.2.2', :require => 'liquid' gem 'formtastic', '~> 2.0.2' gem 'responders', '~> 0.6.4' -gem 'cells', '~> 3.7.1' +gem 'cells', '~> 3.8.0' gem 'RedCloth', '~> 4.2.8' gem 'sanitize', '~> 2.0.3' gem 'highline', '~> 1.6.2' diff --git a/Gemfile.lock b/Gemfile.lock index eea9a812..c346158f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -69,7 +69,7 @@ GEM carrierwave-mongoid (0.1.3) carrierwave (>= 0.5.6) mongoid (~> 2.1) - cells (3.7.1) + cells (3.8.0) actionpack (~> 3.0) railties (~> 3.0) childprocess (0.3.0) @@ -291,7 +291,7 @@ DEPENDENCIES cancan (~> 1.6.7) capybara carrierwave-mongoid (~> 0.1.3) - cells (~> 3.7.1) + cells (~> 3.8.0) codemirror-rails coffee-script (~> 2.2.0) compass (~> 0.12.alpha.4) diff --git a/app/assets/stylesheets/locomotive/not_logged_in/installation.css.scss b/app/assets/stylesheets/locomotive/not_logged_in/installation.css.scss index 12478c50..1fbb25e1 100644 --- a/app/assets/stylesheets/locomotive/not_logged_in/installation.css.scss +++ b/app/assets/stylesheets/locomotive/not_logged_in/installation.css.scss @@ -46,10 +46,12 @@ body.installation { } // li.question li { - input { - &[type=text] { width: 302px; } + &.string { + input[type=text] { width: 290px; } + } - &[type=password] { width: 180px; } + &.password { + input[type=password] { width: 180px; } } } // li diff --git a/app/cells/locomotive/menu_cell.rb b/app/cells/locomotive/menu_cell.rb index b56666ec..128b4c59 100644 --- a/app/cells/locomotive/menu_cell.rb +++ b/app/cells/locomotive/menu_cell.rb @@ -1,4 +1,5 @@ -class Locomotive::MenuCell < Cell::Base +class Locomotive::MenuCell < Cell::Rails + include ::Locomotive::Engine.routes.url_helpers delegate :sections, :to => :parent_controller @@ -17,10 +18,10 @@ class Locomotive::MenuCell < Cell::Base def url_options super.reverse_merge( - :host => request.host_with_port, - :protocol => request.protocol, - :_path_segments => request.symbolized_path_parameters - ).merge(:script_name => request.script_name) + :host => request.host_with_port, + :protocol => request.protocol, + :_path_segments => request.symbolized_path_parameters + ).merge(:script_name => request.script_name) end class MenuProxy diff --git a/app/controllers/locomotive/api/base_controller.rb b/app/controllers/locomotive/api/base_controller.rb index d0103bad..427d5752 100644 --- a/app/controllers/locomotive/api/base_controller.rb +++ b/app/controllers/locomotive/api/base_controller.rb @@ -9,6 +9,8 @@ module Locomotive before_filter :require_site + before_filter :set_locale + # before_filter :validate_site_membership skip_before_filter :verify_authenticity_token @@ -39,6 +41,13 @@ module Locomotive authenticate_locomotive_account! end + def set_locale + ::Mongoid::Fields::I18n.locale = params[:locale] || current_site.default_locale + ::I18n.locale = ::Mongoid::Fields::I18n.locale + + self.setup_i18n_fallbacks + end + end end end \ No newline at end of file diff --git a/app/views/locomotive/layouts/not_logged_in.html.haml b/app/views/locomotive/layouts/not_logged_in.html.haml index 6e24e467..6c180592 100644 --- a/app/views/locomotive/layouts/not_logged_in.html.haml +++ b/app/views/locomotive/layouts/not_logged_in.html.haml @@ -2,7 +2,7 @@ !!! %html{ :xmlns => 'http://www.w3.org/1999/xhtml' } %head - %title= title || escape_once("#{Locomotive.config.name} — #{current_site.name}") + %title= escape_once(title || "#{Locomotive.config.name} — #{current_site.name}") = javascript_include_tag 'locomotive/not_logged_in' = stylesheet_link_tag 'locomotive/not_logged_in', :media => 'screen' diff --git a/lib/generators/locomotive/install/install_generator.rb b/lib/generators/locomotive/install/install_generator.rb index e0f682c2..ee22a599 100644 --- a/lib/generators/locomotive/install/install_generator.rb +++ b/lib/generators/locomotive/install/install_generator.rb @@ -13,6 +13,8 @@ module Locomotive template 'carrierwave.rb', 'config/initializers/carrierwave.rb' template 'dragonfly.rb', 'config/initializers/dragonfly.rb' + + template 'mongoid.yml', 'config/mongoid.yml' end def insert_engine_routes diff --git a/lib/generators/locomotive/install/templates/mongoid.yml b/lib/generators/locomotive/install/templates/mongoid.yml new file mode 100644 index 00000000..b717cae7 --- /dev/null +++ b/lib/generators/locomotive/install/templates/mongoid.yml @@ -0,0 +1,34 @@ +defaults: &defaults + host: localhost + port: 27017 + # slaves: + # - host: slave1.local + # port: 27018 + # - host: slave2.local + # port: 27019 + +development: + <<: *defaults + database: locomotive_dev + +test: + <<: *defaults + database: locomotive_test + +# set these environment variables on your prod server +production: + # <<: *defaults + # database: locomotive_prod + + # other settings for production + # host: <%%= ENV['MONGOID_HOST'] %> + # port: <%%= ENV['MONGOID_PORT'] %> + # username: <%%= ENV['MONGOID_USERNAME'] %> + # password: <%%= ENV['MONGOID_PASSWORD'] %> + # database: <%%= ENV['MONGOID_DATABASE'] %> + + # heroku + # uri: <%%= ENV['MONGOHQ_URL'] %> + + # bushido (mongohq_url will also work) + uri: <%%= ENV['MONGODB_URL'] %> \ No newline at end of file diff --git a/locomotive_cms.gemspec b/locomotive_cms.gemspec index 46c6b146..f3a60af7 100644 --- a/locomotive_cms.gemspec +++ b/locomotive_cms.gemspec @@ -27,7 +27,7 @@ Gem::Specification.new do |s| s.add_dependency 'mongoid', '~> 2.4.2' s.add_dependency 'locomotive_mongoid_acts_as_tree', '0.1.5.8' - s.add_dependency 'custom_fields', '~> 2.0.0.rc1' + s.add_dependency 'custom_fields', '~> 2.0.0.rc2' s.add_dependency 'kaminari'