Sha256: 4d218cd4e46abc7b27050d836c8b2849f089a3f751a8f6df2fd3acb15f12351c
Contents?: true
Size: 830 Bytes
Versions: 4
Compression:
Stored size: 830 Bytes
Contents
module Formstrap class BlocksView < ViewModel def repeater_options keys = %i[form attribute names label] options = to_h.slice(*keys) default_repeater_options.deep_merge(options) end def paths @paths || [] end def prefixes paths + ["admin/blocks", "blocks", ""] end def badge_style(object) visible = object.visible? errors = object.errors.present? if !visible && !errors "bg-light text-secondary" elsif errors "bg-danger text-white" else "bg-light text-dark" end end private def default_repeater_options { attribute: "blocks", label: false, templates: names, row: { class: "repeater-row list-group-item pt-3" } } end end end
Version data entries
4 entries across 4 versions & 1 rubygems