Module: Shipyard::ButtonHelper
- Includes:
- ActionView::Helpers::TagHelper, ActionView::Helpers::UrlHelper
- Included in:
- Jekyll::Button
- Defined in:
- lib/shipyard-framework/helpers/button_helper.rb
Instance Method Summary collapse
Instance Method Details
#btn(text, *args, &block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/shipyard-framework/helpers/button_helper.rb', line 6 def btn(text, *args, &block) if block_given? args << text text = capture(&block) end # Save any options that were passed in. = {} args.each do |arg| = .merge(arg) if arg.is_a?(Hash) end # Output the appropriate button. if .key?(:href) [:role] = :button link_to text, [:href], (args, ) else content_tag :button, text, (args, ) end end |