Skip to content

Commit ea00240

Browse files
author
Franck Allimant
committed
Fixed template and edit bugs
1 parent 28604e8 commit ea00240

9 files changed

+97
-224
lines changed

AdminIncludes/module_configuration.html

+6-46
Original file line numberDiff line numberDiff line change
@@ -117,52 +117,12 @@
117117

118118
{* Capture the dialog body, to pass it to the generic dialog *}
119119
{capture "keyword_group_creation_dialog"}
120+
{form_hidden_fields}
120121

121-
{form_hidden_fields form=$form}
122-
123-
{form_field form=$form field='success_url'}
124-
<input type="hidden" name="{$name}" value="{url path='/admin/module/Keyword'}" />
125-
{/form_field}
126-
127-
{form_field form=$form field='title'}
128-
<div class="form-group {if $error}has-error{/if}">
129-
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
130-
{loop type="lang" name="default-lang" default_only="1"}
131-
<div class="input-group">
132-
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='title'}">
133-
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.png"}" alt="$TITLE" /></span>
134-
</div>
135-
136-
<div class="help-block">{intl l='Enter here the keyword group name in the default language (%title)' d='keyword' title="$TITLE"}</div>
137-
138-
{* Switch edition to the current locale *}
139-
<input type="hidden" name="edit_language_id" value="{$ID}" />
140-
141-
{form_field form=$form field='locale'}
142-
<input type="hidden" name="{$name}" value="{$LOCALE}" />
143-
{/form_field}
144-
{/loop}
145-
</div>
146-
{/form_field}
147-
148-
{form_field form=$form field='code'}
149-
<div class="form-group {if $error}has-error{/if}">
150-
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
151-
<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'}">
152-
<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>
153-
</div>
154-
{/form_field}
155-
156-
{form_field form=$form field='visible'}
157-
<div class="form-group {if $error}has-error{/if}">
158-
<div class="checkbox">
159-
<label for="{$label_attr.for}" class="control-label">
160-
<input id="{$label_attr.for}" name="{$name}" type="checkbox" value="1" checked> {$label}
161-
</label>
162-
</div>
163-
</div>
164-
{/form_field}
165-
122+
{render_form_field field='success_url' value="{url path='/admin/module/Keyword'}"}
123+
{render_form_field field='title'}
124+
{render_form_field field='code'}
125+
{render_form_field field='visible'}
166126
{/capture}
167127

168128
{include
@@ -175,7 +135,7 @@
175135
dialog_ok_label = {intl l="Save"}
176136

177137
form_action = {url path='/admin/module/Keyword/group/create'}
178-
form_enctype = {form_enctype form=$form}
138+
form_enctype = {form_enctype}
179139
form_error_message = $form_error_message
180140
}
181141
{/form}

Config/module.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<descriptive locale="en_US">
88
<title>Keyword</title>
99
</descriptive>
10-
<version>3.0.1</version>
10+
<version>3.0.2</version>
1111
<author>
1212
<name>Michaël Espeche</name>
1313
<email>mespeche@openstudio.fr</email>

Form/KeywordCreationForm.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
namespace Keyword\Form;
2424

