Skip to content

Commit

Permalink
Polishing BO UI, added Tools menu entry
Browse files Browse the repository at this point in the history
  • Loading branch information
Franck Allimant committed Sep 12, 2023
1 parent c65064c commit 0996d69
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 42 deletions.
2 changes: 2 additions & 0 deletions Config/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
<tag name="hook.event_listener" event="configuration.catalog-top" type="back" method="onConfigurationCatalogTop"/>
<tag name="hook.event_listener" event="module.configuration" type="back" method="onModuleConfiguration" />
<tag name="hook.event_listener" event="module.config-js" type="back" method="onModuleConfigurationJavascript" />
<tag name="hook.event_listener" event="module.config-js" type="back" method="onModuleConfigurationJavascript" />
<tag name="hook.event_listener" event="main.top-menu-tools" type="back" method="onMainTopMenuTools" />
</hook>
</hooks>

Expand Down
2 changes: 1 addition & 1 deletion Config/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<descriptive locale="fr_FR">
<title>Gérer la réécriture d'url</title>
</descriptive>
<version>2.1.3</version>
<version>2.1.4</version>
<author>
<name>Vincent Lopes, Gilles Bourgeat, Tom Pradat</name>
<email>[email protected], [email protected], [email protected]</email>
Expand Down
2 changes: 0 additions & 2 deletions Config/sqldb.map

This file was deleted.

16 changes: 16 additions & 0 deletions Hook/ConfigurationHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@

namespace RewriteUrl\Hook;

use Carousel\Carousel;
use RewriteUrl\RewriteUrl;
use Thelia\Core\Event\Hook\HookRenderBlockEvent;
use Thelia\Core\Event\Hook\HookRenderEvent;
use Thelia\Core\Hook\BaseHook;
use Thelia\Model\ConfigQuery;
use Thelia\Tools\URL;

