partially_useful 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +13 -10
- data/README.md +12 -4
- data/lib/partially_useful/partial_renderer.rb +6 -1
- data/lib/partially_useful/railtie.rb +1 -1
- data/lib/partially_useful/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c946ba0664ecb0b799fa878beb56ae454aac2840
|
4
|
+
data.tar.gz: 376bba8c028629234928b5283a5094d233b4b23b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8edaaa45a616ee17fc2921a1778bfdd852efc9827cda85a130fc716cbfdb6e075acfcc0896340903b42740b0a41270ee59a16f9bff4ee376b663b0ba7303e724
|
7
|
+
data.tar.gz: 8b4d25a75fc210cfa8903c9a1673cff20170a2c5070a5f78da2042a13cb931c5e90de872ce8b881c729d0ca3ea1313dbe433cb8bb50d2d21d758df4a2c4097b4
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
partially_useful (0.0.
|
4
|
+
partially_useful (0.0.3)
|
5
5
|
railties (~> 4.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actionpack (4.1.
|
11
|
-
actionview (= 4.1.
|
12
|
-
activesupport (= 4.1.
|
10
|
+
actionpack (4.1.1)
|
11
|
+
actionview (= 4.1.1)
|
12
|
+
activesupport (= 4.1.1)
|
13
13
|
rack (~> 1.5.2)
|
14
14
|
rack-test (~> 0.6.2)
|
15
|
-
actionview (4.1.
|
16
|
-
activesupport (= 4.1.
|
15
|
+
actionview (4.1.1)
|
16
|
+
activesupport (= 4.1.1)
|
17
17
|
builder (~> 3.1)
|
18
18
|
erubis (~> 2.7.0)
|
19
|
-
activesupport (4.1.
|
19
|
+
activesupport (4.1.1)
|
20
20
|
i18n (~> 0.6, >= 0.6.9)
|
21
21
|
json (~> 1.7, >= 1.7.7)
|
22
22
|
minitest (~> 5.1)
|
@@ -26,22 +26,25 @@ GEM
|
|
26
26
|
erubis (2.7.0)
|
27
27
|
i18n (0.6.9)
|
28
28
|
json (1.8.1)
|
29
|
+
json (1.8.1-java)
|
29
30
|
minitest (5.3.3)
|
30
31
|
rack (1.5.2)
|
31
32
|
rack-test (0.6.2)
|
32
33
|
rack (>= 1.0)
|
33
|
-
railties (4.1.
|
34
|
-
actionpack (= 4.1.
|
35
|
-
activesupport (= 4.1.
|
34
|
+
railties (4.1.1)
|
35
|
+
actionpack (= 4.1.1)
|
36
|
+
activesupport (= 4.1.1)
|
36
37
|
rake (>= 0.8.7)
|
37
38
|
thor (>= 0.18.1, < 2.0)
|
38
39
|
rake (10.3.1)
|
39
40
|
thor (0.19.1)
|
40
41
|
thread_safe (0.3.3)
|
42
|
+
thread_safe (0.3.3-java)
|
41
43
|
tzinfo (1.1.0)
|
42
44
|
thread_safe (~> 0.1)
|
43
45
|
|
44
46
|
PLATFORMS
|
47
|
+
java
|
45
48
|
ruby
|
46
49
|
|
47
50
|
DEPENDENCIES
|
data/README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
# PartiallyUseful
|
2
2
|
|
3
|
-
[](https://travis-ci.org/phoet/
|
3
|
+
[](https://travis-ci.org/phoet/partially_useful)
|
4
4
|
|
5
|
-
|
5
|
+
HTML source code is very verbose and can be a pain in the ass to find a specific part on big pages.
|
6
6
|
|
7
|
-
|
7
|
+
Finding the origin of a piece of HTML in the Rails `app/views` directory can be tedious and error prone.
|
8
|
+
|
9
|
+
Adding this gem to your Rails application adds HTML comments at development time, so it's easy to find the right partials.
|
8
10
|
|
9
11
|
```html
|
10
12
|
<!-- start rendering 'some_partial' with locals '[:all, :assigned, :locals]'-->
|
@@ -26,13 +28,19 @@ gem 'partially_useful', group: 'development'
|
|
26
28
|
|
27
29
|
## Usage
|
28
30
|
|
29
|
-
The plugin is enabled by default,
|
31
|
+
The plugin is enabled by default, but you can disable it in your Rails configuration:
|
30
32
|
|
31
33
|
```ruby
|
32
34
|
# config/environments/development.rb
|
33
35
|
config.partially_useful = false
|
34
36
|
```
|
35
37
|
|
38
|
+
## Caveats
|
39
|
+
|
40
|
+
HTML comments might subtly break your application when partials are used out of the usual HTML rendering context (JS, CSS etc).
|
41
|
+
|
42
|
+
If you run into any problems, make sure to disable the gem and restart your Rails server.
|
43
|
+
|
36
44
|
## Supported Ruby versions
|
37
45
|
|
38
46
|
See .travis.yml
|
@@ -1,8 +1,13 @@
|
|
1
1
|
module PartiallyUseful
|
2
2
|
module PartialRenderer
|
3
|
+
def self.included(klass)
|
4
|
+
klass.send :alias_method, :original_rails_render, :render
|
5
|
+
klass.send :remove_method, :render
|
6
|
+
end
|
7
|
+
|
3
8
|
def render(context, options, block)
|
4
9
|
msg = "rendering '#{options[:partial]}' with locals '#{(options[:locals] || {}).keys}'"
|
5
|
-
"<!-- start #{msg}-->\n#{
|
10
|
+
"<!-- start #{msg}-->\n#{original_rails_render(context, options, block)}\n<!-- end #{msg}-->\n".html_safe
|
6
11
|
end
|
7
12
|
end
|
8
13
|
end
|
@@ -4,7 +4,7 @@ module PartiallyUseful
|
|
4
4
|
|
5
5
|
initializer :partially_useful do |app|
|
6
6
|
if app.config.partially_useful
|
7
|
-
ActionView::PartialRenderer.send(:
|
7
|
+
ActionView::PartialRenderer.send(:include, PartiallyUseful::PartialRenderer)
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: partially_useful
|
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
|
- phoet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -146,4 +146,3 @@ test_files:
|
|
146
146
|
- test/dummy/public/favicon.ico
|
147
147
|
- test/partially_useful_test.rb
|
148
148
|
- test/test_helper.rb
|
149
|
-
has_rdoc:
|