2525
use Keyword\Model\KeywordQuery;
26+
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
27+
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
2628
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
2729
use Symfony\Component\Form\Extension\Core\Type\TextType;
2830
use Symfony\Component\Validator\Constraints\Callback;
@@ -63,13 +65,14 @@ protected function buildForm()
6365
))
6466
)
6567
))
66-
->add('visible', IntegerType::class, array(
68+
->add('visible', CheckboxType::class, array(
6769
'label' => Translator::getInstance()->trans('Visible ?'),
70+
'required' => false,
6871
'label_attr' => array(
6972
'for' => 'keyword_visible'
7073
)
7174
))
72-
->add("locale", TextType::class, array(
75+
->add("locale", HiddenType::class, array(
7376
"constraints" => array(
7477
new NotBlank()
7578
)

Form/KeywordGroupCreationForm.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
namespace Keyword\Form;
2424

2525
use Keyword\Model\KeywordGroupQuery;
26+
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
27+
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
2628
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
2729
use Symfony\Component\Form\Extension\Core\Type\TextType;
2830
use Symfony\Component\Validator\Constraints\Callback;
@@ -55,13 +57,14 @@ protected function buildForm()
5557
'for' => 'keyword_code'
5658
)
5759
))
58-
->add('visible', IntegerType::class, array(
60+
->add('visible', CheckboxType::class, array(
5961
'label' => Translator::getInstance()->trans('Visible ?'),
62+
'required' => false,
6063
'label_attr' => array(
6164
'for' => 'keyword_visible'
6265
)
6366
))
64-
->add("locale", TextType::class, array(
67+
->add("locale", HiddenType::class, array(
6568
"constraints" => array(
6669
new NotBlank()
6770
)

I18n/fr_FR.php

+29-29
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
<?php
22

33
return array(
4-
'Edit keyword' => 'Modification du mot clé',
5-
'Keywords' => 'Mots clé',
6-
'Edit keyword %title' => 'Modifier le mot clé : <span class="label label-info">%title</span>',
7-
'Edit previous keyword' => 'Modifier le mot clé précédent',
8-
'Edit next keyword' => 'Modifier le mot clé suivant',
4+
'Edit keyword' => 'Modification du mot-clé',
5+
'Keywords' => 'mots-clés',
6+
'Edit keyword %title' => 'Modifier le mot-clé <span class="label label-info">%title</span>',
7+
'Edit previous keyword' => 'Modifier le mot-clé précédent',
8+
'Edit next keyword' => 'Modifier le mot-clé suivant',
99
'unique identifier' => 'identifiant unique',
1010
'Unique identifier' => 'Identifiant unique',
11-
'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',
12-
'Keyword created on %date_create. Last modification: %date_change' => 'Mot clé créé le %date_create. Dernière modification le %date_change',
13-
'View keyword associations' => 'Voir les associations du mot clé',
14-
'View keyword "%title" associations' => 'Voir les associations du mot clé : <span class="label label-info">%title</span>',
15-
'View previous keyword' => 'Voir le mot clé précédent',
16-
'View next keyword' => 'Voir le mot clé suivant',
11+
'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',
12+
'Keyword created on %date_create. Last modification: %date_change' => 'mot-clé créé le %date_create. Dernière modification le %date_change',
13+
'View keyword associations' => 'Voir les associations du mot-clé',
14+
'View keyword "%title" associations' => 'Associations des mots-clés du goupe <span class="label label-info">%title</span>',
15+
'View previous keyword' => 'Voir le mot-clé précédent',
16+
'View next keyword' => 'Voir le mot-clé suivant',
1717
'Folders association' => 'Dossiers associés',
1818
'Contents association' => 'Contenus associés',
1919
'Categories association' => 'Catégories associés',
2020
'Products association' => 'Produits associés',
2121
'Contents' => 'Contenus',
22-
'This keyword has no folder assocation.' => 'Ce mot clé n\'a pas de dossier associé',
23-
'This keyword has no content assocation.' => 'Ce mot clé n\'a pas de contenu associé',
24-
'This keyword has no category assocation.' => 'Ce mot clé n\'a pas de catégorie associée',
25-
'This keyword has no product assocation.' => 'Ce mot clé n\'a pas de produit associé',
26-
'Keywords association' => 'Mots clé associés',
27-
'Enter new keyword position' => 'Entrez la nouvelle position du mot clé',
28-
'Add a new keyword' => 'Ajouter un nouveau mot clé',
29-
'Browse this keyword' => 'Voir ce mot clé',
30-
'Edit this keyword' => 'Modifier ce mot clé',
31-
'Delete this keyword' => 'Supprimer ce mot clé',
32-
'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.',
33-
'There is no keywords.' => 'Il n\'y a pas de mot clé.',
34-
'Enter here the keyword name in the default language (%title)' => 'Entrez ici le titre du mot clé dans la langue par defaut (%title)',
35-
'Create a new keyword' => 'Créer un nouveau mot clé',
36-
'Delete keyword' => 'Supprimer le mot clé',
37-
'Do you really want to delete this keyword and all its associations ?' => 'Voulez-vous vraiment supprimer ce mot clé ainsi que toutes ses assocations ?',
22+
'This keyword has no folder assocation.' => 'Ce mot-clé n\'a pas de dossier associé',
23+
'This keyword has no content assocation.' => 'Ce mot-clé n\'a pas de contenu associé',
24+
'This keyword has no category assocation.' => 'Ce mot-clé n\'a pas de catégorie associée',
25+
'This keyword has no product assocation.' => 'Ce mot-clé n\'a pas de produit associé',
26+
'Keywords association' => 'mots-clés associés',
27+
'Enter new keyword position' => 'Entrez la nouvelle position du mot-clé',
28+
'Add a new keyword' => 'Ajouter un nouveau mot-clé',
29+
'Browse this keyword' => 'Voir ce mot-clé',
30+
'Edit this keyword' => 'Modifier ce mot-clé',
31+
'Delete this keyword' => 'Supprimer ce mot-clé',
32+
'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.',
33+
'There is no keywords.' => 'Il n\'y a pas de mot-clé.',
34+
'Enter here the keyword name in the default language (%title)' => 'Entrez ici le titre du mot-clé dans la langue par defaut (%title)',
35+
'Create a new keyword' => 'Créer un nouveau mot-clé',
36+
'Delete keyword' => 'Supprimer le mot-clé',
37+
'Do you really want to delete this keyword and all its associations ?' => 'Voulez-vous vraiment supprimer ce mot-clé ainsi que toutes ses assocations ?',
3838

3939
'Edit keyword group' => 'Modification du groupe de mots-clés',
4040
'Keyword Groups' => 'Goupes de mots-clés',
@@ -56,12 +56,12 @@
5656
'Edit next keyword group' => 'Modifier le groupe de mots-clés suivant',
5757
'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',
5858
'View keyword group associations' => 'Voir les associations du groupe de mots-clés',
59-
'View keyword group "%title" associations' => 'Voir les associations du groupe de mots-clés : <span class="label label-info">%title</span>',
59+
'View keyword group "%title" associations' => 'Mots-clés du groupe <span class="label label-info">%title</span>',
6060
'View previous keyword group' => 'Voir le groupe de mots-clés précédent',
6161
'View next keyword group' => 'Voir le groupe de mots-clés suivant',
6262
'Enter new folder position' => 'Entrez la nouvelle position du dossier',
6363
'Enter new content position' => 'Entrez la nouvelle position du contenu',
6464
'Enter new category position' => 'Entrez la nouvelle position de la catégorie',
6565
'Enter new product position' => 'Entrez la nouvelle position du produit',
66-
'Change keyword group' => 'Changer le mot clé de groupe'
66+
'Change keyword group' => 'Changer le mot-clé de groupe'
6767
);

templates/backOffice/default/keyword-edit.html

+20-45
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{block name="main-content"}
99
<div class="keyword edit-keyword">
1010
<div id="wrapper" class="container">
11-
11+
k={$keyword_id}
1212
{loop name="keyword_edit" type="keyword" visible="*" id="{$keyword_id}" backend_context="1" lang="$edit_language_id"}
1313
<ul class="breadcrumb">
1414
<li><a href="{url path='admin/home'}">{intl l="Home"}</a></li>
@@ -57,7 +57,7 @@
5757
<div class="form-container">
5858

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

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

@@ -68,55 +68,30 @@
6868

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

71-
{form_hidden_fields form=$form}
72-
73-
{form_field form=$form field='success_url'}
74-
<input type="hidden" name="{$name}" value="{url path="/admin/module/Keyword/update{$ID}"}" />
75-
{/form_field}
71+
{form_hidden_fields}
7672

77-
{form_field form=$form field='locale'}
78-
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
79-
{/form_field}
73+
{render_form_field field='id' value=$ID}
74+
{render_form_field field='success_url' value={url path="/admin/module/Keyword/update{$ID}"}}
75+
{render_form_field field='locale' value=$edit_language_locale}
8076

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

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

85-
{form_field form=$form field='code'}
86-
<div class="form-group {if $error}has-error{/if}">
87-
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
88-
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='unique identifier' d='keyword'}">
89-
<div class="help-block">{intl l='Enter here the unique identifier of the keyword which must be use into your loops' d='keyword'}</div>
90-
</div>
91-
{/form_field}
92-
93-
<div class="row">
94-
<div class="col-md-6">
95-
{form_field form=$form field='visible'}
96-
<div class="form-group {if $error}has-error{/if}">
97-
<label for="{$label_attr.for}" class="control-label">{intl l='Visibility'}</label>
98-
<div class="checkbox">
99-
<label>
100-
<input type="checkbox" id="{$label_attr.for}" name="{$name}" value="1" {if $value != 0}checked="checked"{/if}>
101-
{$label}
102-
</label>
103-
</div>
104-
</div>
105-
{/form_field}
106-
</div>
107-
</div>
84+
{render_form_field field='code' value=$CODE}
85+
{render_form_field field='visible' value=$VISIBLE}
10886
</div>
10987
<div class="col-md-4">
110-
{form_field form=$form field='keyword_group_id'}
111-
<div class="form-group {if $error}has-error{/if}">
112-
<label for="{$label_attr.for}" class="control-label">{$label}</label>
113-
<select class="form-control" name="{$name}" id="{$label_attr.for}">
114-
{loop name="keyword.group" type="keyword_group"}
115-
<option value="{$ID}" {if $KEYWORD_GROUP_ID == $ID}selected{/if}>{$TITLE}</option>
116-
{/loop}
117-
</select>
118-
</div>
119-
{/form_field}
88+
{custom_render_form_field field='keyword_group_id'}
89+
<select class="form-control" {form_field_attributes field="keyword_group_id"}>
90+
{loop name="keyword.group" type="keyword_group"}
91+
<option value="{$ID}" {if $KEYWORD_GROUP_ID == $ID}selected{/if}>{$TITLE}</option>
92+
{/loop}
93+
</select>
94+
{/custom_render_form_field}
12095
</div>
12196
</div>
12297

@@ -147,4 +122,4 @@
147122

148123
</div>
149124
</div>
150-
{/block}
125+
{/block}

0 commit comments

Comments
 (0)