From 711843a0c81e1e2ec7a015431786df4ef32d5092 Mon Sep 17 00:00:00 2001 From: Yassine Doghri Date: Thu, 7 Jul 2022 10:08:04 +0000 Subject: [PATCH] feat: add legalNoticeURL to app config for setting an external url to legal notice --- .gitlab-ci.yml | 2 +- app/Config/App.php | 2 ++ app/Helpers/page_helper.php | 9 +++++++++ app/Language/en/Common.php | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index deb76f5a..57a3d069 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -75,7 +75,7 @@ tests: MYSQL_PASSWORD: "castopod" script: - - apt-get install -y mariadb-client libmariadb-dev + - apt-get update && apt-get install -y mariadb-client libmariadb-dev - echo "SHOW DATABASES;" | mysql --user=root --password="$MYSQL_ROOT_PASSWORD" --host=mariadb "$MYSQL_DATABASE" diff --git a/app/Config/App.php b/app/Config/App.php index cf921c7c..61b9a511 100644 --- a/app/Config/App.php +++ b/app/Config/App.php @@ -456,4 +456,6 @@ class App extends BaseConfig * Storage limit in Gigabytes */ public ?int $storageLimit = null; + + public ?string $legalNoticeURL = null; } diff --git a/app/Helpers/page_helper.php b/app/Helpers/page_helper.php index b0c20929..43bc5978 100644 --- a/app/Helpers/page_helper.php +++ b/app/Helpers/page_helper.php @@ -34,6 +34,15 @@ if (! function_exists('render_page_links')) { ]); } + // if set in .env, add legal notice link at the end of page links + if (config('App')->legalNoticeURL !== null) { + $links .= anchor(config('App')->legalNoticeURL, lang('Common.legal_notice'), [ + 'class' => 'px-2 py-1 underline hover:no-underline focus:ring-accent', + 'target' => '_blank', + 'rel' => 'noopener noreferrer', + ]); + } + return ''; } } diff --git a/app/Language/en/Common.php b/app/Language/en/Common.php index aff8136b..1258afcc 100644 --- a/app/Language/en/Common.php +++ b/app/Language/en/Common.php @@ -26,4 +26,5 @@ return [ 'read_less' => 'Read less', 'see_more' => 'See more', 'see_less' => 'See less', + 'legal_notice' => 'Legal notice', ];