Sha256: e382fab8fdd4036418f0eeb0398508e5300fb20ed2ec2b5f4d25f6c5412d3b6f

Contents?: true

Size: 646 Bytes

Versions: 7

Compression:

Stored size: 646 Bytes

Contents

# frozen_string_literal: true

# Adds a (by default submit) button
#
# == Basic usage:
#    {%button name:'commit' value:'save'%}Save{%endbutton%}
#
# == Advanced usage:
#    {%button button name:'commit' value:'save'%}Save{%endbutton%}
#    {%button reset name:'commit' value:'save'%}Save{%endbutton%}
#
class ButtonTag < LiquidumBlock
  def render(context)
    super

    %[<button] + attr_str(:type, argv1, 'submit') +
      attr_str(:name, arg(:name), 'commit') +
      attr_str(:value, arg(:value)) +
      attr_str(:class, arg(:class)) +
      %[>] + render_body + %[</button>]
  end
end

Liquid::Template.register_tag('button', ButtonTag)

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
scribo-1.0.44 lib/scribo/liquid/tags/button_tag.rb
scribo-1.0.43 lib/scribo/liquid/tags/button_tag.rb
scribo-1.0.42 lib/scribo/liquid/tags/button_tag.rb
scribo-1.0.41 lib/scribo/liquid/tags/button_tag.rb
scribo-1.0.40 lib/scribo/liquid/tags/button_tag.rb
scribo-1.0.39 lib/scribo/liquid/tags/button_tag.rb
scribo-1.0.38 lib/scribo/liquid/tags/button_tag.rb