Class: Records::Filter

Inherits:
Components::Base
  • Object
show all
Includes:
Phlex::Rails::Helpers::FormWith, Phlex::Rails::Helpers::HiddenFieldTag, Phlex::Rails::Helpers::LinkTo
Defined in:
app/components/databasium/records/filter.rb

Instance Method Summary collapse

Constructor Details

#initialize(model:, turbo_frame:, columns_names_types:, hidden: true) ⇒ Filter

Returns a new instance of Filter.



9
10
11
12
13
14
# File 'app/components/databasium/records/filter.rb', line 9

def initialize(model:, turbo_frame:, columns_names_types:, hidden: true)
  @model = model
  @turbo_frame = turbo_frame
  @columns_names_types = columns_names_types
  @hidden = hidden
end

Instance Method Details

#view_templateObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/components/databasium/records/filter.rb', line 16

def view_template
  if @model
    div(
      class: class_names("hidden" => @hidden),
      id: "filter",
      data: {
        toggle_target: "filter",
        controller: "filter",
        filter_columns_value: @columns_names_types.to_json
      }
    ) { render_filter }
  end
end