Sha256: 67b7738acc83282af6d8a87751d6440ac934bff4028d741f25bc6664ab7d0037

Contents?: true

Size: 880 Bytes

Versions: 3

Compression:

Stored size: 880 Bytes

Contents

class Admin::StructuresController < Admin::BaseController
  include AbAdmin::Controllers::Tree

  load_and_authorize_resource

  protected

  def resource_action_items
    edit_structure = AbAdmin::Config::ActionItem.new({}) { |r| link_to icon('wrench', true), edit_resource_path(r), class: 'btn btn-warning' }
    edit_static_page = AbAdmin::Config::ActionItem.new({}) do |r|
      link_to(icon('pencil', true), edit_structure_record_path(r), class: 'btn btn-primary') if r.structure_type.has_static_page?
    end
    [edit_static_page, edit_structure, :destroy, :show]
  end

  def tree_node_renderer
    @tree_node_renderer ||= lambda { |r| link_to r.admin_title, edit_structure_record_path(r), class: 'tree-item_link' }
  end

  def custom_settings
    {index_views: [:tree], default_order: 'lft'}
  end

  def permitted_params
    params[:structure].try!(:permit!)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ab_admin-0.11.0 app/controllers/admin/structures_controller.rb
ab_admin-0.10.0 app/controllers/admin/structures_controller.rb
ab_admin-0.9.0 app/controllers/admin/structures_controller.rb