Sha256: 9659b7efcb3b89452be9211fe3e3552c02b7a3d16f1babee00c9fe689e1c9af1

Contents?: true

Size: 909 Bytes

Versions: 6

Compression:

Stored size: 909 Bytes

Contents

module Admin::CustomFieldsHelper
    
  def options_for_field_kind(selected = nil)
    # %w{String Text Boolean Email File Date}
    options = %w{String Text Category}.map do |kind|
      [t("admin.custom_fields.kind.#{kind.downcase}"), kind]
    end    
  end
  
  def options_for_order_by(content_type, collection_name)
    options = %w{updated_at _position_in_list}.map do |type|
      [t("admin.content_types.form.order_by.#{type.gsub(/^_/, '')}"), type]
    end
    options + options_for_highlighted_field(content_type, collection_name)
  end
  
  def options_for_highlighted_field(content_type, collection_name)
    custom_fields_collection_name = "ordered_#{collection_name.singularize}_custom_fields".to_sym
    collection = content_type.send(custom_fields_collection_name)
    collection.delete_if { |f| f.label == 'field name' }
    collection.map { |field| [field.label, field._name] }
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
locomotive_cms-0.0.2.5 app/helpers/admin/custom_fields_helper.rb
locomotive_cms-0.0.2.4 app/helpers/admin/custom_fields_helper.rb
locomotive_cms-0.0.2.3 app/helpers/admin/custom_fields_helper.rb
locomotive_cms-0.0.2.2 app/helpers/admin/custom_fields_helper.rb
locomotive_cms-0.0.2.1 app/helpers/admin/custom_fields_helper.rb
locomotive_cms-0.0.2 app/helpers/admin/custom_fields_helper.rb