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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f892e062e48d71514f3f2f85c30538d160ef9877
4
- data.tar.gz: 2c07df34be4e30b87eff53905cd39e2609dd4bd4
3
+ metadata.gz: 94ba4cc1d00e944460f9696b5debcc97488c033f
4
+ data.tar.gz: e3dc5aba66ece81d13603648758e001693cd40fa
5
5
  SHA512:
6
- metadata.gz: 30b2537732a5a65b98799d1771803c327de429dcec79e05e970a15b784eea9d1990133ada21cec33e028940dcf42145ef62dad5dbfd06dd5adba33176812da44
7
- data.tar.gz: c65f72d72a6c6b69dface8f3d403b8275bdfffe19f06ca1261cacbeaee318472bcd946ede941cb2a4de78602340abceabe426e91da9e9fa62e78e98f57917a13
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
+ ```
@@ -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
@@ -1,3 +1,3 @@
1
1
  module ViewSourceMap
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  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.8
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-08 00:00:00.000000000 Z
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: '0'
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: '0'
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: