roda-gen 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 +7 -0
- data/CHANGELOG.md +9 -0
- data/LICENSE.txt +21 -0
- data/README.md +94 -0
- data/bin/roda +11 -0
- data/lib/roda-gen.rb +3 -0
- data/lib/roda_gen/app_name.rb +29 -0
- data/lib/roda_gen/cli.rb +122 -0
- data/lib/roda_gen/generators/daemon.rb +78 -0
- data/lib/roda_gen/generators/migration.rb +68 -0
- data/lib/roda_gen/generators/migration_numbering.rb +21 -0
- data/lib/roda_gen/generators/model.rb +75 -0
- data/lib/roda_gen/generators/project.rb +145 -0
- data/lib/roda_gen/generators/route.rb +71 -0
- data/lib/roda_gen/generators/templates/daemon/bin/%daemon_name%.tt +13 -0
- data/lib/roda_gen/generators/templates/daemon/lib/daemon/%daemon_name%.rb.tt +22 -0
- data/lib/roda_gen/generators/templates/daemon/spec/daemons/%daemon_name%_spec.rb.tt +18 -0
- data/lib/roda_gen/generators/templates/migration/db/migrate/%migration_filename%.rb.tt +6 -0
- data/lib/roda_gen/generators/templates/model/db/migrate/%migration_filename%.rb.tt +12 -0
- data/lib/roda_gen/generators/templates/model/models/%resource_name%.rb.tt +5 -0
- data/lib/roda_gen/generators/templates/model/spec/models/%resource_name%_spec.rb.tt +18 -0
- data/lib/roda_gen/generators/templates/project/%app_name%.rb.tt +43 -0
- data/lib/roda_gen/generators/templates/project/.bundle/config.tt +3 -0
- data/lib/roda_gen/generators/templates/project/.erb_lint.yml.tt +29 -0
- data/lib/roda_gen/generators/templates/project/.gitignore.tt +19 -0
- data/lib/roda_gen/generators/templates/project/.reek.yml.tt +45 -0
- data/lib/roda_gen/generators/templates/project/.rspec.tt +4 -0
- data/lib/roda_gen/generators/templates/project/.rubocop.yml.tt +119 -0
- data/lib/roda_gen/generators/templates/project/.ruby-version.tt +1 -0
- data/lib/roda_gen/generators/templates/project/.rubycritic.yml.tt +15 -0
- data/lib/roda_gen/generators/templates/project/Gemfile.tt +109 -0
- data/lib/roda_gen/generators/templates/project/Procfile.dev.tt +7 -0
- data/lib/roda_gen/generators/templates/project/README.md.tt +891 -0
- data/lib/roda_gen/generators/templates/project/Rakefile.tt +3 -0
- data/lib/roda_gen/generators/templates/project/assets/javascripts/admin.js.tt +84 -0
- data/lib/roda_gen/generators/templates/project/assets/javascripts/app.js.tt +29 -0
- data/lib/roda_gen/generators/templates/project/assets/javascripts/push.js.tt +53 -0
- data/lib/roda_gen/generators/templates/project/assets/javascripts/upload.js.tt +200 -0
- data/lib/roda_gen/generators/templates/project/assets/stylesheets/app.css.tt +52 -0
- data/lib/roda_gen/generators/templates/project/assets/stylesheets/typography.css.tt +85 -0
- data/lib/roda_gen/generators/templates/project/bin/console.tt +2 -0
- data/lib/roda_gen/generators/templates/project/bin/dev.tt +8 -0
- data/lib/roda_gen/generators/templates/project/bin/gdpr_worker.tt +13 -0
- data/lib/roda_gen/generators/templates/project/bin/push_sender.tt +13 -0
- data/lib/roda_gen/generators/templates/project/bin/setup.tt +224 -0
- data/lib/roda_gen/generators/templates/project/bin/shrine_clean_cache.tt +13 -0
- data/lib/roda_gen/generators/templates/project/config/boot.rb.tt +23 -0
- data/lib/roda_gen/generators/templates/project/config/console.rb.tt +20 -0
- data/lib/roda_gen/generators/templates/project/config/database.rb.tt +45 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/00_environments.rb.tt +5 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/01_logger.rb.tt +46 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/02_app_config.rb.tt +19 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/10_database.rb.tt +3 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/15_mail.rb.tt +53 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/20_redis.rb.tt +13 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/25_rack_attack.rb.tt +96 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/30_i18n.rb.tt +37 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/35_listen_job.rb.tt +4 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/37_shrine.rb.tt +20 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/40_routing.rb.tt +20 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/41_render.rb.tt +10 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/43_static.rb.tt +30 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/44_sessions.rb.tt +62 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/45_security.rb.tt +49 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/46_flash.rb.tt +5 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/47_json.rb.tt +8 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/48_errors.rb.tt +43 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/49_misc.rb.tt +26 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/50_mailer.rb.tt +52 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/51_locale_kit.rb.tt +29 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/52_consent_kit.rb.tt +28 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/55_audit_log.rb.tt +16 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/56_form_helper.rb.tt +7 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/57_rodauth.rb.tt +304 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/60_web_push.rb.tt +12 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/61_flipper.rb.tt +15 -0
- data/lib/roda_gen/generators/templates/project/config/initializers/62_split.rb.tt +15 -0
- data/lib/roda_gen/generators/templates/project/config/puma.rb.tt +24 -0
- data/lib/roda_gen/generators/templates/project/config/settings/development.yml.tt +9 -0
- data/lib/roda_gen/generators/templates/project/config/settings/production.yml.tt +13 -0
- data/lib/roda_gen/generators/templates/project/config/settings/test.yml.tt +9 -0
- data/lib/roda_gen/generators/templates/project/config/settings.yml.tt +45 -0
- data/lib/roda_gen/generators/templates/project/config.ru.tt +36 -0
- data/lib/roda_gen/generators/templates/project/db/migrate/create_account_profiles.rb.tt +66 -0
- data/lib/roda_gen/generators/templates/project/db/migrate/create_accounts.rb.tt +70 -0
- data/lib/roda_gen/generators/templates/project/db/migrate/create_audit_log.rb.tt +185 -0
- data/lib/roda_gen/generators/templates/project/db/migrate/create_authorization.rb.tt +68 -0
- data/lib/roda_gen/generators/templates/project/db/migrate/create_countries.rb.tt +13 -0
- data/lib/roda_gen/generators/templates/project/db/migrate/create_country_calling_codes.rb.tt +15 -0
- data/lib/roda_gen/generators/templates/project/db/migrate/create_country_exit_codes.rb.tt +13 -0
- data/lib/roda_gen/generators/templates/project/db/migrate/create_country_languages.rb.tt +19 -0
- data/lib/roda_gen/generators/templates/project/db/migrate/create_country_time_zones.rb.tt +11 -0
- data/lib/roda_gen/generators/templates/project/db/migrate/create_currencies.rb.tt +12 -0
- data/lib/roda_gen/generators/templates/project/db/migrate/create_gdpr_requests.rb.tt +43 -0
- data/lib/roda_gen/generators/templates/project/db/migrate/create_languages.rb.tt +11 -0
- data/lib/roda_gen/generators/templates/project/db/migrate/create_push_subscriptions.rb.tt +16 -0
- data/lib/roda_gen/generators/templates/project/db/migrate/create_rodauth_features.rb.tt +105 -0
- data/lib/roda_gen/generators/templates/project/db/migrate/create_settings.rb.tt +60 -0
- data/lib/roda_gen/generators/templates/project/db/seeds/01_countries.csv.tt +250 -0
- data/lib/roda_gen/generators/templates/project/db/seeds/01_currencies.csv.tt +162 -0
- data/lib/roda_gen/generators/templates/project/db/seeds/01_languages.csv.tt +144 -0
- data/lib/roda_gen/generators/templates/project/db/seeds/02_country_calling_codes.csv.tt +237 -0
- data/lib/roda_gen/generators/templates/project/db/seeds/02_country_exit_codes.csv.tt +239 -0
- data/lib/roda_gen/generators/templates/project/db/seeds/02_country_languages.csv.tt +226 -0
- data/lib/roda_gen/generators/templates/project/db/seeds/02_country_time_zones.csv.tt +369 -0
- data/lib/roda_gen/generators/templates/project/db/seeds/03_setting_system_defaults.yml.tt +35 -0
- data/lib/roda_gen/generators/templates/project/db/seeds.rb.tt +69 -0
- data/lib/roda_gen/generators/templates/project/deploy/Caddyfile.tt +69 -0
- data/lib/roda_gen/generators/templates/project/deploy/logrotate/%app_name%-caddy.tt +11 -0
- data/lib/roda_gen/generators/templates/project/deploy/systemd/%app_name%-audit-partition.service.tt +21 -0
- data/lib/roda_gen/generators/templates/project/deploy/systemd/%app_name%-audit-partition.timer.tt +16 -0
- data/lib/roda_gen/generators/templates/project/deploy/systemd/%app_name%-gdpr-worker.service.tt +25 -0
- data/lib/roda_gen/generators/templates/project/deploy/systemd/%app_name%-push-sender.service.tt +25 -0
- data/lib/roda_gen/generators/templates/project/deploy/systemd/%app_name%-shrine-cleanup.service.tt +21 -0
- data/lib/roda_gen/generators/templates/project/deploy/systemd/%app_name%-shrine-cleanup.timer.tt +16 -0
- data/lib/roda_gen/generators/templates/project/deploy/systemd/%app_name%.service.tt +36 -0
- data/lib/roda_gen/generators/templates/project/helpers/audit_helper.rb.tt +59 -0
- data/lib/roda_gen/generators/templates/project/helpers/authorization_helper.rb.tt +25 -0
- data/lib/roda_gen/generators/templates/project/helpers/current_account_helper.rb.tt +33 -0
- data/lib/roda_gen/generators/templates/project/helpers/feature_flag_helper.rb.tt +34 -0
- data/lib/roda_gen/generators/templates/project/helpers/form_helper.rb.tt +50 -0
- data/lib/roda_gen/generators/templates/project/helpers/http_cache_helper.rb.tt +15 -0
- data/lib/roda_gen/generators/templates/project/helpers/logger_helper.rb.tt +7 -0
- data/lib/roda_gen/generators/templates/project/helpers/split_helper.rb.tt +22 -0
- data/lib/roda_gen/generators/templates/project/lib/audit_context.rb.tt +26 -0
- data/lib/roda_gen/generators/templates/project/lib/audit_lookup.rb.tt +21 -0
- data/lib/roda_gen/generators/templates/project/lib/daemon/base.rb.tt +104 -0
- data/lib/roda_gen/generators/templates/project/lib/daemon/gdpr_worker.rb.tt +53 -0
- data/lib/roda_gen/generators/templates/project/lib/daemon/push_sender.rb.tt +47 -0
- data/lib/roda_gen/generators/templates/project/lib/daemon/shrine_cache_cleaner.rb.tt +22 -0
- data/lib/roda_gen/generators/templates/project/lib/deploy_check.rb.tt +96 -0
- data/lib/roda_gen/generators/templates/project/lib/filtered_logger.rb.tt +54 -0
- data/lib/roda_gen/generators/templates/project/lib/gdpr.rb.tt +106 -0
- data/lib/roda_gen/generators/templates/project/lib/rbac_audit.rb.tt +47 -0
- data/lib/roda_gen/generators/templates/project/lib/tasks/.rubocop.yml.tt +4 -0
- data/lib/roda_gen/generators/templates/project/lib/tasks/audit.rake.tt +85 -0
- data/lib/roda_gen/generators/templates/project/lib/tasks/console.rake.tt +8 -0
- data/lib/roda_gen/generators/templates/project/lib/tasks/db.rake.tt +104 -0
- data/lib/roda_gen/generators/templates/project/lib/tasks/deploy.rake.tt +38 -0
- data/lib/roda_gen/generators/templates/project/lib/tasks/flags.rake.tt +47 -0
- data/lib/roda_gen/generators/templates/project/lib/tasks/gdpr.rake.tt +31 -0
- data/lib/roda_gen/generators/templates/project/lib/tasks/parser_current_shim.rb.tt +13 -0
- data/lib/roda_gen/generators/templates/project/lib/tasks/quality.rake.tt +84 -0
- data/lib/roda_gen/generators/templates/project/lib/tasks/secrets.rake.tt +154 -0
- data/lib/roda_gen/generators/templates/project/lib/tasks/spec.rake.tt +136 -0
- data/lib/roda_gen/generators/templates/project/lib/tasks/split.rake.tt +27 -0
- data/lib/roda_gen/generators/templates/project/lib/tasks/tailwind.rake.tt +35 -0
- data/lib/roda_gen/generators/templates/project/locales/de.yml.tt +325 -0
- data/lib/roda_gen/generators/templates/project/locales/en.yml.tt +321 -0
- data/lib/roda_gen/generators/templates/project/locales/es.yml.tt +326 -0
- data/lib/roda_gen/generators/templates/project/locales/fr.yml.tt +329 -0
- data/lib/roda_gen/generators/templates/project/locales/it.yml.tt +325 -0
- data/lib/roda_gen/generators/templates/project/locales/rodauth/de.yml.tt +5 -0
- data/lib/roda_gen/generators/templates/project/locales/rodauth/en.yml.tt +6 -0
- data/lib/roda_gen/generators/templates/project/locales/rodauth/es.yml.tt +5 -0
- data/lib/roda_gen/generators/templates/project/locales/rodauth/fr.yml.tt +5 -0
- data/lib/roda_gen/generators/templates/project/locales/rodauth/it.yml.tt +5 -0
- data/lib/roda_gen/generators/templates/project/locales/rodauth/sv.yml.tt +274 -0
- data/lib/roda_gen/generators/templates/project/locales/rodauth/tru.yml.tt +274 -0
- data/lib/roda_gen/generators/templates/project/locales/sv.yml.tt +319 -0
- data/lib/roda_gen/generators/templates/project/locales/tru.yml.tt +294 -0
- data/lib/roda_gen/generators/templates/project/log/.keep.tt +0 -0
- data/lib/roda_gen/generators/templates/project/models/account.rb.tt +50 -0
- data/lib/roda_gen/generators/templates/project/models/account_privilege.rb.tt +15 -0
- data/lib/roda_gen/generators/templates/project/models/account_profile.rb.tt +115 -0
- data/lib/roda_gen/generators/templates/project/models/account_role.rb.tt +14 -0
- data/lib/roda_gen/generators/templates/project/models/audit_action.rb.tt +23 -0
- data/lib/roda_gen/generators/templates/project/models/audit_actor_type.rb.tt +10 -0
- data/lib/roda_gen/generators/templates/project/models/audit_log.rb.tt +257 -0
- data/lib/roda_gen/generators/templates/project/models/audit_status.rb.tt +9 -0
- data/lib/roda_gen/generators/templates/project/models/country.rb.tt +17 -0
- data/lib/roda_gen/generators/templates/project/models/country_calling_code.rb.tt +7 -0
- data/lib/roda_gen/generators/templates/project/models/country_exit_code.rb.tt +7 -0
- data/lib/roda_gen/generators/templates/project/models/country_language.rb.tt +8 -0
- data/lib/roda_gen/generators/templates/project/models/country_time_zone.rb.tt +7 -0
- data/lib/roda_gen/generators/templates/project/models/currency.rb.tt +7 -0
- data/lib/roda_gen/generators/templates/project/models/gdpr_request.rb.tt +32 -0
- data/lib/roda_gen/generators/templates/project/models/gender.rb.tt +7 -0
- data/lib/roda_gen/generators/templates/project/models/language.rb.tt +13 -0
- data/lib/roda_gen/generators/templates/project/models/privilege.rb.tt +21 -0
- data/lib/roda_gen/generators/templates/project/models/push_subscription.rb.tt +10 -0
- data/lib/roda_gen/generators/templates/project/models/role.rb.tt +21 -0
- data/lib/roda_gen/generators/templates/project/models/role_privilege.rb.tt +14 -0
- data/lib/roda_gen/generators/templates/project/models/setting_system_default.rb.tt +11 -0
- data/lib/roda_gen/generators/templates/project/models/setting_user_value.rb.tt +12 -0
- data/lib/roda_gen/generators/templates/project/models/settings.rb.tt +22 -0
- data/lib/roda_gen/generators/templates/project/models/signup_form_data.rb.tt +61 -0
- data/lib/roda_gen/generators/templates/project/models.rb.tt +6 -0
- data/lib/roda_gen/generators/templates/project/package.json.tt +13 -0
- data/lib/roda_gen/generators/templates/project/public/apple-touch-icon.png +0 -0
- data/lib/roda_gen/generators/templates/project/public/favicon.ico +0 -0
- data/lib/roda_gen/generators/templates/project/public/favicon.svg.tt +5 -0
- data/lib/roda_gen/generators/templates/project/public/fonts/JetBrainsMono-Italic-Variable.woff2 +0 -0
- data/lib/roda_gen/generators/templates/project/public/fonts/JetBrainsMono-Variable.woff2 +0 -0
- data/lib/roda_gen/generators/templates/project/public/fonts/Lato-Bold.woff2 +0 -0
- data/lib/roda_gen/generators/templates/project/public/fonts/Lato-BoldItalic.woff2 +0 -0
- data/lib/roda_gen/generators/templates/project/public/fonts/Lato-Italic.woff2 +0 -0
- data/lib/roda_gen/generators/templates/project/public/fonts/Lato-Regular.woff2 +0 -0
- data/lib/roda_gen/generators/templates/project/public/fonts/NOTICE.md +17 -0
- data/lib/roda_gen/generators/templates/project/public/fonts/NotoSansSyriac-Bold.woff2 +0 -0
- data/lib/roda_gen/generators/templates/project/public/fonts/NotoSansSyriac-Regular.woff2 +0 -0
- data/lib/roda_gen/generators/templates/project/public/fonts/NotoSansSyriacWestern-Bold.woff2 +0 -0
- data/lib/roda_gen/generators/templates/project/public/fonts/NotoSansSyriacWestern-Regular.woff2 +0 -0
- data/lib/roda_gen/generators/templates/project/public/manifest.webmanifest.tt +12 -0
- data/lib/roda_gen/generators/templates/project/public/robots.txt.tt +4 -0
- data/lib/roda_gen/generators/templates/project/public/service-worker.js.tt +27 -0
- data/lib/roda_gen/generators/templates/project/routes/account.rb.tt +10 -0
- data/lib/roda_gen/generators/templates/project/routes/admin.rb.tt +118 -0
- data/lib/roda_gen/generators/templates/project/routes/gdpr.rb.tt +32 -0
- data/lib/roda_gen/generators/templates/project/routes/heartbeat.rb.tt +35 -0
- data/lib/roda_gen/generators/templates/project/routes/legal.rb.tt +20 -0
- data/lib/roda_gen/generators/templates/project/routes/profile.rb.tt +56 -0
- data/lib/roda_gen/generators/templates/project/routes/push.rb.tt +25 -0
- data/lib/roda_gen/generators/templates/project/spec/browser/role_boundary_spec.rb.tt +10 -0
- data/lib/roda_gen/generators/templates/project/spec/browser/spec_helper.rb.tt +146 -0
- data/lib/roda_gen/generators/templates/project/spec/browser/support/auth_helpers.rb.tt +71 -0
- data/lib/roda_gen/generators/templates/project/spec/browser/uat/auth_spec.rb.tt +25 -0
- data/lib/roda_gen/generators/templates/project/spec/browser/uat/consent_nojs_spec.rb.tt +60 -0
- data/lib/roda_gen/generators/templates/project/spec/browser/uat/create_account_form_spec.rb.tt +26 -0
- data/lib/roda_gen/generators/templates/project/spec/browser/uat/otp_lifecycle_spec.rb.tt +67 -0
- data/lib/roda_gen/generators/templates/project/spec/browser/uat/profile_form_spec.rb.tt +17 -0
- data/lib/roda_gen/generators/templates/project/spec/browser/uat/upload_spec.rb.tt +102 -0
- data/lib/roda_gen/generators/templates/project/spec/browser/wcag/auth_pages_spec.rb.tt +61 -0
- data/lib/roda_gen/generators/templates/project/spec/browser/wcag/legal_pages_spec.rb.tt +33 -0
- data/lib/roda_gen/generators/templates/project/spec/daemons/base_spec.rb.tt +106 -0
- data/lib/roda_gen/generators/templates/project/spec/daemons/gdpr_worker_spec.rb.tt +72 -0
- data/lib/roda_gen/generators/templates/project/spec/daemons/push_sender_spec.rb.tt +74 -0
- data/lib/roda_gen/generators/templates/project/spec/locale_parity_spec.rb.tt +58 -0
- data/lib/roda_gen/generators/templates/project/spec/models/account_profile_spec.rb.tt +180 -0
- data/lib/roda_gen/generators/templates/project/spec/models/account_spec.rb.tt +104 -0
- data/lib/roda_gen/generators/templates/project/spec/models/audit_actor_type_spec.rb.tt +7 -0
- data/lib/roda_gen/generators/templates/project/spec/models/audit_log_spec.rb.tt +398 -0
- data/lib/roda_gen/generators/templates/project/spec/models/audit_status_spec.rb.tt +7 -0
- data/lib/roda_gen/generators/templates/project/spec/models/authorization_spec.rb.tt +82 -0
- data/lib/roda_gen/generators/templates/project/spec/models/country_calling_code_spec.rb.tt +11 -0
- data/lib/roda_gen/generators/templates/project/spec/models/country_exit_code_spec.rb.tt +10 -0
- data/lib/roda_gen/generators/templates/project/spec/models/country_language_spec.rb.tt +21 -0
- data/lib/roda_gen/generators/templates/project/spec/models/country_spec.rb.tt +29 -0
- data/lib/roda_gen/generators/templates/project/spec/models/country_time_zone_spec.rb.tt +9 -0
- data/lib/roda_gen/generators/templates/project/spec/models/currency_spec.rb.tt +9 -0
- data/lib/roda_gen/generators/templates/project/spec/models/deploy_check_spec.rb.tt +143 -0
- data/lib/roda_gen/generators/templates/project/spec/models/gdpr_spec.rb.tt +110 -0
- data/lib/roda_gen/generators/templates/project/spec/models/language_spec.rb.tt +15 -0
- data/lib/roda_gen/generators/templates/project/spec/models/rbac_audit_spec.rb.tt +110 -0
- data/lib/roda_gen/generators/templates/project/spec/models/setting_system_default_spec.rb.tt +26 -0
- data/lib/roda_gen/generators/templates/project/spec/models/setting_user_value_spec.rb.tt +33 -0
- data/lib/roda_gen/generators/templates/project/spec/models/settings_spec.rb.tt +63 -0
- data/lib/roda_gen/generators/templates/project/spec/models/signup_form_data_spec.rb.tt +22 -0
- data/lib/roda_gen/generators/templates/project/spec/spec_helper.rb.tt +93 -0
- data/lib/roda_gen/generators/templates/project/spec/support/audit_log_helpers.rb.tt +21 -0
- data/lib/roda_gen/generators/templates/project/spec/support/audit_lookup_shared_examples.rb.tt +19 -0
- data/lib/roda_gen/generators/templates/project/spec/support/auth_helpers.rb.tt +62 -0
- data/lib/roda_gen/generators/templates/project/spec/support/faker.rb.tt +30 -0
- data/lib/roda_gen/generators/templates/project/spec/web/admin_spec.rb.tt +155 -0
- data/lib/roda_gen/generators/templates/project/spec/web/audit_log_spec.rb.tt +159 -0
- data/lib/roda_gen/generators/templates/project/spec/web/auth_spec.rb.tt +492 -0
- data/lib/roda_gen/generators/templates/project/spec/web/authorization_spec.rb.tt +110 -0
- data/lib/roda_gen/generators/templates/project/spec/web/boot_spec.rb.tt +27 -0
- data/lib/roda_gen/generators/templates/project/spec/web/consent_banner_spec.rb.tt +46 -0
- data/lib/roda_gen/generators/templates/project/spec/web/feature_flag_helper_spec.rb.tt +33 -0
- data/lib/roda_gen/generators/templates/project/spec/web/flags_spec.rb.tt +67 -0
- data/lib/roda_gen/generators/templates/project/spec/web/gdpr_spec.rb.tt +55 -0
- data/lib/roda_gen/generators/templates/project/spec/web/heartbeat_spec.rb.tt +65 -0
- data/lib/roda_gen/generators/templates/project/spec/web/host_allowlist_spec.rb.tt +27 -0
- data/lib/roda_gen/generators/templates/project/spec/web/legal_spec.rb.tt +61 -0
- data/lib/roda_gen/generators/templates/project/spec/web/locale_resolver_spec.rb.tt +34 -0
- data/lib/roda_gen/generators/templates/project/spec/web/logger_helper_spec.rb.tt +23 -0
- data/lib/roda_gen/generators/templates/project/spec/web/logger_spec.rb.tt +82 -0
- data/lib/roda_gen/generators/templates/project/spec/web/otp_audit_spec.rb.tt +147 -0
- data/lib/roda_gen/generators/templates/project/spec/web/profile_spec.rb.tt +97 -0
- data/lib/roda_gen/generators/templates/project/spec/web/push_spec.rb.tt +55 -0
- data/lib/roda_gen/generators/templates/project/spec/web/rack_attack_runtime_spec.rb.tt +52 -0
- data/lib/roda_gen/generators/templates/project/spec/web/rack_attack_spec.rb.tt +81 -0
- data/lib/roda_gen/generators/templates/project/spec/web/rbac_audit_spec.rb.tt +62 -0
- data/lib/roda_gen/generators/templates/project/spec/web/request_id_spec.rb.tt +62 -0
- data/lib/roda_gen/generators/templates/project/spec/web/role_boundary_spec.rb.tt +21 -0
- data/lib/roda_gen/generators/templates/project/spec/web/session_skip_spec.rb.tt +74 -0
- data/lib/roda_gen/generators/templates/project/spec/web/split_helper_spec.rb.tt +38 -0
- data/lib/roda_gen/generators/templates/project/spec/web/type_routing_spec.rb.tt +55 -0
- data/lib/roda_gen/generators/templates/project/spec/web/upload_zone_spec.rb.tt +91 -0
- data/lib/roda_gen/generators/templates/project/tmp/.keep.tt +0 -0
- data/lib/roda_gen/generators/templates/project/vendor/.keep.tt +0 -0
- data/lib/roda_gen/generators/templates/project/views/403.erb.tt +10 -0
- data/lib/roda_gen/generators/templates/project/views/404.erb.tt +10 -0
- data/lib/roda_gen/generators/templates/project/views/500.erb.tt +12 -0
- data/lib/roda_gen/generators/templates/project/views/_head_meta.erb.tt +29 -0
- data/lib/roda_gen/generators/templates/project/views/_impersonate_picker.erb.tt +21 -0
- data/lib/roda_gen/generators/templates/project/views/_language_switcher.erb.tt +22 -0
- data/lib/roda_gen/generators/templates/project/views/_locked_accounts.erb.tt +18 -0
- data/lib/roda_gen/generators/templates/project/views/_upload_zone.erb.tt +35 -0
- data/lib/roda_gen/generators/templates/project/views/account/profile.erb.tt +149 -0
- data/lib/roda_gen/generators/templates/project/views/admin/flags.erb.tt +51 -0
- data/lib/roda_gen/generators/templates/project/views/consent_kit/_banner.erb.tt +59 -0
- data/lib/roda_gen/generators/templates/project/views/consent_kit/_preferences.erb.tt +87 -0
- data/lib/roda_gen/generators/templates/project/views/gdpr/erased.erb.tt +6 -0
- data/lib/roda_gen/generators/templates/project/views/gdpr/index.erb.tt +28 -0
- data/lib/roda_gen/generators/templates/project/views/layout.erb.tt +112 -0
- data/lib/roda_gen/generators/templates/project/views/legal/contact.erb.tt +44 -0
- data/lib/roda_gen/generators/templates/project/views/legal/cookies.erb.tt +47 -0
- data/lib/roda_gen/generators/templates/project/views/legal/disclaimer.erb.tt +19 -0
- data/lib/roda_gen/generators/templates/project/views/legal/privacy.erb.tt +26 -0
- data/lib/roda_gen/generators/templates/project/views/mailers/account_unlocked.erb.tt +5 -0
- data/lib/roda_gen/generators/templates/project/views/mailers/data_erased.erb.tt +5 -0
- data/lib/roda_gen/generators/templates/project/views/mailers/data_export.erb.tt +5 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/add-recovery-codes.erb.tt +30 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/change-login.erb.tt +44 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/change-password.erb.tt +41 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/close-account.erb.tt +27 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/confirm-password.erb.tt +23 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/create-account.erb.tt +183 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/login.erb.tt +51 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/logout.erb.tt +10 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/otp-auth.erb.tt +26 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/otp-disable.erb.tt +27 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/otp-setup.erb.tt +48 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/otp-unlock-not-available.erb.tt +18 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/otp-unlock.erb.tt +28 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/recovery-auth.erb.tt +23 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/recovery-codes.erb.tt +26 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/remember.erb.tt +35 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/reset-password-request.erb.tt +27 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/reset-password.erb.tt +30 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/two-factor-auth.erb.tt +8 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/two-factor-disable.erb.tt +20 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/two-factor-manage.erb.tt +36 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/unlock-account-request.erb.tt +13 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/unlock-account.erb.tt +23 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/verify-account-resend.erb.tt +26 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/verify-account.erb.tt +32 -0
- data/lib/roda_gen/generators/templates/project/views/rodauth/verify-login-change.erb.tt +8 -0
- data/lib/roda_gen/generators/templates/route/routes/%plural%.rb.tt +19 -0
- data/lib/roda_gen/generators/templates/route/spec/web/%plural%_spec.rb.tt +36 -0
- data/lib/roda_gen/generators/templates/route/views/%plural%/index.erb.tt +11 -0
- data/lib/roda_gen/generators/templates/route/views/%plural%/show.erb.tt +7 -0
- data/lib/roda_gen/generators/templates/upload/db/migrate/%migration_filename%.rb.tt +13 -0
- data/lib/roda_gen/generators/templates/upload/helpers/upload_serving.rb.tt +43 -0
- data/lib/roda_gen/generators/templates/upload/models/%resource_name%.rb.tt +11 -0
- data/lib/roda_gen/generators/templates/upload/models/%resource_name%_uploader.rb.tt +19 -0
- data/lib/roda_gen/generators/templates/upload/routes/%plural%.rb.tt +44 -0
- data/lib/roda_gen/generators/templates/upload/spec/web/%plural%_spec.rb.tt +56 -0
- data/lib/roda_gen/generators/templates/upload/views/%plural%/index.erb.tt +18 -0
- data/lib/roda_gen/generators/upload.rb +83 -0
- data/lib/roda_gen/project_context.rb +30 -0
- data/lib/roda_gen/version.rb +5 -0
- data/lib/roda_gen.rb +16 -0
- metadata +497 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
# Reproduces the README upload recipe's r.on('cache') line and direct_upload_options on a test-only app,
|
|
6
|
+
# keep the two in step
|
|
7
|
+
RSpec.describe 'direct upload drop zone' do
|
|
8
|
+
let(:app) do
|
|
9
|
+
Class.new(<%= @app.camel %>) do
|
|
10
|
+
hash_branch('upload') do |r|
|
|
11
|
+
rodauth.require_authentication
|
|
12
|
+
r.on('cache') { r.run Shrine.upload_endpoint(:cache, **direct_upload_options) }
|
|
13
|
+
r.get { view(inline: %(<%%== render('./_upload_zone', locals: { url: '/upload/cache' }) %>)) }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def direct_upload_options
|
|
17
|
+
{
|
|
18
|
+
max_size: Settings.for_system('file_upload_max_size').to_i,
|
|
19
|
+
upload_context: lambda do |request|
|
|
20
|
+
path = request.params['relative_path'].to_s
|
|
21
|
+
keep = path.length.between?(1, 512) && !path.start_with?('/') && !path.split('/').include?('..')
|
|
22
|
+
keep ? { metadata: { 'relative_path' => path } } : {}
|
|
23
|
+
end
|
|
24
|
+
}
|
|
25
|
+
end
|
|
26
|
+
end.freeze.app
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
let(:cache) { Shrine.storages[:cache] }
|
|
30
|
+
|
|
31
|
+
def zone_page
|
|
32
|
+
get '/upload'
|
|
33
|
+
follow_redirect! while last_response.redirect?
|
|
34
|
+
last_response.body
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Shrine answers errors (413 and friends) with a plain-text body, so those return nil
|
|
38
|
+
def upload(content, name:, relative_path: nil)
|
|
39
|
+
params = {
|
|
40
|
+
'file' => Rack::Test::UploadedFile.new(StringIO.new(content), 'text/plain', original_filename: name),
|
|
41
|
+
'_csrf' => zone_page[/data-csrf="([^"]+)"/, 1]
|
|
42
|
+
}
|
|
43
|
+
params['relative_path'] = relative_path if relative_path
|
|
44
|
+
post '/upload/cache', params, 'HTTP_ACCEPT' => 'application/json'
|
|
45
|
+
JSON.parse(last_response.body) if last_response.ok?
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it 'sends anonymous visitors to log in before a token is ever minted' do
|
|
49
|
+
get '/upload'
|
|
50
|
+
follow_redirect! while last_response.redirect? && !last_response.headers['Location'].include?('login')
|
|
51
|
+
expect(last_response.headers['Location']).to include('/account/login')
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
context 'when signed in' do
|
|
55
|
+
# English profile so the page renders at /en/ and the string assertions hold
|
|
56
|
+
before { sign_up_and_log_in(language: 'en') }
|
|
57
|
+
|
|
58
|
+
it 'renders the zone with the endpoint URL, a path-bound token, the cap and the no-JS input' do
|
|
59
|
+
html = zone_page
|
|
60
|
+
expect(html).to include('data-url="/upload/cache"', 'data-max-size="20971520"', 'name="files[]"')
|
|
61
|
+
expect(html[/data-csrf="([^"]+)"/, 1]).not_to be_empty
|
|
62
|
+
expect(html).to include(I18n.t('upload.drop_here', locale: :en))
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it 'stores the file in the cache and returns the cached-file JSON' do
|
|
66
|
+
json = upload('hello', name: 'hello.txt')
|
|
67
|
+
expect(last_response.status).to eq(200)
|
|
68
|
+
expect(json['storage']).to eq('cache')
|
|
69
|
+
expect(cache.exists?(json['id'])).to be(true)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it 'keeps a folder-relative path as metadata' do
|
|
73
|
+
json = upload('x', name: 'a.txt', relative_path: 'photos/2026/a.txt')
|
|
74
|
+
expect(json.dig('metadata', 'relative_path')).to eq('photos/2026/a.txt')
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
it 'drops a traversal path instead of storing it' do
|
|
78
|
+
json = upload('x', name: 'a.txt', relative_path: '../../etc/passwd')
|
|
79
|
+
expect(json['metadata']).not_to have_key('relative_path')
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it 'answers 413 above file_upload_max_size and stores nothing' do
|
|
83
|
+
allow(Settings).to receive(:for_system).and_call_original
|
|
84
|
+
allow(Settings).to receive(:for_system).with('file_upload_max_size').and_return(4)
|
|
85
|
+
stored = cache.store.size
|
|
86
|
+
upload('more than four bytes', name: 'big.txt')
|
|
87
|
+
expect(last_response.status).to eq(413)
|
|
88
|
+
expect(cache.store.size).to eq(stored)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<%% @page_title = t('errors.forbidden.title') %>
|
|
2
|
+
<section class="hero min-h-[40vh]">
|
|
3
|
+
<div class="hero-content text-center">
|
|
4
|
+
<div class="max-w-md">
|
|
5
|
+
<h1 class="text-5xl font-bold"><%%= t('errors.forbidden.title') %></h1>
|
|
6
|
+
<p class="py-6"><%%= t('errors.forbidden.body') %></p>
|
|
7
|
+
<%%== link_to(t('errors.back_home'), '/', class: 'btn btn-primary') %>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</section>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<%% @page_title = t('errors.not_found.title', default: 'Page not found') %>
|
|
2
|
+
<section class="hero min-h-[40vh]">
|
|
3
|
+
<div class="hero-content text-center">
|
|
4
|
+
<div class="max-w-md">
|
|
5
|
+
<h1 class="text-5xl font-bold"><%%= t('errors.not_found.title', default: 'Page not found') %></h1>
|
|
6
|
+
<p class="py-6"><%%= t('errors.not_found.body', default: 'The page you’re looking for doesn’t exist or has moved.') %></p>
|
|
7
|
+
<%%== link_to(t('errors.back_home', default: 'Back to homepage'), '/', class: 'btn btn-primary') %>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</section>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<%% @page_title = t('errors.server_error.title', default: 'Something went wrong') %>
|
|
2
|
+
<section class="hero min-h-[40vh]">
|
|
3
|
+
<div class="hero-content text-center">
|
|
4
|
+
<div class="max-w-md">
|
|
5
|
+
<div class="alert alert-error" role="alert">
|
|
6
|
+
<span><%%= t('errors.server_error.title', default: 'Something went wrong') %></span>
|
|
7
|
+
</div>
|
|
8
|
+
<p class="py-6"><%%= t('errors.server_error.body', default: 'We hit an unexpected error. The team has been notified.') %></p>
|
|
9
|
+
<%%== link_to(t('errors.back_home', default: 'Back to homepage'), '/', class: 'btn btn-primary') %>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</section>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<%% page_title = (defined?(@page_title) && @page_title) || '<%= @app.human %>' %>
|
|
2
|
+
<%% page_description = (defined?(@page_description) && @page_description) || '<%= @app.human %>' %>
|
|
3
|
+
<%%# Query string dropped so tracking params don't fragment indexing. LocaleKit's
|
|
4
|
+
middleware strips the locale prefix from path_info, path_with_locale puts it back -%>
|
|
5
|
+
<%% canonical_url =
|
|
6
|
+
if defined?(@canonical_url) && @canonical_url
|
|
7
|
+
@canonical_url
|
|
8
|
+
elsif LocaleKit.excluded_path?(request.path_info, LocaleKit.configuration)
|
|
9
|
+
request.url.split('?', 2).first
|
|
10
|
+
else
|
|
11
|
+
"#{request.base_url}#{path_with_locale(current_locale)}"
|
|
12
|
+
end %>
|
|
13
|
+
<%% og_image = (defined?(@og_image) && @og_image) || "#{request.base_url}/apple-touch-icon.png" %>
|
|
14
|
+
<%% og_type = (defined?(@og_type) && @og_type) || 'website' %>
|
|
15
|
+
|
|
16
|
+
<title><%%= page_title %></title>
|
|
17
|
+
<meta name="description" content="<%%= page_description %>">
|
|
18
|
+
<link rel="canonical" href="<%%= canonical_url %>">
|
|
19
|
+
|
|
20
|
+
<meta property="og:title" content="<%%= page_title %>">
|
|
21
|
+
<meta property="og:description" content="<%%= page_description %>">
|
|
22
|
+
<meta property="og:url" content="<%%= canonical_url %>">
|
|
23
|
+
<meta property="og:type" content="<%%= og_type %>">
|
|
24
|
+
<meta property="og:image" content="<%%= og_image %>">
|
|
25
|
+
|
|
26
|
+
<%%# One hreflang per locale unconditionally, LocaleKit's middleware serves /{locale}{path} for any path -%>
|
|
27
|
+
<%% LocaleKit.configuration.available_locales.each do |loc| -%>
|
|
28
|
+
<link rel="alternate" hreflang="<%%= loc %>" href="<%%= request.base_url %><%%= path_with_locale(loc) %>">
|
|
29
|
+
<%% end -%>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<%%# Wired by assets/javascripts/admin.js. One data-csrf token covers every
|
|
2
|
+
result since the target id travels in the POST body, not the path -%>
|
|
3
|
+
<button type="button" class="btn btn-ghost btn-circle" data-admin-open="impersonate"
|
|
4
|
+
aria-label="<%%= t('admin.impersonate.open') %>">
|
|
5
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
6
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M15 19.128a9.38 9.38 0 0 0 2.625.372 9.337 9.337 0 0 0 4.121-.952 4.125 4.125 0 0 0-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 0 1 8.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0 1 11.964-3.07M12 6.375a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0Zm8.25 2.25a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z"/>
|
|
7
|
+
</svg>
|
|
8
|
+
</button>
|
|
9
|
+
<dialog id="admin-impersonate-dialog" class="modal">
|
|
10
|
+
<div class="modal-box">
|
|
11
|
+
<h2 class="text-lg font-bold mb-3"><%%= t('admin.impersonate.title') %></h2>
|
|
12
|
+
<input type="search" id="admin-impersonate-search" class="input input-bordered w-full"
|
|
13
|
+
autocomplete="off" placeholder="<%%= t('admin.impersonate.search_placeholder') %>"
|
|
14
|
+
data-csrf="<%%= csrf_token('/admin/impersonate') %>">
|
|
15
|
+
<ul id="admin-impersonate-results" class="menu mt-2 w-full p-0"
|
|
16
|
+
data-empty="<%%= t('admin.impersonate.no_results') %>"></ul>
|
|
17
|
+
<div class="modal-action">
|
|
18
|
+
<form method="dialog"><button class="btn"><%%= t('admin.close') %></button></form>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</dialog>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<%% available = LocaleKit.configuration.available_locales %>
|
|
2
|
+
<%% if available.size > 1 %>
|
|
3
|
+
<%% current = (current_locale rescue available.first).to_sym %>
|
|
4
|
+
<details class="dropdown dropdown-end">
|
|
5
|
+
<summary class="btn btn-ghost btn-circle" aria-label="<%%= t('nav.language', default: 'Language') %>">
|
|
6
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
7
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0 0c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m-9 9h18"/>
|
|
8
|
+
</svg>
|
|
9
|
+
</summary>
|
|
10
|
+
<ul class="menu menu-sm dropdown-content mt-3 bg-base-200 rounded-box z-10 w-52 p-2 shadow-lg">
|
|
11
|
+
<%% available.each do |loc| %>
|
|
12
|
+
<%% is_current = (current == loc) %>
|
|
13
|
+
<li>
|
|
14
|
+
<a href="<%%= path_with_locale(loc) %>" hreflang="<%%= loc %>" lang="<%%= loc %>"<%%== ' class="menu-active text-primary font-semibold" aria-current="true"' if is_current %>>
|
|
15
|
+
<span class="font-mono text-[10px] uppercase opacity-50 w-8 shrink-0"><%%= loc %></span>
|
|
16
|
+
<span class="grow"><%%= t("locales.#{loc}", default: loc.to_s) %></span>
|
|
17
|
+
</a>
|
|
18
|
+
</li>
|
|
19
|
+
<%% end %>
|
|
20
|
+
</ul>
|
|
21
|
+
</details>
|
|
22
|
+
<%% end %>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<%%# Wired by assets/javascripts/admin.js, the data-csrf token on the list covers every unlock form -%>
|
|
2
|
+
<button type="button" class="btn btn-ghost btn-circle" data-admin-open="locked"
|
|
3
|
+
aria-label="<%%= t('admin.locked_accounts.open') %>">
|
|
4
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
5
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M13.5 10.5V6.75a4.5 4.5 0 1 1 9 0v3.75M3.75 21.75h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H3.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z"/>
|
|
6
|
+
</svg>
|
|
7
|
+
</button>
|
|
8
|
+
<dialog id="admin-locked-dialog" class="modal">
|
|
9
|
+
<div class="modal-box">
|
|
10
|
+
<h2 class="text-lg font-bold mb-3"><%%= t('admin.locked_accounts.title') %></h2>
|
|
11
|
+
<ul id="admin-locked-results" class="menu w-full p-0"
|
|
12
|
+
data-empty="<%%= t('admin.locked_accounts.none') %>"
|
|
13
|
+
data-csrf="<%%= csrf_token('/admin/accounts/unlock') %>"></ul>
|
|
14
|
+
<div class="modal-action">
|
|
15
|
+
<form method="dialog"><button class="btn"><%%= t('admin.close') %></button></form>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</dialog>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<%%# Render INSIDE the upload form: render('./_upload_zone', locals: { url: '/upload/cache' }).
|
|
2
|
+
Driven by assets/javascripts/upload.js, keep max_files under the README's rack-attack ceiling -%>
|
|
3
|
+
<%% max_size = Settings.for_system('file_upload_max_size').to_i %>
|
|
4
|
+
<%% limit = defined?(max_files) ? max_files : 100 %>
|
|
5
|
+
<div data-upload-zone hidden
|
|
6
|
+
class="rounded-box border-2 border-dashed border-base-300 p-6 text-center space-y-3"
|
|
7
|
+
data-url="<%%= url %>"
|
|
8
|
+
data-csrf="<%%= csrf_token(url) %>"
|
|
9
|
+
data-max-size="<%%= max_size %>"
|
|
10
|
+
data-max-files="<%%= limit %>"
|
|
11
|
+
data-too-large="<%%= t('upload.too_large', max: max_size / 1_048_576) %>"
|
|
12
|
+
data-too-many="<%%= t('upload.too_many', max: limit) %>"
|
|
13
|
+
data-failed="<%%= t('upload.failed') %>"
|
|
14
|
+
data-done="<%%= t('upload.done') %>">
|
|
15
|
+
<p class="font-medium"><%%= t('upload.drop_here') %></p>
|
|
16
|
+
<p class="text-sm"><%%= t('upload.hint', max: max_size / 1_048_576) %></p>
|
|
17
|
+
<div class="flex flex-wrap justify-center gap-2">
|
|
18
|
+
<label class="btn btn-sm">
|
|
19
|
+
<%%= t('upload.choose_files') %>
|
|
20
|
+
<input type="file" multiple class="sr-only">
|
|
21
|
+
</label>
|
|
22
|
+
<label class="btn btn-sm btn-ghost">
|
|
23
|
+
<%%= t('upload.choose_folder') %>
|
|
24
|
+
<input type="file" multiple webkitdirectory class="sr-only">
|
|
25
|
+
</label>
|
|
26
|
+
</div>
|
|
27
|
+
<p class="text-error text-sm" data-upload-message role="alert" hidden></p>
|
|
28
|
+
<ul class="not-prose space-y-2 text-left" data-upload-list aria-live="polite"></ul>
|
|
29
|
+
</div>
|
|
30
|
+
<noscript>
|
|
31
|
+
<label class="block">
|
|
32
|
+
<span class="block mb-1 text-sm font-medium"><%%= t('upload.choose_files') %></span>
|
|
33
|
+
<input type="file" name="files[]" multiple class="file-input w-full">
|
|
34
|
+
</label>
|
|
35
|
+
</noscript>
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
<form method="post" action="/account/profile" class="max-w-2xl mx-auto space-y-6">
|
|
2
|
+
<%%== csrf_tag('/account/profile') %>
|
|
3
|
+
|
|
4
|
+
<header>
|
|
5
|
+
<h1 class="text-2xl font-bold"><%%= t('forms.profile.heading') %></h1>
|
|
6
|
+
<p class="meta"><%%= t('forms.required_legend') %></p>
|
|
7
|
+
</header>
|
|
8
|
+
|
|
9
|
+
<%%== field_error_summary(label_prefix: 'forms.create_account.label') %>
|
|
10
|
+
|
|
11
|
+
<fieldset class="fieldset bg-base-200 border-base-300 rounded-box border p-4 space-y-3">
|
|
12
|
+
<legend class="fieldset-legend px-2 text-base font-semibold"><%%= t('forms.profile.fieldset.identity') %></legend>
|
|
13
|
+
|
|
14
|
+
<%%# Disabled on purpose, email changes via change-login and personal_identity_number is immutable after signup -%>
|
|
15
|
+
<label class="block">
|
|
16
|
+
<span class="block mb-1 text-sm font-medium"><%%= t('forms.create_account.label.email') %></span>
|
|
17
|
+
<input type="email" class="input w-full" value="<%%= current_account.email %>" disabled>
|
|
18
|
+
</label>
|
|
19
|
+
|
|
20
|
+
<label class="block">
|
|
21
|
+
<span class="block mb-1 text-sm font-medium"><%%= t('forms.create_account.label.personal_identity_number') %></span>
|
|
22
|
+
<input type="text" class="input w-full" value="<%%= @profile.personal_identity_number %>" disabled>
|
|
23
|
+
</label>
|
|
24
|
+
</fieldset>
|
|
25
|
+
|
|
26
|
+
<fieldset class="fieldset bg-base-200 border-base-300 rounded-box border p-4 space-y-3">
|
|
27
|
+
<legend class="fieldset-legend px-2 text-base font-semibold"><%%= t('forms.profile.fieldset.name') %></legend>
|
|
28
|
+
|
|
29
|
+
<div class="grid sm:grid-cols-2 gap-3">
|
|
30
|
+
<label class="block">
|
|
31
|
+
<span class="block mb-1 text-sm font-medium"><%%= t('forms.create_account.label.first_name') %></span>
|
|
32
|
+
<input type="text" name="first_name" id="field-first_name" class="input w-full" value="<%%= @profile.first_name %>" required <%%== field_error_aria(:first_name) %>>
|
|
33
|
+
<%%== field_error_for(:first_name) %>
|
|
34
|
+
</label>
|
|
35
|
+
|
|
36
|
+
<label class="block">
|
|
37
|
+
<span class="block mb-1 text-sm font-medium"><%%= t('forms.create_account.label.last_name') %></span>
|
|
38
|
+
<input type="text" name="last_name" id="field-last_name" class="input w-full" value="<%%= @profile.last_name %>" required <%%== field_error_aria(:last_name) %>>
|
|
39
|
+
<%%== field_error_for(:last_name) %>
|
|
40
|
+
</label>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<label class="block">
|
|
44
|
+
<span class="block mb-1 text-sm font-medium"><%%= t('forms.create_account.label.gender') %></span>
|
|
45
|
+
<select name="gender" id="field-gender" class="select w-full" <%%== field_error_aria(:gender) %>>
|
|
46
|
+
<option value=""><%%= t('forms.create_account.gender.prefer_not_to_say') %></option>
|
|
47
|
+
<%% Gender.order(:gender).each do |g| %>
|
|
48
|
+
<option value="<%%= g.gender %>"<%%= ' selected' if @profile.gender == g.gender %>><%%= t("forms.create_account.gender.#{g.gender}") %></option>
|
|
49
|
+
<%% end %>
|
|
50
|
+
</select>
|
|
51
|
+
<%%== field_error_for(:gender) %>
|
|
52
|
+
</label>
|
|
53
|
+
</fieldset>
|
|
54
|
+
|
|
55
|
+
<fieldset class="fieldset bg-base-200 border-base-300 rounded-box border p-4 space-y-3">
|
|
56
|
+
<legend class="fieldset-legend px-2 text-base font-semibold"><%%= t('forms.profile.fieldset.address') %></legend>
|
|
57
|
+
|
|
58
|
+
<label class="block">
|
|
59
|
+
<span class="block mb-1 text-sm font-medium"><%%= t('forms.create_account.label.address') %></span>
|
|
60
|
+
<input type="text" name="address" id="field-address" class="input w-full" value="<%%= @profile.address %>" required <%%== field_error_aria(:address) %>>
|
|
61
|
+
<%%== field_error_for(:address) %>
|
|
62
|
+
</label>
|
|
63
|
+
|
|
64
|
+
<div class="grid sm:grid-cols-2 gap-3">
|
|
65
|
+
<label class="block">
|
|
66
|
+
<span class="block mb-1 text-sm font-medium"><%%= t('forms.create_account.label.postal_code') %></span>
|
|
67
|
+
<input type="text" name="postal_code" id="field-postal_code" class="input w-full" value="<%%= @profile.postal_code %>" required <%%== field_error_aria(:postal_code) %>>
|
|
68
|
+
<%%== field_error_for(:postal_code) %>
|
|
69
|
+
</label>
|
|
70
|
+
|
|
71
|
+
<label class="block">
|
|
72
|
+
<span class="block mb-1 text-sm font-medium"><%%= t('forms.create_account.label.city') %></span>
|
|
73
|
+
<input type="text" name="city" id="field-city" class="input w-full" value="<%%= @profile.city %>" required <%%== field_error_aria(:city) %>>
|
|
74
|
+
<%%== field_error_for(:city) %>
|
|
75
|
+
</label>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<label class="block">
|
|
79
|
+
<span class="block mb-1 text-sm font-medium"><%%= t('forms.create_account.label.country') %></span>
|
|
80
|
+
<select name="country" id="field-country" class="select w-full" required <%%== field_error_aria(:country) %>>
|
|
81
|
+
<%% SignupFormData.countries.each do |c| %>
|
|
82
|
+
<option value="<%%= c.iso_code %>"<%%= ' selected' if @profile.country == c.iso_code %>><%%= c.name %></option>
|
|
83
|
+
<%% end %>
|
|
84
|
+
</select>
|
|
85
|
+
<%%== field_error_for(:country) %>
|
|
86
|
+
</label>
|
|
87
|
+
</fieldset>
|
|
88
|
+
|
|
89
|
+
<fieldset class="fieldset bg-base-200 border-base-300 rounded-box border p-4 space-y-3">
|
|
90
|
+
<legend class="fieldset-legend px-2 text-base font-semibold"><%%= t('forms.profile.fieldset.preferences') %></legend>
|
|
91
|
+
|
|
92
|
+
<div class="grid sm:grid-cols-2 gap-3">
|
|
93
|
+
<label class="block">
|
|
94
|
+
<span class="block mb-1 text-sm font-medium"><%%= t('forms.create_account.label.language') %></span>
|
|
95
|
+
<select name="language" id="field-language" class="select w-full" required <%%== field_error_aria(:language) %>>
|
|
96
|
+
<%% SignupFormData.languages_by_country.each do |(country_iso, country_name), langs| %>
|
|
97
|
+
<optgroup label="<%%= country_name %>" data-country-iso="<%%= country_iso %>">
|
|
98
|
+
<%% langs.each do |lang| %>
|
|
99
|
+
<option value="<%%= lang[:language_code] %>"<%%= ' selected' if @profile.language == lang[:language_code] %>><%%= lang[:language_name] %></option>
|
|
100
|
+
<%% end %>
|
|
101
|
+
</optgroup>
|
|
102
|
+
<%% end %>
|
|
103
|
+
</select>
|
|
104
|
+
<%%== field_error_for(:language) %>
|
|
105
|
+
</label>
|
|
106
|
+
|
|
107
|
+
<label class="block">
|
|
108
|
+
<span class="block mb-1 text-sm font-medium"><%%= t('forms.create_account.label.time_zone') %></span>
|
|
109
|
+
<select name="time_zone" id="field-time_zone" class="select w-full" required <%%== field_error_aria(:time_zone) %>>
|
|
110
|
+
<%% SignupFormData.time_zones_by_country.each do |(country_iso, country_name), zones| %>
|
|
111
|
+
<optgroup label="<%%= country_name %>" data-country-iso="<%%= country_iso %>">
|
|
112
|
+
<%% zones.each do |z| %>
|
|
113
|
+
<option value="<%%= z[:time_zone] %>"<%%= ' selected' if @profile.time_zone == z[:time_zone] %>><%%= z[:time_zone] %></option>
|
|
114
|
+
<%% end %>
|
|
115
|
+
</optgroup>
|
|
116
|
+
<%% end %>
|
|
117
|
+
</select>
|
|
118
|
+
<%%== field_error_for(:time_zone) %>
|
|
119
|
+
</label>
|
|
120
|
+
</div>
|
|
121
|
+
</fieldset>
|
|
122
|
+
|
|
123
|
+
<fieldset class="fieldset bg-base-200 border-base-300 rounded-box border p-4 space-y-3">
|
|
124
|
+
<legend class="fieldset-legend px-2 text-base font-semibold"><%%= t('forms.profile.fieldset.contact') %></legend>
|
|
125
|
+
|
|
126
|
+
<label class="block">
|
|
127
|
+
<span class="block mb-1 text-sm font-medium"><%%= t('forms.create_account.label.mobile_number') %></span>
|
|
128
|
+
<input type="tel" name="mobile_number" id="field-mobile_number" class="input w-full" value="<%%= @profile.mobile_number %>" required <%%== field_error_aria(:mobile_number) %>>
|
|
129
|
+
<%%== field_error_for(:mobile_number) %>
|
|
130
|
+
</label>
|
|
131
|
+
</fieldset>
|
|
132
|
+
|
|
133
|
+
<button type="submit" class="btn btn-primary w-full"><%%= t('forms.profile.save') %></button>
|
|
134
|
+
</form>
|
|
135
|
+
|
|
136
|
+
<%%# Wired by assets/javascripts/push.js, kept outside the form so it never submits the profile -%>
|
|
137
|
+
<section class="max-w-2xl mx-auto mt-6">
|
|
138
|
+
<fieldset class="fieldset bg-base-200 border-base-300 rounded-box border p-4">
|
|
139
|
+
<legend class="fieldset-legend px-2 text-base font-semibold"><%%= t('push.fieldset') %></legend>
|
|
140
|
+
<p class="meta mb-3"><%%= t('push.description') %></p>
|
|
141
|
+
<button type="button" id="push-enable" class="btn btn-outline"
|
|
142
|
+
data-vapid-key="<%%= <%= @app.camel %>Config.web_push.public_key %>"
|
|
143
|
+
data-csrf="<%%= csrf_token('/push/subscribe') %>"
|
|
144
|
+
data-enabled-label="<%%= t('push.enabled') %>"
|
|
145
|
+
data-unsupported="<%%= t('push.unsupported') %>">
|
|
146
|
+
<%%= t('push.enable') %>
|
|
147
|
+
</button>
|
|
148
|
+
</fieldset>
|
|
149
|
+
</section>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<div class="max-w-3xl mx-auto space-y-6">
|
|
2
|
+
<h1 class="text-2xl font-bold"><%%= t('admin.flags.title') %></h1>
|
|
3
|
+
|
|
4
|
+
<%% if @flags.empty? %>
|
|
5
|
+
<p class="meta"><%%= t('admin.flags.none') %></p>
|
|
6
|
+
<%% else %>
|
|
7
|
+
<div class="overflow-x-auto">
|
|
8
|
+
<table class="table">
|
|
9
|
+
<thead>
|
|
10
|
+
<tr>
|
|
11
|
+
<th><%%= t('admin.flags.col.flag') %></th>
|
|
12
|
+
<th><%%= t('admin.flags.col.state') %></th>
|
|
13
|
+
<%% if @can_manage %><th><%%= t('admin.flags.col.actions') %></th><%% end %>
|
|
14
|
+
</tr>
|
|
15
|
+
</thead>
|
|
16
|
+
<tbody>
|
|
17
|
+
<%% @flags.each do |feature| %>
|
|
18
|
+
<tr>
|
|
19
|
+
<td class="font-mono"><%%= feature.key %></td>
|
|
20
|
+
<td><%%= flag_state_label(feature) %></td>
|
|
21
|
+
<%% if @can_manage %>
|
|
22
|
+
<td>
|
|
23
|
+
<form method="post" action="/admin/flags/<%%= feature.key %>" class="flex flex-wrap items-center gap-2 m-0">
|
|
24
|
+
<%%== csrf_tag("/admin/flags/#{feature.key}") %>
|
|
25
|
+
<button type="submit" name="op" value="enable" class="btn btn-xs btn-success"><%%= t('admin.flags.enable') %></button>
|
|
26
|
+
<button type="submit" name="op" value="disable" class="btn btn-xs btn-error"><%%= t('admin.flags.disable') %></button>
|
|
27
|
+
<span class="join">
|
|
28
|
+
<input type="number" name="value" min="0" max="100" class="input input-xs input-bordered join-item w-20" aria-label="<%%= t('admin.flags.set_percentage') %>">
|
|
29
|
+
<button type="submit" name="op" value="percentage" class="btn btn-xs join-item"><%%= t('admin.flags.set_percentage') %></button>
|
|
30
|
+
</span>
|
|
31
|
+
</form>
|
|
32
|
+
</td>
|
|
33
|
+
<%% end %>
|
|
34
|
+
</tr>
|
|
35
|
+
<%% end %>
|
|
36
|
+
</tbody>
|
|
37
|
+
</table>
|
|
38
|
+
</div>
|
|
39
|
+
<%% end %>
|
|
40
|
+
|
|
41
|
+
<%% if @can_manage %>
|
|
42
|
+
<form method="post" action="/admin/flags" class="flex flex-wrap items-end gap-2">
|
|
43
|
+
<%%== csrf_tag('/admin/flags') %>
|
|
44
|
+
<label class="block">
|
|
45
|
+
<span class="block mb-1 text-sm font-medium"><%%= t('admin.flags.new_key') %></span>
|
|
46
|
+
<input type="text" name="key" class="input input-bordered" required>
|
|
47
|
+
</label>
|
|
48
|
+
<button type="submit" class="btn btn-primary"><%%= t('admin.flags.create') %></button>
|
|
49
|
+
</form>
|
|
50
|
+
<%% end %>
|
|
51
|
+
</div>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<%%# Non-modal <dialog open>, so Esc and backdrop clicks do nothing and the only way past is a POST.
|
|
2
|
+
id="consent-banner-dialog" and both form ids are used by spec/browser/spec_helper.rb (AcceptConsentOnVisit) -%>
|
|
3
|
+
<%% unless consent_recorded? %>
|
|
4
|
+
<dialog open id="consent-banner-dialog" class="modal" aria-labelledby="consent-banner-title">
|
|
5
|
+
<div class="modal-box max-w-xl border-t-4 border-success">
|
|
6
|
+
<h2 id="consent-banner-title" class="text-2xl font-bold mb-3">
|
|
7
|
+
<%%= ::I18n.t('consent_kit.banner.title') %>
|
|
8
|
+
</h2>
|
|
9
|
+
<div class="prose prose-sm max-w-none mb-6">
|
|
10
|
+
<%%= ::I18n.t('consent_kit.banner.message') %>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<%%# Equal weight on both buttons, EDPB wants reject as easy as accept -%>
|
|
14
|
+
<div class="flex flex-wrap gap-3 justify-center">
|
|
15
|
+
<%%# autofocus puts keyboard users in the banner on load, it sits last in body -%>
|
|
16
|
+
<button type="submit" form="consent-kit-only-necessary-form" class="btn btn-outline btn-error min-w-40" autofocus>
|
|
17
|
+
<%%= ::I18n.t('consent_kit.banner.only_necessary') %>
|
|
18
|
+
</button>
|
|
19
|
+
<button type="submit" form="consent-kit-accept-all-form" class="btn btn-outline btn-success min-w-40">
|
|
20
|
+
<%%= ::I18n.t('consent_kit.banner.accept_all') %>
|
|
21
|
+
</button>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<%%# link-primary, not link-hover, so the text meets WCAG 2.1 AA contrast on modal-box -%>
|
|
25
|
+
<div class="flex gap-4 justify-center mt-4 text-sm">
|
|
26
|
+
<button type="button" popovertarget="consent-preferences" class="link link-primary">
|
|
27
|
+
<%%= ::I18n.t('consent_kit.banner.customize') %>
|
|
28
|
+
</button>
|
|
29
|
+
<%% privacy_path = ::ConsentKit.configuration.privacy_policy_path %>
|
|
30
|
+
<%% if privacy_path %>
|
|
31
|
+
<span aria-hidden="true" class="opacity-60">|</span>
|
|
32
|
+
<%%== link_to(::I18n.t('consent_kit.banner.privacy_policy'), privacy_path, class: 'link link-primary') %>
|
|
33
|
+
<%% end %>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</dialog>
|
|
37
|
+
|
|
38
|
+
<%%# Forms sit outside the dialog so the buttons' form= attribute works in every browser -%>
|
|
39
|
+
<form id="consent-kit-only-necessary-form" action="/consent" method="post" class="hidden">
|
|
40
|
+
<%%== csrf_tag('/consent') %>
|
|
41
|
+
<input type="hidden" name="return_to" value="<%%= request.fullpath %>">
|
|
42
|
+
<input type="hidden" name="categories[]" value="necessary">
|
|
43
|
+
</form>
|
|
44
|
+
<form id="consent-kit-accept-all-form" action="/consent" method="post" class="hidden">
|
|
45
|
+
<%%== csrf_tag('/consent') %>
|
|
46
|
+
<input type="hidden" name="return_to" value="<%%= request.fullpath %>">
|
|
47
|
+
<%% ConsentKit.categories.each do |cat| %>
|
|
48
|
+
<input type="hidden" name="categories[]" value="<%%= cat %>">
|
|
49
|
+
<%% end %>
|
|
50
|
+
</form>
|
|
51
|
+
<%% end %>
|
|
52
|
+
|
|
53
|
+
<%%# Always rendered so any popovertarget="consent-preferences" button can reopen it after a choice.
|
|
54
|
+
backdrop: is Tailwind's ::backdrop variant. hidden + [&:popover-open]:block keeps the card
|
|
55
|
+
invisible on browsers without the Popover API, which would otherwise render it inline -%>
|
|
56
|
+
<div id="consent-preferences" popover role="dialog" aria-labelledby="consent-preferences-title"
|
|
57
|
+
class="hidden [&:popover-open]:block m-auto max-h-[calc(100dvh-2rem)] max-w-[calc(100vw-2rem)] overflow-auto border-0 bg-transparent p-0 backdrop:bg-black/50">
|
|
58
|
+
<%%== render('consent_kit/_preferences') %>
|
|
59
|
+
</div>
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<%%# Separate <form> per action so the one-click hidden categories[] wins regardless of toggle state.
|
|
2
|
+
NOT daisyUI's modal-box, it stays at opacity 0 outside an open .modal and would render invisible -%>
|
|
3
|
+
<div class="card relative w-[min(42rem,calc(100vw-2rem))] bg-base-100 p-6 shadow-xl">
|
|
4
|
+
<button type="button"
|
|
5
|
+
popovertarget="consent-preferences" popovertargetaction="hide"
|
|
6
|
+
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
|
|
7
|
+
aria-label="<%%= ::I18n.t('consent_kit.preferences.close') %>">×</button>
|
|
8
|
+
|
|
9
|
+
<h2 id="consent-preferences-title" class="text-lg font-bold mb-2"><%%= ::I18n.t('consent_kit.preferences.title') %></h2>
|
|
10
|
+
<p class="text-sm text-base-content/80 mb-4"><%%= ::I18n.t('consent_kit.preferences.intro') %></p>
|
|
11
|
+
|
|
12
|
+
<form id="consent-save-form" action="/consent" method="post" class="space-y-4">
|
|
13
|
+
<%%== csrf_tag('/consent') %>
|
|
14
|
+
<input type="hidden" name="return_to" value="<%%= @return_to || request.fullpath %>">
|
|
15
|
+
|
|
16
|
+
<%% ConsentKit.categories.each do |cat| %>
|
|
17
|
+
<fieldset class="fieldset bg-base-200 border-base-300 rounded-box border p-4 space-y-2">
|
|
18
|
+
<legend class="fieldset-legend px-2 text-base font-semibold flex items-center gap-1">
|
|
19
|
+
<%%= ::I18n.t("consent_kit.categories.#{cat}") %>
|
|
20
|
+
<%% desc = ::I18n.t("consent_kit.category_descriptions.#{cat}", default: '') %>
|
|
21
|
+
<%% unless desc.empty? %>
|
|
22
|
+
<span class="tooltip tooltip-right" data-tip="<%%= desc %>">
|
|
23
|
+
<span class="badge badge-ghost badge-sm cursor-help" tabindex="0" aria-label="<%%= ::I18n.t('consent_kit.preferences.help') %>">?</span>
|
|
24
|
+
</span>
|
|
25
|
+
<%% end %>
|
|
26
|
+
</legend>
|
|
27
|
+
|
|
28
|
+
<%% if cat == :necessary %>
|
|
29
|
+
<input type="hidden" name="categories[]" value="necessary">
|
|
30
|
+
<label class="label cursor-not-allowed gap-2 justify-start">
|
|
31
|
+
<input type="checkbox" class="toggle toggle-primary" checked disabled>
|
|
32
|
+
<span class="label-text"><%%= ::I18n.t('consent_kit.preferences.always_on') %></span>
|
|
33
|
+
</label>
|
|
34
|
+
<%% else %>
|
|
35
|
+
<label class="label cursor-pointer gap-2 justify-start">
|
|
36
|
+
<input type="checkbox" class="toggle toggle-primary" name="categories[]" value="<%%= cat %>" <%%= 'checked' if consented?(cat) %>>
|
|
37
|
+
<span class="label-text"><%%= ::I18n.t('consent_kit.preferences.allow') %></span>
|
|
38
|
+
</label>
|
|
39
|
+
<%% end %>
|
|
40
|
+
|
|
41
|
+
<%% services = ConsentKit.registry.by_category(cat) %>
|
|
42
|
+
<%% if services.any? %>
|
|
43
|
+
<ul class="text-sm space-y-2 mt-2">
|
|
44
|
+
<%% services.each do |service| %>
|
|
45
|
+
<li>
|
|
46
|
+
<strong><%%= service.name %></strong><%%= service.purpose ? " — #{service.purpose}." : '' %>
|
|
47
|
+
<%% if service.contacts.any? %>
|
|
48
|
+
<span class="text-base-content/70"><%%= ::I18n.t('consent_kit.preferences.contacts') %> <%%= service.contacts.join(', ') %>.</span>
|
|
49
|
+
<%% end %>
|
|
50
|
+
<%% if service.privacy_policy %>
|
|
51
|
+
<a href="<%%= service.privacy_policy %>" target="_blank" rel="noopener" class="link link-primary">
|
|
52
|
+
<%%= ::I18n.t('consent_kit.preferences.policy') %>
|
|
53
|
+
</a>
|
|
54
|
+
<%% end %>
|
|
55
|
+
</li>
|
|
56
|
+
<%% end %>
|
|
57
|
+
</ul>
|
|
58
|
+
<%% end %>
|
|
59
|
+
</fieldset>
|
|
60
|
+
<%% end %>
|
|
61
|
+
</form>
|
|
62
|
+
|
|
63
|
+
<form id="consent-only-necessary-form" action="/consent" method="post" class="hidden">
|
|
64
|
+
<%%== csrf_tag('/consent') %>
|
|
65
|
+
<input type="hidden" name="return_to" value="<%%= @return_to || request.fullpath %>">
|
|
66
|
+
<input type="hidden" name="categories[]" value="necessary">
|
|
67
|
+
</form>
|
|
68
|
+
|
|
69
|
+
<div class="flex items-center gap-2 mt-6 meta">
|
|
70
|
+
<span class="tooltip tooltip-right"
|
|
71
|
+
data-tip="<%%= ::I18n.t('consent_kit.preferences.storage_help',
|
|
72
|
+
cookie: ::ConsentKit.configuration.consent_cookie_name,
|
|
73
|
+
days: (::ConsentKit.configuration.consent_cookie_max_age / 86_400)) %>">
|
|
74
|
+
<span class="badge badge-ghost badge-sm cursor-help" tabindex="0" aria-label="<%%= ::I18n.t('consent_kit.preferences.help') %>">?</span>
|
|
75
|
+
</span>
|
|
76
|
+
<%% if (ts = consent_recorded_at) %>
|
|
77
|
+
<span class="consent-kit-timestamp">
|
|
78
|
+
<%%= ::I18n.t('consent_kit.preferences.your_choice', date: ts.to_date.iso8601) %>
|
|
79
|
+
</span>
|
|
80
|
+
<%% end %>
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
<div class="mt-6 flex flex-wrap justify-end gap-2">
|
|
84
|
+
<button type="submit" form="consent-only-necessary-form" class="btn btn-ghost"><%%= ::I18n.t('consent_kit.banner.only_necessary') %></button>
|
|
85
|
+
<button type="submit" form="consent-save-form" class="btn btn-primary"><%%= ::I18n.t('consent_kit.preferences.save') %></button>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<div class="max-w-2xl mx-auto space-y-4">
|
|
2
|
+
<h1 class="text-2xl font-bold"><%%= t('gdpr.erased_page.heading') %></h1>
|
|
3
|
+
<p><%%= t('gdpr.erased_page.body') %></p>
|
|
4
|
+
<p class="meta"><%%= t('gdpr.erased_page.retention_note') %></p>
|
|
5
|
+
<%%== link_to(t('gdpr.erased_page.home_link'), '/', class: 'btn btn-primary') %>
|
|
6
|
+
</div>
|