Skip to content

Commit

Permalink
Terms of service page (#19)
Browse files Browse the repository at this point in the history
* Moved default settings to migrations

* Terms of service page

---------

Co-authored-by: Konrad Sroga <konradsroga@gmail.com>
  • Loading branch information
pteroca-com and ksroga authored Sep 9, 2024
1 parent 3aa2c3f commit f92da2d
Show file tree
Hide file tree
Showing 16 changed files with 140 additions and 10 deletions.
30 changes: 30 additions & 0 deletions migrations/Version20240909174033.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

final class Version20240909174033 extends AbstractMigration
{
public function getDescription(): string
{
return 'Insert terms of service setting';
}

public function up(Schema $schema): void
{
$this->addSql('INSERT INTO setting (name, type, value) VALUES (?, ?, ?)', [
'terms_of_service',
'twig',
'<h1>Terms of service</h1> <p>You can set content of this page in settings.</p>',
]);
}

public function down(Schema $schema): void
{
$this->addSql('DELETE FROM setting WHERE name = ?', ['terms_of_service']);
}
}
32 changes: 32 additions & 0 deletions public/assets/css/panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,36 @@ a:hover {
.powered-by {
font-size: 0.7rem;
color: rgba(255, 255, 255, 0.4);
}

.default-page.container {
max-width: 800px;
margin: 50px auto;
padding: 20px;
background: #fff;
border-radius: 10px;
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
position: relative;
z-index: 2;
}

.default-page.container::before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(to bottom, #f9f9f9 0%, #eaeaea 100%);
border-radius: 10px;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
z-index: -1;
}

.default-page.container .row {
padding: 20px;
background: #fdfdfd;
border: 1px solid #e0e0e0;
border-radius: 8px;
box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.05);
}
26 changes: 26 additions & 0 deletions src/Core/Controller/PageController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace App\Core\Controller;

use App\Core\Enum\SettingEnum;
use App\Core\Service\SettingService;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Annotation\Route;

class PageController extends AbstractController
{
#[Route('/terms-of-service', name: 'terms_of_service')]
public function index(
SettingService $settingService,
): Response {
$pageContent = $settingService->getSetting(SettingEnum::TERMS_OF_SERVICE->value);
if (empty($pageContent)) {
throw new NotFoundHttpException();
}
return $this->render('panel/page/default.html.twig', [
'pageContent' => $pageContent,
]);
}
}
2 changes: 2 additions & 0 deletions src/Core/Enum/SettingEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,6 @@ enum SettingEnum: string
case GOOGLE_CAPTCHA_SITE_KEY = 'google_captcha_site_key';

case GOOGLE_CAPTCHA_SECRET_KEY = 'google_captcha_secret_key';

case TERMS_OF_SERVICE = 'terms_of_service';
}
3 changes: 2 additions & 1 deletion src/Core/Resources/translations/messages.cn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pteroca:
surname: '姓氏'
email_address: '电子邮件地址'
password: '密码'
accept_terms: '我接受服务条款'
accept_terms: '我接受 <a href="{{ link }}" target="_blank">服务条款</a>'
submit: '注册'
verification_token_invalid: '验证令牌无效或已过期。'
verification_success: '您的账户已成功验证。'
Expand Down Expand Up @@ -246,6 +246,7 @@ pteroca:
require_email_verification: '需要电子邮件验证'
google_captcha_verification: '需要 Google CAPTCHA 验证'
google_captcha_site_key: 'Google CAPTCHA 网站密钥'
terms_of_service: '服务条款页面内容'
user:
email: '电子邮件'
roles: '角色'
Expand Down
3 changes: 2 additions & 1 deletion src/Core/Resources/translations/messages.de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pteroca:
surname: 'Nachname'
email_address: 'E-Mail-Adresse'
password: 'Passwort'
accept_terms: 'Ich akzeptiere die Nutzungsbedingungen'
accept_terms: 'Ich akzeptiere <a href="{{ link }}" target="_blank">die Nutzungsbedingungen</a>'
submit: 'Registrieren'
verification_token_invalid: 'Der Verifizierungstoken ist ungültig oder abgelaufen.'
verification_success: 'Ihr Konto wurde erfolgreich verifiziert.'
Expand Down Expand Up @@ -246,6 +246,7 @@ pteroca:
require_email_verification: 'E-Mail-Verifizierung erforderlich'
google_captcha_verification: 'Google CAPTCHA-Verifizierung erforderlich'
google_captcha_site_key: 'Google CAPTCHA-Site-Schlüssel'
terms_of_service: 'Inhalt der Seite mit den Nutzungsbedingungen'
user:
email: 'E-Mail'
roles: 'Rollen'
Expand Down
3 changes: 2 additions & 1 deletion src/Core/Resources/translations/messages.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pteroca:
surname: 'Last name'
email_address: 'Email address'
password: 'Password'
accept_terms: 'I accept the terms of service'
accept_terms: 'I accept the <a href="{{ link }}" target="_blank">terms of service</a>'
submit: 'Register'
verification_token_invalid: 'The verification token is either invalid or has expired.'
verification_success: 'Your account has been successfully verified.'
Expand Down Expand Up @@ -246,6 +246,7 @@ pteroca:
require_email_verification: 'Require email verification'
google_captcha_verification: 'Require Google CAPTCHA verification'
google_captcha_site_key: 'Google CAPTCHA site key'
terms_of_service: 'Terms of service page content'
user:
email: 'Email'
roles: 'Roles'
Expand Down
3 changes: 2 additions & 1 deletion src/Core/Resources/translations/messages.es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pteroca:
surname: 'Apellido'
email_address: 'Dirección de correo electrónico'
password: 'Contraseña'
accept_terms: 'Acepto los términos y condiciones'
accept_terms: 'Acepto los <a href="{{ link }}" target="_blank">términos y condiciones</a>'
submit: 'Registrarse'
verification_token_invalid: 'El token de verificación es inválido o ha expirado.'
verification_success: 'Tu cuenta ha sido verificada exitosamente.'
Expand Down Expand Up @@ -246,6 +246,7 @@ pteroca:
require_email_verification: 'Requerir verificación de correo electrónico'
google_captcha_verification: 'Requerir verificación de Google CAPTCHA'
google_captcha_site_key: 'Clave del sitio CAPTCHA de Google'
terms_of_service: 'Contenido de la página de condiciones de servicio'
user:
email: 'Correo electrónico'
roles: 'Roles'
Expand Down
3 changes: 2 additions & 1 deletion src/Core/Resources/translations/messages.fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pteroca:
surname: 'Nom de famille'
email_address: 'Adresse e-mail'
password: 'Mot de passe'
accept_terms: "J'accepte les conditions d'utilisation"
accept_terms: "J'accepte les <a href=\"{{ link }}\" target=\"_blank\">conditions d'utilisation</a>"
submit: 'S’inscrire'
verification_token_invalid: 'Le jeton de vérification est invalide ou expiré.'
verification_success: 'Votre compte a été vérifié avec succès.'
Expand Down Expand Up @@ -246,6 +246,7 @@ pteroca:
require_email_verification: 'Exiger la vérification de l’e-mail'
google_captcha_verification: 'Exiger la vérification CAPTCHA Google'
google_captcha_site_key: 'Clé du site CAPTCHA Google'
terms_of_service: 'Contenu de la page sur les conditions d’utilisation'
user:
email: 'E-mail'
roles: 'Rôles'
Expand Down
3 changes: 2 additions & 1 deletion src/Core/Resources/translations/messages.it.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pteroca:
surname: 'Cognome'
email_address: 'Indirizzo e-mail'
password: 'Password'
accept_terms: 'Accetto i termini e condizioni'
accept_terms: 'Accetto i <a href="{{ link }}" target="_blank">termini e condizioni</a>'
submit: 'Registrati'
verification_token_invalid: 'Il token di verifica è non valido o è scaduto.'
verification_success: 'Il tuo account è stato verificato con successo.'
Expand Down Expand Up @@ -246,6 +246,7 @@ pteroca:
require_email_verification: 'Richiedi verifica dell’e-mail'
google_captcha_verification: 'Richiedi verifica Google CAPTCHA'
google_captcha_site_key: 'Chiave del sito Google CAPTCHA'
terms_of_service: 'Contenuto della pagina dei Termini di servizio'
user:
email: 'E-mail'
roles: 'Ruoli'
Expand Down
3 changes: 2 additions & 1 deletion src/Core/Resources/translations/messages.pl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pteroca:
surname: 'Nazwisko'
email_address: 'Adres e-mail'
password: 'Hasło'
accept_terms: 'Akceptuję regulamin'
accept_terms: 'Akceptuję <a href="{{ link }}" target="_blank">regulamin</a>'
submit: 'Zarejestruj się'
verification_token_invalid: 'Token weryfikacyjny jest już nieaktywny bądź jest nieprawidłowy.'
verification_success: 'Twoje konto zostało pomyślnie zweryfikowane.'
Expand Down Expand Up @@ -246,6 +246,7 @@ pteroca:
require_email_verification: 'Wymagaj weryfikacji adresu e-mail'
google_captcha_verification: 'Wymagaj weryfikacji CAPTCHA Google'
google_captcha_site_key: 'Klucz witryny CAPTCHA Google'
terms_of_service: 'Zawartość strony z warunkami korzystania z usługi'
user:
email: 'Email'
roles: 'Role'
Expand Down
3 changes: 2 additions & 1 deletion src/Core/Resources/translations/messages.pt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pteroca:
surname: 'Sobrenome'
email_address: 'Endereço de e-mail'
password: 'Senha'
accept_terms: 'Aceito os termos e condições'
accept_terms: 'Aceito os <a href="{{ link }}" target="_blank">termos e condições</a>'
submit: 'Cadastrar'
verification_token_invalid: 'O token de verificação é inválido ou expirou.'
verification_success: 'Sua conta foi verificada com sucesso.'
Expand Down Expand Up @@ -246,6 +246,7 @@ pteroca:
require_email_verification: 'Exigir verificação de e-mail'
google_captcha_verification: 'Exigir verificação do Google CAPTCHA'
google_captcha_site_key: 'Chave do site do Google CAPTCHA'
terms_of_service: 'Conteúdo da página de termos de serviço'
user:
email: 'E-mail'
roles: 'Funções'
Expand Down
3 changes: 2 additions & 1 deletion src/Core/Resources/translations/messages.ua.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pteroca:
surname: 'Прізвище'
email_address: 'Електронна пошта'
password: 'Пароль'
accept_terms: 'Я приймаю умови використання'
accept_terms: 'Я приймаю <a href="{{ link }}" target="_blank">умови використання</a>'
submit: 'Зареєструватися'
verification_token_invalid: 'Код підтвердження недійсний або закінчився.'
verification_success: 'Ваш обліковий запис успішно підтверджено.'
Expand Down Expand Up @@ -246,6 +246,7 @@ pteroca:
require_email_verification: 'Необхідна верифікація електронної пошти'
google_captcha_verification: 'Необхідна перевірка CAPTCHA Google'
google_captcha_site_key: 'Ключ сайту CAPTCHA Google'
terms_of_service: 'Умови надання послуг Зміст сторінки'
user:
email: 'Електронна пошта'
roles: 'Ролі'
Expand Down
14 changes: 14 additions & 0 deletions templates/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@
{% block stylesheets %}
{% endblock %}

