Skip to content

Commit

Permalink
Fixed template and edit bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Franck Allimant committed Aug 26, 2024
1 parent 28604e8 commit ea00240
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 224 deletions.
52 changes: 6 additions & 46 deletions AdminIncludes/module_configuration.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,52 +117,12 @@

{* Capture the dialog body, to pass it to the generic dialog *}
{capture "keyword_group_creation_dialog"}
{form_hidden_fields}

{form_hidden_fields form=$form}

{form_field form=$form field='success_url'}
<input type="hidden" name="{$name}" value="{url path='/admin/module/Keyword'}" />
{/form_field}

{form_field form=$form field='title'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
{loop type="lang" name="default-lang" default_only="1"}
<div class="input-group">
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='title'}">
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.png"}" alt="$TITLE" /></span>
</div>

<div class="help-block">{intl l='Enter here the keyword group name in the default language (%title)' d='keyword' title="$TITLE"}</div>

{* Switch edition to the current locale *}
<input type="hidden" name="edit_language_id" value="{$ID}" />

{form_field form=$form field='locale'}
<input type="hidden" name="{$name}" value="{$LOCALE}" />
{/form_field}
{/loop}
</div>
{/form_field}

{form_field form=$form field='code'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='unique identifier' d='keyword'}">
<div class="help-block">{intl l='Enter here the unique identifier of the keyword group which must be use into your loops' d='keyword'}</div>
</div>
{/form_field}

{form_field form=$form field='visible'}
<div class="form-group {if $error}has-error{/if}">
<div class="checkbox">
<label for="{$label_attr.for}" class="control-label">
<input id="{$label_attr.for}" name="{$name}" type="checkbox" value="1" checked> {$label}
</label>
</div>
</div>
{/form_field}

{render_form_field field='success_url' value="{url path='/admin/module/Keyword'}"}
{render_form_field field='title'}
{render_form_field field='code'}
{render_form_field field='visible'}
{/capture}

{include
Expand All @@ -175,7 +135,7 @@
dialog_ok_label = {intl l="Save"}

form_action = {url path='/admin/module/Keyword/group/create'}
form_enctype = {form_enctype form=$form}
form_enctype = {form_enctype}
form_error_message = $form_error_message
}
{/form}
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="en_US">
<title>Keyword</title>
</descriptive>
<version>3.0.1</version>
<version>3.0.2</version>
<author>
<name>Michaël Espeche</name>
<email>[email protected]</email>
Expand Down
7 changes: 5 additions & 2 deletions Form/KeywordCreationForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
namespace Keyword\Form;

