Sha256: 42b03a1af924fc5003ed7b79ef4d945a5d425ec73a15d8e3f9d7a12a5f19116d

Contents?: true

Size: 689 Bytes

Versions: 7

Compression:

Stored size: 689 Bytes

Contents

# frozen_string_literal: true

# Add a text-area, either specifying everything manually or using a model object on the form
#
# == Basic usage:
#    {%textarea name:"name"%}{%endtextarea%}
#
# == Advanced usage:
#    {%textarea name%}{%endtextarea%}
#
# This last usage requires a model on the form
#
class TextareaTag < LiquidumBlock
  def render(context)
    super

    result = %[<textarea] +
             attr_str(:name, arg(:name), input(:name, argv1)) +
             attr_str(:id, arg(:id), input(:id, argv1))

    result += attrs_str(reject: %[name id])
    result += %[>] + render_body + %[</textarea>]

    result
  end
end

Liquid::Template.register_tag('textarea', TextareaTag)

Version data entries

7 entries across 7 versions & 1 rubygems

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