activenavbar 1.0.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -9
- data/activenavbar-1.0.1.gem +0 -0
- data/activenavbar-1.0.2.gem +0 -0
- data/activenavbar-1.0.3.gem +0 -0
- data/activenavbar-1.0.4.gem +0 -0
- data/lib/activenavbar.rb +5 -1
- data/lib/activenavbar/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 403d169d3013e86d5dc4b4d0e4aa1b6a938ed955
|
4
|
+
data.tar.gz: 43666daca55967dc732d942d7474d3a4318f125f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e298272c6c59d0bacff2a5942cc29965954344224b29b330a418cbbe7e7aa7768ab7535b816b812e41bc30a77812a1554dd0e1c23bf835fa04a026a7656befe
|
7
|
+
data.tar.gz: f35447dc7ec7e1e45d4d9eb60ab9a59e917c7183902f7da37c35457804ba02495e3f9e60eaa47a06aba96265753cb3ffc8ffdf7c1a4d27217bb6346a141de390
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@ The simplest way to install is to use Bundler.
|
|
10
10
|
Add this line to your application's Gemfile:
|
11
11
|
|
12
12
|
```ruby
|
13
|
-
gem 'activenavbar'
|
13
|
+
gem 'activenavbar', '~> 1.0.4'
|
14
14
|
```
|
15
15
|
|
16
16
|
And then execute:
|
@@ -31,15 +31,15 @@ Or install it yourself as:
|
|
31
31
|
|
32
32
|
## Usage
|
33
33
|
|
34
|
-
Assume we have home,
|
34
|
+
Assume we have home, food and beverage page, and have navbar for each page below:
|
35
35
|
|
36
36
|
%ul
|
37
37
|
%li
|
38
38
|
= link_to "Home", homes_path
|
39
39
|
%li
|
40
|
-
= link_to "Food",
|
40
|
+
= link_to "Food", foods_path
|
41
41
|
%li
|
42
|
-
= link_to "Beverage",
|
42
|
+
= link_to "Beverage", beverages_path
|
43
43
|
|
44
44
|
Assume we have style sheet for navbar below:
|
45
45
|
|
@@ -67,8 +67,8 @@ Now we want a navbar link becomes active when we click on it:
|
|
67
67
|
|
68
68
|
%ul
|
69
69
|
= navbar_link "Home", root_path, "active"
|
70
|
-
= navbar_link "Food
|
71
|
-
= navbar_link "Beverage",
|
70
|
+
= navbar_link '<span class="glyphicon glyphicon-heart"></span> Food', foods_path, "active"
|
71
|
+
= navbar_link "Beverage", beverages_path, "active"
|
72
72
|
|
73
73
|
Well, Home link becomes active when we click on Home link.
|
74
74
|
|
@@ -76,8 +76,8 @@ HTML output:
|
|
76
76
|
|
77
77
|
<ul>
|
78
78
|
<li class="active"><a href="/">Home</a></li>
|
79
|
-
<li class=""><a href="/
|
80
|
-
<li class=""><a href="/
|
79
|
+
<li class=""><a href="/foods"><span class="glyphicon glyphicon-heart"></span>Food</a></li>
|
80
|
+
<li class=""><a href="/beverages">Beverage</a></li>
|
81
81
|
</ul>
|
82
82
|
|
83
|
-
Say hi to me @bunlongvan
|
83
|
+
Say hi to me @bunlongvan
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/activenavbar.rb
CHANGED
@@ -3,7 +3,11 @@ require "activenavbar/version"
|
|
3
3
|
module Activenavbar
|
4
4
|
def navbar_link(label, path, active_class)
|
5
5
|
class_name = current_page?(path) || path == "/#{request.fullpath.split('/')[1]}" ? active_class : ''
|
6
|
-
content_tag(:li, :class => class_name)
|
6
|
+
content_tag(:li, :class => class_name) do
|
7
|
+
link_to path do
|
8
|
+
label.html_safe
|
9
|
+
end
|
10
|
+
end
|
7
11
|
end
|
8
12
|
end
|
9
13
|
|
data/lib/activenavbar/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activenavbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bunlong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -55,6 +55,10 @@ files:
|
|
55
55
|
- activenavbar-0.0.1.gem
|
56
56
|
- activenavbar-0.0.2.gem
|
57
57
|
- activenavbar-1.0.0.gem
|
58
|
+
- activenavbar-1.0.1.gem
|
59
|
+
- activenavbar-1.0.2.gem
|
60
|
+
- activenavbar-1.0.3.gem
|
61
|
+
- activenavbar-1.0.4.gem
|
58
62
|
- activenavbar.gemspec
|
59
63
|
- gem-private_key.pem
|
60
64
|
- lib/activenavbar.rb
|