Merge branch 'master' of github.com:locomotivecms/engine

This commit is contained in:
did 2012-05-23 15:03:37 -07:00
commit 04d9fe17f8
3 changed files with 9 additions and 2 deletions

View File

@ -27,7 +27,7 @@ module Locomotive
def set_label_field
if @new_label_field_name.present?
self.label_field_id = self.entries_custom_fields.detect { |f| f.name == @new_label_field_name.underscore }._id
self.label_field_id = self.entries_custom_fields.detect { |f| f.name == @new_label_field_name.underscore }.try(:_id)
end
# unknown label_field_name, get the first one instead

View File

@ -95,7 +95,7 @@ module Locomotive
if render_children_for_page?(page, depth) && bootstrap?
css += ' dropdown'
link_options = %{ class="dropdown-toggle" data-toogle="dropdown"}
link_options = %{ class="dropdown-toggle" data-toggle="dropdown"}
href = '#'
caret = %{ <b class="caret"></b>}
end

View File

@ -284,6 +284,13 @@ describe Locomotive::ContentType do
lambda { asset.active_at }.should raise_error
end
it 'removes the field used as the label when setting the original label_field_name value before' do
@content_type.label_field_name = 'name'
@content_type.entries_custom_fields.destroy_all :conditions => { :name => @content_type.label_field_name }
@content_type.save
@content_type.label_field_name.should == 'description'
end
it 'renames field label' do
@content_type.entries_custom_fields[1].label = 'Simple description'
@content_type.entries_custom_fields[1].name = nil