Sha256: 97951c4d9534d65e60a6146d8897dab3cb8e5f7ffaead2b57b899166adca513b
Contents?: true
Size: 765 Bytes
Versions: 2
Compression:
Stored size: 765 Bytes
Contents
module Headmin module Form class FlatpickrView < ViewModel def options keys = attributes - %i[data wrapper] options = to_h.slice(*keys) default_options.deep_merge(options) end private def default_options { data: default_data.deep_merge(data || {}), wrapper: default_wrapper_options.deep_merge(wrapper || {}) } end def default_data { "flatpickr-target": "input", flatpickr: { defaultDate: form.object&.send(attribute)&.strftime("%d/%m/%Y") } } end def default_wrapper_options { data: { controller: "flatpickr" } } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
headmin-0.4.2 | app/models/headmin/form/flatpickr_view.rb |
headmin-0.4.1 | app/models/headmin/form/flatpickr_view.rb |