Sha256: 5ef11d94eb45817e8a368e8641c9b37c3b8c7bea2c1fe29886fbbff14093736e
Contents?: true
Size: 746 Bytes
Versions: 47
Compression:
Stored size: 746 Bytes
Contents
# frozen_string_literal: true module Satis module Switch class Component < Satis::ApplicationComponent attr_reader :url, :form, :attribute, :icon, :options def initialize(form:, attribute:, **options, &block) super @form = form @attribute = attribute @options = options @block = block @icon = true @icon = options[:icon] if options.key?(:icon) @value = options.key?(:value) ? options[:value] : @form.object.send(attribute) @value = @value == '0' || !@value ? false : true options[:input_html] ||= {} options[:input_html] = { data: { 'satis-switch-target' => 'hiddenInput' } }.deep_merge(options[:input_html]) end end end end
Version data entries
47 entries across 47 versions & 1 rubygems