actionview-pathfinder 0.0.2 → 0.1.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc0f9b4f01f00344f22a93fb41e1eca695ec4ded
|
4
|
+
data.tar.gz: e8613dfddf95f606f14e1fae5f4593381de25311
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84198882c9f212e2bbac621eea44d91cf5e27efaf728d14bbede487f4b9ed05400d749f9f1a069e6eb9e70f68393611f5fe994138037352b7e4669c17be703d4
|
7
|
+
data.tar.gz: 83e4a24d45289af625e6fde47251d2aa77afd1cf149cc4ff0ebfb5d9c2a31bf85eb8e40b8e028d6b9e41057d1b2e9b0b7c5c6fc08844007f7abdfb9546bdfa39
|
@@ -1,8 +1,9 @@
|
|
1
1
|
require "actionview/pathfinder/version"
|
2
2
|
require "actionview/pathfinder/template"
|
3
|
+
require "actionview/pathfinder/partial_renderer"
|
3
4
|
|
4
5
|
module ActionView
|
5
6
|
module Pathfinder
|
6
|
-
ActionView::
|
7
|
+
ActionView::PartialRenderer.send(:prepend, Pathfinder::PartialRenderer)
|
7
8
|
end
|
8
9
|
end
|
@@ -1,23 +1,38 @@
|
|
1
1
|
module ActionView
|
2
2
|
module Pathfinder
|
3
|
-
|
3
|
+
class Template < SimpleDelegator
|
4
|
+
|
5
|
+
def initialize(template)
|
6
|
+
super
|
7
|
+
@template = template
|
8
|
+
end
|
4
9
|
|
5
10
|
# adds an html comment at the beginning and end of each template,
|
6
11
|
# when rendering, that contains the path to that view file.
|
7
12
|
#
|
8
13
|
def render(view, locals, buffer=nil, &block)
|
9
|
-
|
10
|
-
|
14
|
+
@template.instance_variable_set(:'@source', wrapped_source)
|
15
|
+
|
11
16
|
super(view, locals, buffer, &block)
|
12
17
|
end
|
13
18
|
|
14
19
|
private
|
15
20
|
|
21
|
+
def wrapped_source
|
22
|
+
path = virtual_path.to_s
|
23
|
+
|
24
|
+
[
|
25
|
+
html_comment(path),
|
26
|
+
source,
|
27
|
+
html_comment("end of #{path}")
|
28
|
+
].join('')
|
29
|
+
end
|
30
|
+
|
16
31
|
def html_comment(text)
|
17
32
|
return '' unless formats.include?(:html)
|
18
33
|
|
19
34
|
if handler_type == 'haml'
|
20
|
-
["/", text, "\n\n"].join('')
|
35
|
+
["/ ", text, "\n\n"].join('')
|
21
36
|
else
|
22
37
|
["\n<!-- ", text, " -->\n"].join('')
|
23
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionview-pathfinder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Duffy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- Rakefile
|
67
67
|
- actionview-pathfinder.gemspec
|
68
68
|
- lib/actionview/pathfinder.rb
|
69
|
+
- lib/actionview/pathfinder/partial_renderer.rb
|
69
70
|
- lib/actionview/pathfinder/template.rb
|
70
71
|
- lib/actionview/pathfinder/version.rb
|
71
72
|
homepage: http://github.com/weblinc/actionview-pathfinder
|