-
-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: migrated FAQs overview page to controller (#3257)
- Loading branch information
Showing
16 changed files
with
196 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
164 changes: 84 additions & 80 deletions
164
phpmyfaq/assets/templates/admin/content/faq.overview.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,96 @@ | ||
<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-list-alt"></i> | ||
{{ 'msgHeaderFAQOverview' | translate }} | ||
</h1> | ||
<div class="pmf-faq-overview-search col-4"> | ||
<form name="pmf-faq-search-autocomplete" id="pmf-faq-search-autocomplete" action="?action=faq-overview" | ||
method="post" role="form"> | ||
{{ csrfTokenSearch | raw }} | ||
<div class="input-group"> | ||
<input type="text" class="form-control" placeholder="{{ 'msgAdminSearchFaqs' | translate }}" | ||
id="pmf-faq-overview-search-input" autocomplete="off"> | ||
<button class="btn btn-primary" type="button" id="pmf-faq-overview-search-button"> | ||
<i class="bi bi-search" aria-hidden="true"></i> | ||
</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
{% extends '@admin/index.twig' %} | ||
|
||
{% if categories is empty %} | ||
<div class="alert alert-danger" role="alert"> | ||
{{ 'msgErrorNoRecords' | translate }} | ||
{% 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-list-alt"></i> | ||
{{ 'msgHeaderFAQOverview' | translate }} | ||
</h1> | ||
<div class="pmf-faq-overview-search col-4"> | ||
<form name="pmf-faq-search-autocomplete" id="pmf-faq-search-autocomplete" action="?action=faq-overview" | ||
method="post" role="form"> | ||
{{ csrfTokenSearch | raw }} | ||
<div class="input-group"> | ||
<input type="text" class="form-control" placeholder="{{ 'msgAdminSearchFaqs' | translate }}" | ||
id="pmf-faq-overview-search-input" autocomplete="off"> | ||
<button class="btn btn-primary" type="button" id="pmf-faq-overview-search-button"> | ||
<i class="bi bi-search" aria-hidden="true"></i> | ||
</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
{% endif %} | ||
|
||
<div class="accordion shadow" id="pm-admin-faq-overview"> | ||
<div class="accordion-item d-flex justify-content-start flex-wrap flex-md-nowrap align-items-center p-3 bg-secondary-subtle"> | ||
<div class="col-2"> | ||
<div class="form-check"> | ||
<input class="form-check-input" type="checkbox" value="" id="pmf-checkbox-filter-inactive"> | ||
<label class="form-check-label" for="pmf-checkbox-filter-inactive"> | ||
{{ 'msgOnlyInactiveFAQs' | translate }} | ||
</label> | ||
</div> | ||
{% if categories is empty %} | ||
<div class="alert alert-danger" role="alert"> | ||
{{ 'msgErrorNoRecords' | translate }} | ||
</div> | ||
<div class="col-2"> | ||
<div class="form-check"> | ||
<input class="form-check-input" type="checkbox" value="" id="pmf-checkbox-filter-new"> | ||
<label class="form-check-label" for="pmf-checkbox-filter-new"> | ||
{{ 'msgOnlyNewFAQs' | translate }} | ||
</label> | ||
{% endif %} | ||
|
||
<div class="accordion shadow" id="pm-admin-faq-overview"> | ||
<div class="accordion-item d-flex justify-content-start flex-wrap flex-md-nowrap align-items-center p-3 bg-secondary-subtle"> | ||
<div class="col-2"> | ||
<div class="form-check"> | ||
<input class="form-check-input" type="checkbox" value="" id="pmf-checkbox-filter-inactive"> | ||
<label class="form-check-label" for="pmf-checkbox-filter-inactive"> | ||
{{ 'msgOnlyInactiveFAQs' | translate }} | ||
</label> | ||
</div> | ||
</div> | ||
<div class="col-2"> | ||
<div class="form-check"> | ||
<input class="form-check-input" type="checkbox" value="" id="pmf-checkbox-filter-new"> | ||
<label class="form-check-label" for="pmf-checkbox-filter-new"> | ||
{{ 'msgOnlyNewFAQs' | translate }} | ||
</label> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% for category in categories %} | ||
<div class="accordion-item"> | ||
<div class="accordion-header category-header-indent-{{ category.indent }}"> | ||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" | ||
data-bs-target="#category-id-{{ category.id }}"> | ||
{% for category in categories %} | ||
<div class="accordion-item"> | ||
<div class="accordion-header category-header-indent-{{ category.indent }}"> | ||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" | ||
data-bs-target="#category-id-{{ category.id }}"> | ||
|
||
<span class="lead">{{ category.name }}</span> | ||
<span class="badge bg-primary mx-1">{{ numberOfRecords[category.id] ?? 0 }} {{ 'msgEntries' | translate }}</span> | ||
<span class="badge bg-info mx-1">{{ numberOfComments[category.id] ?? 0 }} {{ msgComments }}</span> | ||
<span class="lead">{{ category.name }}</span> | ||
<span class="badge bg-primary mx-1">{{ numberOfRecords[category.id] ?? 0 }} {{ 'msgEntries' | translate }}</span> | ||
<span class="badge bg-info mx-1">{{ numberOfComments[category.id] ?? 0 }} {{ msgComments }}</span> | ||
|
||
</button> | ||
</div> | ||
<div id="category-id-{{ category.id }}" class="accordion-collapse collapse" data-pmf-language="{{ category.lang }}" | ||
data-bs-parent="#category-id-{{ category.id }}" data-pmf-categoryId="{{ category.id }}"> | ||
<div class="accordion-body"> | ||
<table class="table table-hover table-sm align-middle"> | ||
<thead class="thead-light"> | ||
<tr> | ||
<th colspan="3" class="align-middle"> | ||
ID | ||
</th> | ||
<th class="align-middle"> | ||
{{ msgQuestion }} | ||
</th> | ||
<th class="align-middle"> | ||
{{ msgDate }} | ||
</th> | ||
<th class="align-middle"> | ||
{{ msgSticky }} | ||
</th> | ||
<th class="align-middle"> | ||
{{ 'msgActive' | translate }} | ||
</th> | ||
<th colspan="4" class="align-middle"> | ||
Actions | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody id="tbody-category-id-{{ category.id }}" data-pmf-csrf="{{ csrfTokenOverview }}"> | ||
</button> | ||
</div> | ||
<div id="category-id-{{ category.id }}" class="accordion-collapse collapse" data-pmf-language="{{ category.lang }}" | ||
data-bs-parent="#category-id-{{ category.id }}" data-pmf-categoryId="{{ category.id }}"> | ||
<div class="accordion-body"> | ||
<table class="table table-hover table-sm align-middle"> | ||
<thead class="thead-light"> | ||
<tr> | ||
<th colspan="3" class="align-middle"> | ||
ID | ||
</th> | ||
<th class="align-middle"> | ||
{{ msgQuestion }} | ||
</th> | ||
<th class="align-middle"> | ||
{{ msgDate }} | ||
</th> | ||
<th class="align-middle"> | ||
{{ msgSticky }} | ||
</th> | ||
<th class="align-middle"> | ||
{{ 'msgActive' | translate }} | ||
</th> | ||
<th colspan="4" class="align-middle"> | ||
Actions | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody id="tbody-category-id-{{ category.id }}" data-pmf-csrf="{{ csrfTokenOverview }}"> | ||
|
||
</tbody> | ||
</table> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
{% endfor %} | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 15 additions & 1 deletion
16
phpmyfaq/src/phpMyFAQ/Controller/Administration/CategoryController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,25 @@ | ||
<?php | ||
|
||
/** | ||
* The Administration Category Controller | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at https://mozilla.org/MPL/2.0/. | ||
* | ||
* @package phpMyFAQ | ||
* @author Thorsten Rinne <[email protected]> | ||
* @copyright 2024 phpMyFAQ Team | ||
* @license https://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 | ||
* @link https://www.phpmyfaq.de | ||
* @since 2024-12-04 | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace phpMyFAQ\Controller\Administration; | ||
|
||
use phpMyFAQ\Category; | ||
use phpMyFAQ\Category\Image; | ||
use phpMyFAQ\Category\Permission; | ||
use phpMyFAQ\Core\Exception; | ||
use phpMyFAQ\Database; | ||
|
Oops, something went wrong.