b4um_generators 0.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 +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +28 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +21 -0
- data/README.de.md +821 -0
- data/README.md +815 -0
- data/Rakefile +12 -0
- data/b4um_generators.gemspec +30 -0
- data/bin/console +11 -0
- data/bin/setup +8 -0
- data/lib/b4um_generators/version.rb +5 -0
- data/lib/b4um_generators.rb +8 -0
- data/lib/generators/b4um/bento/bento_generator.rb +81 -0
- data/lib/generators/b4um/bento/templates/_alternating.html.erb.tt +15 -0
- data/lib/generators/b4um/bento/templates/_bento.html.erb.tt +26 -0
- data/lib/generators/b4um/bento/templates/_grid.html.erb.tt +13 -0
- data/lib/generators/b4um/bento/templates/_list.html.erb.tt +15 -0
- data/lib/generators/b4um/comments/comments_generator.rb +259 -0
- data/lib/generators/b4um/comments/templates/_comments.html.erb.tt +63 -0
- data/lib/generators/b4um/comments/templates/comment.rb.tt +5 -0
- data/lib/generators/b4um/comments/templates/comments_controller.rb.tt +45 -0
- data/lib/generators/b4um/comments/templates/create_comments.rb.tt +14 -0
- data/lib/generators/b4um/controller/controller_generator.rb +397 -0
- data/lib/generators/b4um/help/help_generator.rb +755 -0
- data/lib/generators/b4um/infinite_scroll/infinite_scroll_generator.rb +199 -0
- data/lib/generators/b4um/infinite_scroll/templates/infinite_scroll_controller.js +61 -0
- data/lib/generators/b4um/install/install_generator.rb +492 -0
- data/lib/generators/b4um/install/templates/_cookie_consent.html.erb +27 -0
- data/lib/generators/b4um/install/templates/_footer.html.erb +17 -0
- data/lib/generators/b4um/install/templates/_hero.html.erb +33 -0
- data/lib/generators/b4um/install/templates/_navigation.html.erb +31 -0
- data/lib/generators/b4um/install/templates/_sitemap.html.erb +48 -0
- data/lib/generators/b4um/install/templates/_theme_switcher.html.erb +57 -0
- data/lib/generators/b4um/install/templates/b4um/badges.css +43 -0
- data/lib/generators/b4um/install/templates/b4um/base.css +42 -0
- data/lib/generators/b4um/install/templates/b4um/callouts.css +58 -0
- data/lib/generators/b4um/install/templates/b4um/cards.css +401 -0
- data/lib/generators/b4um/install/templates/b4um/comments.css +52 -0
- data/lib/generators/b4um/install/templates/b4um/cookie-consent.css +83 -0
- data/lib/generators/b4um/install/templates/b4um/empty-state.css +26 -0
- data/lib/generators/b4um/install/templates/b4um/flash.css +86 -0
- data/lib/generators/b4um/install/templates/b4um/footer.css +338 -0
- data/lib/generators/b4um/install/templates/b4um/forms.css +924 -0
- data/lib/generators/b4um/install/templates/b4um/hero.css +149 -0
- data/lib/generators/b4um/install/templates/b4um/layout.css +166 -0
- data/lib/generators/b4um/install/templates/b4um/lightbox.css +268 -0
- data/lib/generators/b4um/install/templates/b4um/navigation.css +257 -0
- data/lib/generators/b4um/install/templates/b4um/pagination.css +85 -0
- data/lib/generators/b4um/install/templates/b4um/resources.css +121 -0
- data/lib/generators/b4um/install/templates/b4um/search.css +41 -0
- data/lib/generators/b4um/install/templates/b4um/tables.css +67 -0
- data/lib/generators/b4um/install/templates/b4um/theme-switcher.css +178 -0
- data/lib/generators/b4um/install/templates/b4um/theme.css +132 -0
- data/lib/generators/b4um/install/templates/b4um.css +20 -0
- data/lib/generators/b4um/install/templates/b4um.yml +12 -0
- data/lib/generators/b4um/install/templates/b4um_helper.rb +27 -0
- data/lib/generators/b4um/install/templates/cookie_consent_controller.js +76 -0
- data/lib/generators/b4um/install/templates/dismissible_controller.js +7 -0
- data/lib/generators/b4um/install/templates/image_lightbox_controller.js +414 -0
- data/lib/generators/b4um/install/templates/image_preview_controller.js +85 -0
- data/lib/generators/b4um/install/templates/navigation_controller.js +25 -0
- data/lib/generators/b4um/install/templates/navigation_helper.rb +26 -0
- data/lib/generators/b4um/install/templates/sitemap_controller.js +35 -0
- data/lib/generators/b4um/install/templates/theme_controller.js +122 -0
- data/lib/generators/b4um/pagination/pagination_generator.rb +179 -0
- data/lib/generators/b4um/pagination/templates/_pagination.html.erb.tt +48 -0
- data/lib/generators/b4um/pagination/templates/pagination.rb +36 -0
- data/lib/generators/b4um/scaffold/scaffold_generator.rb +333 -0
- data/lib/generators/b4um/scaffold/templates/_bento.html.erb.tt +26 -0
- data/lib/generators/b4um/scaffold/templates/_form.html.erb.tt +218 -0
- data/lib/generators/b4um/scaffold/templates/_resource.html.erb.tt +144 -0
- data/lib/generators/b4um/scaffold/templates/_table.html.erb.tt +40 -0
- data/lib/generators/b4um/scaffold/templates/edit.html.erb.tt +21 -0
- data/lib/generators/b4um/scaffold/templates/index.html.erb.tt +24 -0
- data/lib/generators/b4um/scaffold/templates/new.html.erb.tt +17 -0
- data/lib/generators/b4um/scaffold/templates/show.html.erb.tt +31 -0
- data/lib/generators/b4um/search/search_generator.rb +165 -0
- data/lib/generators/b4um/search/templates/search.rb +34 -0
- data/lib/generators/b4um/search/templates/search_form.html.erb.tt +15 -0
- data/lib/generators/b4um/table/table_generator.rb +63 -0
- data/lib/generators/b4um/table/templates/_table.html.erb.tt +40 -0
- data/lib/generators/b4um/trix/templates/b4um_rich_text_helper.rb +58 -0
- data/lib/generators/b4um/trix/templates/b4um_trix.js +551 -0
- data/lib/generators/b4um/trix/trix_generator.rb +383 -0
- data/sig/b4um_generators.rbs +4 -0
- metadata +148 -0
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rails/generators"
|
|
4
|
+
require "yaml"
|
|
5
|
+
|
|
6
|
+
module B4um
|
|
7
|
+
module Generators
|
|
8
|
+
class InstallGenerator < Rails::Generators::Base
|
|
9
|
+
source_root File.expand_path("templates", __dir__)
|
|
10
|
+
|
|
11
|
+
desc "Installs the B4UM base setup."
|
|
12
|
+
|
|
13
|
+
def install_bcrypt
|
|
14
|
+
unless yes?("Install bcrypt for password support? (y/n)")
|
|
15
|
+
say " bcrypt skipped."
|
|
16
|
+
return
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
gemfile_path = File.join(destination_root, "Gemfile")
|
|
20
|
+
gemfile = File.read(gemfile_path)
|
|
21
|
+
|
|
22
|
+
if gemfile.match?(/^\s*gem ["']bcrypt["']/)
|
|
23
|
+
say " bcrypt is already present in the Gemfile."
|
|
24
|
+
return
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
if gemfile.match?(/^\s*#\s*gem ["']bcrypt["']/)
|
|
28
|
+
gsub_file(
|
|
29
|
+
"Gemfile",
|
|
30
|
+
/^(\s*)#\s*(gem ["']bcrypt["'].*)$/,
|
|
31
|
+
'\1\2'
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
@gems_added = true
|
|
35
|
+
|
|
36
|
+
say " bcrypt activated in the Gemfile."
|
|
37
|
+
return
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
gem "bcrypt"
|
|
41
|
+
@gems_added = true
|
|
42
|
+
|
|
43
|
+
say " bcrypt added to the Gemfile."
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def install_active_storage
|
|
47
|
+
unless yes?("Install Active Storage for image attachments? (y/n)")
|
|
48
|
+
say " Active Storage skipped."
|
|
49
|
+
return
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
migration_files = Dir.glob(
|
|
53
|
+
File.join(
|
|
54
|
+
destination_root,
|
|
55
|
+
"db/migrate/*_create_active_storage_tables.active_storage.rb"
|
|
56
|
+
)
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
if migration_files.any?
|
|
60
|
+
say " Active Storage is already installed."
|
|
61
|
+
return
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
rails_command "active_storage:install"
|
|
65
|
+
|
|
66
|
+
say " Active Storage installed."
|
|
67
|
+
say " Running database migrations..."
|
|
68
|
+
|
|
69
|
+
rails_command "db:migrate"
|
|
70
|
+
|
|
71
|
+
say " Active Storage database tables created."
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def create_stylesheet
|
|
75
|
+
copy_file "b4um.css", "app/assets/stylesheets/b4um.css"
|
|
76
|
+
|
|
77
|
+
directory(
|
|
78
|
+
"b4um",
|
|
79
|
+
"app/assets/stylesheets/b4um"
|
|
80
|
+
)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def install_hero
|
|
84
|
+
unless yes?("Add a hero section? (y/n)")
|
|
85
|
+
say " Hero section skipped."
|
|
86
|
+
return
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
copy_file(
|
|
90
|
+
"_hero.html.erb",
|
|
91
|
+
"app/views/shared/_hero.html.erb"
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
@hero_installed = true
|
|
95
|
+
|
|
96
|
+
say " Hero section installed."
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def install_footer
|
|
100
|
+
unless yes?("Add a footer? (y/n)")
|
|
101
|
+
@footer_installed = false
|
|
102
|
+
|
|
103
|
+
say " Footer skipped."
|
|
104
|
+
return
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
footer_path = "app/views/shared/_footer.html.erb"
|
|
108
|
+
full_footer_path = File.join(destination_root, footer_path)
|
|
109
|
+
|
|
110
|
+
if File.exist?(full_footer_path)
|
|
111
|
+
@footer_installed = true
|
|
112
|
+
|
|
113
|
+
say " Footer already exists; keeping existing footer."
|
|
114
|
+
return
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
copy_file(
|
|
118
|
+
"_footer.html.erb",
|
|
119
|
+
footer_path
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
@footer_installed = true
|
|
123
|
+
|
|
124
|
+
say " Footer installed."
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def install_sitemap
|
|
128
|
+
unless @footer_installed
|
|
129
|
+
say " Sitemap skipped because footer is not installed."
|
|
130
|
+
return
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
unless yes?("Add a sitemap to the footer? (y/n)")
|
|
134
|
+
say " Sitemap skipped."
|
|
135
|
+
return
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
@sitemap_column_count = ask_sitemap_column_count
|
|
139
|
+
|
|
140
|
+
default_titles = %w[
|
|
141
|
+
Kontakt
|
|
142
|
+
Inhalte
|
|
143
|
+
Service
|
|
144
|
+
Mehr
|
|
145
|
+
Weitere
|
|
146
|
+
]
|
|
147
|
+
|
|
148
|
+
@sitemap_titles = Array.new(@sitemap_column_count) do |index|
|
|
149
|
+
default_title = default_titles[index]
|
|
150
|
+
|
|
151
|
+
ask(
|
|
152
|
+
"Sitemap column #{index + 1} title [#{default_title}]:"
|
|
153
|
+
).presence || default_title
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
copy_file(
|
|
157
|
+
"_sitemap.html.erb",
|
|
158
|
+
"app/views/shared/_sitemap.html.erb"
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
copy_file(
|
|
162
|
+
"sitemap_controller.js",
|
|
163
|
+
"app/javascript/controllers/sitemap_controller.js"
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
@sitemap_installed = true
|
|
167
|
+
|
|
168
|
+
say " Sitemap installed."
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def install_cookie_consent
|
|
172
|
+
unless yes?("Add cookie consent? (y/n)")
|
|
173
|
+
say " Cookie consent skipped."
|
|
174
|
+
return
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
copy_file(
|
|
178
|
+
"_cookie_consent.html.erb",
|
|
179
|
+
"app/views/shared/_cookie_consent.html.erb"
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
copy_file(
|
|
183
|
+
"cookie_consent_controller.js",
|
|
184
|
+
"app/javascript/controllers/cookie_consent_controller.js"
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
@cookie_consent_installed = true
|
|
188
|
+
|
|
189
|
+
say " Cookie consent installed."
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
def copy_navigation
|
|
193
|
+
copy_file "_navigation.html.erb",
|
|
194
|
+
"app/views/shared/_navigation.html.erb"
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
def copy_navigation_controller
|
|
198
|
+
copy_file "navigation_controller.js",
|
|
199
|
+
"app/javascript/controllers/navigation_controller.js"
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
def copy_theme_controller
|
|
203
|
+
copy_file "theme_controller.js",
|
|
204
|
+
"app/javascript/controllers/theme_controller.js"
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
def copy_theme_switcher
|
|
208
|
+
copy_file(
|
|
209
|
+
"_theme_switcher.html.erb",
|
|
210
|
+
"app/views/shared/_theme_switcher.html.erb"
|
|
211
|
+
)
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
def copy_b4um_config
|
|
215
|
+
copy_file "b4um.yml",
|
|
216
|
+
"config/b4um.yml"
|
|
217
|
+
|
|
218
|
+
return unless @sitemap_installed
|
|
219
|
+
return unless @sitemap_titles
|
|
220
|
+
|
|
221
|
+
config_path = "config/b4um.yml"
|
|
222
|
+
full_config_path = File.join(destination_root, config_path)
|
|
223
|
+
|
|
224
|
+
config = YAML.safe_load_file(full_config_path) || {}
|
|
225
|
+
|
|
226
|
+
config["sitemap"] = @sitemap_titles.each_with_index.map do |title, index|
|
|
227
|
+
{
|
|
228
|
+
"key" => "column_#{index + 1}",
|
|
229
|
+
"title" => title
|
|
230
|
+
}
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
File.write(
|
|
234
|
+
full_config_path,
|
|
235
|
+
config.to_yaml
|
|
236
|
+
)
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
def copy_image_preview_controller
|
|
240
|
+
copy_file "image_preview_controller.js",
|
|
241
|
+
"app/javascript/controllers/image_preview_controller.js"
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
def copy_image_lightbox_controller
|
|
245
|
+
copy_file "image_lightbox_controller.js",
|
|
246
|
+
"app/javascript/controllers/image_lightbox_controller.js"
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
def copy_dismissible_controller
|
|
250
|
+
copy_file "dismissible_controller.js",
|
|
251
|
+
"app/javascript/controllers/dismissible_controller.js"
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
def copy_navigation_helper
|
|
255
|
+
copy_file "navigation_helper.rb",
|
|
256
|
+
"app/helpers/navigation_helper.rb"
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
def copy_b4um_helper
|
|
260
|
+
copy_file "b4um_helper.rb",
|
|
261
|
+
"app/helpers/b4um_helper.rb"
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
def update_application_layout
|
|
265
|
+
layout_path = "app/views/layouts/application.html.erb"
|
|
266
|
+
full_layout_path = File.join(destination_root, layout_path)
|
|
267
|
+
|
|
268
|
+
ensure_page_top_anchor(layout_path, full_layout_path)
|
|
269
|
+
ensure_navigation(layout_path, full_layout_path)
|
|
270
|
+
ensure_main_container(layout_path, full_layout_path)
|
|
271
|
+
ensure_hero(layout_path, full_layout_path)
|
|
272
|
+
ensure_theme_switcher(layout_path, full_layout_path)
|
|
273
|
+
ensure_footer(layout_path, full_layout_path)
|
|
274
|
+
ensure_sitemap_footer_render
|
|
275
|
+
ensure_cookie_consent(layout_path, full_layout_path)
|
|
276
|
+
ensure_cookie_consent_footer_link
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
def install_selected_gems
|
|
280
|
+
return unless @gems_added
|
|
281
|
+
|
|
282
|
+
say "Installing selected gems..."
|
|
283
|
+
|
|
284
|
+
run "bundle install"
|
|
285
|
+
|
|
286
|
+
say "Selected gems installed."
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
private
|
|
290
|
+
|
|
291
|
+
def ask_sitemap_column_count
|
|
292
|
+
loop do
|
|
293
|
+
answer = ask(
|
|
294
|
+
"Number of sitemap columns [4]:"
|
|
295
|
+
).to_s.strip
|
|
296
|
+
|
|
297
|
+
return 4 if answer.empty?
|
|
298
|
+
|
|
299
|
+
column_count = Integer(answer, exception: false)
|
|
300
|
+
|
|
301
|
+
return column_count if column_count&.between?(2, 5)
|
|
302
|
+
|
|
303
|
+
say " Please choose between 2 and 5 sitemap columns."
|
|
304
|
+
end
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
def ensure_navigation(layout_path, full_layout_path)
|
|
308
|
+
layout = File.read(full_layout_path)
|
|
309
|
+
|
|
310
|
+
return if layout.include?('render "shared/navigation"')
|
|
311
|
+
|
|
312
|
+
gsub_file(
|
|
313
|
+
layout_path,
|
|
314
|
+
'<div id="b4um-page-top"></div>',
|
|
315
|
+
<<~ERB.chomp
|
|
316
|
+
<div id="b4um-page-top"></div>
|
|
317
|
+
<%= render "shared/navigation" %>
|
|
318
|
+
ERB
|
|
319
|
+
)
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
def ensure_main_container(layout_path, full_layout_path)
|
|
323
|
+
layout = File.read(full_layout_path)
|
|
324
|
+
|
|
325
|
+
return if layout.include?('class="container"')
|
|
326
|
+
|
|
327
|
+
gsub_file(
|
|
328
|
+
layout_path,
|
|
329
|
+
'<%= render "shared/navigation" %>',
|
|
330
|
+
<<~ERB.chomp
|
|
331
|
+
<%= render "shared/navigation" %>
|
|
332
|
+
|
|
333
|
+
<main class="container">
|
|
334
|
+
<% flash.each do |type, message| %>
|
|
335
|
+
<div class="flash <%= "flash--" + type.to_s %>"
|
|
336
|
+
data-controller="dismissible">
|
|
337
|
+
<%= message %>
|
|
338
|
+
|
|
339
|
+
<button type="button"
|
|
340
|
+
class="flash__close"
|
|
341
|
+
data-action="dismissible#dismiss"
|
|
342
|
+
aria-label="Close">
|
|
343
|
+
×
|
|
344
|
+
</button>
|
|
345
|
+
</div>
|
|
346
|
+
<% end %>
|
|
347
|
+
ERB
|
|
348
|
+
)
|
|
349
|
+
|
|
350
|
+
gsub_file(
|
|
351
|
+
layout_path,
|
|
352
|
+
"</body>",
|
|
353
|
+
" </main>\n</body>"
|
|
354
|
+
)
|
|
355
|
+
end
|
|
356
|
+
|
|
357
|
+
def ensure_hero(layout_path, full_layout_path)
|
|
358
|
+
return unless @hero_installed
|
|
359
|
+
|
|
360
|
+
layout = File.read(full_layout_path)
|
|
361
|
+
|
|
362
|
+
return if layout.include?('render "shared/hero"')
|
|
363
|
+
|
|
364
|
+
gsub_file(
|
|
365
|
+
layout_path,
|
|
366
|
+
'<main class="container">',
|
|
367
|
+
<<~ERB.chomp
|
|
368
|
+
<main class="container">
|
|
369
|
+
<%= render "shared/hero" if request.path == root_path %>
|
|
370
|
+
ERB
|
|
371
|
+
)
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
def ensure_theme_switcher(layout_path, full_layout_path)
|
|
375
|
+
layout = File.read(full_layout_path)
|
|
376
|
+
|
|
377
|
+
return if layout.include?('render "shared/theme_switcher"')
|
|
378
|
+
|
|
379
|
+
gsub_file(
|
|
380
|
+
layout_path,
|
|
381
|
+
"</body>",
|
|
382
|
+
<<~ERB.chomp
|
|
383
|
+
<%= render "shared/theme_switcher" %>
|
|
384
|
+
</body>
|
|
385
|
+
ERB
|
|
386
|
+
)
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
def ensure_footer(layout_path, full_layout_path)
|
|
390
|
+
return unless @footer_installed
|
|
391
|
+
|
|
392
|
+
layout = File.read(full_layout_path)
|
|
393
|
+
|
|
394
|
+
return if layout.include?('render "shared/footer"')
|
|
395
|
+
|
|
396
|
+
gsub_file(
|
|
397
|
+
layout_path,
|
|
398
|
+
"</body>",
|
|
399
|
+
<<~ERB.chomp
|
|
400
|
+
<%= render "shared/footer" %>
|
|
401
|
+
</body>
|
|
402
|
+
ERB
|
|
403
|
+
)
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
def ensure_cookie_consent(layout_path, full_layout_path)
|
|
407
|
+
return unless @cookie_consent_installed
|
|
408
|
+
|
|
409
|
+
layout = File.read(full_layout_path)
|
|
410
|
+
|
|
411
|
+
return if layout.include?('render "shared/cookie_consent"')
|
|
412
|
+
|
|
413
|
+
gsub_file(
|
|
414
|
+
layout_path,
|
|
415
|
+
"</body>",
|
|
416
|
+
<<~ERB.chomp
|
|
417
|
+
<%= render "shared/cookie_consent" %>
|
|
418
|
+
</body>
|
|
419
|
+
ERB
|
|
420
|
+
)
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
def ensure_sitemap_footer_render
|
|
424
|
+
return unless @sitemap_installed
|
|
425
|
+
|
|
426
|
+
footer_path = "app/views/shared/_footer.html.erb"
|
|
427
|
+
full_footer_path = File.join(destination_root, footer_path)
|
|
428
|
+
|
|
429
|
+
return unless File.exist?(full_footer_path)
|
|
430
|
+
|
|
431
|
+
footer = File.read(full_footer_path)
|
|
432
|
+
|
|
433
|
+
return if footer.include?('render "shared/sitemap"')
|
|
434
|
+
|
|
435
|
+
gsub_file(
|
|
436
|
+
footer_path,
|
|
437
|
+
'<div class="b4um-footer__inner">',
|
|
438
|
+
<<~ERB.chomp
|
|
439
|
+
<%= render "shared/sitemap" %>
|
|
440
|
+
|
|
441
|
+
<div class="b4um-footer__inner">
|
|
442
|
+
ERB
|
|
443
|
+
)
|
|
444
|
+
end
|
|
445
|
+
|
|
446
|
+
def ensure_cookie_consent_footer_link
|
|
447
|
+
return unless @cookie_consent_installed
|
|
448
|
+
|
|
449
|
+
footer_path = "app/views/shared/_footer.html.erb"
|
|
450
|
+
full_footer_path = File.join(destination_root, footer_path)
|
|
451
|
+
|
|
452
|
+
return unless File.exist?(full_footer_path)
|
|
453
|
+
|
|
454
|
+
footer = File.read(full_footer_path)
|
|
455
|
+
|
|
456
|
+
return if footer.include?("data-b4um-cookie-consent-open")
|
|
457
|
+
return unless footer.include?("<%# B4UM_FOOTER_LINKS %>")
|
|
458
|
+
|
|
459
|
+
gsub_file(
|
|
460
|
+
footer_path,
|
|
461
|
+
"<%# B4UM_FOOTER_LINKS %>",
|
|
462
|
+
<<~ERB.chomp
|
|
463
|
+
<button
|
|
464
|
+
type="button"
|
|
465
|
+
class="b4um-footer__link b4um-footer__link--button"
|
|
466
|
+
data-b4um-cookie-consent-open
|
|
467
|
+
>
|
|
468
|
+
Cookie-Einstellungen
|
|
469
|
+
</button>
|
|
470
|
+
|
|
471
|
+
<%# B4UM_FOOTER_LINKS %>
|
|
472
|
+
ERB
|
|
473
|
+
)
|
|
474
|
+
end
|
|
475
|
+
|
|
476
|
+
def ensure_page_top_anchor(layout_path, full_layout_path)
|
|
477
|
+
layout = File.read(full_layout_path)
|
|
478
|
+
|
|
479
|
+
return if layout.include?('id="b4um-page-top"')
|
|
480
|
+
|
|
481
|
+
gsub_file(
|
|
482
|
+
layout_path,
|
|
483
|
+
"<body>",
|
|
484
|
+
<<~ERB.chomp
|
|
485
|
+
<body>
|
|
486
|
+
<div id="b4um-page-top"></div>
|
|
487
|
+
ERB
|
|
488
|
+
)
|
|
489
|
+
end
|
|
490
|
+
end
|
|
491
|
+
end
|
|
492
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<div
|
|
2
|
+
class="b4um-cookie-consent"
|
|
3
|
+
data-controller="cookie-consent"
|
|
4
|
+
data-cookie-consent-target="banner"
|
|
5
|
+
hidden
|
|
6
|
+
>
|
|
7
|
+
<div class="b4um-cookie-consent__content">
|
|
8
|
+
<p class="b4um-cookie-consent__text">
|
|
9
|
+
Diese Website verwendet optionale Cookies. Du kannst selbst entscheiden,
|
|
10
|
+
ob du diese zulassen möchtest.
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<div class="b4um-cookie-consent__actions">
|
|
14
|
+
<button
|
|
15
|
+
type="button"
|
|
16
|
+
class="button button--secondary"
|
|
17
|
+
data-action="cookie-consent#reject"
|
|
18
|
+
>
|
|
19
|
+
Ablehnen
|
|
20
|
+
</button>
|
|
21
|
+
|
|
22
|
+
<button type="button" class="button" data-action="cookie-consent#accept">
|
|
23
|
+
Akzeptieren
|
|
24
|
+
</button>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<footer class="b4um-footer">
|
|
2
|
+
<a class="b4um-footer__back-to-top" href="#b4um-page-top">
|
|
3
|
+
Zurück zum Seitenanfang
|
|
4
|
+
</a>
|
|
5
|
+
|
|
6
|
+
<div class="b4um-footer__inner">
|
|
7
|
+
<p class="b4um-footer__copyright">
|
|
8
|
+
©
|
|
9
|
+
<%= Time.current.year %>
|
|
10
|
+
Deine Anwendung
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<nav class="b4um-footer__links" aria-label="Rechtliche Hinweise">
|
|
14
|
+
<%# B4UM_FOOTER_LINKS %>
|
|
15
|
+
</nav>
|
|
16
|
+
</div>
|
|
17
|
+
</footer>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<section class="b4um-hero b4um-hero--text-only">
|
|
2
|
+
<div class="b4um-hero__content">
|
|
3
|
+
<p class="b4um-hero__eyebrow">
|
|
4
|
+
Willkommen
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<h1 class="b4um-hero__title">
|
|
8
|
+
Deine Anwendung
|
|
9
|
+
</h1>
|
|
10
|
+
|
|
11
|
+
<p class="b4um-hero__text">
|
|
12
|
+
Hier kannst du deine Anwendung mit einer kurzen Beschreibung vorstellen.
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<%# Optionaler Hero-Link:
|
|
16
|
+
Füge hier einen Link mit der Klasse "button button--primary" ein.
|
|
17
|
+
Beispiel:
|
|
18
|
+
link_to "Mehr erfahren", about_path, class: "button button--primary"
|
|
19
|
+
%>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<%# Optionales Hero-Bild:
|
|
23
|
+
Entferne "b4um-hero--text-only" oben und aktiviere den Bereich unten.
|
|
24
|
+
%>
|
|
25
|
+
|
|
26
|
+
<!--
|
|
27
|
+
<div class="b4um-hero__media">
|
|
28
|
+
Hero-Bild hier einfügen.
|
|
29
|
+
Beispiel:
|
|
30
|
+
image_tag "hero.jpg", class: "b4um-hero__image", alt: ""
|
|
31
|
+
</div>
|
|
32
|
+
-->
|
|
33
|
+
</section>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<nav
|
|
2
|
+
class="navigation"
|
|
3
|
+
aria-label="Main navigation"
|
|
4
|
+
data-controller="navigation"
|
|
5
|
+
>
|
|
6
|
+
<div class="navigation__inner">
|
|
7
|
+
<%= link_to "b4um", "/", class: "navigation__brand" %>
|
|
8
|
+
|
|
9
|
+
<button
|
|
10
|
+
class="navigation__toggle"
|
|
11
|
+
type="button"
|
|
12
|
+
aria-label="Open navigation"
|
|
13
|
+
aria-expanded="false"
|
|
14
|
+
aria-controls="navigation-menu"
|
|
15
|
+
data-navigation-target="toggle"
|
|
16
|
+
data-action="click->navigation#toggle"
|
|
17
|
+
>
|
|
18
|
+
<span class="navigation__toggle-line"></span>
|
|
19
|
+
<span class="navigation__toggle-line"></span>
|
|
20
|
+
<span class="navigation__toggle-line"></span>
|
|
21
|
+
</button>
|
|
22
|
+
|
|
23
|
+
<div
|
|
24
|
+
class="navigation__menu"
|
|
25
|
+
id="navigation-menu"
|
|
26
|
+
data-navigation-target="menu"
|
|
27
|
+
>
|
|
28
|
+
<%# B4UM_NAVIGATION_LINKS %>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</nav>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<div
|
|
2
|
+
class="b4um-footer__sitemap"
|
|
3
|
+
data-controller="sitemap"
|
|
4
|
+
data-action="resize@window->sitemap#reset"
|
|
5
|
+
>
|
|
6
|
+
<nav class="b4um-sitemap" aria-label="Sitemap">
|
|
7
|
+
<% b4um_sitemap_columns.each do |column| %>
|
|
8
|
+
<% column_key = column["key"].to_s %>
|
|
9
|
+
|
|
10
|
+
<div class="b4um-sitemap__item">
|
|
11
|
+
<button
|
|
12
|
+
type="button"
|
|
13
|
+
class="b4um-sitemap__title"
|
|
14
|
+
aria-expanded="false"
|
|
15
|
+
aria-controls="b4um-sitemap-<%= column_key.tr("_", "-") %>"
|
|
16
|
+
data-sitemap-target="title"
|
|
17
|
+
data-action="sitemap#toggle"
|
|
18
|
+
>
|
|
19
|
+
<%= column["title"] %>
|
|
20
|
+
</button>
|
|
21
|
+
|
|
22
|
+
<div class="b4um-sitemap__content">
|
|
23
|
+
<ul
|
|
24
|
+
id="b4um-sitemap-<%= column_key.tr("_", "-") %>"
|
|
25
|
+
class="b4um-sitemap__list"
|
|
26
|
+
data-sitemap-target="list"
|
|
27
|
+
>
|
|
28
|
+
<% Array(column["links"]).each do |link| %>
|
|
29
|
+
<% path = b4um_sitemap_path(link["route"]) %>
|
|
30
|
+
|
|
31
|
+
<% if path %>
|
|
32
|
+
<li>
|
|
33
|
+
<%= link_to link["title"],
|
|
34
|
+
path,
|
|
35
|
+
class: [
|
|
36
|
+
"b4um-sitemap__link",
|
|
37
|
+
("is-active" if current_page?(path)),
|
|
38
|
+
].compact.join(" "),
|
|
39
|
+
aria: (current_page?(path) ? { current: "page" } : {}) %>
|
|
40
|
+
</li>
|
|
41
|
+
<% end %>
|
|
42
|
+
<% end %>
|
|
43
|
+
</ul>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
<% end %>
|
|
47
|
+
</nav>
|
|
48
|
+
</div>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<div class="b4um-theme-switcher" data-controller="theme">
|
|
2
|
+
<div class="b4um-theme-switcher__menu" data-theme-target="menu" hidden>
|
|
3
|
+
<div class="b4um-theme-switcher__title">
|
|
4
|
+
Darstellung
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<button
|
|
8
|
+
type="button"
|
|
9
|
+
class="b4um-theme-switcher__option"
|
|
10
|
+
data-theme-target="option"
|
|
11
|
+
data-theme-value="system"
|
|
12
|
+
data-action="theme#select"
|
|
13
|
+
role="menuitemradio"
|
|
14
|
+
aria-checked="false"
|
|
15
|
+
>
|
|
16
|
+
<span class="b4um-theme-switcher__indicator" aria-hidden="true"></span>
|
|
17
|
+
System
|
|
18
|
+
</button>
|
|
19
|
+
|
|
20
|
+
<button
|
|
21
|
+
type="button"
|
|
22
|
+
class="b4um-theme-switcher__option"
|
|
23
|
+
data-theme-target="option"
|
|
24
|
+
data-theme-value="light"
|
|
25
|
+
data-action="theme#select"
|
|
26
|
+
role="menuitemradio"
|
|
27
|
+
aria-checked="false"
|
|
28
|
+
>
|
|
29
|
+
<span class="b4um-theme-switcher__indicator" aria-hidden="true"></span>
|
|
30
|
+
Hell
|
|
31
|
+
</button>
|
|
32
|
+
|
|
33
|
+
<button
|
|
34
|
+
type="button"
|
|
35
|
+
class="b4um-theme-switcher__option"
|
|
36
|
+
data-theme-target="option"
|
|
37
|
+
data-theme-value="dark"
|
|
38
|
+
data-action="theme#select"
|
|
39
|
+
role="menuitemradio"
|
|
40
|
+
aria-checked="false"
|
|
41
|
+
>
|
|
42
|
+
<span class="b4um-theme-switcher__indicator" aria-hidden="true"></span>
|
|
43
|
+
Dunkel
|
|
44
|
+
</button>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<button
|
|
48
|
+
type="button"
|
|
49
|
+
class="b4um-theme-switcher__toggle"
|
|
50
|
+
data-theme-target="toggle"
|
|
51
|
+
data-action="theme#toggle"
|
|
52
|
+
aria-expanded="false"
|
|
53
|
+
aria-label="Darstellung ändern"
|
|
54
|
+
>
|
|
55
|
+
<span data-theme-target="icon" aria-hidden="true">◐</span>
|
|
56
|
+
</button>
|
|
57
|
+
</div>
|