seiten 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/seiten/page.rb +33 -1
- data/lib/seiten/routes_helper.rb +1 -1
- data/lib/seiten/version.rb +1 -1
- data/test/dummy/config/initializers/new_framework_defaults.rb +0 -4
- data/test/dummy/log/test.log +1750 -44482
- data/test/dummy/tmp/local_secret.txt +1 -0
- data/test/integration/navigation_test.rb +4 -6
- data/test/lib/seiten/page_translation_test.rb +64 -0
- metadata +11 -12
- data/test/dummy/log/development.log +0 -1716
|
@@ -0,0 +1 @@
|
|
|
1
|
+
d903bb3e8383977eec8d47e4120fae894fd5c79cc03af889f3473857a60ba3ad3794efa808678887116994828abe094052f4a8991de8b56641a07339a29e2f14
|
|
@@ -2,15 +2,13 @@ require 'test_helper'
|
|
|
2
2
|
|
|
3
3
|
class NavigationTest < ActionDispatch::IntegrationTest
|
|
4
4
|
def test_should_ignore_active_storage_routes
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
end
|
|
5
|
+
get '/rails/active_storage/test'
|
|
6
|
+
assert_response :not_found
|
|
8
7
|
end
|
|
9
8
|
|
|
10
9
|
def test_should_raise_seiten_routing_error
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
end
|
|
10
|
+
get '/non-existing-route'
|
|
11
|
+
assert_response :not_found
|
|
14
12
|
end
|
|
15
13
|
|
|
16
14
|
def test_returns_2_level_deep_navigation
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class Seiten::PageTranslationTest < ActiveSupport::TestCase
|
|
4
|
+
def build(locale, pages)
|
|
5
|
+
navigation = Seiten::Navigation.new(name: :manual, locale: locale)
|
|
6
|
+
Seiten.navigations << navigation
|
|
7
|
+
navigation.pages.build(pages: pages)
|
|
8
|
+
navigation
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def page(navigation, title)
|
|
12
|
+
navigation.pages.find_by(title: title)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
setup do
|
|
16
|
+
@de = build(:de, [
|
|
17
|
+
{ 'title' => 'Einleitung', 'nodes' => [{ 'title' => 'Module' }, { 'title' => 'Account einrichten' }] },
|
|
18
|
+
{ 'title' => 'Rechnungen', 'key' => 'invoices' },
|
|
19
|
+
{ 'title' => 'Kontakt' }
|
|
20
|
+
])
|
|
21
|
+
@en = build(:en, [
|
|
22
|
+
{ 'title' => 'Introduction', 'nodes' => [{ 'title' => 'Modules' }, { 'title' => 'Set up your account' }] },
|
|
23
|
+
{ 'title' => 'Pricing' },
|
|
24
|
+
{ 'title' => 'Contact' },
|
|
25
|
+
{ 'title' => 'Invoices', 'key' => 'invoices' }
|
|
26
|
+
])
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
teardown do
|
|
30
|
+
Seiten.navigations -= [@de, @en]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
test '#position is the index path in the navigation tree' do
|
|
34
|
+
assert_equal [0], page(@de, 'Einleitung').position
|
|
35
|
+
assert_equal [0, 1], page(@de, 'Account einrichten').position
|
|
36
|
+
assert_equal [2], page(@de, 'Kontakt').position
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
test '#translation finds the page at the same position in the other locale' do
|
|
40
|
+
assert_equal page(@en, 'Introduction'), page(@de, 'Einleitung').translation(:en)
|
|
41
|
+
assert_equal page(@en, 'Set up your account'), page(@de, 'Account einrichten').translation('en')
|
|
42
|
+
assert_equal page(@de, 'Module'), page(@en, 'Modules').translation(:de)
|
|
43
|
+
assert_equal page(@en, 'Contact'), page(@de, 'Kontakt').translation(:en)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
test '#translation matches pages with a key by their key, wherever they are' do
|
|
47
|
+
assert_equal page(@en, 'Invoices'), page(@de, 'Rechnungen').translation(:en)
|
|
48
|
+
assert_equal page(@de, 'Rechnungen'), page(@en, 'Invoices').translation(:de)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
test '#translation leaves out pages without a counterpart' do
|
|
52
|
+
assert_nil page(@en, 'Pricing').translation(:de), 'the German page at its position has a key'
|
|
53
|
+
assert_nil page(@de, 'Einleitung').translation(:fr), 'no French navigation'
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
test '#translation of the own locale is the page itself' do
|
|
57
|
+
assert_equal page(@de, 'Module'), page(@de, 'Module').translation(:de)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
test '#translations lists the page in every locale that has it' do
|
|
61
|
+
assert_equal({ 'de' => page(@de, 'Module'), 'en' => page(@en, 'Modules') }, page(@de, 'Module').translations)
|
|
62
|
+
assert_equal({ 'en' => page(@en, 'Pricing') }, page(@en, 'Pricing').translations)
|
|
63
|
+
end
|
|
64
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: seiten
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Puglisi
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: rails
|
|
@@ -155,13 +154,13 @@ files:
|
|
|
155
154
|
- test/dummy/config/navigations/help.en.yml
|
|
156
155
|
- test/dummy/config/routes.rb
|
|
157
156
|
- test/dummy/config/secrets.yml
|
|
158
|
-
- test/dummy/log/development.log
|
|
159
157
|
- test/dummy/log/test.log
|
|
160
158
|
- test/dummy/public/404.html
|
|
161
159
|
- test/dummy/public/422.html
|
|
162
160
|
- test/dummy/public/500.html
|
|
163
161
|
- test/dummy/public/favicon.ico
|
|
164
162
|
- test/dummy/script/rails
|
|
163
|
+
- test/dummy/tmp/local_secret.txt
|
|
165
164
|
- test/fixtures/breadcrumb.html
|
|
166
165
|
- test/fixtures/navigation.html
|
|
167
166
|
- test/integration/layout_test.rb
|
|
@@ -174,6 +173,7 @@ files:
|
|
|
174
173
|
- test/lib/seiten/page_collection_builder_test.rb
|
|
175
174
|
- test/lib/seiten/page_collection_test.rb
|
|
176
175
|
- test/lib/seiten/page_test.rb
|
|
176
|
+
- test/lib/seiten/page_translation_test.rb
|
|
177
177
|
- test/lib/seiten/slug_builder_test.rb
|
|
178
178
|
- test/lib/seiten_test.rb
|
|
179
179
|
- test/test_helper.rb
|
|
@@ -181,7 +181,6 @@ homepage: http://danielpuglisi.com
|
|
|
181
181
|
licenses:
|
|
182
182
|
- MIT
|
|
183
183
|
metadata: {}
|
|
184
|
-
post_install_message:
|
|
185
184
|
rdoc_options: []
|
|
186
185
|
require_paths:
|
|
187
186
|
- lib
|
|
@@ -196,8 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
196
195
|
- !ruby/object:Gem::Version
|
|
197
196
|
version: '0'
|
|
198
197
|
requirements: []
|
|
199
|
-
rubygems_version:
|
|
200
|
-
signing_key:
|
|
198
|
+
rubygems_version: 4.0.10
|
|
201
199
|
specification_version: 4
|
|
202
200
|
summary: Static Pages for Rails.
|
|
203
201
|
test_files:
|
|
@@ -212,18 +210,18 @@ test_files:
|
|
|
212
210
|
- test/dummy/app/controllers/posts_controller.rb
|
|
213
211
|
- test/dummy/app/helpers/application_helper.rb
|
|
214
212
|
- test/dummy/app/pages/application/de/produkte.html.erb
|
|
213
|
+
- test/dummy/app/pages/application/en/about.html.erb
|
|
214
|
+
- test/dummy/app/pages/application/en/about/our-team.html.erb
|
|
215
215
|
- test/dummy/app/pages/application/en/about/our-team/italy.html.erb
|
|
216
216
|
- test/dummy/app/pages/application/en/about/our-team/switzerland.html.erb
|
|
217
|
-
- test/dummy/app/pages/application/en/about/our-team.html.erb
|
|
218
217
|
- test/dummy/app/pages/application/en/about/partners.html.erb
|
|
219
218
|
- test/dummy/app/pages/application/en/about/works.html.erb
|
|
220
|
-
- test/dummy/app/pages/application/en/about.html.erb
|
|
221
219
|
- test/dummy/app/pages/application/en/contact.html.erb
|
|
222
220
|
- test/dummy/app/pages/application/en/home.html.erb
|
|
221
|
+
- test/dummy/app/pages/application/en/products.html.erb
|
|
223
222
|
- test/dummy/app/pages/application/en/products/hire-us.html.erb
|
|
224
223
|
- test/dummy/app/pages/application/en/products/logo-design.html.erb
|
|
225
224
|
- test/dummy/app/pages/application/en/products/web-development.html.erb
|
|
226
|
-
- test/dummy/app/pages/application/en/products.html.erb
|
|
227
225
|
- test/dummy/app/pages/application/localization.html.erb
|
|
228
226
|
- test/dummy/app/pages/help/en/home.html.erb
|
|
229
227
|
- test/dummy/app/pages/help/en/logging-in.html.erb
|
|
@@ -233,6 +231,7 @@ test_files:
|
|
|
233
231
|
- test/dummy/app/views/layouts/team.html.erb
|
|
234
232
|
- test/dummy/app/views/pages/secret.html.erb
|
|
235
233
|
- test/dummy/app/views/posts/index.html.erb
|
|
234
|
+
- test/dummy/config.ru
|
|
236
235
|
- test/dummy/config/application.rb
|
|
237
236
|
- test/dummy/config/boot.rb
|
|
238
237
|
- test/dummy/config/cable.yml
|
|
@@ -257,14 +256,13 @@ test_files:
|
|
|
257
256
|
- test/dummy/config/navigations/help.en.yml
|
|
258
257
|
- test/dummy/config/routes.rb
|
|
259
258
|
- test/dummy/config/secrets.yml
|
|
260
|
-
- test/dummy/config.ru
|
|
261
|
-
- test/dummy/log/development.log
|
|
262
259
|
- test/dummy/log/test.log
|
|
263
260
|
- test/dummy/public/404.html
|
|
264
261
|
- test/dummy/public/422.html
|
|
265
262
|
- test/dummy/public/500.html
|
|
266
263
|
- test/dummy/public/favicon.ico
|
|
267
264
|
- test/dummy/script/rails
|
|
265
|
+
- test/dummy/tmp/local_secret.txt
|
|
268
266
|
- test/fixtures/breadcrumb.html
|
|
269
267
|
- test/fixtures/navigation.html
|
|
270
268
|
- test/integration/layout_test.rb
|
|
@@ -277,6 +275,7 @@ test_files:
|
|
|
277
275
|
- test/lib/seiten/page_collection_builder_test.rb
|
|
278
276
|
- test/lib/seiten/page_collection_test.rb
|
|
279
277
|
- test/lib/seiten/page_test.rb
|
|
278
|
+
- test/lib/seiten/page_translation_test.rb
|
|
280
279
|
- test/lib/seiten/slug_builder_test.rb
|
|
281
280
|
- test/lib/seiten_test.rb
|
|
282
281
|
- test/test_helper.rb
|