/**
* Class ConfigurationHook
Expand Down Expand Up @@ -53,4 +57,16 @@ public function onConfigurationCatalogTop(HookRenderEvent $event)
'configuration-catalog.html'
));
}

public function onMainTopMenuTools(HookRenderBlockEvent $event)
{
$event->add(
[
'id' => 'tools_menu_rewriteutl',
'class' => '',
'url' => URL::getInstance()->absoluteUrl('/admin/module/RewriteUrl'),
'title' => $this->trans('Global URL Rewriting', [], RewriteUrl::MODULE_DOMAIN),
]
);
}
}
6 changes: 3 additions & 3 deletions I18n/backOffice/default/fr_FR.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
'Close' => 'Fermer',
'Condition' => 'Condition',
'Configuration' => 'Configuration',
'Configure' => 'Configuration',
'Contents' => 'Contenus',
'Currently enabled rules' => 'Règles activées',
'Default' => 'Url par défaut',
'Default Url' => 'URL par défaut',
'Default url' => 'Url par défaut',
'Delete Url' => 'Supprimer une Url',
'Delete this redirect' => 'Supprimer cette redirection',
'Do you really want to delete the url %html ?' => 'Voulez-vous vraiment supprimer l\'url %html ?',
'Do you really want to set the url %html as default ?' => 'Définir %html comme URL part défaut ?',
'Edit information in %lng' => 'Modifier l\'information en %lng',
'Enable URL rewriting' => 'Activer la réécriture d\'URL',
'Enter a URL with a leading \'/\' and no domain name. Ex : for \'www.mysite.com/one/two\', enter \'/one/two\'.' => 'Saisissez une URL commençant par un \'/\' et sans nom de domaine. Ex : pour \'www.monsite.com/un/deux\', saisissez \'/un/deux\'.',
Expand All @@ -37,10 +38,10 @@
'For questions or bug reporting, thank you to use %url.' => 'Pour toutes questions ou déclaration de bug, merci d\'utiliser %url',
'For the regex, your input is compare to URL without the domain name and without any GET params. Ex : for \'www.mysite.com/one/two?three=four\', your regex will be compare to \'/one/two\'.' => 'Pour une regex, votre expression régulière sera comparée aux URLs sans nom de domaine et sans paramètres GET. Ex : pour \'www.monsite.com/un/deux?trois=quatre\', votre regex sera comparée à \'/un/deux\'.',
'GET params' => 'Paramètres GET',
'Global URL Rewriting' => 'Ré-écritures URL globales',
'Home' => 'Accueil',
'ID' => 'ID',
'List of not rewriten urls' => 'Liste des urls non réécrites',
'Modules' => 'Modules',
'Name' => 'Nom',
'New url' => 'Nouvelle url',
'No redirected url.' => 'Pas de redirection',
Expand All @@ -62,7 +63,6 @@
'Redirected' => 'Redirigé vers',
'Reference' => 'Référence',
'Regex' => 'Regex',
'RewriteUrl' => 'RewriteURL',
'Rule management' => 'Gestion des règles de redirection',
'Rule type' => 'Type de règle',
'Search' => 'Rechercher',
Expand Down
3 changes: 3 additions & 0 deletions I18n/fr_FR.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

return array(
'At least one GET parameter is required.' => 'Au moins un paramètre GET est requis.',
'Get Params' => 'Paramètres GET',
'Global URL Rewriting' => 'Ré-écritures URL globales',
'Param condition is empty.' => 'Une des conditions d\'un paramètre GET est vide.',
'Param name is empty.' => 'Le nom d\'un paramètre GET est vide.',
'Redirect url cannot be empty.' => 'L URL redirigée ne peut pas être vide.',
'Regex' => 'Expression régulière',
'Regex value cannot be empty.' => 'La valeur de l\'expression régulière ne peut pas être vide.',
'This url is already used here %url.' => 'L URL est déjà utilisée ici : %url',
'Unable to change the configuration variable.' => 'Impossible de changer la variable de configuration.',
Expand Down
68 changes: 32 additions & 36 deletions templates/backOffice/default/RewriteUrl/module-configuration.html
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
{$d='rewriteurl.bo.default'}
<div class="modules-configure">
<div id="wrapper" class="container">
<div class="clearfix">
<ul class="breadcrumb pull-left">
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
<li><a href="{url path='/admin/modules'}">{intl l="Modules"}</a></li>
<li><a href="#">{intl l="Configure"} : RewriteUrl</a></li>
</ul>
</div>

<div class="general-block-decorator">
<div class="row">
<div class="col-md-12 title title-without-tabs">
{intl d=$d l="Global URL Rewriting"}
</div>
</div>

<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-body">
<div>
<label>{intl l="Enable URL rewriting"}</label>
<label>{intl d=$d l="Enable URL rewriting"}</label>
<div class="make-switch switch-small js_switch_rewrite_url" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
<input type="checkbox" {if $isRewritingEnabled}checked="checked"{/if}>
</div>
</div>
<span class="help-block">{intl l="Set the config variable 'rewriting_enable'"}</span>
<span class="help-block">{intl d=$d l="Set the config variable 'rewriting_enable'"}</span>
</div>
</div>



<div class="panel panel-default">
<div class="panel-heading clearfix">
<div class="panel-title">
{intl l="Rule management"}
</div>
<div class="panel-heading">
<h3 class="panel-title">
{intl d=$d l="Rule management"}
</h3>
</div>
<div class="panel-body">

Expand All @@ -39,12 +36,12 @@
<table class="table table-condensed table-striped">
<thead>
<tr>
<th class="text-center"><label class="control-label">{intl l="Rule type"}</label></th>
<th class="text-center"><label class="control-label">{intl l="Condition"} <a href="#" data-toggle="tooltip" title="{intl l="For the regex, your input is compare to URL without the domain name and without any GET params. Ex : for 'www.mysite.com/one/two?three=four', your regex will be compare to '/one/two'."}"><span class="glyphicon glyphicon-question-sign"></span></a></label></th>
<th class="text-center"><label class="control-label">{intl l="404 only"}</label></th>
<th class="text-center"><label class="control-label">{intl l="Redirect to"} <a href="#" data-toggle="tooltip" title="{intl l="Enter a URL with a leading '/' and no domain name. Ex : for 'www.mysite.com/one/two', enter '/one/two'."}"><span class="glyphicon glyphicon-question-sign"></span></a></label></th>
<th class="text-center"><label class="control-label">{intl l="Position"}</label></th>
<th class="text-center"><label class="control-label">{intl l="Actions"}</label></th>
<th class="text-center"><label class="control-label">{intl d=$d l="Rule type"}</label></th>
<th class="text-center"><label class="control-label">{intl d=$d l="Condition"} <a href="#" data-toggle="tooltip" title="{intl d=$d l="For the regex, your input is compare to URL without the domain name and without any GET params. Ex : for 'www.mysite.com/one/two?three=four', your regex will be compare to '/one/two'."}"><span class="glyphicon glyphicon-question-sign"></span></a></label></th>
<th class="text-center"><label class="control-label">{intl d=$d l="404 only"}</label></th>
<th class="text-center"><label class="control-label">{intl d=$d l="Redirect to"} <a href="#" data-toggle="tooltip" title="{intl d=$d l="Enter a URL with a leading '/' and no domain name. Ex : for 'www.mysite.com/one/two', enter '/one/two'."}"><span class="glyphicon glyphicon-question-sign"></span></a></label></th>
<th class="text-center"><label class="control-label">{intl d=$d l="Position"}</label></th>
<th class="text-center"><label class="control-label">{intl d=$d l="Actions"}</label></th>
</tr>
</thead>

Expand All @@ -53,8 +50,8 @@
<tr data-idrule="new">
<td class="text-center">
<select class="js_rule_type form-control" data-idrule="new" required>
<option value="regex">{intl l="Regex"}</option>
<option value="params">{intl l="GET params"}</option>
<option value="regex">{intl d=$d l="Regex"}</option>
<option value="params">{intl d=$d l="GET params"}</option>
</select>
</td>
<td class="text-center">
Expand Down Expand Up @@ -82,20 +79,20 @@
</tr>

<tr>
<td colspan="6" class="text-center"><hr><h2 class="text-center">{intl l="Currently enabled rules"}</h2><hr></td>
<td colspan="6" class="text-center"><hr><h2 class="text-center">{intl d=$d l="Currently enabled rules"}</h2><hr></td>
</tr>
</tbody>
</table>

<table class="table table-condensed table-striped" id="redirection-table">
<thead>
<tr>
<th class="text-center"><label class="control-label">{intl l="Rule type"}</label></th>
<th class="text-center"><label class="control-label">{intl l="Condition"} <a href="#" data-toggle="tooltip" title="{intl l="For the regex, your input is compare to URL without the domain name and without any GET params. Ex : for 'www.mysite.com/one/two?three=four', your regex will be compare to '/one/two'."}"><span class="glyphicon glyphicon-question-sign"></span></a></label></th>
<th class="text-center"><label class="control-label">{intl l="404 only"}</label></th>
<th class="text-center"><label class="control-label">{intl l="Redirect to"} <a href="#" data-toggle="tooltip" title="{intl l="Enter a URL with a leading '/' and no domain name. Ex : for 'www.mysite.com/one/two', enter '/one/two'."}"><span class="glyphicon glyphicon-question-sign"></span></a></label></th>
<th class="text-center"><label class="control-label">{intl l="Position"}</label></th>
<th class="text-center"><label class="control-label">{intl l="Actions"}</label></th>
<th class="text-center"><label class="control-label">{intl d=$d l="Rule type"}</label></th>
<th class="text-center"><label class="control-label">{intl d=$d l="Condition"} <a href="#" data-toggle="tooltip" title="{intl d=$d l="For the regex, your input is compare to URL without the domain name and without any GET params. Ex : for 'www.mysite.com/one/two?three=four', your regex will be compare to '/one/two'."}"><span class="glyphicon glyphicon-question-sign"></span></a></label></th>
<th class="text-center"><label class="control-label">{intl d=$d l="404 only"}</label></th>
<th class="text-center"><label class="control-label">{intl d=$d l="Redirect to"} <a href="#" data-toggle="tooltip" title="{intl d=$d l="Enter a URL with a leading '/' and no domain name. Ex : for 'www.mysite.com/one/two', enter '/one/two'."}"><span class="glyphicon glyphicon-question-sign"></span></a></label></th>
<th class="text-center"><label class="control-label">{intl d=$d l="Position"}</label></th>
<th class="text-center"><label class="control-label">{intl d=$d l="Actions"}</label></th>
</tr>
</thead>
</table>
Expand All @@ -118,10 +115,10 @@
<select class="js_param_condition form-control" data-idparamrule="1" data-idrule="new">
<option value="equals">=</option>
<option value="not_equals"></option>
<option value="exists">{intl l="exists"}</option>
<option value="missing">{intl l="is missing"}</option>
<option value="empty">{intl l="is empty"}</option>
<option value="not_empty">{intl l="is not empty"}</option>
<option value="exists">{intl d=$d l="exists"}</option>
<option value="missing">{intl d=$d l="is missing"}</option>
<option value="empty">{intl d=$d l="is empty"}</option>
<option value="not_empty">{intl d=$d l="is not empty"}</option>
</select>
</div>

Expand All @@ -138,6 +135,5 @@
</div>
</div>


{include file="RewriteUrl/module-configuration-js.html"}

0 comments on commit 0996d69

Please sign in to comment.