Sha256: 3314f5cc4e7e97a8696e8b7622657298d57322127b71db20b07c69026b4cfd89

Contents?: true

Size: 871 Bytes

Versions: 4

Compression:

Stored size: 871 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 settings
    {index_view: 'tree', default_order: 'lft'}
  end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ab_admin-0.8.3 app/controllers/admin/structures_controller.rb
ab_admin-0.8.2 app/controllers/admin/structures_controller.rb
ab_admin-0.8.1 app/controllers/admin/structures_controller.rb
ab_admin-0.8.0 app/controllers/admin/structures_controller.rb