Sha256: 0b39fe001bdbeeb1d72a5b8a9b987956dfd16b7914884c64bdaf382ac4c56549

Contents?: true

Size: 1.75 KB

Versions: 1

Compression:

Stored size: 1.75 KB

Contents

ActiveAdmin.register Ecm::References::Reference do
  menu :parent => Proc.new { I18n.t('ecm.references.active_admin.menu') }.call

  # List settings
  sortable_member_actions

  form do |f|
    f.inputs do
      f.input :category, :as => :select,
                         :collection => nested_set_options(Ecm::References::Category) { |c| "#{'    ' * c.depth}• #{c.to_s}".html_safe },
                         :prompt => ''
    end # f.inputs

    f.inputs do
      f.input :name
      f.input :description
      f.input :published, :as => :boolean
    end # f.inputs

    f.inputs do
      f.input :markup_language, :as => :select, :collection => Ecm::References::Configuration.markup_languages.map(&:to_s)
    end # f.inputs

    form_inputs_for_pictureable(f)

    f.actions

#    f.inputs do
#      span do f.object.errors.inspect end
#    end
  end # form

  index do
    selectable_column
    column :preview_picture do |reference|
      image_tag(reference.preview_picture_image_url(:small_thumb)) unless reference.preview_picture_image_url(:small_thumb).nil?
    end
    column :category
    column :name
    column :published
    column :created_at
    column :updated_at
    default_actions
  end # index

  show :title => :to_s do
    panel Ecm::References::Reference.human_attribute_name(:description) do
      ecm_references_reference.description
    end # panel

    panel_for_pictureable
  end # show

  sidebar Ecm::References::Reference.human_attribute_name(:details), :only => :show do
    attributes_table_for ecm_references_reference do
      row :category
      row :name
      row :published
      row :markup_language
      row :created_at
      row :updated_at
    end
  end # sidebar
end # ActiveAdmin.register Ecm::References::Reference

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ecm_references-0.0.1.pre app/admin/ecm_references_references.rb