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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5731f8e378e32e46014e4d2f9d2748eae3803569
4
- data.tar.gz: 39292b7f8b3ed0420519f81d562c2ec0c1c878a6
3
+ metadata.gz: 7ff3eff988f3787487b60b8f11c630b6e24bfa1a
4
+ data.tar.gz: 3b643778c38bc5d7159d2e460621ed0b23fc397b
5
5
  SHA512:
6
- metadata.gz: 077a595d5009743cba67dc635509d57000bc1858ee9194c9ffda5dbad5b01bd92105d96c57afcc3c14b60bc8c8348024b82d74076d17b1f9ca0e1c213a2f327e
7
- data.tar.gz: 2dca4f322b805da90386ac74e71a7b224759c08a524d8e9f45cd60348c16465cf2d6a3a5bb04277337ea068c8422ee0259bd4e13ad28705b3a6fc246db0afa3c
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(parent_id=nil, deep=2)
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)
@@ -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(/^http:\/\/.+/))
39
+ if slug[0] == "/" || !!(slug.match(/^https?:\/\/.+/))
41
40
  page["slug"] = slug
42
41
  else
43
42
  page["slug"] = "#{url}/#{slug}"
@@ -1,3 +1,3 @@
1
1
  module Seiten
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/seiten.rb CHANGED
@@ -20,6 +20,5 @@ module Seiten
20
20
 
21
21
  ActiveSupport.on_load(:action_controller) do
22
22
  include Controllers::Helpers
23
- helper_method :current_page
24
23
  end
25
24
  end
@@ -0,0 +1,2 @@
1
+ <h1>Subnavigation</h1>
2
+ <%= seiten_navigation parent_id: Seiten::Page.find_by_slug("/about/our-team").id %>
@@ -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
@@ -8,8 +8,12 @@
8
8
  </head>
9
9
  <body>
10
10
 
11
+ <h1>Navigation</h1>
11
12
  <%= seiten_navigation %>
12
13
 
14
+ <h1>Breadcrumb</h1>
15
+ <%= seiten_breadcrumb %>
16
+
13
17
  <%= yield %>
14
18
 
15
19
  </body>
@@ -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: "Me"
8
- - title: "Our Product"
14
+ - title: "Our Team"
15
+ nodes:
16
+ - title: "Switzerland"
17
+ - title: "Italy"
18
+ - title: "Works"
19
+ - title: "Partners"
9
20
  nodes:
10
- - title: "Pricing"
11
- - title: "Features"
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"