Class: YummyGuide::Administrate::Filters::DatetimeLocalRange

Inherits:
Base
  • Object
show all
Defined in:
lib/yummy_guide/administrate/filters.rb

Instance Attribute Summary

Attributes inherited from Base

#name, #options

Instance Method Summary collapse

Methods inherited from Base

#initialize, #label_text, #visible?, #with_name, with_options

Constructor Details

This class inherits a constructor from YummyGuide::Administrate::Filters::Base

Instance Method Details

#row(view_context, form, _scope, current_values, locals) ⇒ Object



255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/yummy_guide/administrate/filters.rb', line 255

def row(view_context, form, _scope, current_values, locals)
  from_name = (options[:from] || :"start_#{name}").to_sym
  to_name = (options[:to] || :"end_#{name}").to_sym

  view_context.(:tr) do
    view_context.safe_join([
      label_cell(view_context, form, locals),
      view_context.(:td) do
        view_context.safe_join([
          form.datetime_local_field(from_name, value: current_values[from_name.to_s].presence || evaluate_option(options[:from_default], view_context, locals)),
          view_context.(:p, "", style: "text-align: center; margin: 0;"),
          form.datetime_local_field(to_name, value: current_values[to_name.to_s].presence || evaluate_option(options[:to_default], view_context, locals))
        ])
      end,
      clear_cell(view_context)
    ])
  end
end