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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 157e33c3501d504b0f477800b0edf1dfda0ed005
4
- data.tar.gz: d435e901372ec5f8eef01e16a7efa94a9d7fbcf6
3
+ metadata.gz: 649aad9b2c89338664e94077b6cf76852ca7a7d7
4
+ data.tar.gz: dfd9c547cd5ff6448905ae97ca4bfe5a7df6388e
5
5
  SHA512:
6
- metadata.gz: b2b69e70efddf07ce8ac3b034a24a4e2d126db2512b79df640e5aa5c9c6bf5d708e8f5d972777ee235ed47b8a28c2122ccc39a2afe2c5d4aef1da8b6a6c5d542
7
- data.tar.gz: 4229477e5b5d137e5b83c6aeac8083acf1e1e79f5ba11f9d334adefc9d3d2a58d6cb7d55d67e5137c9b5642ed5b29c2ffe3ffbc968cf9a6a1bca712ddc23c6ff
6
+ metadata.gz: d7a6401cd9a910d97eb56b52d028b5941273b78bf4fa4950cea0534daf70af68233d7626c6cd00b5f6537a7d052e0fd400762c686c52c815097343cf125477d9
7
+ data.tar.gz: 63435a70f8067de9eff27ee955b3916c073e155405b79be4e8ff2c6bcfbbd5c7a31def284477ce1bcdd6078ae293820448127eeb2447b652befc8013e6759ead
@@ -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
@@ -460,7 +460,7 @@ module Articles
460
460
 
461
461
  class RssIndex < Index
462
462
  format :rss
463
- layout nil
463
+ layout false
464
464
  end
465
465
  end
466
466
 
@@ -13,7 +13,7 @@ module Lotus
13
13
  # module Articles
14
14
  # class Show
15
15
  # include Lotus::View
16
- # layout nil
16
+ # layout false
17
17
  # end
18
18
  # end
19
19
  #
@@ -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
- Dir.glob( "#{ [root, recursive, template_name].join(separator) }.#{ format }.#{ engines }" ).map do |template|
73
- View::Template.new template
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
@@ -3,6 +3,6 @@ module Lotus
3
3
  # Defines the version
4
4
  #
5
5
  # @since 0.1.0
6
- VERSION = '0.4.2'.freeze
6
+ VERSION = '0.4.3'.freeze
7
7
  end
8
8
  end
@@ -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.2
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-06-23 00:00:00.000000000 Z
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: []