From a83417180cf61cdfadc5509b0aaa2fdb66592be3 Mon Sep 17 00:00:00 2001
From: Yassine Doghri <yassine@doghri.fr>
Date: Tue, 13 Oct 2020 16:16:45 +0000
Subject: [PATCH] fix: fix layout bugs in admin and update translation files

fixes #40
---
 app/Language/en/Admin.php                      | 12 ++++++++++++
 app/Language/en/AdminNavigation.php            |  5 +++++
 app/Views/_assets/styles/radioBtn.css          |  2 +-
 app/Views/admin/_layout.php                    |  2 +-
 app/Views/admin/_sidebar.php                   |  7 +++----
 app/Views/admin/dashboard.php                  |  6 +++---
 app/Views/admin/episode/create.php             |  2 +-
 app/Views/admin/episode/edit.php               |  8 ++------
 app/Views/admin/my_account/change_password.php |  4 ++++
 app/Views/admin/my_account/view.php            |  4 ++++
 app/Views/admin/podcast/_sidebar.php           |  6 +++---
 app/Views/admin/podcast/create.php             |  6 ++++--
 app/Views/admin/podcast/edit.php               |  4 ++--
 13 files changed, 45 insertions(+), 23 deletions(-)
 create mode 100644 app/Language/en/Admin.php

diff --git a/app/Language/en/Admin.php b/app/Language/en/Admin.php
new file mode 100644
index 0000000000..62a75a8e29
--- /dev/null
+++ b/app/Language/en/Admin.php
@@ -0,0 +1,12 @@
+<?php
+
+/**
+ * @copyright  2020 Podlibre
+ * @license    https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
+ * @link       https://castopod.org/
+ */
+
+return [
+    'dashboard' => 'Admin dashboard',
+    'welcome_message' => 'Welcome to the admin area!',
+];
diff --git a/app/Language/en/AdminNavigation.php b/app/Language/en/AdminNavigation.php
index 212863f5d1..d9c2ada029 100644
--- a/app/Language/en/AdminNavigation.php
+++ b/app/Language/en/AdminNavigation.php
@@ -20,4 +20,9 @@ return [
     'pages' => 'Pages',
     'page-list' => 'All pages',
     'page-create' => 'New Page',
+    'account' => [
+        'my-account' => 'My account',
+        'change-password' => 'Change password',
+        'logout' => 'Logout',
+    ],
 ];
diff --git a/app/Views/_assets/styles/radioBtn.css b/app/Views/_assets/styles/radioBtn.css
index 7e6045d6f4..1007c67333 100644
--- a/app/Views/_assets/styles/radioBtn.css
+++ b/app/Views/_assets/styles/radioBtn.css
@@ -7,7 +7,7 @@
 }
 
 .form-radio-btn + label {
-  @apply px-2 py-1 text-sm text-black bg-white border rounded cursor-pointer;
+  @apply inline-block px-2 py-1 text-sm text-black bg-white border rounded cursor-pointer;
 
   &:hover {
     @apply bg-green-100;
diff --git a/app/Views/admin/_layout.php b/app/Views/admin/_layout.php
index d18c245949..d04edd4e19 100644
--- a/app/Views/admin/_layout.php
+++ b/app/Views/admin/_layout.php
@@ -30,7 +30,7 @@
                         'pageTitle'
                     ) ?></h1>
                 </div>
-                <div class="flex flex-wrap gap-y-2"><?= $this->renderSection(
+                <div class="flex flex-wrap"><?= $this->renderSection(
                     'headerRight'
                 ) ?></div>
             </div>
diff --git a/app/Views/admin/_sidebar.php b/app/Views/admin/_sidebar.php
index d6e1bf49d7..b57cccfe2b 100644
--- a/app/Views/admin/_sidebar.php
+++ b/app/Views/admin/_sidebar.php
@@ -52,13 +52,12 @@ $navigation = [
     <nav class="absolute z-50 flex-col hidden py-2 text-black whitespace-no-wrap bg-white border rounded shadow" aria-labelledby="my-accountDropdown" data-popper="menu" data-popper-placement="right-end">
         <a class="px-4 py-1 hover:bg-gray-100" href="<?= route_to(
             'my-account'
-        ) ?>">My Account</a>
+        ) ?>"><?= lang('AdminNavigation.account.my-account') ?></a>
         <a class="px-4 py-1 hover:bg-gray-100" href="<?= route_to(
             'change-password'
-        ) ?>">Change password</a>
+        ) ?>"><?= lang('AdminNavigation.account.change-password') ?></a>
         <a class="px-4 py-1 hover:bg-gray-100" href="<?= route_to(
             'logout'
