Class: Admin::Books::IndexBuilder

Inherits:
Releaf::Builders::IndexBuilder
  • Object
show all
Defined in:
lib/generators/dummy/templates/builders/admin/books/index_builder.rb

Instance Method Summary collapse

Instance Method Details

#active_search_fieldObject


8
9
10
11
12
13
14
15
# File 'lib/generators/dummy/templates/builders/admin/books/index_builder.rb', line 8

def active_search_field
  search_field :only_active do
    [
      check_box_tag(:only_active, 'true', params['only_active'].present?),
      label_tag(:only_active, t("Only active"))
    ]
  end
end

#extra_search_contentObject


4
5
6
# File 'lib/generators/dummy/templates/builders/admin/books/index_builder.rb', line 4

def extra_search_content
  active_search_field + publishing_date_search_fields
end

#publishing_date_search_fieldsObject


17
18
19
20
21
22
23
24
25
26
# File 'lib/generators/dummy/templates/builders/admin/books/index_builder.rb', line 17

def publishing_date_search_fields
  search_field :published_between do
    [
      tag(:label, t('Published between'), for: "search_published_since" ),
      tag(:input, "", name: "published_since", type: "date", class: "text date-picker", value: params[:published_since], id: "search_published_since"),
      tag(:label, t('and'), for: "search_published_up_to" ),
      tag(:input, "", name: "published_up_to", type: "date", class: "text date-picker", value: params[:published_up_to], id: "search_published_up_to")
    ]
  end
end