Sha256: e72ee4945fe0bc51c680525565e88562b47a4b0e097c47faf216a2f842065207

Contents?: true

Size: 690 Bytes

Versions: 8

Compression:

Stored size: 690 Bytes

Contents

class TextareaScope < ViewScope
  def initialize(handler, path, attributes)
    super(handler, path)

    @attributes = attributes
  end

  def add_binding(content)
    @html << "{{#{content}}}"
  end

  def close_scope(pop=true)
    # Remove from the scope
    @handler.scope.pop

    attributes = @attributes

    if @html[/\{\{[^\}]+\}\}/]
      # If the html inside the textarea has a binding, process it as
      # a value attribute.
      attributes['value'] = @html
      @html = ''
    end

    # Normal tag
    attributes = @handler.last.process_attributes('textarea', attributes)

    @handler.last.html << "<textarea#{attribute_string(attributes)}>#{@html}</textarea>"

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
volt-0.8.14 lib/volt/server/html_parser/textarea_scope.rb
volt-0.8.13 lib/volt/server/html_parser/textarea_scope.rb
volt-0.8.11 lib/volt/server/html_parser/textarea_scope.rb
volt-0.8.10 lib/volt/server/html_parser/textarea_scope.rb
volt-0.8.9 lib/volt/server/html_parser/textarea_scope.rb
volt-0.8.8 lib/volt/server/html_parser/textarea_scope.rb
volt-0.8.7 lib/volt/server/html_parser/textarea_scope.rb
volt-0.8.6 lib/volt/server/html_parser/textarea_scope.rb