seiten 0.0.8 → 1.0.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 +5 -5
- data/Rakefile +1 -0
- data/app/controllers/seiten/pages_controller.rb +2 -18
- data/config/initializers/seiten.rb +1 -1
- data/lib/seiten/errors/base_error.rb +4 -0
- data/lib/seiten/errors/page_error.rb +4 -0
- data/lib/seiten/errors/routing_error.rb +4 -0
- data/lib/seiten/helpers/backend.rb +23 -0
- data/lib/seiten/helpers/current.rb +33 -0
- data/lib/seiten/helpers/frontend.rb +19 -0
- data/lib/seiten/html/breadcrumb.rb +41 -0
- data/lib/seiten/html/helpers.rb +32 -0
- data/lib/seiten/html/navigation.rb +39 -0
- data/lib/seiten/navigation.rb +43 -0
- data/lib/seiten/page.rb +71 -50
- data/lib/seiten/page_collection.rb +54 -0
- data/lib/seiten/page_collection_builder.rb +63 -0
- data/lib/seiten/railtie.rb +7 -0
- data/lib/seiten/routes_helper.rb +16 -11
- data/lib/seiten/slug_builder.rb +32 -0
- data/lib/seiten/version.rb +1 -1
- data/lib/seiten.rb +63 -12
- data/test/controllers/helper_methods_test.rb +25 -0
- data/test/controllers/pages_controller_test.rb +9 -0
- data/test/controllers/posts_controller_test.rb +12 -0
- data/test/controllers/seiten/pages_controller_test.rb +39 -0
- data/test/dummy/app/controllers/application_controller.rb +10 -0
- data/test/dummy/app/controllers/pages_controller.rb +1 -1
- data/test/dummy/app/controllers/posts_controller.rb +10 -0
- data/test/dummy/app/helpers/application_helper.rb +1 -0
- data/test/dummy/app/pages/{de → application/de}/produkte.html.erb +0 -0
- data/test/dummy/app/pages/{en/about/our-team/switzerland.html.erb → application/en/about/our-team/italy.html.erb} +0 -0
- data/test/dummy/app/pages/{en/about/works.html.erb → application/en/about/our-team/switzerland.html.erb} +0 -0
- data/test/dummy/app/pages/application/en/about/our-team.html.erb +2 -0
- data/test/dummy/app/pages/application/en/about/partners.html.erb +1 -0
- data/test/dummy/app/pages/{en/contact.html.erb → application/en/about/works.html.erb} +0 -0
- data/test/dummy/app/pages/{en/about/our-team/italy.html.erb → application/en/about.html.erb} +0 -0
- data/test/dummy/app/pages/{en/products/logo-design.html.erb → application/en/contact.html.erb} +0 -0
- data/test/dummy/app/pages/{en → application/en}/home.html.erb +0 -0
- data/test/dummy/app/pages/{en/products/web-development.html.erb → application/en/products/hire-us.html.erb} +0 -0
- data/test/dummy/{db/test.sqlite3 → app/pages/application/en/products/logo-design.html.erb} +0 -0
- data/test/dummy/app/pages/application/en/products/web-development.html.erb +0 -0
- data/test/dummy/app/pages/{en → application/en}/products.html.erb +0 -0
- data/test/dummy/app/pages/{localization.html.erb → application/localization.html.erb} +0 -0
- data/test/dummy/app/pages/help/en/home.html.erb +0 -0
- data/test/dummy/app/pages/help/en/logging-in.html.erb +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +1 -1
- data/test/dummy/app/views/layouts/home.html.erb +1 -1
- data/test/dummy/app/views/pages/secret.html.erb +1 -1
- data/test/dummy/app/views/posts/index.html.erb +1 -0
- data/test/dummy/config/application.rb +4 -41
- data/test/dummy/config/boot.rb +2 -9
- data/test/dummy/config/cable.yml +9 -0
- data/test/dummy/config/environments/development.rb +26 -21
- data/test/dummy/config/environments/production.rb +3 -0
- data/test/dummy/config/environments/test.rb +15 -19
- data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +6 -5
- data/test/dummy/config/initializers/mime_types.rb +0 -1
- data/test/dummy/config/initializers/new_framework_defaults.rb +20 -0
- data/test/dummy/config/initializers/session_store.rb +1 -6
- data/test/dummy/config/initializers/wrap_parameters.rb +5 -5
- data/test/dummy/config/{navigation/de.yml → navigations/application.de.yml} +5 -5
- data/test/dummy/config/{navigation/en.yml → navigations/application.en.yml} +15 -7
- data/test/dummy/config/navigations/help.en.yml +17 -0
- data/test/dummy/config/routes.rb +6 -3
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/log/development.log +1716 -4559
- data/test/dummy/log/test.log +43833 -16254
- data/test/fixtures/breadcrumb.html +1 -0
- data/test/fixtures/navigation.html +1 -0
- data/test/integration/layout_test.rb +10 -11
- data/test/integration/navigation_test.rb +50 -50
- data/test/lib/seiten/helpers/frontend_test.rb +37 -0
- data/test/lib/seiten/html/breadcrumb_test.rb +29 -0
- data/test/lib/seiten/html/helpers_test.rb +55 -0
- data/test/lib/seiten/html/navigation_test.rb +29 -0
- data/test/lib/seiten/navigation_test.rb +45 -0
- data/test/lib/seiten/page_collection_builder_test.rb +141 -0
- data/test/lib/seiten/page_collection_test.rb +59 -0
- data/test/lib/seiten/page_test.rb +188 -0
- data/test/lib/seiten/slug_builder_test.rb +47 -0
- data/test/lib/seiten_test.rb +16 -0
- data/test/test_helper.rb +2 -8
- metadata +134 -78
- data/app/helpers/seiten_helper.rb +0 -46
- data/lib/seiten/controllers/helpers.rb +0 -16
- data/lib/seiten/page_store.rb +0 -165
- data/test/dummy/app/assets/javascripts/application.js +0 -15
- data/test/dummy/app/assets/stylesheets/application.css +0 -13
- data/test/dummy/app/pages/en/about/our-team.html.erb +0 -2
- data/test/dummy/app/pages/en/about/partners.html.erb +0 -1
- data/test/dummy/config/navigation.yml +0 -37
- data/test/dummy/db/development.sqlite3 +0 -0
- 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/integration/i18n_test.rb +0 -31
- data/test/integration/redirect_test.rb +0 -15
- data/test/page_store_test.rb +0 -28
- data/test/page_test.rb +0 -104
- data/test/seiten_test.rb +0 -11
@@ -0,0 +1,188 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Seiten::PageTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
def navigation
|
6
|
+
@navigation ||= Seiten::Navigation.new(name: :test, locale: :en)
|
7
|
+
end
|
8
|
+
|
9
|
+
def pages
|
10
|
+
@pages ||= navigation.pages
|
11
|
+
end
|
12
|
+
|
13
|
+
setup do
|
14
|
+
Seiten.navigations << navigation
|
15
|
+
end
|
16
|
+
|
17
|
+
teardown do
|
18
|
+
Seiten.navigations = Seiten.navigations - [navigation]
|
19
|
+
navigation.pages = []
|
20
|
+
end
|
21
|
+
|
22
|
+
test '#navigation' do
|
23
|
+
page = pages.new
|
24
|
+
|
25
|
+
assert_equal navigation, page.navigation
|
26
|
+
end
|
27
|
+
|
28
|
+
test '#external?' do
|
29
|
+
page = pages.new
|
30
|
+
|
31
|
+
page.slug = 'about-us'
|
32
|
+
assert_not page.external?
|
33
|
+
|
34
|
+
page.slug = 'http://codegestalt.com'
|
35
|
+
assert page.external?
|
36
|
+
end
|
37
|
+
|
38
|
+
test '#parent' do
|
39
|
+
parent_page = pages.new(id: 5)
|
40
|
+
child_page = pages.new(id: 10, parent_id: 5)
|
41
|
+
|
42
|
+
assert_equal parent_page, child_page.parent
|
43
|
+
assert_nil parent_page.parent
|
44
|
+
end
|
45
|
+
|
46
|
+
test '#parent?' do
|
47
|
+
parent_page = pages.new(id: 5)
|
48
|
+
child_page = pages.new(id: 10, parent_id: 5)
|
49
|
+
|
50
|
+
assert child_page.parent?
|
51
|
+
child_page.parent_id = nil
|
52
|
+
assert_not parent_page.parent?
|
53
|
+
child_page.parent_id = 4
|
54
|
+
assert_not child_page.parent?
|
55
|
+
end
|
56
|
+
|
57
|
+
test '#ancestors' do
|
58
|
+
parent_page = pages.new(id: 5)
|
59
|
+
child_page_1 = pages.new(id: 10, parent_id: 5)
|
60
|
+
child_page_2 = pages.new(id: 15, parent_id: 10)
|
61
|
+
|
62
|
+
assert_equal [], parent_page.ancestors
|
63
|
+
assert_equal [parent_page], child_page_1.ancestors
|
64
|
+
assert_equal [child_page_1, parent_page], child_page_2.ancestors
|
65
|
+
end
|
66
|
+
|
67
|
+
test '#self_and_ancestors' do
|
68
|
+
parent_page = pages.new(id: 5)
|
69
|
+
child_page_1 = pages.new(id: 10, parent_id: 5)
|
70
|
+
child_page_2 = pages.new(id: 15, parent_id: 10)
|
71
|
+
|
72
|
+
assert_equal [parent_page], parent_page.self_and_ancestors
|
73
|
+
assert_equal [child_page_1, parent_page], child_page_1.self_and_ancestors
|
74
|
+
assert_equal [child_page_2, child_page_1, parent_page], child_page_2.self_and_ancestors
|
75
|
+
end
|
76
|
+
|
77
|
+
test '#root' do
|
78
|
+
parent_page = pages.new(id: 5)
|
79
|
+
child_page_1 = pages.new(id: 10, parent_id: 5)
|
80
|
+
child_page_2 = pages.new(id: 15, parent_id: 10)
|
81
|
+
|
82
|
+
assert_equal parent_page, child_page_2.root
|
83
|
+
assert_equal parent_page, child_page_1.root
|
84
|
+
assert_equal parent_page, parent_page.root
|
85
|
+
end
|
86
|
+
|
87
|
+
test '#children' do
|
88
|
+
parent_page = pages.new(id: 5)
|
89
|
+
child_page_1 = pages.new(id: 10, parent_id: 5)
|
90
|
+
child_page_2 = pages.new(id: 15, parent_id: 5)
|
91
|
+
child_page_3 = pages.new(id: 20, parent_id: 5)
|
92
|
+
|
93
|
+
assert_equal [child_page_1, child_page_2, child_page_3], parent_page.children
|
94
|
+
end
|
95
|
+
|
96
|
+
test '#children?' do
|
97
|
+
parent_page = pages.new(id: 5)
|
98
|
+
child_page_1 = pages.new(id: 10, parent_id: 5)
|
99
|
+
|
100
|
+
assert_equal true, parent_page.children?
|
101
|
+
assert_equal false, child_page_1.children?
|
102
|
+
end
|
103
|
+
|
104
|
+
test '#parent_of?' do
|
105
|
+
parent_page = pages.new(id: 5)
|
106
|
+
child_page_1 = pages.new(id: 10, parent_id: 5)
|
107
|
+
child_page_2 = pages.new(id: 15, parent_id: 10)
|
108
|
+
sibling_page = pages.new(id: 25)
|
109
|
+
|
110
|
+
assert parent_page.parent_of?(child_page_1)
|
111
|
+
assert parent_page.parent_of?(child_page_2)
|
112
|
+
assert child_page_1.parent_of?(child_page_2)
|
113
|
+
|
114
|
+
assert_not child_page_1.parent_of?(parent_page)
|
115
|
+
assert_not child_page_2.parent_of?(parent_page)
|
116
|
+
|
117
|
+
assert_not sibling_page.parent_of?(parent_page)
|
118
|
+
assert_not parent_page.parent_of?(sibling_page)
|
119
|
+
end
|
120
|
+
|
121
|
+
test '#active?' do
|
122
|
+
parent_page = pages.new(id: 5)
|
123
|
+
child_page = pages.new(id: 10, parent_id: 5)
|
124
|
+
sibling_page = pages.new(id: 15)
|
125
|
+
|
126
|
+
assert parent_page.active?(parent_page)
|
127
|
+
assert parent_page.active?(child_page)
|
128
|
+
assert_not parent_page.active?(sibling_page)
|
129
|
+
|
130
|
+
assert child_page.active?(child_page)
|
131
|
+
assert_not child_page.active?(parent_page)
|
132
|
+
assert_not child_page.active?(sibling_page)
|
133
|
+
|
134
|
+
assert_nil parent_page.active?(nil)
|
135
|
+
end
|
136
|
+
|
137
|
+
test '#template_path' do
|
138
|
+
page = pages.new(slug: 'about-us/projects')
|
139
|
+
|
140
|
+
assert_equal 'test/en/about-us/projects', page.template_path
|
141
|
+
|
142
|
+
page = pages.new(slug: '')
|
143
|
+
|
144
|
+
assert_equal 'test/en/home', page.template_path
|
145
|
+
end
|
146
|
+
|
147
|
+
test '#data' do
|
148
|
+
page = pages.new
|
149
|
+
assert_equal Hash.new, page.data
|
150
|
+
assert_nil page.data[:header_image]
|
151
|
+
|
152
|
+
page = pages.new(data: { header_image: 'logo.jpg', description: 'Our logo design is awesome.' })
|
153
|
+
assert_equal({ header_image: 'logo.jpg', description: 'Our logo design is awesome.' }, page.data)
|
154
|
+
assert_equal "logo.jpg", page.data[:header_image]
|
155
|
+
end
|
156
|
+
|
157
|
+
test '#path' do
|
158
|
+
# Regular page
|
159
|
+
page = pages.new(slug: 'about/products')
|
160
|
+
assert_equal [:seiten, :test, :page, { slug: 'about/products' }], page.path
|
161
|
+
|
162
|
+
# Regular page
|
163
|
+
navigation.name = 'application'
|
164
|
+
navigation.pages.navigation_id = "application.en"
|
165
|
+
page = pages.new(slug: 'about/products')
|
166
|
+
assert_equal [:seiten, nil, :page, { slug: 'about/products' }], page.path
|
167
|
+
|
168
|
+
# External page
|
169
|
+
page = pages.new(slug: 'https://codegestalt.com')
|
170
|
+
assert_equal 'https://codegestalt.com', page.path
|
171
|
+
|
172
|
+
# Anchor page
|
173
|
+
page = pages.new(slug: nil)
|
174
|
+
assert_equal '#', page.path
|
175
|
+
|
176
|
+
# Refer page
|
177
|
+
page = pages.new(refer: '/about/our-team')
|
178
|
+
assert_equal '/about/our-team', page.path
|
179
|
+
end
|
180
|
+
|
181
|
+
test '#layout' do
|
182
|
+
page = pages.new
|
183
|
+
assert_equal 'application', page.layout
|
184
|
+
|
185
|
+
page = pages.new(layout: 'custom')
|
186
|
+
assert_equal 'custom', page.layout
|
187
|
+
end
|
188
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Seiten::SlugBuilderTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
test 'should return parameterized title' do
|
6
|
+
slug = Seiten::SlugBuilder.call(title: 'My Page')
|
7
|
+
assert_equal 'my-page', slug
|
8
|
+
end
|
9
|
+
|
10
|
+
test 'should return empty string' do
|
11
|
+
slug = Seiten::SlugBuilder.call(title: 'Home', url: '/')
|
12
|
+
assert_equal '', slug
|
13
|
+
slug = Seiten::SlugBuilder.call(title: 'Home', root: true)
|
14
|
+
assert_equal '', slug
|
15
|
+
end
|
16
|
+
|
17
|
+
test 'should remove leading slash' do
|
18
|
+
slug = Seiten::SlugBuilder.call(title: 'Home', url: '/home')
|
19
|
+
assert_equal 'home', slug
|
20
|
+
end
|
21
|
+
|
22
|
+
test 'should return external url' do
|
23
|
+
slug = Seiten::SlugBuilder.call(title: 'Github', url: 'https://github.com')
|
24
|
+
assert_equal 'https://github.com', slug
|
25
|
+
end
|
26
|
+
|
27
|
+
test 'should return absolute url' do
|
28
|
+
slug = Seiten::SlugBuilder.call(
|
29
|
+
{
|
30
|
+
title: 'Contact',
|
31
|
+
url: '/contact'
|
32
|
+
},
|
33
|
+
'about'
|
34
|
+
)
|
35
|
+
assert_equal 'contact', slug
|
36
|
+
end
|
37
|
+
|
38
|
+
test 'should return url with prefix' do
|
39
|
+
slug = Seiten::SlugBuilder.call(
|
40
|
+
{
|
41
|
+
title: 'Projects'
|
42
|
+
},
|
43
|
+
'about'
|
44
|
+
)
|
45
|
+
assert_equal 'about/projects', slug
|
46
|
+
end
|
47
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -10,12 +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
|
-
|
14
|
-
# Seiten.config[:storage_type] = :yaml
|
15
|
-
# Seiten.config[:storage_file] = File.join('..', 'fixtures', 'navigation.yml')
|
16
|
-
# Seiten.config[:storage_directory] = File.join('app', 'pages')
|
17
|
-
end
|
13
|
+
Seiten.config[:pages_dir] = 'test/dummy/app/pages'
|
18
14
|
|
19
|
-
|
20
|
-
include Capybara::DSL
|
21
|
-
end
|
15
|
+
FIXTURES_DIR = File.join(File.dirname(__FILE__), 'fixtures')
|
metadata
CHANGED
@@ -1,57 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seiten
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Puglisi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.2'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '4.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: capybara
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.10'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.10'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: puma
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '2
|
47
|
+
version: '5.2'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: web-console
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
53
60
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: Seiten lets you create static pages for your Rails project and provides
|
56
70
|
you with some cool navigational helper likes breadcrumb or custom navigations.
|
57
71
|
email:
|
@@ -63,61 +77,84 @@ files:
|
|
63
77
|
- MIT-LICENSE
|
64
78
|
- Rakefile
|
65
79
|
- app/controllers/seiten/pages_controller.rb
|
66
|
-
- app/helpers/seiten_helper.rb
|
67
80
|
- config/initializers/seiten.rb
|
68
81
|
- lib/seiten.rb
|
69
|
-
- lib/seiten/controllers/helpers.rb
|
70
82
|
- lib/seiten/engine.rb
|
83
|
+
- lib/seiten/errors/base_error.rb
|
84
|
+
- lib/seiten/errors/page_error.rb
|
85
|
+
- lib/seiten/errors/routing_error.rb
|
86
|
+
- lib/seiten/helpers/backend.rb
|
87
|
+
- lib/seiten/helpers/current.rb
|
88
|
+
- lib/seiten/helpers/frontend.rb
|
89
|
+
- lib/seiten/html/breadcrumb.rb
|
90
|
+
- lib/seiten/html/helpers.rb
|
91
|
+
- lib/seiten/html/navigation.rb
|
92
|
+
- lib/seiten/navigation.rb
|
71
93
|
- lib/seiten/page.rb
|
72
|
-
- lib/seiten/
|
94
|
+
- lib/seiten/page_collection.rb
|
95
|
+
- lib/seiten/page_collection_builder.rb
|
96
|
+
- lib/seiten/railtie.rb
|
73
97
|
- lib/seiten/routes_helper.rb
|
98
|
+
- lib/seiten/slug_builder.rb
|
74
99
|
- lib/seiten/version.rb
|
75
100
|
- lib/tasks/sticky_pages_tasks.rake
|
101
|
+
- test/controllers/helper_methods_test.rb
|
102
|
+
- test/controllers/pages_controller_test.rb
|
103
|
+
- test/controllers/posts_controller_test.rb
|
104
|
+
- test/controllers/seiten/pages_controller_test.rb
|
76
105
|
- test/dummy/README.rdoc
|
77
106
|
- test/dummy/Rakefile
|
78
|
-
- test/dummy/app/assets/javascripts/application.js
|
79
|
-
- test/dummy/app/assets/stylesheets/application.css
|
80
107
|
- test/dummy/app/controllers/application_controller.rb
|
81
108
|
- test/dummy/app/controllers/pages_controller.rb
|
109
|
+
- test/dummy/app/controllers/posts_controller.rb
|
82
110
|
- test/dummy/app/helpers/application_helper.rb
|
83
|
-
- test/dummy/app/pages/de/produkte.html.erb
|
84
|
-
- test/dummy/app/pages/en/about
|
85
|
-
- test/dummy/app/pages/en/about/our-team
|
86
|
-
- test/dummy/app/pages/en/about/our-team/
|
87
|
-
- test/dummy/app/pages/en/about/
|
88
|
-
- test/dummy/app/pages/en/about/
|
89
|
-
- test/dummy/app/pages/en/
|
90
|
-
- test/dummy/app/pages/en/
|
91
|
-
- test/dummy/app/pages/en/
|
92
|
-
- test/dummy/app/pages/en/products
|
93
|
-
- test/dummy/app/pages/en/products/
|
94
|
-
- test/dummy/app/pages/
|
111
|
+
- test/dummy/app/pages/application/de/produkte.html.erb
|
112
|
+
- test/dummy/app/pages/application/en/about.html.erb
|
113
|
+
- test/dummy/app/pages/application/en/about/our-team.html.erb
|
114
|
+
- test/dummy/app/pages/application/en/about/our-team/italy.html.erb
|
115
|
+
- test/dummy/app/pages/application/en/about/our-team/switzerland.html.erb
|
116
|
+
- test/dummy/app/pages/application/en/about/partners.html.erb
|
117
|
+
- test/dummy/app/pages/application/en/about/works.html.erb
|
118
|
+
- test/dummy/app/pages/application/en/contact.html.erb
|
119
|
+
- test/dummy/app/pages/application/en/home.html.erb
|
120
|
+
- test/dummy/app/pages/application/en/products.html.erb
|
121
|
+
- test/dummy/app/pages/application/en/products/hire-us.html.erb
|
122
|
+
- test/dummy/app/pages/application/en/products/logo-design.html.erb
|
123
|
+
- test/dummy/app/pages/application/en/products/web-development.html.erb
|
124
|
+
- test/dummy/app/pages/application/localization.html.erb
|
125
|
+
- test/dummy/app/pages/help/en/home.html.erb
|
126
|
+
- test/dummy/app/pages/help/en/logging-in.html.erb
|
95
127
|
- test/dummy/app/views/layouts/application.html.erb
|
96
128
|
- test/dummy/app/views/layouts/home.html.erb
|
97
129
|
- test/dummy/app/views/layouts/products.html.erb
|
98
130
|
- test/dummy/app/views/layouts/team.html.erb
|
99
131
|
- test/dummy/app/views/pages/secret.html.erb
|
132
|
+
- test/dummy/app/views/posts/index.html.erb
|
100
133
|
- test/dummy/config.ru
|
101
134
|
- test/dummy/config/application.rb
|
102
135
|
- test/dummy/config/boot.rb
|
136
|
+
- test/dummy/config/cable.yml
|
103
137
|
- test/dummy/config/database.yml
|
104
138
|
- test/dummy/config/environment.rb
|
105
139
|
- test/dummy/config/environments/development.rb
|
106
140
|
- test/dummy/config/environments/production.rb
|
107
141
|
- test/dummy/config/environments/test.rb
|
142
|
+
- test/dummy/config/initializers/application_controller_renderer.rb
|
108
143
|
- test/dummy/config/initializers/backtrace_silencers.rb
|
144
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
145
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
109
146
|
- test/dummy/config/initializers/inflections.rb
|
110
147
|
- test/dummy/config/initializers/mime_types.rb
|
148
|
+
- test/dummy/config/initializers/new_framework_defaults.rb
|
111
149
|
- test/dummy/config/initializers/secret_token.rb
|
112
150
|
- test/dummy/config/initializers/session_store.rb
|
113
151
|
- test/dummy/config/initializers/wrap_parameters.rb
|
114
152
|
- test/dummy/config/locales/en.yml
|
115
|
-
- test/dummy/config/
|
116
|
-
- test/dummy/config/
|
117
|
-
- test/dummy/config/
|
153
|
+
- test/dummy/config/navigations/application.de.yml
|
154
|
+
- test/dummy/config/navigations/application.en.yml
|
155
|
+
- test/dummy/config/navigations/help.en.yml
|
118
156
|
- test/dummy/config/routes.rb
|
119
|
-
- test/dummy/
|
120
|
-
- test/dummy/db/test.sqlite3
|
157
|
+
- test/dummy/config/secrets.yml
|
121
158
|
- test/dummy/log/development.log
|
122
159
|
- test/dummy/log/test.log
|
123
160
|
- test/dummy/public/404.html
|
@@ -125,22 +162,26 @@ files:
|
|
125
162
|
- test/dummy/public/500.html
|
126
163
|
- test/dummy/public/favicon.ico
|
127
164
|
- test/dummy/script/rails
|
128
|
-
- test/
|
129
|
-
- test/
|
130
|
-
- test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
|
131
|
-
- test/integration/i18n_test.rb
|
165
|
+
- test/fixtures/breadcrumb.html
|
166
|
+
- test/fixtures/navigation.html
|
132
167
|
- test/integration/layout_test.rb
|
133
168
|
- test/integration/navigation_test.rb
|
134
|
-
- test/
|
135
|
-
- test/
|
136
|
-
- test/
|
137
|
-
- test/
|
169
|
+
- test/lib/seiten/helpers/frontend_test.rb
|
170
|
+
- test/lib/seiten/html/breadcrumb_test.rb
|
171
|
+
- test/lib/seiten/html/helpers_test.rb
|
172
|
+
- test/lib/seiten/html/navigation_test.rb
|
173
|
+
- test/lib/seiten/navigation_test.rb
|
174
|
+
- test/lib/seiten/page_collection_builder_test.rb
|
175
|
+
- test/lib/seiten/page_collection_test.rb
|
176
|
+
- test/lib/seiten/page_test.rb
|
177
|
+
- test/lib/seiten/slug_builder_test.rb
|
178
|
+
- test/lib/seiten_test.rb
|
138
179
|
- test/test_helper.rb
|
139
180
|
homepage: http://danielpuglisi.com
|
140
181
|
licenses:
|
141
182
|
- MIT
|
142
183
|
metadata: {}
|
143
|
-
post_install_message:
|
184
|
+
post_install_message:
|
144
185
|
rdoc_options: []
|
145
186
|
require_paths:
|
146
187
|
- lib
|
@@ -155,72 +196,87 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
196
|
- !ruby/object:Gem::Version
|
156
197
|
version: '0'
|
157
198
|
requirements: []
|
158
|
-
|
159
|
-
|
160
|
-
signing_key:
|
199
|
+
rubygems_version: 3.3.7
|
200
|
+
signing_key:
|
161
201
|
specification_version: 4
|
162
202
|
summary: Static Pages for Rails.
|
163
203
|
test_files:
|
164
|
-
- test/
|
165
|
-
- test/
|
204
|
+
- test/controllers/helper_methods_test.rb
|
205
|
+
- test/controllers/pages_controller_test.rb
|
206
|
+
- test/controllers/posts_controller_test.rb
|
207
|
+
- test/controllers/seiten/pages_controller_test.rb
|
208
|
+
- test/dummy/README.rdoc
|
209
|
+
- test/dummy/Rakefile
|
166
210
|
- test/dummy/app/controllers/application_controller.rb
|
167
211
|
- test/dummy/app/controllers/pages_controller.rb
|
212
|
+
- test/dummy/app/controllers/posts_controller.rb
|
168
213
|
- test/dummy/app/helpers/application_helper.rb
|
169
|
-
- test/dummy/app/pages/de/produkte.html.erb
|
170
|
-
- test/dummy/app/pages/en/about/our-team/italy.html.erb
|
171
|
-
- test/dummy/app/pages/en/about/our-team/switzerland.html.erb
|
172
|
-
- test/dummy/app/pages/en/about/our-team.html.erb
|
173
|
-
- test/dummy/app/pages/en/about/partners.html.erb
|
174
|
-
- test/dummy/app/pages/en/about/works.html.erb
|
175
|
-
- test/dummy/app/pages/en/
|
176
|
-
- test/dummy/app/pages/en/
|
177
|
-
- test/dummy/app/pages/en/
|
178
|
-
- test/dummy/app/pages/en/products/
|
179
|
-
- test/dummy/app/pages/en/products.html.erb
|
180
|
-
- test/dummy/app/pages/
|
214
|
+
- test/dummy/app/pages/application/de/produkte.html.erb
|
215
|
+
- test/dummy/app/pages/application/en/about/our-team/italy.html.erb
|
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
|
+
- test/dummy/app/pages/application/en/about/partners.html.erb
|
219
|
+
- test/dummy/app/pages/application/en/about/works.html.erb
|
220
|
+
- test/dummy/app/pages/application/en/about.html.erb
|
221
|
+
- test/dummy/app/pages/application/en/contact.html.erb
|
222
|
+
- test/dummy/app/pages/application/en/home.html.erb
|
223
|
+
- test/dummy/app/pages/application/en/products/hire-us.html.erb
|
224
|
+
- test/dummy/app/pages/application/en/products/logo-design.html.erb
|
225
|
+
- test/dummy/app/pages/application/en/products/web-development.html.erb
|
226
|
+
- test/dummy/app/pages/application/en/products.html.erb
|
227
|
+
- test/dummy/app/pages/application/localization.html.erb
|
228
|
+
- test/dummy/app/pages/help/en/home.html.erb
|
229
|
+
- test/dummy/app/pages/help/en/logging-in.html.erb
|
181
230
|
- test/dummy/app/views/layouts/application.html.erb
|
182
231
|
- test/dummy/app/views/layouts/home.html.erb
|
183
232
|
- test/dummy/app/views/layouts/products.html.erb
|
184
233
|
- test/dummy/app/views/layouts/team.html.erb
|
185
234
|
- test/dummy/app/views/pages/secret.html.erb
|
235
|
+
- test/dummy/app/views/posts/index.html.erb
|
186
236
|
- test/dummy/config/application.rb
|
187
237
|
- test/dummy/config/boot.rb
|
238
|
+
- test/dummy/config/cable.yml
|
188
239
|
- test/dummy/config/database.yml
|
189
240
|
- test/dummy/config/environment.rb
|
190
241
|
- test/dummy/config/environments/development.rb
|
191
242
|
- test/dummy/config/environments/production.rb
|
192
243
|
- test/dummy/config/environments/test.rb
|
244
|
+
- test/dummy/config/initializers/application_controller_renderer.rb
|
193
245
|
- test/dummy/config/initializers/backtrace_silencers.rb
|
246
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
247
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
194
248
|
- test/dummy/config/initializers/inflections.rb
|
195
249
|
- test/dummy/config/initializers/mime_types.rb
|
250
|
+
- test/dummy/config/initializers/new_framework_defaults.rb
|
196
251
|
- test/dummy/config/initializers/secret_token.rb
|
197
252
|
- test/dummy/config/initializers/session_store.rb
|
198
253
|
- test/dummy/config/initializers/wrap_parameters.rb
|
199
254
|
- test/dummy/config/locales/en.yml
|
200
|
-
- test/dummy/config/
|
201
|
-
- test/dummy/config/
|
202
|
-
- test/dummy/config/
|
255
|
+
- test/dummy/config/navigations/application.de.yml
|
256
|
+
- test/dummy/config/navigations/application.en.yml
|
257
|
+
- test/dummy/config/navigations/help.en.yml
|
203
258
|
- test/dummy/config/routes.rb
|
259
|
+
- test/dummy/config/secrets.yml
|
204
260
|
- test/dummy/config.ru
|
205
|
-
- test/dummy/db/development.sqlite3
|
206
|
-
- test/dummy/db/test.sqlite3
|
207
261
|
- test/dummy/log/development.log
|
208
262
|
- test/dummy/log/test.log
|
209
263
|
- test/dummy/public/404.html
|
210
264
|
- test/dummy/public/422.html
|
211
265
|
- test/dummy/public/500.html
|
212
266
|
- test/dummy/public/favicon.ico
|
213
|
-
- test/dummy/Rakefile
|
214
|
-
- test/dummy/README.rdoc
|
215
267
|
- test/dummy/script/rails
|
216
|
-
- test/
|
217
|
-
- test/
|
218
|
-
- test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
|
219
|
-
- test/integration/i18n_test.rb
|
268
|
+
- test/fixtures/breadcrumb.html
|
269
|
+
- test/fixtures/navigation.html
|
220
270
|
- test/integration/layout_test.rb
|
221
271
|
- test/integration/navigation_test.rb
|
222
|
-
- test/
|
223
|
-
- test/
|
224
|
-
- test/
|
225
|
-
- test/
|
272
|
+
- test/lib/seiten/helpers/frontend_test.rb
|
273
|
+
- test/lib/seiten/html/breadcrumb_test.rb
|
274
|
+
- test/lib/seiten/html/helpers_test.rb
|
275
|
+
- test/lib/seiten/html/navigation_test.rb
|
276
|
+
- test/lib/seiten/navigation_test.rb
|
277
|
+
- test/lib/seiten/page_collection_builder_test.rb
|
278
|
+
- test/lib/seiten/page_collection_test.rb
|
279
|
+
- test/lib/seiten/page_test.rb
|
280
|
+
- test/lib/seiten/slug_builder_test.rb
|
281
|
+
- test/lib/seiten_test.rb
|
226
282
|
- test/test_helper.rb
|
@@ -1,46 +0,0 @@
|
|
1
|
-
module SeitenHelper
|
2
|
-
|
3
|
-
def link_to_seiten_page(title, slug, options={})
|
4
|
-
if !!(slug.to_s.match(/^https?:\/\/.+/))
|
5
|
-
link_to title, slug
|
6
|
-
elsif slug == nil
|
7
|
-
link_to title, seiten_page_path(page: "")
|
8
|
-
else
|
9
|
-
link_to title, seiten_page_path(page: slug)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def seiten_navigation(options={})
|
14
|
-
output ||= ""
|
15
|
-
parent_id = options[:parent_id] || nil
|
16
|
-
deep = options[:deep] || 2
|
17
|
-
|
18
|
-
if deep > 0
|
19
|
-
Seiten::Page.find_by_parent_id(parent_id).each do |page|
|
20
|
-
status = page.active?(current_page) ? "active" : "inactive"
|
21
|
-
output += "<li class='#{status}'>#{link_to_seiten_page(page.title, page.slug)}"
|
22
|
-
unless page.children.blank?
|
23
|
-
output += seiten_navigation(parent_id: page.id, deep: deep-1)
|
24
|
-
end
|
25
|
-
output += "</li>"
|
26
|
-
end
|
27
|
-
output = "<ul>#{output}</ul>"
|
28
|
-
end
|
29
|
-
raw output
|
30
|
-
end
|
31
|
-
|
32
|
-
def seiten_breadcrumb(options={})
|
33
|
-
link_separator = options[:link_separator] || ">"
|
34
|
-
|
35
|
-
if current_page
|
36
|
-
output = content_tag(:ul, class: "breadcrumb") do
|
37
|
-
Seiten::Page.get_breadcrumb(current_page).reverse.collect { |page|
|
38
|
-
content_tag :li do
|
39
|
-
raw "#{link_separator} #{link_to_seiten_page(page.title, page.slug)}"
|
40
|
-
end
|
41
|
-
}.join().html_safe
|
42
|
-
end
|
43
|
-
output
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|