Class: LabelTag

Inherits:
LiquidumBlock
  • Object
show all
Defined in:
lib/scribo/liquid/tags/label_tag.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#render(context) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/scribo/liquid/tags/label_tag.rb', line 14

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