change the path to files added in the content entries + ui settings are a hash not an object

This commit is contained in:
Didier Lafforgue 2012-03-02 00:31:45 +01:00
parent 3e3691ad4a
commit 05baecad0b
5 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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 ##

View File

@ -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 }

View File

@ -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 => {

View File

@ -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