lotus-view 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/lotus/view/rendering/null_layout.rb +1 -1
- data/lib/lotus/view/rendering/partial_finder.rb +32 -0
- data/lib/lotus/view/rendering/templates_finder.rb +15 -2
- data/lib/lotus/view/version.rb +1 -1
- data/lotus-view.gemspec +2 -2
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 649aad9b2c89338664e94077b6cf76852ca7a7d7
|
4
|
+
data.tar.gz: dfd9c547cd5ff6448905ae97ca4bfe5a7df6388e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7a6401cd9a910d97eb56b52d028b5941273b78bf4fa4950cea0534daf70af68233d7626c6cd00b5f6537a7d052e0fd400762c686c52c815097343cf125477d9
|
7
|
+
data.tar.gz: 63435a70f8067de9eff27ee955b3916c073e155405b79be4e8ff2c6bcfbbd5c7a31def284477ce1bcdd6078ae293820448127eeb2447b652befc8013e6759ead
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Lotus::View
|
2
2
|
View layer for Lotus
|
3
3
|
|
4
|
+
## v0.4.3 - 2015-07-10
|
5
|
+
### Fixed
|
6
|
+
- [Farrel Lifson] Force partial finder to be explicit when to templates have the same name.
|
7
|
+
|
4
8
|
## v0.4.2 - 2015-06-23
|
5
9
|
### Fixed
|
6
10
|
- [Tom Kadwill] Ensure views to use methods defined by the associated layout.
|
data/README.md
CHANGED
@@ -22,7 +22,39 @@ module Lotus
|
|
22
22
|
# "_sidebar.html.erb"
|
23
23
|
PREFIX = '_'.freeze
|
24
24
|
|
25
|
+
# Find a template for a partial. Initially it will look for the
|
26
|
+
# partial template under the directory of the parent directory
|
27
|
+
# view template, if not found it will search recursivly from
|
28
|
+
# the view root.
|
29
|
+
#
|
30
|
+
# @return [Lotus::View::Template] the requested template
|
31
|
+
#
|
32
|
+
# @see Lotus::View::Rendering::TemplateFinder#find
|
33
|
+
#
|
34
|
+
# @since 0.4.3
|
35
|
+
# @api private
|
36
|
+
def find
|
37
|
+
if path = partial_template_under_view_path
|
38
|
+
View::Template.new path
|
39
|
+
else
|
40
|
+
super
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
25
44
|
protected
|
45
|
+
# @since 0.4.3
|
46
|
+
# @api private
|
47
|
+
def partial_template_under_view_path
|
48
|
+
_find(view_template_dir).first
|
49
|
+
end
|
50
|
+
|
51
|
+
# @since 0.4.3
|
52
|
+
# @api private
|
53
|
+
def view_template_dir
|
54
|
+
*all, _ = @view.template.split(separator)
|
55
|
+
all.join(separator)
|
56
|
+
end
|
57
|
+
|
26
58
|
def template_name
|
27
59
|
*all, last = partial_name.split(separator)
|
28
60
|
all.push( last.prepend(prefix) ).join(separator)
|
@@ -69,12 +69,19 @@ module Lotus
|
|
69
69
|
# Lotus::View::Rendering::TemplatesFinder.new(Articles::Show).find
|
70
70
|
# # => [#<Lotus::View::Template:0x007f8a0a86a970 ... @file="/path/to/templates/articles/show.html.erb">]
|
71
71
|
def find
|
72
|
-
|
73
|
-
View::Template.new
|
72
|
+
_find.map do |template|
|
73
|
+
View::Template.new(template)
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
77
|
protected
|
78
|
+
|
79
|
+
# @api private
|
80
|
+
# @since 0.4.3
|
81
|
+
def _find(lookup = search_path)
|
82
|
+
Dir.glob( "#{ [root, lookup, template_name].join(separator) }.#{ format }.#{ engines }" )
|
83
|
+
end
|
84
|
+
|
78
85
|
# @api private
|
79
86
|
# @since 0.1.0
|
80
87
|
def template_name
|
@@ -87,6 +94,12 @@ module Lotus
|
|
87
94
|
@view.root
|
88
95
|
end
|
89
96
|
|
97
|
+
# @api private
|
98
|
+
# @since 0.4.3
|
99
|
+
def search_path
|
100
|
+
recursive
|
101
|
+
end
|
102
|
+
|
90
103
|
# @api private
|
91
104
|
# @since 0.2.0
|
92
105
|
def recursive
|
data/lib/lotus/view/version.rb
CHANGED
data/lotus-view.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'lotus/view/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'lotus-view'
|
8
8
|
spec.version = Lotus::View::VERSION
|
9
|
-
spec.authors = ['Luca Guidi']
|
10
|
-
spec.email = ['me@lucaguidi.com']
|
9
|
+
spec.authors = ['Luca Guidi', 'Trung Lê', 'Alfonso Uceda Pompa']
|
10
|
+
spec.email = ['me@lucaguidi.com', 'trung.le@ruby-journal.com', 'uceda73@gmail.com']
|
11
11
|
spec.description = %q{View layer for Lotus}
|
12
12
|
spec.summary = %q{View layer for Lotus, with a separation between views and templates}
|
13
13
|
spec.homepage = 'http://lotusrb.org'
|
metadata
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lotus-view
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
|
+
- Trung Lê
|
9
|
+
- Alfonso Uceda Pompa
|
8
10
|
autorequire:
|
9
11
|
bindir: bin
|
10
12
|
cert_chain: []
|
11
|
-
date: 2015-
|
13
|
+
date: 2015-07-10 00:00:00.000000000 Z
|
12
14
|
dependencies:
|
13
15
|
- !ruby/object:Gem::Dependency
|
14
16
|
name: tilt
|
@@ -89,6 +91,8 @@ dependencies:
|
|
89
91
|
description: View layer for Lotus
|
90
92
|
email:
|
91
93
|
- me@lucaguidi.com
|
94
|
+
- trung.le@ruby-journal.com
|
95
|
+
- uceda73@gmail.com
|
92
96
|
executables: []
|
93
97
|
extensions: []
|
94
98
|
extra_rdoc_files: []
|