navGATE 0.1.02 → 0.1.03
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/initializers/build_menu.rb +25 -25
- data/lib/navgate.rb +4 -4
- data/navGATE.gemspec +2 -2
- data/readme.rdoc +9 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c35ee91c220d9bf82d1f18a2e739328aa0e5aed
|
4
|
+
data.tar.gz: a93234e5785df7f61358b8c2cb24210704903cc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ade75be25deeb4016e2905775afa0d4efc676ce2ac8790f1ac41f163b1a2c0b096b8522e4ea9c56923d95680832d45327e74c26e1b7f72c7ed84214a251d8d86
|
7
|
+
data.tar.gz: b4697918cbc10e9aa026053d88000f717dd43aaad385789c878d5e810044ebee9df176e3cbc89ea410718595c1bbdb6b255478948d1a9b56147f866316e7f6bb
|
@@ -1,26 +1,26 @@
|
|
1
1
|
require 'navgate'
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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
|
+
|
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
|
+
|
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
@@ -14,19 +14,21 @@ class Navgate
|
|
14
14
|
if !self.by_id
|
15
15
|
self.selection.each do |select|
|
16
16
|
wrap_with options[:wrap] do
|
17
|
-
@text_to_render += "<a href=\"#{path_for(select)}\" #{options_to_render}>#{select}</a>#{style}"
|
17
|
+
@text_to_render += "<a href=\"#{path_for(select)}\" #{options_to_render}>#{select.gsub('_'," ")}</a>#{style}"
|
18
18
|
end
|
19
19
|
end
|
20
20
|
else
|
21
21
|
self.selection.each_with_index do |select,i|
|
22
22
|
wrap_with options[:wrap] do
|
23
|
-
@text_to_render += "<a href=\"#{path_for(self.by_id[i])}\" #{options_to_render}>#{select}</a>#{style}"
|
23
|
+
@text_to_render += "<a href=\"#{path_for(self.by_id[i])}\" #{options_to_render}>#{select.gsub('_'," ")}</a>#{style}"
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
27
27
|
@text_to_render
|
28
28
|
end
|
29
29
|
|
30
|
+
|
31
|
+
|
30
32
|
private
|
31
33
|
def wrap_with tag, &block
|
32
34
|
if tag.is_a?(Array)
|
@@ -45,8 +47,6 @@ class Navgate
|
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
48
|
-
|
49
|
-
|
50
50
|
def path_for link_to
|
51
51
|
if self.namespace
|
52
52
|
return "/#{self.namespace}/#{link_to}"
|
data/navGATE.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "navGATE"
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.03"
|
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-15"
|
10
10
|
s.description = "Allows the easy creation of menus with config files"
|
11
11
|
s.email = "mbeckerwork@gmail.com"
|
12
12
|
s.extra_rdoc_files = ["lib/navgate.rb", "lib/navgate/base.rb"]
|
data/readme.rdoc
CHANGED
@@ -1,15 +1,20 @@
|
|
1
1
|
= navGATE
|
2
2
|
|
3
|
-
This gem is provided as is, please read through the intializer file "build_menu.rb" for examples on how you can use this gem to build a nav menu
|
3
|
+
This gem is provided as is, please read through the intializer file "build_menu.rb" for examples on how you can use this gem to build a nav menu.
|
4
4
|
|
5
|
-
|
5
|
+
This gem was built with Rails in mind.
|
6
6
|
|
7
|
-
|
7
|
+
note: this is my first gem, I am still trying to set it up, so be carefull when downloading this.
|
8
|
+
Also I've included the extra files needed to get it working in there respective directories, eg, the code in 'Applicationhelper' needs to go in 'Applicationhelper'.
|
9
|
+
I've tried to to make it easy to install but I'm still not sure how to get those things into the right files automaticly, if some one could point me in the right direction, I'd be happy to make the needed changes.
|
10
|
+
lastly the gem is up on rubygems.org
|
11
|
+
==Building the menus
|
8
12
|
|
9
13
|
When building the menu there are multiple options available, building the menu is done in an initializer file in the configs directory.
|
10
14
|
|
11
15
|
There are several options you can pass through, if you are building the menu with the object builder directly then two options must be present, those being 'selection' and 'controller', the rest are optional.
|
12
16
|
|
17
|
+
Also note, you can pass multiple Navgate::builders as you need, just match them to there controllers and they should render properly.
|
13
18
|
===Options
|
14
19
|
|
15
20
|
selection: This is used to build the menu options.
|
@@ -91,4 +96,4 @@ Wrap: This allows you to wrap each link in a html tag, wrap can itself take two
|
|
91
96
|
example:
|
92
97
|
render_navigation({"class" => "'nav button'",styling: :verticle, wrap: ['li','test']}) %>
|
93
98
|
|
94
|
-
note: class has to be in "" due to it being a keyword in ruby.
|
99
|
+
note: class has to be in "" due to it being a keyword in ruby.
|
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.03
|
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-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Allows the easy creation of menus with config files
|
14
14
|
email: mbeckerwork@gmail.com
|