navGATE 0.1.23 → 0.1.24

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cfffca90e5a8c00a84fd93e7a425e0bfdaae75c1
4
- data.tar.gz: 6c41bbb8e738392546be1d2e7f28b28af562728e
3
+ metadata.gz: 4b486930a82ec515b354bdba6204f06d72cf199c
4
+ data.tar.gz: f3449613e5c25aeb8da60459e5365043f2412e5f
5
5
  SHA512:
6
- metadata.gz: e43a5e747a2a6205b6993289b732fe3e3fc0500910446c92cc00ace3dbaa717f21caae97cf524e1361d14a8212f6bb2c87f0d5f5a0657f72b96417aa6640ec05
7
- data.tar.gz: e4aebc4c1a2e42989efc237dddfad22345da5d6e4cb3d50092ccb4ecfeee764d1935558cc32324ecb2539d42a1c2e6b0ca95b9c35f7c1ff52c0d6ede882d30f3
6
+ metadata.gz: c8e3d25f36a480c7114c8b35a1de08dc1a4f42deb2b2314ef1d3e1b366c8916f612f792f938881281faf381874676ff0e4a514a5c7abe392de32b314a663de32
7
+ data.tar.gz: de7388e3031a146023c896c309933834a333c4a2a795cfda5bd1e66ca6dd614914519c90a6d25b4cb09804095ebfcbd972ef46a74c4ff726efd9ba375c4dafbb
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rake'
3
3
  require 'echoe'
4
4
 
5
5
 
6
- Echoe.new('navGATE','0.1.23') do |p|
6
+ Echoe.new('navGATE','0.1.24') do |p|
7
7
  p.summary = "Allows the easy creation of navigation with config files"
8
8
  p.description = "Can create navigation from objects using the nav builder,from database tables or from a yaml file"
9
9
  p.url = "https://github.com/Thermatix/navGATE"
@@ -96,7 +96,7 @@ class Navgate
96
96
 
97
97
  end
98
98
 
99
- attr_accessor :controllers, :navs
99
+ attr_accessor :controllers, :navs, :ignoring
100
100
 
101
101
  def initialize
102
102
  self.controllers = Rails.application.routes.routes.map do |route|
@@ -125,17 +125,26 @@ class Navgate
125
125
 
126
126
 
127
127
  def render_nav selection, controller, options
128
- nav = nav_cache(controller.split('/').last).render_it_with(options,selection).html_safe
129
- nav
128
+ if ignoring.include?(selection)
129
+ nav = nav_cache(controller.split('/').last).render_it_with(options,selection).html_safe
130
+ nav
131
+ else
132
+ nil
133
+ end
130
134
  end
131
135
 
132
136
  def select selection, controller
133
- if selection
134
- return selection
137
+ if ignoring.include?(selection)
138
+ if selection
139
+ selection
140
+ else
141
+ nav_cache(controller.split('/').last).default.to_s
142
+ end
135
143
  else
136
- return nav_cache(controller.split('/').last).default.to_s
144
+ nil
137
145
  end
138
146
  end
147
+
139
148
  private
140
149
 
141
150
  def nav_cache controller
@@ -4,11 +4,10 @@ This gem is provided as is.
4
4
 
5
5
  This gem allows for the ease of navigation building, from preset lists, from active model databases (eg, categories), from yaml files; but it's not just
6
6
  for the ease of use it's also that you can have multiple navigation menus for differant controllers, or the same menu for differant controllers.
7
- Whatever you want is up to you.
7
+ However you want it, it's up to you.
8
8
 
9
9
  This gem was built with Rails in mind.
10
10
 
11
- note: this is my first gem.
12
11
 
13
12
  lastly the gem is up on rubygems.org
14
13
 
@@ -31,7 +30,7 @@ For non rails version of NavGATE the helpers change, instead they work like so:
31
30
  render_navigation(selection, controller, options = nil)
32
31
 
33
32
  You have to pass the controller (or page it matches) and the current selection,
34
- in rails they would pass automatically as <tt> params[:controller] </tt> and <tt> params[:selection] </tt> respecivly (selection being the currenty selected nav item).
33
+ in rails they would pass automatically as <tt> params[:controller] </tt> and <tt> params[:selection] </tt> respectively (selection being the currently selected nav item).
35
34
 
36
35
  ==Building the menus
37
36
 
@@ -47,7 +46,7 @@ There are two ways to use this, the first is to use an array of strings containi
47
46
 
48
47
  <b>Default</b>: This is used to give the menu a default selection for when the user has not selected anything. Pass a string containing the name of the default selection, if no string is passed then the first item from selection is used.
49
48
 
50
- <b>prefix</b>: This is used when you have a prefix before the target in the URL, eg: if your links render out as "host.com/books" without a prefix; with a prefix of 'shelf' it will render out as "host.com/shelf/books". Namespacing is ignored within this gem, it only looks at the controller's name and nothing else when controller mathing.
49
+ <b>prefix</b>: This is used when you have a prefix before the target in the URL, eg: if your links render out as "host.com/books" without a prefix; with a prefix of 'shelf' it will render out as "host.com/shelf/books". Namespacing is ignored within this gem, it only looks at the controller's name and nothing else when controller matching.
51
50
 
52
51
  <b>controller</b>: This is used to match the menu to a controller, when deciding which menu to render, it can also be an array of strings; it matches this attribute to the current controller.
53
52
 
@@ -55,7 +54,7 @@ There are two ways to use this, the first is to use an array of strings containi
55
54
 
56
55
  <b>css_class</b>: This is used when you want to hard code the CSS class selector into the menu rather then from the view.
57
56
 
58
- <b>css_selected</b>: the css overide for the selected thats currently selected. if no overide is passed then the link is simply not rendered out, as with css_class it overides the one passed in the view, but only for the selected link
57
+ <b>css_selected</b>: the css override for the selected that's currently selected. if no override is passed then the link is simply not rendered out, as with css_class it overrides the one passed in the view, but only for the selected link
59
58
 
60
59
  examples:
61
60
 
@@ -127,10 +126,13 @@ The yaml file:
127
126
  controller: admin_panel
128
127
 
129
128
 
129
+ ==Ignoring Controllers
130
+ Sometimes you're going to want to ignore controllers that don't any gui. Doing that is simple, when you're building the menu just pass an Array to build like so
131
+ build.ignoring = ['controllers','to','ignore']
132
+ before or after you pass through the navs.
130
133
 
131
134
  ==Rendering the menu
132
135
 
133
-
134
136
  To render the menu use the provided helper <tt>render_navigation(options)</tt>;
135
137
  options is a hash that is used to build any html options you might want such as
136
138
  'class='some_css_class', it can also take two extra options, 'styling:' and 'wrap:'.
@@ -166,7 +168,7 @@ resulting url
166
168
  host.com/books
167
169
  host.com/games
168
170
 
169
- routes to the root but the paritals rendered would be respectively
171
+ routes to the root but the partials rendered would be respectively
170
172
  _books.html.erb
171
173
  _games.html.erb
172
174
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "navGATE"
5
- s.version = "0.1.23"
5
+ s.version = "0.1.24"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Martin Becker"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: navGATE
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.23
4
+ version: 0.1.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Becker