Skip to content

Commit

Permalink
Merge branch 'release/3.1.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
adrenth committed Jun 12, 2023
2 parents 9fd49db + f0ead2f commit cd137f1
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 91 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.1.9] - 2023-06-12

* Added environment variables for manipulating the navigation:
* `VDLP_REDIRECT_SHOW_IMPORT`
* `VDLP_REDIRECT_SHOW_EXPORT`
* `VDLP_REDIRECT_SHOW_SETTINGS`
* `VDLP_REDIRECT_SHOW_EXTENSION`
* UI optimizations

## [3.1.8] - 2023-05-25

* Add German translation (#104).
Expand Down
126 changes: 70 additions & 56 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,75 @@ public function registerNavigation(): array
'vdlp/redirect/' . (Settings::isStatisticsEnabled() ? 'statistics' : 'redirects')
);

$sideMenu = [
'redirects' => [
'icon' => 'icon-list',
'label' => 'vdlp.redirect::lang.navigation.menu_label',
'url' => Backend::url('vdlp/redirect/redirects'),
'order' => 20,
'permissions' => [
'vdlp.redirect.access_redirects',
],
],
'categories' => [
'label' => 'vdlp.redirect::lang.buttons.categories',
'url' => Backend::url('vdlp/redirect/categories'),
'icon' => 'icon-tag',
'order' => 60,
'permissions' => [
'vdlp.redirect.access_redirects',
],
],
];

if ((bool) config('vdlp.redirect::navigation.show_import', true) === true) {
$sideMenu['import'] = [
'label' => 'vdlp.redirect::lang.buttons.import',
'url' => Backend::url('vdlp/redirect/redirects/import'),
'icon' => 'icon-download',
'order' => 70,
'permissions' => [
'vdlp.redirect.access_redirects',
],
];
}

if ((bool) config('vdlp.redirect::navigation.show_export', true) === true) {
$sideMenu['export'] = [
'label' => 'vdlp.redirect::lang.buttons.export',
'url' => Backend::url('vdlp/redirect/redirects/export'),
'icon' => 'icon-upload',
'order' => 80,
'permissions' => [
'vdlp.redirect.access_redirects',
],
];
}

if ((bool) config('vdlp.redirect::navigation.show_settings', true) === true) {
$sideMenu['settings'] = [
'label' => 'vdlp.redirect::lang.buttons.settings',
'url' => Backend::url('system/settings/update/vdlp/redirect/config'),
'icon' => 'icon-cogs',
'order' => 90,
'permissions' => [
'vdlp.redirect.access_redirects',
],
];
}

if ((bool) config('vdlp.redirect::navigation.show_extensions', true) === true) {
$sideMenu['extensions'] = [
'label' => 'vdlp.redirect::lang.buttons.extensions',
'url' => Backend::url('vdlp/redirect/extensions'),
'icon' => 'icon-cubes',
'order' => 100,
'permissions' => [
'vdlp.redirect.access_redirects',
],
];
}

$navigation = [
'redirect' => [
'label' => 'vdlp.redirect::lang.navigation.menu_label',
Expand All @@ -83,62 +152,7 @@ public function registerNavigation(): array
'permissions' => [
'vdlp.redirect.access_redirects',
],
'sideMenu' => [
'redirects' => [
'icon' => 'icon-list',
'label' => 'vdlp.redirect::lang.navigation.menu_label',
'url' => Backend::url('vdlp/redirect/redirects'),
'order' => 20,
'permissions' => [
'vdlp.redirect.access_redirects',
],
],
'categories' => [
'label' => 'vdlp.redirect::lang.buttons.categories',
'url' => Backend::url('vdlp/redirect/categories'),
'icon' => 'icon-tag',
'order' => 60,
'permissions' => [
'vdlp.redirect.access_redirects',
],
],
'import' => [
'label' => 'vdlp.redirect::lang.buttons.import',
'url' => Backend::url('vdlp/redirect/redirects/import'),
'icon' => 'icon-download',
'order' => 70,
'permissions' => [
'vdlp.redirect.access_redirects',
],
],
'export' => [
'label' => 'vdlp.redirect::lang.buttons.export',
'url' => Backend::url('vdlp/redirect/redirects/export'),
'icon' => 'icon-upload',
'order' => 80,
'permissions' => [
'vdlp.redirect.access_redirects',
],
],
'settings' => [
'label' => 'vdlp.redirect::lang.buttons.settings',
'url' => Backend::url('system/settings/update/vdlp/redirect/config'),
'icon' => 'icon-cogs',
'order' => 90,
'permissions' => [
'vdlp.redirect.access_redirects',
],
],
'extensions' => [
'label' => 'vdlp.redirect::lang.buttons.extensions',
'url' => Backend::url('vdlp/redirect/extensions'),
'icon' => 'icon-cubes',
'order' => 100,
'permissions' => [
'vdlp.redirect.access_redirects',
],
],
],
'sideMenu' => $sideMenu,
],
];

