new liquid filter: random + the page handle property is accessible in a template
did
committed Jul 04, 2013
commit ba466e011fd9a0d5618894767b49eed8a49af586
Showing 5
changed files with
8 additions
and 4 deletions
locomotive/wagon/liquid/drops/page.rb b/lib/locomotive/wagon/liquid/drops/page.rb
+2
-2
| @@ | @@ -5,7 +5,7 @@ module Locomotive |
| class Page < Base | |
| delegate :title, :slug, :fullpath, :parent, :depth, :seo_title, :redirect_url, :meta_description, :meta_keywords, | |
| - | :templatized?, :published?, :redirect?, :listed?, to: '_source' |
| + | :templatized?, :published?, :redirect?, :listed?, :handle, to: '_source' |
| def children | |
| _children = _source.children || [] | |
| @@ | @@ -16,7 +16,7 @@ module Locomotive |
| def content_type | |
| ProxyCollection.new(_source.content_type) if _source.content_type | |
| end | |
| - | |
| + | |
| def breadcrumbs | |
| # TODO | |
| '' | |
locomotive/wagon/liquid/filters/misc.rb b/lib/locomotive/wagon/liquid/filters/misc.rb
+4
-0
| @@ | @@ -18,6 +18,10 @@ module Locomotive |
| input.blank? ? value : input | |
| end | |
| + | def random(input) |
| + | rand(input.to_i) |
| + | end |
| + | |
| end | |
| ::Liquid::Template.register_filter(Misc) | |
locomotive/wagon/liquid/filters/text.rb b/lib/locomotive/wagon/liquid/filters/text.rb
+0
-1
| @@ | @@ -35,7 +35,6 @@ module Locomotive |
| result | |
| end | |
| - | |
| def textile(input) | |
| ::RedCloth.new(input).to_html | |
| end | |
locomotive/wagon/liquid/scopeable.rb b/lib/locomotive/wagon/liquid/scopeable.rb
+1
-1
| @@ | @@ -14,7 +14,7 @@ module Locomotive |
| entries.each do |content| | |
| accepted = (conditions.map do |key, value| | |
| case value | |
| - | when TrueClass, FalseClass, String then content.send(key) == value |
| + | when TrueClass, FalseClass, String, Integer then content.send(key) == value |
| else | |
| true | |
| end | |
spec/fixtures/default/app/views/snippets/A_Complicated-one.liquid.haml
+1
-0
| @@ | @@ -0,0 +1 @@ |
| + | %p A complicated one name indeed. |
| \ No newline at end of file | |