easy_partials 0.3.4 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -1
- data/easy_partials.gemspec +1 -4
- data/lib/easy_partials/controller_additions.rb +0 -4
- data/lib/easy_partials/helper_additions.rb +4 -5
- data/lib/easy_partials/object_additions.rb +0 -2
- data/lib/easy_partials.rb +0 -1
- data/spec/spec_helper.rb +0 -1
- metadata +4 -21
- data/VERSION +0 -1
data/README.rdoc
CHANGED
@@ -8,6 +8,7 @@ an expansion of a blog post by Mike Stone at
|
|
8
8
|
|
9
9
|
* Allows easy partial invocation syntax, with simpler local variable passing
|
10
10
|
* Allows configurable shared directories for partials
|
11
|
+
* Rails 3 compatible
|
11
12
|
|
12
13
|
== SYNOPSIS:
|
13
14
|
|
@@ -46,7 +47,7 @@ newgem, but you get them automatically when you install easypartials.
|
|
46
47
|
sudo gem install easy_partials
|
47
48
|
|
48
49
|
== Note on Patches/Pull Requests
|
49
|
-
|
50
|
+
|
50
51
|
* Fork the project.
|
51
52
|
* Make your feature addition or bug fix.
|
52
53
|
* Add tests for it. This is important so I don't break it in a
|
data/easy_partials.gemspec
CHANGED
@@ -5,11 +5,10 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{easy_partials}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.6"
|
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"]
|
12
|
-
s.date = %q{2011-02-27}
|
13
12
|
s.description = %q{An easier way to call partials}
|
14
13
|
s.email = %q{abukhait@gmail.com}
|
15
14
|
s.extra_rdoc_files = [
|
@@ -24,7 +23,6 @@ Gem::Specification.new do |s|
|
|
24
23
|
"README.rdoc",
|
25
24
|
"Rakefile",
|
26
25
|
"TODO",
|
27
|
-
"VERSION",
|
28
26
|
"easy_partials.gemspec",
|
29
27
|
"lib/easy_partials.rb",
|
30
28
|
"lib/easy_partials/controller_additions.rb",
|
@@ -58,4 +56,3 @@ Gem::Specification.new do |s|
|
|
58
56
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
59
57
|
end
|
60
58
|
end
|
61
|
-
|
@@ -1,9 +1,7 @@
|
|
1
1
|
module EasyPartials
|
2
|
-
|
3
2
|
# This module is automatically included into all controllers.
|
4
3
|
module ControllerAdditions
|
5
4
|
module ClassMethods
|
6
|
-
|
7
5
|
# Add additional partial locations for the auto finding of partials
|
8
6
|
# (via the <% _partial_name %> mechanism). This can be a single
|
9
7
|
# partial directory, or a list of them. Each value should be a
|
@@ -22,14 +20,12 @@ module EasyPartials
|
|
22
20
|
controller.instance_variable_set :@additional_partials, (locations + EasyPartials.shared_directories).flatten.uniq
|
23
21
|
end
|
24
22
|
end
|
25
|
-
|
26
23
|
end
|
27
24
|
|
28
25
|
def self.included(base)
|
29
26
|
base.extend ClassMethods
|
30
27
|
end
|
31
28
|
end
|
32
|
-
|
33
29
|
end
|
34
30
|
|
35
31
|
if defined? ActionController
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module EasyPartials
|
2
|
-
|
3
2
|
module HelperAdditions
|
4
|
-
|
5
3
|
def method_missing(method_name, *args, &block)
|
6
4
|
method_str = method_name.to_s
|
7
5
|
return super unless method_str.sub! METHOD_REGEXP, ''
|
@@ -29,6 +27,7 @@ module EasyPartials
|
|
29
27
|
def partial_method(locations, *args, &block)
|
30
28
|
raise "No possible locations!" if locations.empty?
|
31
29
|
partial_name = locations.delete_at 0
|
30
|
+
|
32
31
|
new_method = lambda do |block, *args|
|
33
32
|
if params[:format] == "pdf"
|
34
33
|
invoke_partial partial_name, *args, &block
|
@@ -36,6 +35,7 @@ module EasyPartials
|
|
36
35
|
concat_partial partial_name, *args, &block
|
37
36
|
end
|
38
37
|
end
|
38
|
+
|
39
39
|
begin
|
40
40
|
new_method.call block, *args
|
41
41
|
rescue ActionView::MissingTemplate
|
@@ -58,6 +58,8 @@ module EasyPartials
|
|
58
58
|
locals.merge! :args => args
|
59
59
|
end
|
60
60
|
|
61
|
+
locals[:options] = locals.dup unless locals.has_key?(:options)
|
62
|
+
|
61
63
|
locals.merge! :body => capture(&block) if block
|
62
64
|
locals[:body] = nil unless locals[:body]
|
63
65
|
|
@@ -68,7 +70,6 @@ module EasyPartials
|
|
68
70
|
else
|
69
71
|
render :partial => partial.to_s, :locals => locals
|
70
72
|
end
|
71
|
-
|
72
73
|
end
|
73
74
|
|
74
75
|
# Used to create nice templated "tags" while keeping the html out of
|
@@ -96,9 +97,7 @@ module EasyPartials
|
|
96
97
|
rendered = invoke_partial partial, *args, &block
|
97
98
|
concat rendered
|
98
99
|
end
|
99
|
-
|
100
100
|
end
|
101
|
-
|
102
101
|
end
|
103
102
|
|
104
103
|
module ApplicationHelper
|
data/lib/easy_partials.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_partials
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 3
|
9
|
-
- 4
|
10
|
-
version: 0.3.4
|
4
|
+
prerelease:
|
5
|
+
version: 0.3.6
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Samer Abukhait
|
@@ -15,7 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2011-
|
13
|
+
date: 2011-06-01 00:00:00 -07:00
|
19
14
|
default_executable:
|
20
15
|
dependencies:
|
21
16
|
- !ruby/object:Gem::Dependency
|
@@ -26,11 +21,6 @@ dependencies:
|
|
26
21
|
requirements:
|
27
22
|
- - ">="
|
28
23
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 13
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 2
|
33
|
-
- 9
|
34
24
|
version: 1.2.9
|
35
25
|
type: :development
|
36
26
|
version_requirements: *id001
|
@@ -51,7 +41,6 @@ files:
|
|
51
41
|
- README.rdoc
|
52
42
|
- Rakefile
|
53
43
|
- TODO
|
54
|
-
- VERSION
|
55
44
|
- easy_partials.gemspec
|
56
45
|
- lib/easy_partials.rb
|
57
46
|
- lib/easy_partials/controller_additions.rb
|
@@ -74,23 +63,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
74
63
|
requirements:
|
75
64
|
- - ">="
|
76
65
|
- !ruby/object:Gem::Version
|
77
|
-
hash: 3
|
78
|
-
segments:
|
79
|
-
- 0
|
80
66
|
version: "0"
|
81
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
68
|
none: false
|
83
69
|
requirements:
|
84
70
|
- - ">="
|
85
71
|
- !ruby/object:Gem::Version
|
86
|
-
hash: 3
|
87
|
-
segments:
|
88
|
-
- 0
|
89
72
|
version: "0"
|
90
73
|
requirements: []
|
91
74
|
|
92
75
|
rubyforge_project: easy_partials
|
93
|
-
rubygems_version: 1.
|
76
|
+
rubygems_version: 1.6.2
|
94
77
|
signing_key:
|
95
78
|
specification_version: 3
|
96
79
|
summary: Easy Partials
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.3.4
|