From ea050afd5e528210ebb741136bd4eb9514dea4d8 Mon Sep 17 00:00:00 2001 From: did Date: Fri, 29 Apr 2011 01:16:40 +0200 Subject: [PATCH] use absolute urls for the pagination links + allow developers to access the http params within a liquid template + the with_scope handles category fields --- app/models/content_type.rb | 9 ++++++++- lib/locomotive/liquid/filters/html.rb | 10 +++++++--- lib/locomotive/liquid/tags/with_scope.rb | 6 +++--- lib/locomotive/render.rb | 3 ++- spec/lib/locomotive/liquid/tags/with_scope_spec.rb | 10 ++++++++-- 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/app/models/content_type.rb b/app/models/content_type.rb index b41ce53a..00343fd2 100644 --- a/app/models/content_type.rb +++ b/app/models/content_type.rb @@ -82,7 +82,14 @@ class ContentType # convert alias (key) to name field = self.content_custom_fields.detect { |f| f._alias == key } - conditions_with_names[field._name.to_sym] = value + case field.kind.to_sym + when :category + if (category_item = field.category_items.where(:name => value).first).present? + conditions_with_names[field._name.to_sym] = category_item._id + end + else + conditions_with_names[field._name.to_sym] = value + end end self.contents.where(conditions_with_names) diff --git a/lib/locomotive/liquid/filters/html.rb b/lib/locomotive/liquid/filters/html.rb index a7672c4c..f7d4accc 100644 --- a/lib/locomotive/liquid/filters/html.rb +++ b/lib/locomotive/liquid/filters/html.rb @@ -82,13 +82,13 @@ module Locomotive previous_link = (if paginate['previous'].blank? "#{previous_label}" else - "#{previous_label}" + "#{previous_label}" end) links = "" paginate['parts'].each do |part| links << (if part['is_link'] - "#{part['title']}" + "#{part['title']}" elsif part['hellip_break'] "#{part['title']}" else @@ -99,7 +99,7 @@ module Locomotive next_link = (if paginate['next'].blank? "#{next_label}" else - "#{next_label}" + "#{next_label}" end) %{