use Keyword\Model\KeywordQuery;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Validator\Constraints\Callback;
Expand Down Expand Up @@ -63,13 +65,14 @@ protected function buildForm()
))
)
))
->add('visible', IntegerType::class, array(
->add('visible', CheckboxType::class, array(
'label' => Translator::getInstance()->trans('Visible ?'),
'required' => false,
'label_attr' => array(
'for' => 'keyword_visible'
)
))
->add("locale", TextType::class, array(
->add("locale", HiddenType::class, array(
"constraints" => array(
new NotBlank()
)
Expand Down
7 changes: 5 additions & 2 deletions Form/KeywordGroupCreationForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
namespace Keyword\Form;

use Keyword\Model\KeywordGroupQuery;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Validator\Constraints\Callback;
Expand Down Expand Up @@ -55,13 +57,14 @@ protected function buildForm()
'for' => 'keyword_code'
)
))
->add('visible', IntegerType::class, array(
->add('visible', CheckboxType::class, array(
'label' => Translator::getInstance()->trans('Visible ?'),
'required' => false,
'label_attr' => array(
'for' => 'keyword_visible'
)
))
->add("locale", TextType::class, array(
->add("locale", HiddenType::class, array(
"constraints" => array(
new NotBlank()
)
Expand Down
58 changes: 29 additions & 29 deletions I18n/fr_FR.php
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
<?php

return array(
'Edit keyword' => 'Modification du mot clé',
'Keywords' => 'Mots clé',
'Edit keyword %title' => 'Modifier le mot clé : <span class="label label-info">%title</span>',
'Edit previous keyword' => 'Modifier le mot clé précédent',
'Edit next keyword' => 'Modifier le mot clé suivant',
'Edit keyword' => 'Modification du mot-clé',
'Keywords' => 'mots-clés',
'Edit keyword %title' => 'Modifier le mot-clé <span class="label label-info">%title</span>',
'Edit previous keyword' => 'Modifier le mot-clé précédent',
'Edit next keyword' => 'Modifier le mot-clé suivant',
'unique identifier' => 'identifiant unique',
'Unique identifier' => 'Identifiant unique',
'Enter here the unique identifier of the keyword which must be use into your loops' => 'Entrez ici l\'identifiant unique du mot clé qui doit être utilisé dans vos boucles',
'Keyword created on %date_create. Last modification: %date_change' => 'Mot clé créé le %date_create. Dernière modification le %date_change',
'View keyword associations' => 'Voir les associations du mot clé',
'View keyword "%title" associations' => 'Voir les associations du mot clé : <span class="label label-info">%title</span>',
'View previous keyword' => 'Voir le mot clé précédent',
'View next keyword' => 'Voir le mot clé suivant',
'Enter here the unique identifier of the keyword which must be use into your loops' => 'Entrez ici l\'identifiant unique du mot-clé qui doit être utilisé dans vos boucles',
'Keyword created on %date_create. Last modification: %date_change' => 'mot-clé créé le %date_create. Dernière modification le %date_change',
'View keyword associations' => 'Voir les associations du mot-clé',
'View keyword "%title" associations' => 'Associations des mots-clés du goupe <span class="label label-info">%title</span>',
'View previous keyword' => 'Voir le mot-clé précédent',
'View next keyword' => 'Voir le mot-clé suivant',
'Folders association' => 'Dossiers associés',
'Contents association' => 'Contenus associés',
'Categories association' => 'Catégories associés',
'Products association' => 'Produits associés',
'Contents' => 'Contenus',
'This keyword has no folder assocation.' => 'Ce mot clé n\'a pas de dossier associé',
'This keyword has no content assocation.' => 'Ce mot clé n\'a pas de contenu associé',
'This keyword has no category assocation.' => 'Ce mot clé n\'a pas de catégorie associée',
'This keyword has no product assocation.' => 'Ce mot clé n\'a pas de produit associé',
'Keywords association' => 'Mots clé associés',
'Enter new keyword position' => 'Entrez la nouvelle position du mot clé',
'Add a new keyword' => 'Ajouter un nouveau mot clé',
'Browse this keyword' => 'Voir ce mot clé',
'Edit this keyword' => 'Modifier ce mot clé',
'Delete this keyword' => 'Supprimer ce mot clé',
'There is no keywords. To create a new one, click the + button above.' => 'Il n\'y a pas de mot clé. Pour en créer un nouveau, cliquez sur le bouton + ci-dessus.',
'There is no keywords.' => 'Il n\'y a pas de mot clé.',
'Enter here the keyword name in the default language (%title)' => 'Entrez ici le titre du mot clé dans la langue par defaut (%title)',
'Create a new keyword' => 'Créer un nouveau mot clé',
'Delete keyword' => 'Supprimer le mot clé',
'Do you really want to delete this keyword and all its associations ?' => 'Voulez-vous vraiment supprimer ce mot clé ainsi que toutes ses assocations ?',
'This keyword has no folder assocation.' => 'Ce mot-clé n\'a pas de dossier associé',
'This keyword has no content assocation.' => 'Ce mot-clé n\'a pas de contenu associé',
'This keyword has no category assocation.' => 'Ce mot-clé n\'a pas de catégorie associée',
'This keyword has no product assocation.' => 'Ce mot-clé n\'a pas de produit associé',
'Keywords association' => 'mots-clés associés',
'Enter new keyword position' => 'Entrez la nouvelle position du mot-clé',
'Add a new keyword' => 'Ajouter un nouveau mot-clé',
'Browse this keyword' => 'Voir ce mot-clé',
'Edit this keyword' => 'Modifier ce mot-clé',
'Delete this keyword' => 'Supprimer ce mot-clé',
'There is no keywords. To create a new one, click the + button above.' => 'Il n\'y a pas de mot-clé. Pour en créer un nouveau, cliquez sur le bouton + ci-dessus.',
'There is no keywords.' => 'Il n\'y a pas de mot-clé.',
'Enter here the keyword name in the default language (%title)' => 'Entrez ici le titre du mot-clé dans la langue par defaut (%title)',
'Create a new keyword' => 'Créer un nouveau mot-clé',
'Delete keyword' => 'Supprimer le mot-clé',
'Do you really want to delete this keyword and all its associations ?' => 'Voulez-vous vraiment supprimer ce mot-clé ainsi que toutes ses assocations ?',

'Edit keyword group' => 'Modification du groupe de mots-clés',
'Keyword Groups' => 'Goupes de mots-clés',
Expand All @@ -56,12 +56,12 @@
'Edit next keyword group' => 'Modifier le groupe de mots-clés suivant',
'Keyword group created on %date_create. Last modification: %date_change' => 'Groupe de mots-clés créé le %date_create. Dernière modification le %date_change',
'View keyword group associations' => 'Voir les associations du groupe de mots-clés',
'View keyword group "%title" associations' => 'Voir les associations du groupe de mots-clés : <span class="label label-info">%title</span>',
'View keyword group "%title" associations' => 'Mots-clés du groupe <span class="label label-info">%title</span>',
'View previous keyword group' => 'Voir le groupe de mots-clés précédent',
'View next keyword group' => 'Voir le groupe de mots-clés suivant',
'Enter new folder position' => 'Entrez la nouvelle position du dossier',
'Enter new content position' => 'Entrez la nouvelle position du contenu',
'Enter new category position' => 'Entrez la nouvelle position de la catégorie',
'Enter new product position' => 'Entrez la nouvelle position du produit',
'Change keyword group' => 'Changer le mot clé de groupe'
'Change keyword group' => 'Changer le mot-clé de groupe'
);
65 changes: 20 additions & 45 deletions templates/backOffice/default/keyword-edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{block name="main-content"}
<div class="keyword edit-keyword">
<div id="wrapper" class="container">

k={$keyword_id}
{loop name="keyword_edit" type="keyword" visible="*" id="{$keyword_id}" backend_context="1" lang="$edit_language_id"}
<ul class="breadcrumb">
<li><a href="{url path='admin/home'}">{intl l="Home"}</a></li>
Expand Down Expand Up @@ -57,7 +57,7 @@
<div class="form-container">

{form name="keyword_admin_modification"}
<form method="POST" action="{url path='/admin/module/Keyword/save'}" {form_enctype form=$form} class="clearfix">
<form method="POST" action="{url path='/admin/module/Keyword/save'}" {form_enctype} class="clearfix">

{include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/module/Keyword/group/view' keyword_group_id=$KEYWORD_GROUP_ID}"}

Expand All @@ -68,55 +68,30 @@

<input type="hidden" name="current_tab" value="general" />

{form_hidden_fields form=$form}

{form_field form=$form field='success_url'}
<input type="hidden" name="{$name}" value="{url path="/admin/module/Keyword/update{$ID}"}" />
{/form_field}
{form_hidden_fields}

{form_field form=$form field='locale'}
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
{/form_field}
{render_form_field field='id' value=$ID}
{render_form_field field='success_url' value={url path="/admin/module/Keyword/update{$ID}"}}
{render_form_field field='locale' value=$edit_language_locale}

{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}

{include file="includes/standard-description-form-fields.html"}
{render_form_field field='title' value=$TITLE}
{render_form_field field="chapo" value=$CHAPO}
{render_form_field field="description" value=$DESCRIPTION extra_class="wysiwyg"}
{render_form_field field="postscriptum" value=$POSTSCRIPTUM}

{form_field form=$form field='code'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='unique identifier' d='keyword'}">
<div class="help-block">{intl l='Enter here the unique identifier of the keyword which must be use into your loops' d='keyword'}</div>
</div>
{/form_field}

<div class="row">
<div class="col-md-6">
{form_field form=$form field='visible'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{intl l='Visibility'}</label>
<div class="checkbox">
<label>
<input type="checkbox" id="{$label_attr.for}" name="{$name}" value="1" {if $value != 0}checked="checked"{/if}>
{$label}
</label>
</div>
</div>
{/form_field}
</div>
</div>
{render_form_field field='code' value=$CODE}
{render_form_field field='visible' value=$VISIBLE}
</div>
<div class="col-md-4">
{form_field form=$form field='keyword_group_id'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label}</label>
<select class="form-control" name="{$name}" id="{$label_attr.for}">
{loop name="keyword.group" type="keyword_group"}
<option value="{$ID}" {if $KEYWORD_GROUP_ID == $ID}selected{/if}>{$TITLE}</option>
{/loop}
</select>
</div>
{/form_field}
{custom_render_form_field field='keyword_group_id'}
<select class="form-control" {form_field_attributes field="keyword_group_id"}>
{loop name="keyword.group" type="keyword_group"}
<option value="{$ID}" {if $KEYWORD_GROUP_ID == $ID}selected{/if}>{$TITLE}</option>
{/loop}
</select>
{/custom_render_form_field}
</div>
</div>

Expand Down Expand Up @@ -147,4 +122,4 @@

</div>
</div>
{/block}
{/block}
Loading

0 comments on commit ea00240

Please sign in to comment.