body_id 0.0.1 → 0.0.2

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: 22116bc60286b382ff1cb9b4d632a54bb1ea94d9
4
- data.tar.gz: 404bb665290eeaa77cc01f673dd8996c9e54926f
3
+ metadata.gz: 473907e191700b3f6ec9f22dba20bbd73b54692f
4
+ data.tar.gz: 5429df3a7b62bc24d7f899f6df48736b7b4dec39
5
5
  SHA512:
6
- metadata.gz: e0fd3dab82403080f08cc08ee9e8169e410d856d72a1e96dbd30c5bc1eda3fa126e2823bfca661004565c33af8ea9f45fb38e973882374bce109a0e0a81cfc6a
7
- data.tar.gz: 378e6c7e6bd5e2f2ad93c7d7b676b3bcf2e805ddf5947d8f9c0013f793a10e5937478669a2d297ad72ecd3d8ee5120ea14dcbdf9a01a3498de44c7854b1dbb80
6
+ metadata.gz: 130e46f0d6b482469e3dbeb4ee9adf3638a8667fd765ff9de39edaaa4d995a27a1b89fff8702fd5ac5730c59bc36427af030f762f8ef6cd620aab9b31e0b38db
7
+ data.tar.gz: 7c42092c077bc9c64cce7e662403b9ccce246ee598cbceae86c1e030a64c9d08340d6282d86164b513cba3711ecc828e7864674be3b8f669e83059975c24a426
data/README.md CHANGED
@@ -1,8 +1,15 @@
1
- # BodyId
1
+ BodyId
2
+ ======
2
3
 
3
- TODO: Write a gem description
4
+ ![body_id logo](https://raw.github.com/the4dpatrick/body-id-gem/images/body_id.png "body_id logo")
4
5
 
5
- ## Installation
6
+ Create a custom `body_id` from your controller and action names.
7
+ ```
8
+ Pages#index #=> #page-index
9
+ Cars#new #=> #car-new
10
+ ```
11
+ Installation
12
+ ------------
6
13
 
7
14
  Add this line to your application's Gemfile:
8
15
 
@@ -16,13 +23,47 @@ Or install it yourself as:
16
23
 
17
24
  $ gem install body_id
18
25
 
19
- ## Usage
26
+ Usage
27
+ -----
20
28
 
21
- TODO: Write usage instructions here
29
+ In your `application.html.erb`, or other layout files set, `body_id` as the body tag's ID
30
+ ###ERB
31
+ ```erb
32
+ ...
33
+ </head>
34
+ <body id= <%= body_id %>>
35
+ <%= yield %>
36
+ </body>
37
+ </html>
38
+ ```
22
39
 
23
- ## Contributing
40
+ ###HAML
41
+ ```haml
42
+ ...
43
+ %body{ id: "#{ body_id }" }
44
+ ...
45
+ ```
24
46
 
25
- 1. Fork it ( http://github.com/<my-github-username>/body_id/fork )
47
+ Custom `body_id`
48
+ ---------------
49
+ In case you want a custom ID for your body tag, simply create an instance variable with what you want the view's body_id to be.
50
+
51
+ ```ruby
52
+ class PagesContrller < ApplicationController
53
+ def index
54
+ @body_id = 'home'
55
+ end
56
+
57
+ def new
58
+ @body_id = 'awesome-custom-id'
59
+ end
60
+ end
61
+ ```
62
+
63
+ Contributing
64
+ ------------
65
+
66
+ 1. Fork it ( http://github.com/the4dpatrick/body-id-gem )
26
67
  2. Create your feature branch (`git checkout -b my-new-feature`)
27
68
  3. Commit your changes (`git commit -am 'Add some feature'`)
28
69
  4. Push to the branch (`git push origin my-new-feature`)
data/body_id.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = BodyId::VERSION
9
9
  spec.authors = ["Patrick Perey"]
10
10
  spec.email = ["the4dpatrick@yahoo.com"]
11
- spec.summary = %q{Create a custom body_id selector from the controller and action name}
12
- spec.description = %q{Create a custom body_id selector from the controller and action name}
11
+ spec.summary = %q{Create a custom body_id selector from your controller and action names}
12
+ spec.description = %q{Insert body_id within your application layout's <body> tag. Pages#Index becomes "#page-index" You can overwrite the generated ID with a custom ID from within your controller's action by set @body_id to your desired ID}
13
13
  spec.homepage = "https://github.com/the4dpatrick/body-id-gem"
14
14
  spec.license = "MIT"
15
15
 
@@ -5,7 +5,11 @@ module BodyId
5
5
  def body_id
6
6
  controller = controller_name.singularize.underscore
7
7
  action = action_name.underscore
8
- "#{ controller }-#{ action }".gsub(/_/, '-')
8
+ body_id = "#{ controller }-#{ action }".gsub(/_/, '-')
9
+
10
+ # Controller declared instance variable
11
+ # or helper generated string
12
+ @body_id || body_id
9
13
  end
10
14
  end
11
15
  end
@@ -1,3 +1,3 @@
1
1
  module BodyId
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: body_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Perey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-16 00:00:00.000000000 Z
11
+ date: 2014-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,7 +38,9 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: Create a custom body_id selector from the controller and action name
41
+ description: Insert body_id within your application layout's <body> tag. Pages#Index
42
+ becomes "#page-index" You can overwrite the generated ID with a custom ID from within
43
+ your controller's action by set @body_id to your desired ID
42
44
  email:
43
45
  - the4dpatrick@yahoo.com
44
46
  executables: []
@@ -78,5 +80,5 @@ rubyforge_project:
78
80
  rubygems_version: 2.2.1
79
81
  signing_key:
80
82
  specification_version: 4
81
- summary: Create a custom body_id selector from the controller and action name
83
+ summary: Create a custom body_id selector from your controller and action names
82
84
  test_files: []