Sha256: 4adfe6554a8fdab33ce96c5ad3c5b6bb33f45aabb12f90ca778d685a32069a9e

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

module AbAdmin
  module Views
    module ManagerHelpers

      def table_builder
        manager.table ||= ::AbAdmin::Config::Table.default_for_model(resource_class)
      end

      def search_builder
        manager.search ||= ::AbAdmin::Config::Search.default_for_model(resource_class)
      end

      def form_builder
        manager.form ||= ::AbAdmin::Config::Form.default_for_model(resource_class, skip: [:id, :created_at, :updated_at, :lft, :rgt, :depth])
      end

      def show_builder
        manager.show ||= ::AbAdmin::Config::Show.default_for_model(resource_class)
      end

      def action_item_admin_path(name, record=nil)
        custom_action = manager.custom_action_for(name, self)
        if custom_action.collection?
          admin_collection_action_path(model_name: resource_collection_name, custom_action: custom_action.name)
        else
          record ||= resource
          admin_member_action_path(model_name: resource_collection_name, id: record.id, custom_action: custom_action.name)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ab_admin-0.3.6 lib/ab_admin/views/manager_helpers.rb
ab_admin-0.3.5 lib/ab_admin/views/manager_helpers.rb
ab_admin-0.3.4 lib/ab_admin/views/manager_helpers.rb
ab_admin-0.3.3 lib/ab_admin/views/manager_helpers.rb
ab_admin-0.3.2 lib/ab_admin/views/manager_helpers.rb
ab_admin-0.3.1 lib/ab_admin/views/manager_helpers.rb
ab_admin-0.3.0 lib/ab_admin/views/manager_helpers.rb