Sha256: 2ccbfd02a14380eae0399a1d1636d3ca785ca8240154297bd8cacc53baac7763
Contents?: true
Size: 1.29 KB
Versions: 4
Compression:
Stored size: 1.29 KB
Contents
# -*- encoding: utf-8 -*- # -*- frozen_string_literal: true -*- # -*- warn_indent: true -*- module RailsBootstrapForm module Helpers module Buttons extend ActiveSupport::Concern def self.included(base_class) def render_button(value = nil, options = {}, &block) value, options = nil, value if value.is_a?(Hash) bootstrap_options = bootstrap_form_options.scoped(options.delete(:bootstrap_form)) button_html = if (bootstrap_options.render_as_button? || block) button(value, options, &block) else submit(value, options) end if bootstrap_options.layout_inline? tag.div(class: "col-12") { button_html } else button_html end end def secondary(value = nil, options = {}, &block) add_css_class!(options, "btn btn-secondary") render_button(value, options, &block) end def primary(value = nil, options = {}, &block) add_css_class!(options, "btn btn-primary") render_button(value, options, &block) end def danger(value = nil, options = {}, &block) add_css_class!(options, "btn btn-danger") render_button(value, options, &block) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems