Skip to content

Commit

Permalink
refactor: migrated edit FAQ page to controller (#3257)
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsten committed Dec 25, 2024
1 parent 2e13740 commit 1f3fb51
Show file tree
Hide file tree
Showing 68 changed files with 630 additions and 461 deletions.
10 changes: 5 additions & 5 deletions phpmyfaq/admin/assets/src/content/faqs.overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ const populateCategoryTable = async (catgoryId, faqs) => {
addElement('td', { classList: 'align-middle text-center' }, [
addElement('a', {
classList: 'text-decoration-none',
href: `?action=editentry&id=${faq.id}&lang=${faq.language}`,
href: `./faq/edit/${faq.id}/${faq.language}`,
innerText: faq.id,
}),
])
Expand All @@ -185,7 +185,7 @@ const populateCategoryTable = async (catgoryId, faqs) => {
addElement('td', { classList: 'align-middle text-center' }, [
addElement('a', {
classList: 'text-decoration-none',
href: `?action=editentry&id=${faq.id}&lang=${faq.language}`,
href: `./faq/edit/${faq.id}/${faq.language}`,
innerText: faq.solution_id,
}),
])
Expand All @@ -194,7 +194,7 @@ const populateCategoryTable = async (catgoryId, faqs) => {
addElement('td', {}, [
addElement('a', {
classList: 'text-decoration-none',
href: `?action=editentry&id=${faq.id}&lang=${faq.language}`,
href: `./faq/edit/${faq.id}/${faq.language}`,
innerText: faq.question,
}),
])
Expand Down Expand Up @@ -230,14 +230,14 @@ const populateCategoryTable = async (catgoryId, faqs) => {
);
row.append(
addElement('td', { classList: 'align-middle text-center' }, [
addElement('a', { classList: 'btn btn-primary', href: `?action=editentry&id=${faq.id}&lang=${faq.language}` }, [
addElement('a', { classList: 'btn btn-primary', href: `./faq/edit/${faq.id}/${faq.language}` }, [
addElement('i', { classList: 'bi bi-pencil', 'aria-hidden': 'true' }),
]),
])
);
row.append(
addElement('td', { classList: 'align-middle text-center' }, [
addElement('a', { classList: 'btn btn-info', href: `?action=copyentry&id=${faq.id}&lang=${faq.language}` }, [
addElement('a', { classList: 'btn btn-info', href: `./faq/copy/${faq.id}/${faq.language}` }, [
addElement('i', { classList: 'bi bi-copy', 'aria-hidden': 'true' }),
]),
])
Expand Down
26 changes: 13 additions & 13 deletions phpmyfaq/admin/faqs.editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@
}

$templateVars = [
'ad_record_faq' => Translation::get('ad_record_faq'),
'ad_menu_faq_meta' => Translation::get('ad_menu_faq_meta'),
'ad_record_permissions' => Translation::get('ad_record_permissions'),
'msgQuestionAnswer' => Translation::get('msgQuestionAnswer'),
'msgFAQMetaData' => Translation::get('msgFAQMetaData'),
'msgPermissions' => Translation::get('msgPermissions'),
'ad_admin_notes' => Translation::get('ad_admin_notes'),
'ad_entry_changelog' => Translation::get('ad_entry_changelog'),
];
Expand All @@ -262,7 +262,7 @@

$templateVars = [
...$templateVars,
'adminFaqEditorHeader' => Translation::get('ad_entry_edit_1') . ' ' . Translation::get('ad_entry_edit_2'),
'msgAddFAQ' => Translation::get('ad_entry_edit_1') . ' ' . Translation::get('ad_entry_edit_2'),
'editExistingFaq' => true,
'currentRevision' => $currentRevision,
'faqUrl' => $link->toString(),
Expand All @@ -271,7 +271,7 @@
} else {
$templateVars = [
...$templateVars,
'adminFaqEditorHeader' => Translation::get('ad_entry_add'),
'msgAddFAQ' => Translation::get('msgAddFAQ'),
'editExistingFaq' => false,
];
}
Expand Down Expand Up @@ -337,10 +337,10 @@
'msgQuestion' => Translation::get('msgQuestion'),
'msgNoHashAllowed' => Translation::get('msgNoHashAllowed'),
'msgShowHelp' => Translation::get('msgShowHelp'),
'ad_entry_content' => Translation::get('ad_entry_content'),
'ad_entry_category' => Translation::get('ad_entry_category'),
'msgAnswer' => Translation::get('msgAnswer'),
'msgCategory' => Translation::get('msgCategory'),
'categoryOptions' => $categoryHelper->renderOptions($categories),
'ad_entry_locale' => Translation::get('ad_entry_locale'),
'msgLanguage' => Translation::get('msgLanguage'),
'languageOptions' => LanguageHelper::renderSelectLanguage($faqData['lang'], false, [], 'lang'),
'hasPermissionForAddAttachments' => $user->perm->hasPermission(
$currentUserId,
Expand All @@ -350,15 +350,15 @@
$currentUserId,
PermissionType::ATTACHMENT_DELETE->value
),
'ad_menu_attachments' => Translation::get('ad_menu_attachments'),
'msgAttachments' => Translation::get('msgAttachments'),
'csrfTokenDeleteAttachment' => Token::getInstance($container->get('session'))->getTokenString('delete-attachment'),
'attachments' => $attList,
'ad_att_add' => Translation::get('ad_att_add'),
'ad_entry_tags' => Translation::get('ad_entry_tags'),
'msgAddAttachment' => Translation::get('msgAddAttachment'),
'msgTags' => Translation::get('msgTags'),
'ad_entry_keywords' => Translation::get('ad_entry_keywords'),
'ad_entry_author' => Translation::get('ad_entry_author'),
'msgEmail' => Translation::get('msgEmail'),
'msgSeoCenter' => Translation::get('seoCenter'),
'msgSeoCenter' => Translation::get('msgSeoCenter'),
'msgSerp' => Translation::get('msgSerp'),
'msgSerpTitle' => Translation::get('msgSerpTitle'),
'ad_entry_grouppermission' => Translation::get('ad_entry_grouppermission'),
Expand Down Expand Up @@ -386,7 +386,7 @@
'ad_entry_save' => Translation::get('ad_entry_save'),
'msgUpdateFaqDate' => Translation::get('msgUpdateFaqDate'),
'msgKeepFaqDate' => Translation::get('msgKeepFaqDate'),
'msgEditFaqDat' => Translation::get('msgEditFaqDat'),
'msgEditFaqDate' => Translation::get('msgEditFaqDate'),
'ad_entry_status' => Translation::get('ad_entry_status'),
'hasPermissionForApprove' => $user->perm->hasPermission($currentUserId, PermissionType::FAQ_APPROVE->value),
'isActive' => $isActive,
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/admin/forms.translations.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

$templateVars = [
'translations' => $forms->getTranslations($formId, $inputId),
'ad_entry_locale' => Translation::get('ad_entry_locale'),
'msgLanguage' => Translation::get('msgLanguage'),
'msgInputLabel' => Translation::get('msgInputLabel'),
'ad_sess_pageviews' => Translation::get('ad_sess_pageviews'),
'msgFormsEditTranslations' => Translation::get('msgFormsEditTranslations'),
Expand Down
6 changes: 3 additions & 3 deletions phpmyfaq/admin/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
$secLevelEntries['content'] .= $adminHelper->addMenuEntry(
PermissionType::FAQ_ADD->value,
'editentry',
'ad_entry_add',
'msgAddFAQ',
'faq/add'
);
$secLevelEntries['content'] .= $adminHelper->addMenuEntry(
Expand All @@ -88,13 +88,13 @@
$secLevelEntries['content'] .= $adminHelper->addMenuEntry(
'addattachment+editattachment+delattachment',
'attachments',
'ad_menu_attachments',
'msgAttachments',
'attachments'
);
$secLevelEntries['content'] .= $adminHelper->addMenuEntry(
PermissionType::FAQ_EDIT->value,
'tags',
'ad_entry_tags',
'msgTags',
'tags'
);
$secLevelEntries['content'] .= $adminHelper->addMenuEntry(
Expand Down
4 changes: 2 additions & 2 deletions phpmyfaq/admin/import.csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
'adminHeaderCSVImportColumns' => Translation::get('msgColumnStructure'),
'categoryId' => Translation::get('ad_categ_categ'),
'question' => Translation::get('ad_entry_topic'),
'answer' => Translation::get('ad_entry_content'),
'answer' => Translation::get('msgAnswer'),
'keywords' => Translation::get('ad_entry_keywords'),
'author' => Translation::get('ad_entry_author'),
'email' => Translation::get('msgEmail'),
'languageCode' => Translation::get('msgLanguageCode'),
'seperateWithCommas' => Translation::get('msgSeperateWithCommas'),
'tags' => Translation::get('ad_entry_tags'),
'tags' => Translation::get('msgTags'),
'msgImportRecordsColumnStructure' => Translation::get('msgImportRecordsColumnStructure'),
'csrfToken' => Token::getInstance($container->get('session'))->getTokenString('importfaqs'),
'is_active' => Translation::get('ad_entry_active'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<table id="formTranslations" class="table">
<thead>
<tr>
<th scope="col">{{ ad_entry_locale }}</th>
<th scope="col">{{ msgLanguage }}</th>
<th scope="col">{{ msgInputLabel }}</th>
<th scope="col">{{ ad_sess_pageviews }}</th>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/assets/templates/admin/configuration/main.twig
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<li role="presentation" class="nav-item">
<a href="#seo" aria-controls="seo" role="tab" data-bs-toggle="tab" class="nav-link">
<i aria-hidden="true" class="bi bi-search"></i>
{{ 'seoCenter' | translate }}
{{ 'msgSeoCenter' | translate }}
</a>
</li>
<li role="presentation" class="nav-item">
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/assets/templates/admin/content/category.add.twig
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@

<!-- SERP Title -->
<div class="row mb-2">
<label class="col-lg-2 col-form-label" for="serpTitle">{{ msgSerpTitle }}</label>
<label class="col-lg-2 col-form-label" for="serpTitle">{{ 'msgSerpTitle' | translate }}</label>
<div class="col-lg-4">
<input type="text" name="serpTitle" id="serpTitle" value="" class="form-control">
</div>
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/assets/templates/admin/content/category.edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@

<!-- SERP Title -->
<div class="row mb-2">
<label class="col-lg-2 col-form-label" for="serpTitle">{{ msgSerpTitle }}</label>
<label class="col-lg-2 col-form-label" for="serpTitle">{{ 'msgSerpTitle' | translate }}</label>
<div class="col-lg-4">
<input type="text" name="serpTitle" id="serpTitle" value="{{ serpTitle }}" class="form-control">
</div>
Expand Down
Loading

0 comments on commit 1f3fb51

Please sign in to comment.