-        ) ?>">Logout</a>
+        ) ?>"><?= lang('AdminNavigation.account.logout') ?></a>
     </nav>
 </div>
-
diff --git a/app/Views/admin/dashboard.php b/app/Views/admin/dashboard.php
index 214ccaaf7a..58bc0229f5 100644
--- a/app/Views/admin/dashboard.php
+++ b/app/Views/admin/dashboard.php
@@ -2,13 +2,13 @@
 <?= $this->extend('admin/_layout') ?>
 
 <?= $this->section('title') ?>
-Dashboard
+<?= lang('Admin.dashboard') ?>
 <?= $this->endSection() ?>
 
 <?= $this->section('pageTitle') ?>
-Admin dashboard
+<?= lang('Admin.dashboard') ?>
 <?= $this->endSection() ?>
 
 <?= $this->section('content') ?>
-Welcome to the admin area!
+<?= lang('Admin.welcome_message') ?>
 <?= $this->endsection() ?>
diff --git a/app/Views/admin/episode/create.php b/app/Views/admin/episode/create.php
index 30bf7fc1e5..e983158e9d 100644
--- a/app/Views/admin/episode/create.php
+++ b/app/Views/admin/episode/create.php
@@ -108,7 +108,7 @@
 </div>
 
 
-<?= form_fieldset('', ['class' => 'flex mb-4 gap-1']) ?>
+<?= form_fieldset('', ['class' => 'mb-4']) ?>
     <legend>
     <?= lang('Episode.form.type.label') .
         hint_tooltip(lang('Episode.form.type.hint'), 'ml-1') ?>
diff --git a/app/Views/admin/episode/edit.php b/app/Views/admin/episode/edit.php
index 155013db42..3048e1776f 100644
--- a/app/Views/admin/episode/edit.php
+++ b/app/Views/admin/episode/edit.php
@@ -233,7 +233,7 @@
 <?= form_fieldset_close() ?>
 
 
-<?= form_fieldset('', ['class' => 'flex mb-6 gap-1']) ?>
+<?= form_fieldset('', ['class' => 'mb-6']) ?>
     <legend>
     <?= lang('Episode.form.parental_advisory.label') .
         hint_tooltip(lang('Episode.form.type.hint'), 'ml-1') ?>
@@ -287,11 +287,7 @@
         hint_tooltip(lang('Episode.form.block_hint'), 'ml-1'),
     ['id' => 'block', 'name' => 'block'],
     'yes',
-    old(
-        'block',
-
-        $episode->block
-    )
+    old('block', $episode->block)
 ) ?>
 
 <?= form_section_close() ?>
diff --git a/app/Views/admin/my_account/change_password.php b/app/Views/admin/my_account/change_password.php
index 9ae867b6a7..3c34726ba4 100644
--- a/app/Views/admin/my_account/change_password.php
+++ b/app/Views/admin/my_account/change_password.php
@@ -4,6 +4,10 @@
 <?= lang('MyAccount.changePassword') ?>
 <?= $this->endSection() ?>
 
+<?= $this->section('pageTitle') ?>
+<?= lang('MyAccount.changePassword') ?>
+<?= $this->endSection() ?>
+
 
 <?= $this->section('content') ?>
 
diff --git a/app/Views/admin/my_account/view.php b/app/Views/admin/my_account/view.php
index 556876d561..6dc6b8d932 100644
--- a/app/Views/admin/my_account/view.php
+++ b/app/Views/admin/my_account/view.php
@@ -4,6 +4,10 @@
 <?= lang('MyAccount.info') ?>
 <?= $this->endSection() ?>
 
+<?= $this->section('pageTitle') ?>
+<?= lang('MyAccount.info') ?>
+<?= $this->endSection() ?>
+
 
 <?= $this->section('content') ?>
 
diff --git a/app/Views/admin/podcast/_sidebar.php b/app/Views/admin/podcast/_sidebar.php
index 570008cc87..1f49578316 100644
--- a/app/Views/admin/podcast/_sidebar.php
+++ b/app/Views/admin/podcast/_sidebar.php
@@ -83,12 +83,12 @@ $podcastNavigation = [
     <nav class="absolute z-50 flex-col hidden py-2 text-black whitespace-no-wrap bg-white border rounded shadow" aria-labelledby="my-accountDropdown" data-popper="menu" data-popper-placement="right-end">
         <a class="px-4 py-1 hover:bg-gray-100" href="<?= route_to(
             'my-account'
-        ) ?>">My Account</a>
+        ) ?>"><?= lang('AdminNavigation.account.my-account') ?></a>
         <a class="px-4 py-1 hover:bg-gray-100" href="<?= route_to(
             'change-password'
-        ) ?>">Change password</a>
+        ) ?>"><?= lang('AdminNavigation.account.change-password') ?></a>
         <a class="px-4 py-1 hover:bg-gray-100" href="<?= route_to(
             'logout'
-        ) ?>">Logout</a>
+        ) ?>"><?= lang('AdminNavigation.account.logout') ?></a>
     </nav>
 </div>
diff --git a/app/Views/admin/podcast/create.php b/app/Views/admin/podcast/create.php
index e5bd33a065..006dd61a87 100644
--- a/app/Views/admin/podcast/create.php
+++ b/app/Views/admin/podcast/create.php
@@ -58,7 +58,9 @@
     'required' => 'required',
 ]) ?>
 
-<?= form_fieldset('', ['class' => 'flex mb-4 gap-1']) ?>
+<?= form_fieldset('', [
+    'class' => 'mb-4',
+]) ?>
     <legend>
     <?= lang('Podcast.form.type.label') .
         hint_tooltip(lang('Podcast.form.type.hint'), 'ml-1') ?>
@@ -131,7 +133,7 @@
     ]
 ) ?>
 
-<?= form_fieldset('', ['class' => 'flex mb-4 gap-1']) ?>
+<?= form_fieldset('', ['class' => 'mb-4']) ?>
     <legend>
     <?= lang('Podcast.form.parental_advisory.label') .
         hint_tooltip(lang('Podcast.form.parental_advisory.hint'), 'ml-1') ?>
diff --git a/app/Views/admin/podcast/edit.php b/app/Views/admin/podcast/edit.php
index 8b6b1c6c06..2a3933b719 100644
--- a/app/Views/admin/podcast/edit.php
+++ b/app/Views/admin/podcast/edit.php
@@ -61,7 +61,7 @@
     'required' => 'required',
 ]) ?>
 
-<?= form_fieldset('', ['class' => 'flex mb-4 gap-1']) ?>
+<?= form_fieldset('', ['class' => 'mb-4']) ?>
     <legend><?= lang('Podcast.form.type.label') .
         hint_tooltip(lang('Podcast.form.type.hint'), 'ml-1') ?>
     </legend>
@@ -143,7 +143,7 @@
     ]
 ) ?>
 
-<?= form_fieldset('', ['class' => 'flex mb-4 gap-1']) ?>
+<?= form_fieldset('', ['class' => 'mb-4']) ?>
     <legend><?= lang('Podcast.form.parental_advisory.label') .
         hint_tooltip(lang('Podcast.form.parental_advisory.hint'), 'ml-1') ?>
     </legend>
-- 
GitLab