Sha256: d5135fc4335677d75836f459c4e366a9b76c4b96da1429326d957de36514038c

Contents?: true

Size: 626 Bytes

Versions: 7

Compression:

Stored size: 626 Bytes

Contents

# frozen_string_literal: true

# Add a text_field, either specifying everything manually or using a model object on the form
#
# == Basic usage:
#    {%label for:"name"%}Name:{%endlabel%}
#
# == Advanced usage:
#    {%label name%}Name:{%endlabel%}
#
# This last usage requires a model on the form
#
class LabelTag < LiquidumBlock
  def render(context)
    super

    @form_model = lookup(context, 'form.model')
    @form_class_name = lookup(context, 'form.class_name')

    %[<label] + attr_str(:for, arg(:for), input(:id, argv1)) + %[>] + render_body + %[</label>]
  end
end

Liquid::Template.register_tag('label', LabelTag)

Version data entries

7 entries across 7 versions & 1 rubygems

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