Class: PureAdmin::TableFiltersHelper::TableFiltersBuilder

Inherits:
Object
  • Object
show all
Defined in:
app/helpers/pure_admin/table_filters_helper.rb

Overview

Allows building of table filters using a custom DSL.

<%= filters_for resources_path do |filter| %>

<%= filter.on :query %>

<% end %>

Instance Method Summary collapse

Constructor Details

#initialize(helper) { ... } ⇒ TableFiltersBuilder

Creates an instance of TableFiltersBuilder

Parameters:

  • helper (ApplicationHelper)

    instance of application helper to allow access to view helpers.

Yields:

  • instance of TableFiltersBuilder



131
132
133
# File 'app/helpers/pure_admin/table_filters_helper.rb', line 131

def initialize(helper)
  @helper = helper
end

Instance Method Details

#on(attribute, options = {}) { ... } ⇒ Object

Renders a table_filter_item inside the table_filters using a custom DSL.

Parameters:

  • attribute (Symbol)

    the attribute on the resource

  • options (Hash) (defaults to: {})

    all options that can be passed to content_tag are respected here.

Yields:

  • The contents of the details panel item



141
142
143
144
145
146
147
# File 'app/helpers/pure_admin/table_filters_helper.rb', line 141

def on(attribute, options = {}, &block)
  if block_given?
    helper.table_filter_item(attribute, options, &block)
  else
    helper.table_filter_item(attribute, options)
  end
end