From 05baecad0be57265f24966d8fbc60297a235b6bd Mon Sep 17 00:00:00 2001 From: Didier Lafforgue Date: Fri, 2 Mar 2012 00:31:45 +0100 Subject: [PATCH] change the path to files added in the content entries + ui settings are a hash not an object --- app/helpers/locomotive/content_types_helper.rb | 4 ++-- app/models/locomotive/content_entry.rb | 2 +- app/models/locomotive/page.rb | 2 +- lib/locomotive/configuration.rb | 2 +- lib/locomotive/custom_fields.rb | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/helpers/locomotive/content_types_helper.rb b/app/helpers/locomotive/content_types_helper.rb index f6852f07..20eb07cf 100644 --- a/app/helpers/locomotive/content_types_helper.rb +++ b/app/helpers/locomotive/content_types_helper.rb @@ -16,9 +16,9 @@ module Locomotive current_site.content_types.ordered.only(:site_id, :name, :slug, :label_field_name).each_with_index do |content_type, index| next if !content_type.persisted? - if index >= Locomotive.config.ui.max_content_types + if index >= Locomotive.config.ui[:max_content_types] if self.is_content_type_selected(content_type) - others << visible.delete_at(Locomotive.config.ui.max_content_types - 1) # swap content types + others << visible.delete_at(Locomotive.config.ui[:max_content_types] - 1) # swap content types visible.insert(0, content_type) else others << content_type # fills the "..." menu diff --git a/app/models/locomotive/content_entry.rb b/app/models/locomotive/content_entry.rb index fd1dcde2..47c39dd5 100644 --- a/app/models/locomotive/content_entry.rb +++ b/app/models/locomotive/content_entry.rb @@ -30,7 +30,7 @@ module Locomotive ## named scopes ## scope :visible, :where => { :_visible => true } - scope :latest_updated, :order_by => :updated_at.desc, :limit => Locomotive.config.ui.latest_entries_nb + scope :latest_updated, :order_by => :updated_at.desc, :limit => Locomotive.config.ui[:latest_entries_nb] ## methods ## diff --git a/app/models/locomotive/page.rb b/app/models/locomotive/page.rb index 2bb23763..3a651224 100644 --- a/app/models/locomotive/page.rb +++ b/app/models/locomotive/page.rb @@ -45,7 +45,7 @@ module Locomotive validates_exclusion_of :slug, :in => Locomotive.config.reserved_slugs, :if => Proc.new { |p| p.depth <= 1 } ## named scopes ## - scope :latest_updated, :order_by => [[:updated_at, :desc]], :limit => Locomotive.config.ui.latest_entries_nb + scope :latest_updated, :order_by => [[:updated_at, :desc]], :limit => Locomotive.config.ui[:latest_entries_nb] scope :root, :where => { :slug => 'index', :depth => 0 } scope :not_found, :where => { :slug => '404', :depth => 0 } scope :published, :where => { :published => true } diff --git a/lib/locomotive/configuration.rb b/lib/locomotive/configuration.rb index 8bf70d41..1ff74325 100644 --- a/lib/locomotive/configuration.rb +++ b/lib/locomotive/configuration.rb @@ -17,7 +17,7 @@ module Locomotive :manage_subdomain => false, :manage_manage_domains => false, :ui => { - :latest_entries_nb => 5, + :latest_entries_nb => 5, :max_content_types => 2 }, :rack_cache => { diff --git a/lib/locomotive/custom_fields.rb b/lib/locomotive/custom_fields.rb index 3d12c6db..3fd8b8a9 100644 --- a/lib/locomotive/custom_fields.rb +++ b/lib/locomotive/custom_fields.rb @@ -26,7 +26,7 @@ module CustomFields # Set correct paths def store_dir - "sites/#{model.site_id}/contents/#{model.class.model_name.underscore}/#{model.id}/files" + "sites/#{model.site_id}/content_#{model.class.model_name.demodulize.underscore}/#{model.id}/files" end def cache_dir