navGATE 0.1.16 → 0.1.17
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/Manifest +1 -1
- data/Rakefile +1 -1
- data/config/initializers/build_menu.rb +24 -24
- data/lib/navgate.rb +1 -3
- data/lib/navgate/{application_controller.rb → navgatehelpers.rb} +2 -4
- data/lib/readme.rdoc +13 -0
- data/navGATE.gemspec +4 -4
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40c426cea708d1e3f35edfdf8c516cea62d6761a
|
4
|
+
data.tar.gz: dbabb9a4f1b658f771923fd1d83c781bb9eb8298
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a97de027736363a02273a3add6ec14103dfabec2e1d8fdba0e00bb8ea646b3bfdea13157f74b0b1b052e318742add0c9d94f4576a06c163963492b0a82c1d7b
|
7
|
+
data.tar.gz: fb83fbe23438f7bb79d20016964b135a03fede0d4b5106ffe597e88d063dbb78d7fa32cee3659f4308faa7dd7c441793b8cda9f8a854534d6907f2b8c14bfcff
|
data/Manifest
CHANGED
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ require 'rake'
|
|
3
3
|
require 'echoe'
|
4
4
|
|
5
5
|
|
6
|
-
Echoe.new('navGATE','0.1.
|
6
|
+
Echoe.new('navGATE','0.1.17') 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"
|
@@ -1,26 +1,26 @@
|
|
1
|
-
require 'navgate'
|
2
|
-
building menu object from scratch
|
3
|
-
NAVGATE = Navgate.new do |build|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
1
|
+
# require 'navgate'
|
2
|
+
# building menu object from scratch
|
3
|
+
# NAVGATE = Navgate.new do |build|
|
4
|
+
# build.navs = [ Navgate::Builder.new do |options|
|
5
|
+
# options[:selection] = %w(selection site_settings users images misc)
|
6
|
+
# options[:namespace] = 'admin'
|
7
|
+
# options[:controller] = 'admin_panel'
|
8
|
+
# end
|
9
|
+
# ]
|
10
|
+
# end
|
11
11
|
|
12
|
-
building menu object from database fields be sure to pass it as {Model_name: field}
|
13
|
-
NAVGATE = Navgate.new do |build|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
12
|
+
# building menu object from database fields be sure to pass it as {Model_name: field}
|
13
|
+
# NAVGATE = Navgate.new do |build|
|
14
|
+
# build.navs = [ Navgate::Builder.new do |options|
|
15
|
+
# options[:selection] = {categories: :title }
|
16
|
+
# options[:prefix] = 'shop_category'
|
17
|
+
# options[:controller] = 'front_page'
|
18
|
+
# options[:by_id] = true
|
19
|
+
# end
|
20
|
+
# ]
|
21
|
+
# end
|
22
22
|
|
23
|
-
building from yaml file, look through the yaml file for an example
|
24
|
-
NAVGATE = Navgate.new do |build|
|
25
|
-
|
26
|
-
end
|
23
|
+
# building from yaml file, look through the yaml file for an example
|
24
|
+
# NAVGATE = Navgate.new do |build|
|
25
|
+
# build.navs = "#{Rails.root}/config/build_menu.yml"
|
26
|
+
# end
|
data/lib/navgate.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'navgate/base'
|
2
|
-
require 'navgate/
|
2
|
+
require 'navgate/navgatehelpers'
|
3
3
|
class Navgate
|
4
4
|
class Builder < Base
|
5
5
|
|
@@ -8,9 +8,7 @@ class Navgate
|
|
8
8
|
options[:class] = "'#{self.css_class}'" if self.css_class
|
9
9
|
if options
|
10
10
|
options.each do |key,value|
|
11
|
-
ap value
|
12
11
|
options_to_render += ("#{key}=#{value}" + " ") unless ignoring key
|
13
|
-
ap options_to_render
|
14
12
|
end
|
15
13
|
end
|
16
14
|
style = styling(options)
|
@@ -1,7 +1,4 @@
|
|
1
|
-
|
2
|
-
class ApplicationController < ActionController::Base
|
3
|
-
before_filter :make_menu
|
4
|
-
helper_method :render_navigation
|
1
|
+
module NavGateHelpers
|
5
2
|
def make_menu
|
6
3
|
@navgate = NAVGATE
|
7
4
|
@selected ||= @navgate.select(params) if params[:selection]
|
@@ -9,5 +6,6 @@ class ApplicationController < ActionController::Base
|
|
9
6
|
def render_navigation options = nil
|
10
7
|
@navgate.render_nav(params, options)
|
11
8
|
end
|
9
|
+
|
12
10
|
end
|
13
11
|
|
data/lib/readme.rdoc
CHANGED
@@ -11,6 +11,18 @@ This gem was built with Rails in mind.
|
|
11
11
|
note: this is my first gem.
|
12
12
|
|
13
13
|
lastly the gem is up on rubygems.org
|
14
|
+
|
15
|
+
==setup
|
16
|
+
in the Application controller you have to <tt> include NavGateHelpers </tt> first.
|
17
|
+
|
18
|
+
You next have to add a before_filter and helper method to the application controller
|
19
|
+
|
20
|
+
just add
|
21
|
+
helper_method :render_navigation
|
22
|
+
before_filter :make_menu
|
23
|
+
|
24
|
+
to your list of filters and helper methods in the application controller, thats it, you can now use the helper method and the gem to build the navigations
|
25
|
+
|
14
26
|
==Building the menus
|
15
27
|
|
16
28
|
When building the menu there are multiple options available, building the menu is done in an initializer file in the configs directory.
|
@@ -106,6 +118,7 @@ The yaml file:
|
|
106
118
|
|
107
119
|
==Rendering the menu
|
108
120
|
|
121
|
+
|
109
122
|
To render the menu use the provided helper <tt>render_navigation(options)</tt>;
|
110
123
|
options is a hash that is used to build any html options you might want such as
|
111
124
|
'class='some_css_class', it can also take two extra options, 'styling:' and 'wrap:'.
|
data/navGATE.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "navGATE"
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.17"
|
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"]
|
9
|
-
s.date = "2013-10-
|
9
|
+
s.date = "2013-10-17"
|
10
10
|
s.description = "Can create navigation from objects using the nav builder,from database tables or from a yaml file"
|
11
11
|
s.email = "mbeckerwork@gmail.com"
|
12
|
-
s.extra_rdoc_files = ["lib/navgate.rb", "lib/navgate/
|
13
|
-
s.files = ["Manifest", "Rakefile", "config/build_menu.yml", "config/initializers/build_menu.rb", "init.rb", "lib/navgate.rb", "lib/navgate/
|
12
|
+
s.extra_rdoc_files = ["lib/navgate.rb", "lib/navgate/base.rb", "lib/navgate/navgatehelpers.rb", "lib/readme.rdoc"]
|
13
|
+
s.files = ["Manifest", "Rakefile", "config/build_menu.yml", "config/initializers/build_menu.rb", "init.rb", "lib/navgate.rb", "lib/navgate/base.rb", "lib/navgate/navgatehelpers.rb", "lib/readme.rdoc", "navGATE.gemspec"]
|
14
14
|
s.homepage = "https://github.com/Thermatix/navGATE"
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "navGATE"]
|
16
16
|
s.require_paths = ["lib"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: navGATE
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Becker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Can create navigation from objects using the nav builder,from database
|
14
14
|
tables or from a yaml file
|
@@ -17,8 +17,8 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files:
|
19
19
|
- lib/navgate.rb
|
20
|
-
- lib/navgate/application_controller.rb
|
21
20
|
- lib/navgate/base.rb
|
21
|
+
- lib/navgate/navgatehelpers.rb
|
22
22
|
- lib/readme.rdoc
|
23
23
|
files:
|
24
24
|
- Manifest
|
@@ -27,8 +27,8 @@ files:
|
|
27
27
|
- config/initializers/build_menu.rb
|
28
28
|
- init.rb
|
29
29
|
- lib/navgate.rb
|
30
|
-
- lib/navgate/application_controller.rb
|
31
30
|
- lib/navgate/base.rb
|
31
|
+
- lib/navgate/navgatehelpers.rb
|
32
32
|
- lib/readme.rdoc
|
33
33
|
- navGATE.gemspec
|
34
34
|
homepage: https://github.com/Thermatix/navGATE
|