Sha256: 2222be439f65951704066dcc3f7e63bf9b62e433d5c180df68ce3f0d5eff8ca5

Contents?: true

Size: 942 Bytes

Versions: 2

Compression:

Stored size: 942 Bytes

Contents

module Bootstrap
  module ViewHelpers
    module Components
      class Modal < Component
        class Footer < Component
          def to_html
            content_tag(:div, options) { block.call(self) if block.present? }
          end

          def close_button(label, close_options = {})
            close_options = close_button_default_options.merge(close_options)
            close_options[:label] = label
            Button.new(view, close_options).to_html
          end

          protected

          def close_button_default_options
            { data: { dismiss: 'modal' }, style: :secondary, type: :button }
          end

          def inject_class_name_to_options
            options[:class] = "modal-footer #{options[:class]}"
            options[:class].strip!
          end

          def parse_options(options)
            super
            inject_class_name_to_options
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bootstrap-view_helpers-0.0.3 lib/bootstrap/view_helpers/components/modal/footer.rb
bootstrap-view_helpers-0.0.2 lib/bootstrap/view_helpers/components/modal/footer.rb