pantographe / view_component-form

Rails FormBuilder for ViewComponent
MIT License
204 stars 16 forks source link

combine_options! overrides custom-set HTML classes with default values of that component (html_class) #158

Open tmaier opened 9 months ago

tmaier commented 9 months ago
      def combine_options!
        @options = (self.class.default_options.deep_dup || {}).deep_merge(options).tap do |opts|
          opts[:class] = class_names(options[:class], html_class) if (html_class || options[:class]).present?
        end
      end

should be

      def combine_options!
        @options = (self.class.default_options.deep_dup || {}).deep_merge(options).tap do |opts|
          opts[:class] = class_names(html_class, options[:class]) if (html_class || options[:class]).present?
        end
      end

else, one will never be able to override defaults with the classes given via option