seiten 0.0.7 → 0.0.8

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: aac1c7e2cff18662cca1155e49a8f43b13df73f7
4
- data.tar.gz: c6e449e0518a93591b26832d3c3dfa94aacef1c9
3
+ metadata.gz: 048ecf4f24e37168dfc694a467371919f46ce631
4
+ data.tar.gz: 63c13ce42bc05f60039f5e0f437d3f9810f72e85
5
5
  SHA512:
6
- metadata.gz: 117b93f29193643c09bdaff2e2b663c9e636907c6e18ec6f300302fbe51bfca58ac69d0f14ca05a73b0bfdf759368e14973da4a24426367887e1b0b887bd2903
7
- data.tar.gz: dee87d889d81b4d9698dd14c1e2453f1a1a4c5dcda62798d9f8b7c3841d8e4876ab5ee8c075b222058f4ace35ef0d31b8a25148c5da4fb1154dcd0bc33c1b20f
6
+ metadata.gz: a123a3ecdbdb8d2e529169b352bf2a242abc8f52d0b89902a7a09af951423ef87aec1a8ac117c5eb1c93f4cb4a4b920eb764a9d81e71f5f699aaa0c0f80f3b30
7
+ data.tar.gz: 2489e06d4d622e9ae121f50ef73f803600c6be8387afe4764931613395ca11e3aa55cfad861e0f08fc89d1ffeb780f1a31e7c1c8e51a801bfd5fbde8b69d2591
@@ -5,7 +5,6 @@ module Seiten
5
5
  if current_page.nil?
6
6
  raise ActionController::RoutingError.new("Page /#{params[:page]} not found")
7
7
  else
8
- @title = current_page.title
9
8
 
10
9
  if params[:page]
11
10
  filename = params[:page]
data/lib/seiten/page.rb CHANGED
@@ -2,7 +2,7 @@ module Seiten
2
2
 
3
3
  class Page
4
4
 
5
- attr_accessor :id, :parent_id, :title, :children, :slug, :redirect, :layout
5
+ attr_accessor :id, :parent_id, :title, :children, :slug, :redirect, :layout, :metadata
6
6
 
7
7
  # initialize Page object with attributes
8
8
  def initialize(options={})
@@ -13,6 +13,7 @@ module Seiten
13
13
  @external = options[:external]
14
14
  @redirect = options[:redirect]
15
15
  @layout = options[:layout]
16
+ @metadata = options[:metadata].each_with_object({}){|(k,v), h| h[k.to_sym] = v} if options[:metadata]
16
17
  end
17
18
 
18
19
  class << self
@@ -7,8 +7,7 @@ module Seiten
7
7
  def initialize(options={})
8
8
  @storage_type = options[:storage_type] || Seiten.config[:default_storage_type]
9
9
  @storage_directory = options[:storage_directory] || File.join(Rails.root, Seiten.config[:default_storage_directory])
10
- @storage_language = options[:storage_language] || I18n.locale
11
- @storage_language = @storage_language.to_sym
10
+ @storage_language = (options[:storage_language] || I18n.locale).to_sym
12
11
  @storage_file = options[:storage_file] || load_storage_file
13
12
  @pages = load_pages
14
13
  end
@@ -51,9 +50,15 @@ module Seiten
51
50
  Seiten::PageStore.storages << Seiten::PageStore.new(storage_language: locale, storage_directory: File.join(Rails.root, "app", "pages", locale))
52
51
  end
53
52
  else
54
- Seiten::PageStore.storages << Seiten::PageStore.new(storage_language: I18n.default_locale)
53
+ Seiten::PageStore.storages << Seiten::PageStore.new(storage_language: default_locale)
55
54
  end
56
- set_current_page_store(storage_language: I18n.default_locale)
55
+ set_current_page_store(storage_language: default_locale)
56
+ end
57
+
58
+ # NOTE: Haven't found out what's the problem, but Rails has some weird I18n behaviour on initialization.
59
+ # This method returns I18n.default_locale if config.i18n.default_locale is not set.
60
+ def default_locale
61
+ Rails.application.config.i18n.default_locale || I18n.default_locale
57
62
  end
58
63
 
59
64
  end
@@ -1,3 +1,3 @@
1
1
  module Seiten
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
data/lib/seiten.rb CHANGED
@@ -9,7 +9,6 @@ module Seiten
9
9
  default_storage_type: :yaml,
10
10
  default_storage_file: File.join('config', 'navigation'),
11
11
  default_storage_directory: File.join('app', 'pages'),
12
- current_page_store: nil,
13
12
  root_page_filename: "home"
14
13
  }
15
14
 
@@ -8,7 +8,15 @@
8
8
  inherit: true
9
9
  nodes:
10
10
  - title: "Logo Design"
11
+ metadata:
12
+ header_image: "logo.jpg"
13
+ description: "Our logo design is awesome."
14
+ variables:
15
+ fuck: "you"
11
16
  - title: "Web Development"
17
+ metadata:
18
+ header_image: "web-development.jpg"
19
+ description: "First class web development."
12
20
  - title: "Hire us"
13
21
  redirect: "/contact" # links to Contact page
14
22
 
@@ -4556,3 +4556,4 @@ Processing by Seiten::PagesController#show as HTML
4556
4556
  Completed 200 OK in 5ms (Views: 5.2ms | ActiveRecord: 0.0ms)
4557
4557
  Connecting to database specified by database.yml
4558
4558
  Connecting to database specified by database.yml
4559
+ Connecting to database specified by database.yml