Sha256: 4c5aef0eb194f3333cfa1f4430e32c6a30747bf3c8e5d1720d00e90290d72924

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

ActiveAdmin.register ActiveadminSettings::Setting, :as => "Setting" do
  menu :parent => "Settings", :priority  => 1, :label => "General"

  actions  :index, :update, :destroy
  
  controller do
    def update
      update! do |format|
        format.html { render :text => resource.value }
      end
    end
  end

  index :as => :reorder_table do
    column :name do |s|
      "<strong>#{s.name}</strong><br/><em>#{s.description}</em>".html_safe
    end
    
    column :value do |s|
      render :partial => "value", :locals => {:setting => s}
    end

    column "" do |s|
      link_to("Edit",   "#", :class => "member_link edit_setting_link", "data-setting-id" => s.id) +
      link_to("Update", "#", :class => "member_link update_setting_link", "data-setting-id" => s.id) +
      link_to("Delete", admin_setting_path(s), :class => "member_link", :method => :delete, :confirm => "Are you sure?")
    end
  end

  form do |f|
    f.inputs do
      f.input :name
      f.input :type
      f.input :description
      f.input :string
    end

    f.buttons
  end

  collection_action :reorder, :method => :put do
    render :text => resource_class.reorder_objects(params[:ids])
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activeadmin-settings-0.1.0 lib/generators/activeadmin_settings/templates/admin/settings.rb