{% block head_stylesheets %}
{% set defaultThemeColors = get_default_theme_primary_colors() %}
<style>
:root {
--primary-color: {{ defaultThemeColors.light }};
--pagination-active-bg: {{ defaultThemeColors.light }};
}
.ea-dark-scheme {
--primary-color: {{ defaultThemeColors.dark }};
--pagination-active-bg: {{ defaultThemeColors.dark }};
}
</style>
{% endblock %}

{% block javascripts %}
{% endblock %}

Expand Down
17 changes: 17 additions & 0 deletions templates/panel/page/default.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends 'base.html.twig' %}

{% block body_class 'page-login' %}
{% block title %}{{ get_title() }} | {{ 'pteroca.register.title'|trans }}{% endblock %}

{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('/assets/css/app.css') }}">
<link rel="stylesheet" href="{{ asset('/assets/css/panel.css') }}">
{% endblock %}

{% block body %}
<div class="default-page container">
<div class="row">
{{ pageContent|raw }}
</div>
</div>
{% endblock %}
2 changes: 1 addition & 1 deletion templates/panel/registration/register.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<div class="form-group">
<input class="form-check-input" type="checkbox" id="agree_terms" name="{{ field_name(registrationForm.agreeTerms) }}" {{ registrationForm.agreeTerms|default(false) ? 'checked' }}>
<label class="form-check-label" for="agree_terms">
{{ 'pteroca.register.accept_terms'|trans }}
{{ 'pteroca.register.accept_terms'|trans({'{{ link }}': path('terms_of_service') })|raw }}
</label>
</div>

Expand Down

0 comments on commit f92da2d

Please sign in to comment.