phcdevworks_active_menus 2.2.4 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +37 -31
- data/app/helpers/phcdevworks_active_menus/application_helper.rb +20 -20
- data/lib/phcdevworks_active_menus/engine.rb +1 -1
- data/lib/phcdevworks_active_menus/version.rb +1 -1
- metadata +11 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41f33f743e7be3cd034bccc638878a31e95b4d6f35cefc7131d68f4ea49758f2
|
4
|
+
data.tar.gz: cdadbb3feebcb06e2c5cb2cb38038e0e80d2fb57a970f08f8eb59735507e5e6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d44d1baf56b00e61949a8755cef20d0629adfe8e48c96c50c5dc0f7abc8e4bd17911ec54fce7d007fd60ed7b9dde6ded296f43d9c79b04df8f18db98e628fb07
|
7
|
+
data.tar.gz: c166ede1fb4204fd064fe270f82a1dd3d010051da6cf251a4c4601f60ae694507888580ad2e1891ff836d5515bda4ae2c2a37233839912439fdec48e1e5a76b6
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,31 +1,37 @@
|
|
1
|
-
### PHCDevworks Active Menus for Rails
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
* Add active class based on current
|
6
|
-
* Add active class based on
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
Add
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
Add
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
Add
|
30
|
-
|
31
|
-
|
1
|
+
### PHCDevworks Active Menus for Rails 7 (Add Active Class to Menus)
|
2
|
+
|
3
|
+
PHCDevworks Active Menus Rails 7 engine with helpers to add active class to menus.
|
4
|
+
|
5
|
+
* Add active class based on current controller.
|
6
|
+
* Add active class based on current action.
|
7
|
+
* Add active class based on both current controller plus current action.
|
8
|
+
|
9
|
+
#### Step 1 - Add PHCDevworks Active Menus to your gemfile
|
10
|
+
|
11
|
+
gem 'phcdevworks_active_menus'
|
12
|
+
bundle install
|
13
|
+
|
14
|
+
#### Step 2 - Load Helpers in the Application's Controller
|
15
|
+
Add the line of code below into your app/controllers/application_controller.rb (application's controller file).
|
16
|
+
|
17
|
+
helper PhcdevworksActiveMenus::Engine.helpers
|
18
|
+
|
19
|
+
#### How to Add Active Class Based on Controller Only (Often used for main menu items with sub-menus.)
|
20
|
+
Add the line of code in between div class tag.
|
21
|
+
|
22
|
+
<div class"<%= phc_menu_active_controller("ExampleControllerName") %>">
|
23
|
+
|
24
|
+
#### How to Add Active Class Based on Action Only (Often used for submenu items.)
|
25
|
+
Add the line of code in between div class tag.
|
26
|
+
|
27
|
+
<div class"<%= phc_menu_active_action("ExampleActionName") %>">
|
28
|
+
|
29
|
+
#### How to Add Active Class Based on Controller and Action (Used if you need to get specific.)
|
30
|
+
Add the line of code in between div class tag.
|
31
|
+
|
32
|
+
<div class"<%= phc_menu_active_action_controller("ExampleControllerName", "ExampleActionName") %>">
|
33
|
+
|
34
|
+
### Status
|
35
|
+
|
36
|
+
[![Gem Version](https://badge.fury.io/rb/phcdevworks_active_menus.svg)](https://badge.fury.io/rb/phcdevworks_active_menus) [![Publish to Github.com](https://github.com/phcdevworks/phcdevworks_active_menus/actions/workflows/publish_gem_github_com.yml/badge.svg)](https://github.com/phcdevworks/phcdevworks_active_menus/actions/workflows/publish_gem_github_com.yml) [![Publish to Rubygems.org](https://github.com/phcdevworks/phcdevworks_active_menus/actions/workflows/publish_gem_rubygems_org.yml/badge.svg)](https://github.com/phcdevworks/phcdevworks_active_menus/actions/workflows/publish_gem_rubygems_org.yml)
|
37
|
+
|
@@ -1,20 +1,20 @@
|
|
1
|
-
module PhcdevworksActiveMenus
|
2
|
-
module ApplicationHelper
|
3
|
-
|
4
|
-
# Add Active to Menu Based on Controller Name
|
5
|
-
def phc_menu_active_controller(controller_name)
|
6
|
-
params[:controller] == controller_name ? "active" : nil
|
7
|
-
end
|
8
|
-
|
9
|
-
# Add Active to Menu Based on Controller Name
|
10
|
-
def phc_menu_active_action(action_name)
|
11
|
-
params[:action] == action_name ? "active" : nil
|
12
|
-
end
|
13
|
-
|
14
|
-
# Add Active to Menu Based on Both Controller Name and Action
|
15
|
-
def phc_menu_active_action_controller(controller_name, action_name)
|
16
|
-
params[:controller] == controller_name && params[:action] == action_name ? "active" : nil
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
1
|
+
module PhcdevworksActiveMenus
|
2
|
+
module ApplicationHelper
|
3
|
+
|
4
|
+
# Add Active to Menu Based on Controller Name
|
5
|
+
def phc_menu_active_controller(controller_name)
|
6
|
+
params[:controller] == controller_name ? "active" : nil
|
7
|
+
end
|
8
|
+
|
9
|
+
# Add Active to Menu Based on Controller Name
|
10
|
+
def phc_menu_active_action(action_name)
|
11
|
+
params[:action] == action_name ? "active" : nil
|
12
|
+
end
|
13
|
+
|
14
|
+
# Add Active to Menu Based on Both Controller Name and Action
|
15
|
+
def phc_menu_active_action_controller(controller_name, action_name)
|
16
|
+
params[:controller] == controller_name && params[:action] == action_name ? "active" : nil
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phcdevworks_active_menus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PHCDevworks
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '7.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '7.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: phcthemes_admin_panel_pack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '5.1'
|
34
34
|
type: :runtime
|
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: '5.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: phcthemes_web_theme_pack
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '5.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '5.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: sqlite3
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,8 +66,8 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.4'
|
69
|
-
description: Rails helpers to add active class to menu items based on controller
|
70
|
-
controller action.
|
69
|
+
description: Rails 7 helpers to add active class to menu items based on controller
|
70
|
+
and controller action.
|
71
71
|
email:
|
72
72
|
- imfo@phcdevworks.com
|
73
73
|
executables: []
|
@@ -86,7 +86,6 @@ homepage: https://phcdevworks.com/
|
|
86
86
|
licenses:
|
87
87
|
- MIT
|
88
88
|
metadata:
|
89
|
-
allowed_push_host: https://rubygems.org/
|
90
89
|
homepage_uri: https://phcdevworks.com/
|
91
90
|
source_code_uri: https://github.com/phcdevworks/phcdevworks_active_menus
|
92
91
|
changelog_uri: https://github.com/phcdevworks/phcdevworks_active_menus/releases
|
@@ -105,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
104
|
- !ruby/object:Gem::Version
|
106
105
|
version: '0'
|
107
106
|
requirements: []
|
108
|
-
rubygems_version: 3.0.3
|
107
|
+
rubygems_version: 3.0.3.1
|
109
108
|
signing_key:
|
110
109
|
specification_version: 4
|
111
110
|
summary: PHCDevworks - Helpers - Active Menus
|