Sha256: e4b76d6f2d016f4d9a16ca037056ce48a30df9f9ab88d77fa90be2fca7eb4139

Contents?: true

Size: 1.03 KB

Versions: 30

Compression:

Stored size: 1.03 KB

Contents

class CommentForm < Liquid::Block                                             
  Syntax = /(#{Liquid::VariableSignature}+)/   

  def initialize(tag_name, markup, tokens)
    if markup =~ Syntax
      @variable_name = $1
      @attributes = {}
    else
      raise SyntaxError.new("Syntax Error in 'comment_form' - Valid syntax: comment_form [article]")
    end
    
    super
  end

  def render(context)          
    article = context[@variable_name]
              
    context.stack do       
      context['form'] = {
        'posted_successfully?' => context.registers[:posted_successfully],
        'errors' => context['comment.errors'],
        'author' => context['comment.author'],
        'email'  => context['comment.email'],
        'body'   => context['comment.body']
      }
      wrap_in_form(article, render_all(@nodelist, context))
    end
  end          
    
  def wrap_in_form(article, input)    
    %Q{<form id="article-#{article.id}-comment-form" class="comment-form" method="post" action="">\n#{input}\n</form>}    
  end
end

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
liquid_cms-0.3.2.0 lib/generators/liquid_cms/templates/vendor/plugins/liquid/performance/shopify/comment_form.rb
liquid_cms-0.2.2.0 generators/liquid_cms/templates/vendor/plugins/cms_plugins/liquid/performance/shopify/comment_form.rb
liquid_cms-0.2.1.1 generators/liquid_cms/templates/vendor/plugins/cms_plugins/liquid/performance/shopify/comment_form.rb
liquid_cms-0.3.1.0 lib/generators/liquid_cms/templates/vendor/plugins/liquid/performance/shopify/comment_form.rb
liquid_cms-0.2.1.0 generators/liquid_cms/templates/vendor/plugins/cms_plugins/liquid/performance/shopify/comment_form.rb
liquid_cms-0.2.0.13 generators/liquid_cms/templates/vendor/plugins/cms_plugins/liquid/performance/shopify/comment_form.rb
liquid_cms-0.3.0.10 lib/generators/liquid_cms/templates/vendor/plugins/liquid/performance/shopify/comment_form.rb
liquid_cms-0.3.0.9 lib/generators/liquid_cms/templates/vendor/plugins/liquid/performance/shopify/comment_form.rb
liquid_cms-0.2.0.12 generators/liquid_cms/templates/vendor/plugins/cms_plugins/liquid/performance/shopify/comment_form.rb
liquid_cms-0.2.0.11 generators/liquid_cms/templates/vendor/plugins/cms_plugins/liquid/performance/shopify/comment_form.rb
liquid_cms-0.2.0.10 generators/liquid_cms/templates/vendor/plugins/cms_plugins/liquid/performance/shopify/comment_form.rb
liquid_cms-0.3.0.8 lib/generators/liquid_cms/templates/vendor/plugins/liquid/performance/shopify/comment_form.rb
liquid_cms-0.2.0.9 generators/liquid_cms/templates/vendor/plugins/cms_plugins/liquid/performance/shopify/comment_form.rb
liquid_cms-0.3.0.7 lib/generators/liquid_cms/templates/vendor/plugins/liquid/performance/shopify/comment_form.rb
liquid_cms-0.3.0.6 lib/generators/liquid_cms/templates/vendor/plugins/liquid/performance/shopify/comment_form.rb
liquid_cms-0.2.0.8 generators/liquid_cms/templates/vendor/plugins/cms_plugins/liquid/performance/shopify/comment_form.rb
liquid_cms-0.3.0.5 lib/generators/liquid_cms/templates/vendor/plugins/liquid/performance/shopify/comment_form.rb
liquid_cms-0.2.0.7 generators/liquid_cms/templates/vendor/plugins/cms_plugins/liquid/performance/shopify/comment_form.rb
liquid_cms-0.3.0.4 lib/generators/liquid_cms/templates/vendor/plugins/liquid/performance/shopify/comment_form.rb
liquid_cms-0.2.0.6 generators/liquid_cms/templates/vendor/plugins/cms_plugins/liquid/performance/shopify/comment_form.rb