Sha256: ddf9493710f46880fcfbd728e0d13d8a5ffa9864cb71b250869694603b81dcb5

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 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

4 entries across 4 versions & 1 rubygems

Version Path
ab_admin-0.2.3 lib/ab_admin/views/manager_helpers.rb
ab_admin-0.2.2 lib/ab_admin/views/manager_helpers.rb
ab_admin-0.2.1 lib/ab_admin/views/manager_helpers.rb
ab_admin-0.2.0 lib/ab_admin/views/manager_helpers.rb