seiten 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/seiten/pages_controller.rb +19 -2
- data/app/helpers/seiten_helper.rb +11 -8
- data/config/initializers/seiten.rb +1 -0
- data/lib/seiten/controllers/helpers.rb +1 -1
- data/lib/seiten/page.rb +29 -23
- data/lib/seiten/page_store.rb +71 -6
- data/lib/seiten/routes_helper.rb +16 -0
- data/lib/seiten/version.rb +1 -1
- data/lib/seiten.rb +5 -3
- data/test/dummy/app/pages/de/produkte.html.erb +1 -0
- data/test/dummy/app/pages/en/about/partners.html.erb +1 -0
- data/test/dummy/app/pages/en/products.html.erb +1 -0
- data/test/dummy/app/pages/localization.html.erb +1 -0
- data/test/dummy/config/navigation/de.yml +36 -0
- data/test/dummy/config/navigation/en.yml +37 -0
- data/test/dummy/config/navigation.yml +3 -1
- data/test/dummy/config/routes.rb +2 -0
- data/test/dummy/log/development.log +7019 -2550
- data/test/dummy/log/test.log +11327 -3072
- data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/pids/server.pid +1 -1
- data/test/integration/i18n_test.rb +37 -0
- data/test/integration/navigation_test.rb +7 -1
- data/test/page_test.rb +9 -5
- data/test/seiten_test.rb +4 -2
- data/test/test_helper.rb +0 -5
- metadata +48 -24
- data/app/views/seiten/pages/show.html.erb +0 -1
- data/config/routes.rb +0 -11
- data/test/dummy/app/pages/about/partners.html.erb +0 -1
- data/test/dummy/app/pages/products.html.erb +0 -0
- /data/test/dummy/app/pages/{about → en/about}/our-team/italy.html.erb +0 -0
- /data/test/dummy/app/pages/{about → en/about}/our-team/switzerland.html.erb +0 -0
- /data/test/dummy/app/pages/{about → en/about}/our-team.html.erb +0 -0
- /data/test/dummy/app/pages/{about → en/about}/works.html.erb +0 -0
- /data/test/dummy/app/pages/{contact.html.erb → en/contact.html.erb} +0 -0
- /data/test/dummy/app/pages/{home.html.erb → en/home.html.erb} +0 -0
- /data/test/dummy/app/pages/{products → en/products}/logo-design.html.erb +0 -0
- /data/test/dummy/app/pages/{products → en/products}/web-development.html.erb +0 -0
Binary file
|
Binary file
|
Binary file
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
80065
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class I18nTest < ActionDispatch::IntegrationTest
|
4
|
+
|
5
|
+
def test_returns_page_in_root_if_not_found_in_locale_directory
|
6
|
+
visit "/localization"
|
7
|
+
assert_equal 200, status_code
|
8
|
+
assert has_content?("I18n is in root")
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_returns_products_page_in_en_directory
|
12
|
+
I18n.locale = :en
|
13
|
+
visit "/products"
|
14
|
+
assert has_content?("This is the products page")
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_returns_products_page_in_de_directory
|
18
|
+
I18n.locale = :de
|
19
|
+
visit "/produkte"
|
20
|
+
assert has_content?("Das ist die Produkte Seite")
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_loads_de_navigation
|
24
|
+
I18n.locale = :de
|
25
|
+
assert_equal File.join(Rails.root, "config", "navigation", "de.yml"), Seiten::PageStore.new.storage_file
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_loads_en_navigation
|
29
|
+
I18n.locale = :en
|
30
|
+
assert_equal File.join(Rails.root, "config", "navigation", "en.yml"), Seiten::PageStore.new.storage_file
|
31
|
+
end
|
32
|
+
|
33
|
+
# def test_loads_navigation_without_locale_if_not_found
|
34
|
+
# I18n.locale = :fr
|
35
|
+
# assert_equal File.join(Rails.root, "config", "navigation.yml"), Seiten::PageStore.new.storage_file
|
36
|
+
# end
|
37
|
+
end
|
@@ -3,7 +3,6 @@ require 'test_helper'
|
|
3
3
|
class NavigationTest < ActionDispatch::IntegrationTest
|
4
4
|
|
5
5
|
def test_returns_2_level_deep_navigation
|
6
|
-
p Seiten.config[:storage_directory]
|
7
6
|
visit "/"
|
8
7
|
assert has_content?("Home")
|
9
8
|
assert has_content?("Products")
|
@@ -24,6 +23,13 @@ class NavigationTest < ActionDispatch::IntegrationTest
|
|
24
23
|
assert !has_content?("Kreatify")
|
25
24
|
end
|
26
25
|
|
26
|
+
def test_returns_home_url
|
27
|
+
visit "/contact"
|
28
|
+
assert_equal "/contact", current_path
|
29
|
+
click_link "Home"
|
30
|
+
assert_equal "/", current_path
|
31
|
+
end
|
32
|
+
|
27
33
|
def test_returns_sub_navigation
|
28
34
|
visit "/about/partners"
|
29
35
|
assert has_content?("Daniel Puglisi")
|
data/test/page_test.rb
CHANGED
@@ -4,15 +4,19 @@ class PageTest < Test::Unit::TestCase
|
|
4
4
|
|
5
5
|
def test_returns_correct_number_of_page_objects
|
6
6
|
pages = Seiten::Page.all
|
7
|
-
assert_equal
|
7
|
+
assert_equal 16, pages.count
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_returns_page_title
|
11
11
|
assert_equal "Home", Seiten::Page.find(1).title
|
12
12
|
end
|
13
13
|
|
14
|
+
def test_returns_nil_for_root_page_slug
|
15
|
+
assert_equal nil, Seiten::Page.find(1).slug
|
16
|
+
end
|
17
|
+
|
14
18
|
def test_returns_page_slug
|
15
|
-
assert_equal "/", Seiten::Page.find(
|
19
|
+
assert_equal "about/our-team", Seiten::Page.find(7).slug
|
16
20
|
end
|
17
21
|
|
18
22
|
def test_returns_page_layout
|
@@ -35,8 +39,8 @@ class PageTest < Test::Unit::TestCase
|
|
35
39
|
end
|
36
40
|
|
37
41
|
def test_returns_true_if_page_child_is_deeply_nested
|
38
|
-
child = Seiten::Page.find_by_slug("
|
39
|
-
assert_equal true, Seiten::Page.find_by_slug("
|
42
|
+
child = Seiten::Page.find_by_slug("about/our-team")
|
43
|
+
assert_equal true, Seiten::Page.find_by_slug("about").parent_of?(child)
|
40
44
|
end
|
41
45
|
|
42
46
|
def test_returns_false_if_page_is_not_child_of_parent
|
@@ -60,7 +64,7 @@ class PageTest < Test::Unit::TestCase
|
|
60
64
|
end
|
61
65
|
|
62
66
|
def test_finds_page_by_slug
|
63
|
-
page = Seiten::Page.find_by_slug("
|
67
|
+
page = Seiten::Page.find_by_slug("products/logo-design")
|
64
68
|
assert_equal "Logo Design", page.title
|
65
69
|
end
|
66
70
|
|
data/test/seiten_test.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class SeitenTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
|
4
|
+
|
5
|
+
def test_returns_page_storage_path
|
6
|
+
assert_equal File.join(Rails.root, "app/pages/home.html.erb"), Seiten::PageStore.current.file_path(filename: "home.html.erb")
|
7
|
+
assert_equal File.join(Rails.root, "app/pages/en/contact.html.erb"), Seiten::PageStore.current.file_path(filename: "contact.html.erb", locale: "en")
|
6
8
|
end
|
7
9
|
end
|
data/test/test_helper.rb
CHANGED
@@ -10,11 +10,6 @@ Rails.backtrace_cleaner.remove_silencers!
|
|
10
10
|
# Load support files
|
11
11
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
12
12
|
|
13
|
-
# Load fixtures from the engine
|
14
|
-
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
15
|
-
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
16
|
-
end
|
17
|
-
|
18
13
|
class Test::Unit::TestCase
|
19
14
|
# Seiten.config[:storage_type] = :yaml
|
20
15
|
# Seiten.config[:storage_file] = File.join('..', 'fixtures', 'navigation.yml')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seiten
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Puglisi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.2.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.2'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.2'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: sqlite3
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -62,12 +76,12 @@ extra_rdoc_files: []
|
|
62
76
|
files:
|
63
77
|
- app/controllers/seiten/pages_controller.rb
|
64
78
|
- app/helpers/seiten_helper.rb
|
65
|
-
-
|
66
|
-
- config/routes.rb
|
79
|
+
- config/initializers/seiten.rb
|
67
80
|
- lib/seiten/controllers/helpers.rb
|
68
81
|
- lib/seiten/engine.rb
|
69
82
|
- lib/seiten/page.rb
|
70
83
|
- lib/seiten/page_store.rb
|
84
|
+
- lib/seiten/routes_helper.rb
|
71
85
|
- lib/seiten/version.rb
|
72
86
|
- lib/seiten.rb
|
73
87
|
- lib/tasks/sticky_pages_tasks.rake
|
@@ -78,16 +92,18 @@ files:
|
|
78
92
|
- test/dummy/app/controllers/application_controller.rb
|
79
93
|
- test/dummy/app/controllers/pages_controller.rb
|
80
94
|
- test/dummy/app/helpers/application_helper.rb
|
81
|
-
- test/dummy/app/pages/
|
82
|
-
- test/dummy/app/pages/about/our-team/
|
83
|
-
- test/dummy/app/pages/about/our-team.html.erb
|
84
|
-
- test/dummy/app/pages/about/
|
85
|
-
- test/dummy/app/pages/about/
|
86
|
-
- test/dummy/app/pages/
|
87
|
-
- test/dummy/app/pages/
|
88
|
-
- test/dummy/app/pages/
|
89
|
-
- test/dummy/app/pages/products/
|
90
|
-
- test/dummy/app/pages/products.html.erb
|
95
|
+
- test/dummy/app/pages/de/produkte.html.erb
|
96
|
+
- test/dummy/app/pages/en/about/our-team/italy.html.erb
|
97
|
+
- test/dummy/app/pages/en/about/our-team/switzerland.html.erb
|
98
|
+
- test/dummy/app/pages/en/about/our-team.html.erb
|
99
|
+
- test/dummy/app/pages/en/about/partners.html.erb
|
100
|
+
- test/dummy/app/pages/en/about/works.html.erb
|
101
|
+
- test/dummy/app/pages/en/contact.html.erb
|
102
|
+
- test/dummy/app/pages/en/home.html.erb
|
103
|
+
- test/dummy/app/pages/en/products/logo-design.html.erb
|
104
|
+
- test/dummy/app/pages/en/products/web-development.html.erb
|
105
|
+
- test/dummy/app/pages/en/products.html.erb
|
106
|
+
- test/dummy/app/pages/localization.html.erb
|
91
107
|
- test/dummy/app/views/layouts/application.html.erb
|
92
108
|
- test/dummy/app/views/layouts/home.html.erb
|
93
109
|
- test/dummy/app/views/layouts/products.html.erb
|
@@ -107,6 +123,8 @@ files:
|
|
107
123
|
- test/dummy/config/initializers/session_store.rb
|
108
124
|
- test/dummy/config/initializers/wrap_parameters.rb
|
109
125
|
- test/dummy/config/locales/en.yml
|
126
|
+
- test/dummy/config/navigation/de.yml
|
127
|
+
- test/dummy/config/navigation/en.yml
|
110
128
|
- test/dummy/config/navigation.yml
|
111
129
|
- test/dummy/config/routes.rb
|
112
130
|
- test/dummy/config.ru
|
@@ -125,6 +143,7 @@ files:
|
|
125
143
|
- test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
|
126
144
|
- test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
|
127
145
|
- test/dummy/tmp/pids/server.pid
|
146
|
+
- test/integration/i18n_test.rb
|
128
147
|
- test/integration/layout_test.rb
|
129
148
|
- test/integration/navigation_test.rb
|
130
149
|
- test/integration/redirect_test.rb
|
@@ -161,16 +180,18 @@ test_files:
|
|
161
180
|
- test/dummy/app/controllers/application_controller.rb
|
162
181
|
- test/dummy/app/controllers/pages_controller.rb
|
163
182
|
- test/dummy/app/helpers/application_helper.rb
|
164
|
-
- test/dummy/app/pages/
|
165
|
-
- test/dummy/app/pages/about/our-team/
|
166
|
-
- test/dummy/app/pages/about/our-team.html.erb
|
167
|
-
- test/dummy/app/pages/about/
|
168
|
-
- test/dummy/app/pages/about/
|
169
|
-
- test/dummy/app/pages/
|
170
|
-
- test/dummy/app/pages/
|
171
|
-
- test/dummy/app/pages/
|
172
|
-
- test/dummy/app/pages/products/
|
173
|
-
- test/dummy/app/pages/products.html.erb
|
183
|
+
- test/dummy/app/pages/de/produkte.html.erb
|
184
|
+
- test/dummy/app/pages/en/about/our-team/italy.html.erb
|
185
|
+
- test/dummy/app/pages/en/about/our-team/switzerland.html.erb
|
186
|
+
- test/dummy/app/pages/en/about/our-team.html.erb
|
187
|
+
- test/dummy/app/pages/en/about/partners.html.erb
|
188
|
+
- test/dummy/app/pages/en/about/works.html.erb
|
189
|
+
- test/dummy/app/pages/en/contact.html.erb
|
190
|
+
- test/dummy/app/pages/en/home.html.erb
|
191
|
+
- test/dummy/app/pages/en/products/logo-design.html.erb
|
192
|
+
- test/dummy/app/pages/en/products/web-development.html.erb
|
193
|
+
- test/dummy/app/pages/en/products.html.erb
|
194
|
+
- test/dummy/app/pages/localization.html.erb
|
174
195
|
- test/dummy/app/views/layouts/application.html.erb
|
175
196
|
- test/dummy/app/views/layouts/home.html.erb
|
176
197
|
- test/dummy/app/views/layouts/products.html.erb
|
@@ -190,6 +211,8 @@ test_files:
|
|
190
211
|
- test/dummy/config/initializers/session_store.rb
|
191
212
|
- test/dummy/config/initializers/wrap_parameters.rb
|
192
213
|
- test/dummy/config/locales/en.yml
|
214
|
+
- test/dummy/config/navigation/de.yml
|
215
|
+
- test/dummy/config/navigation/en.yml
|
193
216
|
- test/dummy/config/navigation.yml
|
194
217
|
- test/dummy/config/routes.rb
|
195
218
|
- test/dummy/config.ru
|
@@ -208,6 +231,7 @@ test_files:
|
|
208
231
|
- test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
|
209
232
|
- test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
|
210
233
|
- test/dummy/tmp/pids/server.pid
|
234
|
+
- test/integration/i18n_test.rb
|
211
235
|
- test/integration/layout_test.rb
|
212
236
|
- test/integration/navigation_test.rb
|
213
237
|
- test/integration/redirect_test.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= render_html %>
|
data/config/routes.rb
DELETED
@@ -1 +0,0 @@
|
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|