Expand Down
4 changes: 1 addition & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@
"exclude": [
".gitattributes",
".github",
".gitignore",
"tests",
"phpunit.xml"
".gitignore"
]
},
"config": {
Expand Down
13 changes: 13 additions & 0 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,17 @@

'rules_path' => env('VDLP_REDIRECT_RULES_PATH', storage_path('app/redirects.csv')),

/*
|--------------------------------------------------------------------------
| Navigation
|--------------------------------------------------------------------------
*/

'navigation' => [
'show_import' => env('VDLP_REDIRECT_SHOW_IMPORT', true),
'show_export' => env('VDLP_REDIRECT_SHOW_EXPORT', true),
'show_settings' => env('VDLP_REDIRECT_SHOW_SETTINGS', true),
'show_extensions' => env('VDLP_REDIRECT_SHOW_EXTENSION', true),
],

];
59 changes: 31 additions & 28 deletions controllers/redirects/_popup_actions.htm
Original file line number Diff line number Diff line change
@@ -1,56 +1,59 @@
<div class="modal-header">
<button type="button"
class="close"
data-dismiss="modal"
aria-hidden="true">&times;</button>
<h4 class="modal-title"><?= e(trans('vdlp.redirect::lang.buttons.bulk_actions')); ?></h4>
<button type="button"
class="btn-close"
data-dismiss="modal"
aria-hidden="true"></button>
</div>
<div class="modal-body actions">
<div class="form-group">
<?php if ($this->getCacheManager()->cachingEnabledAndSupported()): ?>
<button class="btn btn-default btn-block"
data-request="onClearCache"
data-stripe-load-indicator>
<div class="form-group">
<button class="btn btn-default"
data-request="onClearCache"
data-stripe-load-indicator>
<?= e(trans('vdlp.redirect::lang.buttons.clear_cache')); ?>
</button>
</div>
<?php elseif ($this->getCacheManager()->cachingEnabledButNotSupported()): ?>
<button class="btn btn-default btn-block"
disabled="disabled">
<div class="form-group">
<button class="btn btn-default"
disabled="disabled">
<?= e(trans('vdlp.redirect::lang.buttons.clear_cache')); ?>
</button>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="form-group">
<button class="btn btn-default btn-block"
data-request="onResetAllStatistics"
data-request-confirm="<?= e(trans('vdlp.redirect::lang.redirect.general_confirm')); ?>">
<button class="btn btn-default"
data-request="onResetAllStatistics"
data-request-confirm="<?= e(trans('vdlp.redirect::lang.redirect.general_confirm')); ?>">
<?= e(trans('vdlp.redirect::lang.buttons.reset_all')); ?>
</button>
</div>
<div class="form-group">
<button class="btn btn-default btn-block"
data-request="onEnableAllRedirects"
data-request-confirm="<?= e(trans('vdlp.redirect::lang.redirect.general_confirm')); ?>">
<button class="btn btn-default"
data-request="onEnableAllRedirects"
data-request-confirm="<?= e(trans('vdlp.redirect::lang.redirect.general_confirm')); ?>">
<strong><u><?= e(trans('vdlp.redirect::lang.buttons.enable')); ?></u></strong> <?= e(trans('vdlp.redirect::lang.buttons.all_redirects')); ?>
</button>
</div>
<div class="form-group">
<button class="btn btn-default btn-block"
data-request="onDisableAllRedirects"
data-request-confirm="<?= e(trans('vdlp.redirect::lang.redirect.general_confirm')); ?>">
<button class="btn btn-default"
data-request="onDisableAllRedirects"
data-request-confirm="<?= e(trans('vdlp.redirect::lang.redirect.general_confirm')); ?>">
<strong><u><?= e(trans('vdlp.redirect::lang.buttons.disable')); ?></u></strong> <?= e(trans('vdlp.redirect::lang.buttons.all_redirects')); ?>
</button>
</div>
<button class="btn btn-danger btn-block"
<div class="form-group">
<button class="btn btn-danger"
data-request="onDeleteAllRedirects"
data-request-confirm="<?= e(trans('vdlp.redirect::lang.redirect.general_confirm')); ?>">
<strong><u><?= e(trans('vdlp.redirect::lang.buttons.delete')); ?></u></strong> <?= e(trans('vdlp.redirect::lang.buttons.all_redirects')); ?>
</button>
<hr>
<div class="form-group">
<button class="btn btn-secondary btn-block"
data-dismiss="modal">
<?= e(trans('backend::lang.form.cancel')); ?>
<strong><u><?= e(trans('vdlp.redirect::lang.buttons.delete')); ?></u></strong> <?= e(trans('vdlp.redirect::lang.buttons.all_redirects')); ?>
</button>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary"
data-dismiss="modal">
<?= e(trans('backend::lang.form.cancel')); ?>
</button>
</div>
5 changes: 1 addition & 4 deletions routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@
use Vdlp\Redirect\Classes\StatisticsHelper;

Route::group(['middleware' => ['web']], static function (): void {
Route::get('vdlp/redirect/sparkline/{redirectId}', static function ($redirectId) {
Route::get('vdlp/redirect/sparkline/{redirectId}', static function (Request $request, $redirectId) {
if (!BackendAuth::check()) {
return response('Forbidden', 403);
}

/** @var Request $request */
$request = resolve(Request::class);

$crawler = $request->has('crawler');

$preset = $request->get('preset', '30d-small');
Expand Down
1 change: 1 addition & 0 deletions updates/version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ v3.1.5: "Minor improvements. See: https://github.com/vdlp/oc-redirect-plugin/rel
v3.1.6: "Add support for October CMS 3.3."
v3.1.7: "Remove use of old BrandSetting constants."
v3.1.8: "Add German translation."
v3.1.9: "Added environment variables for manipulating the navigation."

0 comments on commit cd137f1

Please sign in to comment.