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