view_source_map 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -1
- data/lib/view_source_map.rb +12 -0
- data/lib/view_source_map/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94ba4cc1d00e944460f9696b5debcc97488c033f
|
4
|
+
data.tar.gz: e3dc5aba66ece81d13603648758e001693cd40fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05f29327ed8a1bc073b7ff055021fcd5bfe14f1162ba16474e14a4a6886b4688edec3a528279fcaaa134dc0d1b3c6986fe1267150c66871580d44c56345c5496
|
7
|
+
data.tar.gz: 18dcfce6b129e66cd0749ada15a8aeec51a33c9c4200d1a63b7c4541bff0c366d9d8feac65321872a16b8c4ecb8f98d71bb023875d0f6d29f72b2bd70d0e93b6
|
data/README.md
CHANGED
@@ -21,9 +21,16 @@ then see the source of your page:
|
|
21
21
|
![](http://dl.dropbox.com/u/5978869/image/20121204_171625.png)
|
22
22
|
|
23
23
|
## Tips
|
24
|
-
Sometimes this adds too much noise to the html when you're developing.
|
24
|
+
Sometimes this adds too much noise to the html when you're developing.
|
25
25
|
There is a simple way to turn it off.
|
26
26
|
|
27
27
|
```
|
28
28
|
$ DISABLE_VIEW_SOURCE_MAP=1 rails s
|
29
29
|
```
|
30
|
+
|
31
|
+
or
|
32
|
+
|
33
|
+
```
|
34
|
+
<%= render "example_disabled", view_source_map: false %>
|
35
|
+
<%= render partial: "example_disabled_partial", view_source_map: false %>
|
36
|
+
```
|
data/lib/view_source_map.rb
CHANGED
@@ -8,9 +8,12 @@ module ViewSourceMap
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.attach
|
11
|
+
return if @attached
|
12
|
+
@attached = true
|
11
13
|
ActionView::PartialRenderer.class_eval do
|
12
14
|
def render_with_path_comment(context, options, block)
|
13
15
|
content = render_without_path_comment(context, options, block)
|
16
|
+
return content if ViewSourceMap.force_disabled?(options)
|
14
17
|
|
15
18
|
if @lookup_context.rendered_format == :html
|
16
19
|
if options[:layout]
|
@@ -49,6 +52,8 @@ module ViewSourceMap
|
|
49
52
|
end
|
50
53
|
|
51
54
|
def self.detach
|
55
|
+
return unless @attached
|
56
|
+
@attached = false
|
52
57
|
ActionView::PartialRenderer.class_eval do
|
53
58
|
undef_method :render_with_path_comment
|
54
59
|
alias_method :render, :render_without_path_comment
|
@@ -59,4 +64,11 @@ module ViewSourceMap
|
|
59
64
|
alias_method :render_template, :render_template_without_path_comment
|
60
65
|
end
|
61
66
|
end
|
67
|
+
|
68
|
+
def self.force_disabled?(options)
|
69
|
+
return false if options.nil?
|
70
|
+
return true if options[:view_source_map] == false
|
71
|
+
return false if options[:locals].nil?
|
72
|
+
return true if options[:locals][:view_source_map] == false
|
73
|
+
end
|
62
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: view_source_map
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: rspec-rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.99'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.99'
|
41
41
|
description: This is a Rails plugin to insert the path name of a rendered partial
|
42
42
|
view as HTML comment in development environment
|
43
43
|
email:
|