seiten 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/seiten_helper.rb +4 -2
- data/lib/seiten/controllers/helpers.rb +5 -0
- data/lib/seiten/page_store.rb +1 -2
- data/lib/seiten/version.rb +1 -1
- data/lib/seiten.rb +0 -1
- data/test/dummy/app/pages/about/our-team/italy.html.erb +0 -0
- data/test/dummy/app/pages/about/our-team/switzerland.html.erb +0 -0
- data/test/dummy/app/pages/about/our-team.html.erb +2 -0
- data/test/dummy/app/pages/about/partners.html.erb +1 -0
- data/test/dummy/app/pages/about/works.html.erb +0 -0
- data/test/dummy/app/pages/contact.html.erb +0 -0
- data/test/dummy/app/pages/products/logo-design.html.erb +0 -0
- data/test/dummy/app/pages/products/web-development.html.erb +0 -0
- data/test/dummy/app/pages/products.html.erb +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +4 -0
- data/test/dummy/config/navigation.yml +20 -7
- data/test/dummy/log/development.log +2300 -0
- data/test/dummy/log/test.log +1534 -0
- data/test/dummy/tmp/pids/server.pid +1 -1
- data/test/integration/navigation_test.rb +57 -3
- data/test/page_test.rb +6 -6
- data/test/test_helper.rb +3 -2
- metadata +20 -4
- data/test/fixtures/navigation.yml +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ff3eff988f3787487b60b8f11c630b6e24bfa1a
|
4
|
+
data.tar.gz: 3b643778c38bc5d7159d2e460621ed0b23fc397b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bb7ac830e0296c69fdeb75c8794c05bfb3e412875ae99d4cb87246a42c0401ad7034c79e49f27d492dcbcce05d87a89b87e269633722d1d1d1cccbeac05aa50
|
7
|
+
data.tar.gz: 38db0d1c66f10f3d4ff8412440d4222d41277e956c3df186fe47754cefe3d24408f779002d00faa5ab3ecbd77054f7a18b30b2234f2cf7843f186eb855feb7f8
|
@@ -9,15 +9,17 @@ module SeitenHelper
|
|
9
9
|
render :file => File.join(Rails.root, Seiten.config[:storage_directory], filename)
|
10
10
|
end
|
11
11
|
|
12
|
-
def seiten_navigation(
|
12
|
+
def seiten_navigation(options={})
|
13
13
|
output ||= ""
|
14
|
+
parent_id = options[:parent_id] || nil
|
15
|
+
deep = options[:deep] || 2
|
14
16
|
|
15
17
|
if deep > 0
|
16
18
|
Seiten::Page.find_by_parent_id(parent_id).each do |page|
|
17
19
|
status = page.active?(current_page) ? "active" : "inactive"
|
18
20
|
output += "<li class='#{status}'>#{link_to(page.title, page.slug)}"
|
19
21
|
unless page.children.blank?
|
20
|
-
output += seiten_navigation(page.id, deep-1)
|
22
|
+
output += seiten_navigation(parent_id: page.id, deep: deep-1)
|
21
23
|
end
|
22
24
|
output += "</li>"
|
23
25
|
end
|
@@ -2,6 +2,11 @@ module Seiten
|
|
2
2
|
module Controllers
|
3
3
|
# Those helpers are convenience methods added to ApplicationController.
|
4
4
|
module Helpers
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
helper_method :current_page
|
9
|
+
end
|
5
10
|
|
6
11
|
def current_page
|
7
12
|
@current_page ||= Seiten::Page.find_by_slug(request.fullpath)
|
data/lib/seiten/page_store.rb
CHANGED
@@ -7,7 +7,6 @@ module Seiten
|
|
7
7
|
def initialize(options={})
|
8
8
|
@storage_type = options[:storage_type]
|
9
9
|
@storage_file = options[:storage_file]
|
10
|
-
@storage_directory = options[:storage_directory]
|
11
10
|
|
12
11
|
@storage_type ||= Seiten.config[:storage_type]
|
13
12
|
@storage_file ||= File.join(Rails.root, Seiten.config[:storage_file])
|
@@ -37,7 +36,7 @@ module Seiten
|
|
37
36
|
|
38
37
|
# Build link
|
39
38
|
slug = page["url"].nil? ? page["title"].parameterize : page["url"]
|
40
|
-
if slug[0] == "/" || !!(slug.match(/^
|
39
|
+
if slug[0] == "/" || !!(slug.match(/^https?:\/\/.+/))
|
41
40
|
page["slug"] = slug
|
42
41
|
else
|
43
42
|
page["slug"] = "#{url}/#{slug}"
|
data/lib/seiten/version.rb
CHANGED
data/lib/seiten.rb
CHANGED
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= seiten_navigation parent_id: Seiten::Page.find_by_slug("/about/partners").id %>
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,15 +1,28 @@
|
|
1
1
|
- title: "Home"
|
2
2
|
url: "/"
|
3
3
|
|
4
|
+
- title: "Products"
|
5
|
+
nodes:
|
6
|
+
- title: "Logo Design"
|
7
|
+
- title: "Web Development"
|
8
|
+
- title: "Hire us"
|
9
|
+
url: "/contact" # links to Contact page
|
10
|
+
|
4
11
|
- title: "About"
|
5
|
-
redirect: true
|
12
|
+
redirect: true # redirects /about to /about/our-team
|
6
13
|
nodes:
|
7
|
-
- title: "
|
8
|
-
|
14
|
+
- title: "Our Team"
|
15
|
+
nodes:
|
16
|
+
- title: "Switzerland"
|
17
|
+
- title: "Italy"
|
18
|
+
- title: "Works"
|
19
|
+
- title: "Partners"
|
9
20
|
nodes:
|
10
|
-
- title: "
|
11
|
-
|
21
|
+
- title: "Daniel Puglisi"
|
22
|
+
url: "http://danielpuglisi.com"
|
23
|
+
- title: "Codegestalt"
|
24
|
+
url: "http://codegestalt.com"
|
25
|
+
- title: "Kreatify"
|
26
|
+
url: "http://kreatify.com"
|
12
27
|
|
13
28
|
- title: "Contact"
|
14
|
-
url: "contact-me"
|
15
|
-
- title: "test"
|