Sha256: 6c584ba2537a9608c74677af5a958a792e35ab59f9d1bfed59f76109985cec93

Contents?: true

Size: 768 Bytes

Versions: 71

Compression:

Stored size: 768 Bytes

Contents

module Volt
  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
end

Version data entries

71 entries across 71 versions & 1 rubygems

Version Path
volt-0.9.7.pre8 lib/volt/server/html_parser/textarea_scope.rb
volt-0.9.7.pre7 lib/volt/server/html_parser/textarea_scope.rb
volt-0.9.7.pre6 lib/volt/server/html_parser/textarea_scope.rb
volt-0.9.7.pre5 lib/volt/server/html_parser/textarea_scope.rb
volt-0.9.7.pre3 lib/volt/server/html_parser/textarea_scope.rb
volt-0.9.7.pre2 lib/volt/server/html_parser/textarea_scope.rb
volt-0.9.6 lib/volt/server/html_parser/textarea_scope.rb
volt-0.9.6.pre3 lib/volt/server/html_parser/textarea_scope.rb
volt-0.9.6.pre2 lib/volt/server/html_parser/textarea_scope.rb
volt-0.9.6.pre1 lib/volt/server/html_parser/textarea_scope.rb
volt-0.9.5 lib/volt/server/html_parser/textarea_scope.rb
volt-0.9.5.pre12 lib/volt/server/html_parser/textarea_scope.rb
volt-0.9.5.pre11 lib/volt/server/html_parser/textarea_scope.rb
volt-0.9.5.pre9 lib/volt/server/html_parser/textarea_scope.rb
volt-0.9.5.pre8 lib/volt/server/html_parser/textarea_scope.rb
volt-0.9.5.pre7 lib/volt/server/html_parser/textarea_scope.rb
volt-0.9.5.pre6 lib/volt/server/html_parser/textarea_scope.rb
volt-0.9.5.pre5 lib/volt/server/html_parser/textarea_scope.rb
volt-0.9.5.pre4 lib/volt/server/html_parser/textarea_scope.rb
volt-0.9.5.pre3 lib/volt/server/html_parser/textarea_scope.rb