Permalink
Browse files

csrf_meta_tags helper tag

  • Loading branch information...
1 parent cf01950 commit 99b31af810dc28fe83b1e836d4b77ebc0b1bcb77 @pyromaniac pyromaniac committed Apr 3, 2012
Showing with 19 additions and 1 deletion.
  1. +3 −1 CHANGELOG.md
  2. +1 −0 lib/puffer_pages.rb
  3. +15 −0 lib/puffer_pages/liquid/tags/helper.rb
View
@@ -2,6 +2,8 @@
### New features
+* `{% csrf_meta_tags %}` helper tag.
+
* The new `puffer_pages` method for controller
```
@@ -21,7 +23,7 @@
* The only way to declare puffer_page rendering
`render :puffer_page => Page.first` or
- `render :puffer_page => 'some/path'`
+ `render :puffer_page => 'some/path'`.
* Current controller now available from context.registers[:controller]
It is useful for using url helpers in drops.
View
@@ -47,6 +47,7 @@ def self.setup
require 'puffer_pages/liquid/tags/yield'
require 'puffer_pages/liquid/tags/assets'
+require 'puffer_pages/liquid/tags/helper'
require 'puffer_pages/liquid/tags/super'
require 'puffer_pages/liquid/tags/include'
require 'puffer_pages/liquid/tags/partials'
@@ -0,0 +1,15 @@
+module PufferPages
+ module Liquid
+ module Tags
+
+ class Helper < ::Liquid::Tag
+ def render(context)
+ context.registers[:tracker].register("<%= #{@tag_name} %>")
+ end
+ end
+
+ end
+ end
+end
+
+Liquid::Template.register_tag('csrf_meta_tags', PufferPages::Liquid::Tags::Helper)

0 comments on commit 99b31af

Please sign in to comment.