easy_partials 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/easy_partials.gemspec +2 -1
- data/lib/easy_partials/controller_additions.rb +42 -0
- data/lib/easy_partials.rb +1 -24
- metadata +4 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/easy_partials.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{easy_partials}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Samer Abukhait"]
|
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
"VERSION",
|
28
28
|
"easy_partials.gemspec",
|
29
29
|
"lib/easy_partials.rb",
|
30
|
+
"lib/easy_partials/controller_additions.rb",
|
30
31
|
"spec/easy_partials_spec.rb",
|
31
32
|
"spec/spec.opts",
|
32
33
|
"spec/spec_helper.rb"
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module EasyPartials
|
2
|
+
|
3
|
+
# This module is automatically included into all controllers.
|
4
|
+
module ControllerAdditions
|
5
|
+
module ClassMethods
|
6
|
+
|
7
|
+
# Add additional partial locations for the auto finding of partials
|
8
|
+
# (via the <% _partial_name %> mechanism). This can be a single
|
9
|
+
# partial directory, or a list of them. Each value should be a
|
10
|
+
# directory relative to the views directory, and should NOT contain
|
11
|
+
# a trailing "/". The order the directories are added is the order
|
12
|
+
# they will be checked, however the local path will still be checked
|
13
|
+
# first (the global shared directory will be checked after all these
|
14
|
+
# additional directories).
|
15
|
+
#
|
16
|
+
# For example:
|
17
|
+
#
|
18
|
+
# additional_partials "shared/forms"
|
19
|
+
# additional_partials "shared/accounting", "shared_accounting"
|
20
|
+
def additional_partials(*partials)
|
21
|
+
before_filter { |controller|
|
22
|
+
values = controller.instance_variable_get :@additional_partials
|
23
|
+
values = values || []
|
24
|
+
values.push *partials
|
25
|
+
controller.instance_variable_set :@additional_partials, values
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.included(base)
|
32
|
+
base.extend ClassMethods
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
if defined? ActionController
|
39
|
+
ActionController::Base.class_eval do
|
40
|
+
include EasyPartials::ControllerAdditions
|
41
|
+
end
|
42
|
+
end
|
data/lib/easy_partials.rb
CHANGED
@@ -162,28 +162,5 @@ module ApplicationHelper
|
|
162
162
|
|
163
163
|
end
|
164
164
|
|
165
|
-
|
166
|
-
|
167
|
-
# Add additional partial locations for the auto finding of partials
|
168
|
-
# (via the <% _partial_name %> mechanism). This can be a single
|
169
|
-
# partial directory, or a list of them. Each value should be a
|
170
|
-
# directory relative to the views directory, and should NOT contain
|
171
|
-
# a trailing "/". The order the directories are added is the order
|
172
|
-
# they will be checked, however the local path will still be checked
|
173
|
-
# first (the global shared directory will be checked after all these
|
174
|
-
# additional directories).
|
175
|
-
#
|
176
|
-
# For example:
|
177
|
-
#
|
178
|
-
# additional_partials "shared/forms"
|
179
|
-
# additional_partials "shared/accounting", "shared_accounting"
|
180
|
-
def self.additional_partials(*partials)
|
181
|
-
before_filter { |controller|
|
182
|
-
values = controller.instance_variable_get :@additional_partials
|
183
|
-
values = values || []
|
184
|
-
values.push *partials
|
185
|
-
controller.instance_variable_set :@additional_partials, values
|
186
|
-
}
|
187
|
-
end
|
165
|
+
require 'easy_partials/controller_additions'
|
188
166
|
|
189
|
-
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_partials
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Samer Abukhait
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- VERSION
|
55
55
|
- easy_partials.gemspec
|
56
56
|
- lib/easy_partials.rb
|
57
|
+
- lib/easy_partials/controller_additions.rb
|
57
58
|
- spec/easy_partials_spec.rb
|
58
59
|
- spec/spec.opts
|
59
60
|
- spec/spec_helper.rb
|