liquidizer 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
@@ -70,6 +70,8 @@ module Liquidizer
70
70
  end
71
71
 
72
72
  def liquid_template_for_layout(options)
73
+ options ||= {}
74
+
73
75
  if liquify_layout?(options)
74
76
  name = liquid_template_name_for_layout(options)
75
77
  name && find_and_parse_liquid_template(name)
@@ -79,13 +81,16 @@ module Liquidizer
79
81
  end
80
82
 
81
83
  def liquify_layout?(options)
82
- options ||= {}
83
-
84
- return false unless self.class.liquidizer_options[:layout]
85
- return true if options[:layout].nil? && liquifiable_options?(options)
86
- return true if options[:layout] == true
87
-
88
- false
84
+ if self.class.liquidizer_options[:layout]
85
+ case options[:layout]
86
+ when nil then liquifiable_options?(options)
87
+ when false then false
88
+ else
89
+ true
90
+ end
91
+ else
92
+ false
93
+ end
89
94
  end
90
95
 
91
96
  def extract_action_for_render(options)
@@ -122,11 +127,11 @@ module Liquidizer
122
127
  end
123
128
 
124
129
  def liquid_template_name_for_layout(options)
125
- case layout = self.class.read_inheritable_attribute(:layout)
126
- when Symbol then __send__(layout)
127
- when Proc then layout.call(self)
128
- else layout
129
- end
130
+ options[:layout] || case layout = self.class.read_inheritable_attribute(:layout)
131
+ when Symbol then __send__(layout)
132
+ when Proc then layout.call(self)
133
+ else layout
134
+ end
130
135
  end
131
136
 
132
137
  def find_liquid_template(name)
data/liquidizer.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{liquidizer}
8
- s.version = "0.5.0"
8
+ s.version = "0.5.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Adam Cig\303\241nek"]
12
- s.date = %q{2010-03-09}
12
+ s.date = %q{2010-03-10}
13
13
  s.description = %q{WIth this gem, you can render your Ruby on Rails views with liquid templates that are loaded from database. This way, the look and feel of your site can be safely configured by it's users.
14
14
  }
15
15
  s.email = %q{adam.ciganek@gmail.com}
@@ -196,21 +196,24 @@ class ControllerExtensionsTest < ActionController::TestCase
196
196
  assert_select '#layout p', 'This is not liquid template'
197
197
  end
198
198
 
199
- # TODO: make this pass
200
- # test 'renders with overriden liquid layout' do
201
- # setup_controller(PostsController)
199
+ test 'renders with overriden liquid layout' do
200
+ setup_controller(PostsController)
201
+
202
+ LiquidTemplate.create!(
203
+ :name => 'awesome_layout',
204
+ :content => '<div id="awesome_layout">{{ content_for_layout }}</div>')
202
205
 
203
- # LiquidTemplate.create!(
204
- # :name => 'awesome_layout',
205
- # :content => '<div id="awesome_layout">{{ content_for_layout }}</div>')
206
+ LiquidTemplate.create!(
207
+ :name => 'layout',
208
+ :content => '<div id="layout">{{ content_for_layout }}</div>')
206
209
 
207
- # LiquidTemplate.create!(
208
- # :name => 'layout',
209
- # :content => '<div id="layout">{{ content_for_layout }}</div>')
210
+ LiquidTemplate.create!(
211
+ :name => 'posts/edit',
212
+ :content => '<p>Awesome liquid template</p>')
210
213
 
211
- # get :edit
212
- # assert_select '#awesome_layout p'
213
- # end
214
+ get :edit
215
+ assert_select '#awesome_layout p'
216
+ end
214
217
 
215
218
  test 'does not render liquid layout if disabled' do
216
219
  setup_controller(RatingsController)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 0
9
- version: 0.5.0
8
+ - 1
9
+ version: 0.5.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - "Adam Cig\xC3\xA1nek"
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-09 00:00:00 +01:00
17
+ date: 2010-03-10 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency