Skip to content

Commit

Permalink
refactor: code cleanup (#3257)
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsten committed Dec 21, 2024
1 parent 2da1987 commit 675a236
Show file tree
Hide file tree
Showing 54 changed files with 383 additions and 386 deletions.
2 changes: 1 addition & 1 deletion phpmyfaq/admin/category.showstructure.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
'basePath' => $request->getBasePath(),
'faqlangcode' => $faqLangCode,
'msgCategoryRemark_overview' => Translation::get('msgCategoryRemark_overview'),
'ad_categ_title' => Translation::get('ad_categ_titel'),
'categoryNameLabel' => Translation::get('categoryNameLabel'),
'ad_categ_translate' => Translation::get('ad_categ_translate'),
'ad_menu_categ_structure' => Translation::get('ad_menu_categ_structure'),
'msgAddCategory' => Translation::get('msgAddCategory'),
Expand Down
6 changes: 3 additions & 3 deletions phpmyfaq/admin/category.translate.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@
'groupPermission' => $groupPermission[0],
'userPermission' => $userPermission[0],
'csrf' => Token::getInstance($container->get('session'))->getTokenString('update-category'),
'ad_categ_title' => Translation::get('ad_categ_titel'),
'categoryNameLabel' => Translation::get('categoryNameLabel'),
'ad_categ_lang' => Translation::get('ad_categ_lang'),
'langToTranslate' => $category->getCategoryLanguagesToTranslate($id, $selectedLanguage),
'ad_categ_desc' => Translation::get('ad_categ_desc'),
'ad_categ_owner' => Translation::get('ad_categ_owner'),
'categoryDescriptionLabel' => Translation::get('categoryDescriptionLabel'),
'categoryOwnerLabel' => Translation::get('categoryOwnerLabel'),
'userOptions' => $userHelper->getAllUserOptions($category->categoryName[$id]['user_id']),
'ad_categ_transalready' => Translation::get('ad_categ_transalready'),
'langTranslated' => $category->getCategoryLanguagesTranslated($id),
Expand Down
3 changes: 1 addition & 2 deletions phpmyfaq/admin/faqs.editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@
'msgSeoCenter' => Translation::get('seoCenter'),
'msgSerp' => Translation::get('msgSerp'),
'msgSerpTitle' => Translation::get('msgSerpTitle'),
'msgSerpDescription' => Translation::get('msgSerpDescription'),
'ad_entry_grouppermission' => Translation::get('ad_entry_grouppermission'),
'ad_entry_all_groups' => Translation::get('ad_entry_all_groups'),
'allGroups' => $allGroups,
Expand All @@ -371,7 +370,7 @@
$user->perm->getAllGroupsOptions($groupPermission, $user) : '',
'ad_entry_userpermission' => Translation::get('ad_entry_userpermission'),
'allUsers' => $allUsers,
'ad_entry_all_users' => Translation::get('ad_entry_all_users'),
'msgAccessAllUsers' => Translation::get('msgAccessAllUsers'),
'restrictedUsers' => $restrictedUsers,
'ad_entry_restricted_users' => Translation::get('ad_entry_restricted_users'),
'userPermissionOptions' => $userHelper->getAllUserOptions($userPermission[0], true),
Expand Down
25 changes: 14 additions & 11 deletions phpmyfaq/assets/templates/admin/content/category.add.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
{% block content %}
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">
<i aria-hidden="true" class="bi bi-folder"></i> {{ ad_categ_new }}
<i aria-hidden="true" class="bi bi-folder"></i> {{ 'msgNewCategory' | translate }}
</h1>
<div class="btn-toolbar mb-2 mb-md-0">
<div class="btn-group mr-2">
<a class="btn btn-info" href="./category">
<i aria-hidden="true" class="bi bi-list"></i> {{ msgCategoryMatrix }}
<i aria-hidden="true" class="bi bi-list"></i> {{ 'msgCategoryMatrix' | translate }}
</a>
</div>
</div>
Expand All @@ -34,7 +34,7 @@
{% endif %}
<div class="row mb-2">
<label class="col-lg-2 col-form-label" for="name">
{{ ad_categ_title }}
{{ 'categoryNameLabel' | translate }}
</label>
<div class="col-lg-4">
<input type="text" id="name" name="name" class="form-control" required>
Expand All @@ -43,7 +43,7 @@

<div class="row mb-2">
<label class="col-lg-2 col-form-label" for="description">
{{ ad_categ_desc }}
{{ 'categoryDescriptionLabel' | translate }}
</label>
<div class="col-lg-4">
<textarea id="description" name="description" rows="3" class="form-control"></textarea>
Expand All @@ -55,7 +55,7 @@
<div class="form-check">
<input type="checkbox" name="active" id="active" value="1" class="form-check-input" checked>
<label class="form-check-label" for="active">
{{ ad_user_active }}
{{ 'msgActive' | translate }}
</label>
</div>
</div>
Expand All @@ -66,15 +66,15 @@
<div class="form-check">
<input type="checkbox" name="show_home" id="show_home" value="1" class="form-check-input">
<label class="form-check-label" for="show_home">
{{ ad_user_show_home }}
{{ 'categoryShowHomeLabel' | translate }}
</label>
</div>
</div>
</div>

<div class="row mb-2">
<label class="col-lg-2 col-form-label" for="pmf-category-image-upload">
{{ ad_category_image }}:
{{ categoryShowHomeLabel }}:
</label>
<div class="col-lg-4">
<input class="form-control" type="file" name="image" id="pmf-category-image-upload">
Expand All @@ -83,7 +83,7 @@

<div class="row mb-2">
<label class="col-lg-2 col-form-label" for="user_id">
{{ ad_categ_owner }}
{{ 'categoryOwnerLabel' | translate }}
</label>
<div class="col-lg-4">
<select name="user_id" id="user_id" class="form-select">
Expand All @@ -94,7 +94,8 @@
{% if permLevel != 'basic' %}
<div class="row mb-2">
<label class="col-lg-2 col-form-label" for="group_id">
{{ ad_categ_moderator }}</label>
{{ 'categoryModeratorLabel' | translate }}
</label>
<div class="col-lg-4">
<select name="group_id" id="group_id" class="form-select">
{{ groupsOptions|raw }}
Expand Down Expand Up @@ -143,7 +144,7 @@
<input type="radio" name="userpermission" id="userpermission_all" value="all"
class="form-check-input" checked>
<label class="form-check-label" for="userpermission_all">
{{ ad_entry_all_users }}
{{ 'msgAccessAllUsers' | translate }}
</label>
</div>
<div class="form-check">
Expand All @@ -169,7 +170,9 @@

<!-- SERP Description -->
<div class="row mb-2">
<label class="col-lg-2 col-form-label" for="serpDescription">{{ msgSerpDescription }}</label>
<label class="col-lg-2 col-form-label" for="serpDescription">
{{ 'msgSerpDescription' | translate }}
</label>
<div class="col-lg-4">
<textarea type="text" name="serpDescription" id="serpDescription" rows="5" class="form-control"
></textarea>
Expand Down
24 changes: 15 additions & 9 deletions phpmyfaq/assets/templates/admin/content/category.edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<div class="row mb-2">
<label class="col-lg-2 col-form-label" for="name">
{{ categoryNameLabel }}
{{ 'categoryNameLabel' | translate }}
</label>
<div class="col-lg-4">
<input type="text" id="name" name="name" value="{{ categoryName }}" class="form-control">
Expand All @@ -27,7 +27,7 @@

<div class="row mb-2">
<label class="col-lg-2 col-form-label" for="description">
{{ categoryDescriptionLabel }}
{{ 'categoryDescriptionLabel' | translate }}
</label>
<div class="col-lg-4">
<textarea id="description" name="description" rows="3" class="form-control"
Expand All @@ -39,7 +39,9 @@
<div class="offset-lg-2 col-lg-4">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="active" id='active' value="1" {{ categoryActive }}>
<label class="form-check-label" for="active">{{ categoryActiveLabel }}</label>
<label class="form-check-label" for="active">
{{ 'msgActive' | translate }}
</label>
</div>
</div>
</div>
Expand All @@ -49,15 +51,17 @@
<div class="form-check">
<input class="form-check-input" type="checkbox" name="show_home" id='show_home' value="1"
{{ categoryShowHome }}>
<label class="form-check-label" for="show_home">{{ categoryShowHomeLabel }}</label>
<label class="form-check-label" for="show_home">
{{ 'categoryShowHomeLabel' | translate }}
</label>
</div>
</div>
</div>


<div class="row mb-2">
<label class="col-lg-2 col-form-label" for="pmf-category-image-upload">
{{ categoryImageLabel }}
{{ 'categoryImageLabel' | translate }}
</label>
<div class="col-lg-4">
<div class="input-group">
Expand All @@ -75,7 +79,7 @@

<div class="row mb-2">
<label class="col-lg-2 col-form-label" for="user_id">
{{ categoryOwnerLabel }}
{{ 'categoryOwnerLabel' | translate }}
</label>
<div class="col-lg-4">
<select id="user_id" name="user_id" class="form-select">
Expand All @@ -87,7 +91,7 @@
{% if isMediumPermission %}
<div class="row mb-2">
<label class="col-lg-2 col-form-label" for="group_id">
{{ categoryModeratorLabel }}
{{ 'categoryModeratorLabel' | translate }}
</label>
<div class="col-lg-4">
<select name="group_id" id="group_id" class="form-select">
Expand Down Expand Up @@ -134,7 +138,7 @@
<input type="radio" name="userpermission" id="userpermission_all" value="all"
class="form-check-input" {{ allUsers }}>
<label class="form-check-label" for="userpermission_all">
{{ allUsersLabel }}
{{ 'msgAccessAllUsers' | translate }}
</label>
</div>
<div class="form-check">
Expand All @@ -160,7 +164,9 @@

<!-- SERP Description -->
<div class="row mb-2">
<label class="col-lg-2 col-form-label" for="serpDescription">{{ msgSerpDescription }}</label>
<label class="col-lg-2 col-form-label" for="serpDescription">
{{ 'msgSerpDescription' | translate }}
</label>
<div class="col-lg-4">
<textarea type="text" name="serpDescription" id="serpDescription" rows="5" class="form-control"
>{{ serpDescription }}</textarea>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<input type="hidden" name="csrf" id="csrf" value="{{ csrf }}">

<div class="row mb-2">
<label class="col-lg-2 col-form-label" for="name">{{ ad_categ_title }}:</label>
<label class="col-lg-2 col-form-label" for="name">{{ 'categoryNameLabel' | translate }}:</label>
<div class="col-lg-4">
<input type="text" name="name" class="form-control" id="name">
</div>
Expand All @@ -37,14 +37,16 @@
</div>

<div class="row mb-2">
<label class="col-lg-2 col-form-label">{{ ad_categ_desc }}:</label>
<label class="col-lg-2 col-form-label">{{ 'categoryDescriptionLabel' | translate }}</label>
<div class="col-lg-4">
<textarea name="description" rows="3" class="form-control"></textarea>
</div>
</div>

<div class="row mb-2">
<label class="col-lg-2 col-form-label">{{ ad_categ_owner }}:</label>
<label class="col-lg-2 col-form-label">
{{ 'categoryOwnerLabel' | translate }}
</label>
<div class="col-lg-4">
<select name="user_id" class="form-control">
{{ userOptions|raw }}
Expand Down
6 changes: 4 additions & 2 deletions phpmyfaq/assets/templates/admin/content/faq.editor.twig
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@

<!-- SERP Description -->
<div class="row mb-2">
<label class="col-lg-3 col-form-label" for="serpDescription">{{ msgSerpDescription }}</label>
<label class="col-lg-3 col-form-label" for="serpDescription">
{{ 'msgSerpDescription' | translate }}
</label>
<div class="col-lg-9">
<textarea type="text" name="serpDescription" id="serpDescription" rows="5" class="form-control"
>{{ faqData['serp-description'] }}</textarea>
Expand Down Expand Up @@ -307,7 +309,7 @@
<input type="radio" id="allusers" name="userpermission" value="all" class="form-check-input"
{{ allUsers ? 'checked' : '' }}>
<label class="form-check-label" for="allusers">
{{ ad_entry_all_users }}
{{ 'msgAccessAllUsers' | translate }}
</label>
</div>
<div class="form-check">
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/assets/templates/admin/content/faq.overview.twig
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
{{ msgSticky }}
</th>
<th class="align-middle">
{{ msgActive }}
{{ 'msgActive' | translate }}
</th>
<th colspan="4" class="align-middle">
Actions
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/assets/templates/admin/user/user.twig
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
</label>
<div class="col-lg-8">
<select id="user_status" class="form-select" name="user_status" disabled>
<option value="active">{{ 'ad_user_active' | translate }}</option>
<option value="active">{{ 'msgActive' | translate }}</option>
<option value="blocked">{{ 'ad_user_blocked' | translate }}</option>
<option value="protected">{{ 'ad_user_protected' | translate }}</option>
</select>
Expand Down
5 changes: 5 additions & 0 deletions phpmyfaq/src/admin-routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@
'controller' => [CategoryController::class, 'addChild'],
'methods' => 'GET'
],
'admin.category.create' => [
'path' => '/category/create',
'controller' => [CategoryController::class, 'create'],
'methods' => 'POST'
],
'admin.category.edit' => [
'path' => '/category/edit/{categoryId}',
'controller' => [CategoryController::class, 'edit'],
Expand Down
Loading

0 comments on commit 675a236

Please sign in to comment.