From 56de467362ef7d1ef09c68c755d5800254b7681a Mon Sep 17 00:00:00 2001 From: mespeche Date: Fri, 6 Sep 2013 12:55:53 +0200 Subject: [PATCH] Working : - Add label information in Form file - Refactor to bootstrap3 --- core/lib/Thelia/Form/MessageCreationForm.php | 10 +- .../Thelia/Form/MessageModificationForm.php | 42 ++- templates/admin/default/message-edit.html | 174 +++++------- templates/admin/default/messages.html | 266 +++++++++--------- 4 files changed, 244 insertions(+), 248 deletions(-) diff --git a/core/lib/Thelia/Form/MessageCreationForm.php b/core/lib/Thelia/Form/MessageCreationForm.php index a3444c733..6ce84cb06 100644 --- a/core/lib/Thelia/Form/MessageCreationForm.php +++ b/core/lib/Thelia/Form/MessageCreationForm.php @@ -40,11 +40,19 @@ class MessageCreationForm extends BaseForm $this->formBuilder ->add("name", "text", array( - "constraints" => $name_constraints + "constraints" => $name_constraints, + "label" => "Name *", + "label_attr" => array( + "for" => "name" + ) )) ->add("title", "text", array( "constraints" => array( new Constraints\NotBlank() + ), + "label" => "Purpose *", + "label_attr" => array( + "for" => "purpose" ) )) ->add("locale", "hidden", array( diff --git a/core/lib/Thelia/Form/MessageModificationForm.php b/core/lib/Thelia/Form/MessageModificationForm.php index 539a8babc..a23f66e28 100644 --- a/core/lib/Thelia/Form/MessageModificationForm.php +++ b/core/lib/Thelia/Form/MessageModificationForm.php @@ -33,13 +33,43 @@ class MessageModificationForm extends BaseForm { $this->formBuilder ->add("id" , "hidden", array("constraints" => array(new GreaterThan(array('value' => 0))))) - ->add("name" , "text" , array("constraints" => array(new NotBlank()))) - ->add("secured" , "text" , array()) + ->add("name" , "text" , array( + "constraints" => array(new NotBlank()), + "label" => "Name *", + "label_attr" => array( + "for" => "name" + ) + )) + ->add("secured" , "text" , array( + "label" => "Prevent mailing template modification or deletion, except for super-admin" + )) ->add("locale" , "text" , array()) - ->add("title" , "text" , array("constraints" => array(new NotBlank()))) - ->add("subject" , "text" , array("constraints" => array(new NotBlank()))) - ->add("html_message" , "text" , array()) - ->add("text_message" , "text" , array()) + ->add("title" , "text" , array( + "constraints" => array(new NotBlank()), + "label" => "Title *", + "label_attr" => array( + "for" => "title" + ) + )) + ->add("subject" , "text" , array( + "constraints" => array(new NotBlank()), + "label" => "Message subject *", + "label_attr" => array( + "for" => "subject" + ) + )) + ->add("html_message" , "text" , array( + "label" => "HTML Message", + "label_attr" => array( + "for" => "html_message" + ) + )) + ->add("text_message" , "text" , array( + "label" => "Text Message", + "label_attr" => array( + "for" => "text_message" + ) + )) ; } diff --git a/templates/admin/default/message-edit.html b/templates/admin/default/message-edit.html index 92d707b45..a2c524c2e 100644 --- a/templates/admin/default/message-edit.html +++ b/templates/admin/default/message-edit.html @@ -27,127 +27,85 @@
-
+
{form name="thelia.admin.message.modification"}
-
- {* Be sure to get the message ID, even if the form could not be validated *} - + + {* Be sure to get the message ID, even if the form could not be validated *} + - {include file="includes/inner-form-toolbar.html"} + {include file="includes/inner-form-toolbar.html"} - {form_hidden_fields form=$form} + {form_hidden_fields form=$form} - {form_field form=$form field='success_url'} - - {/form_field} + {form_field form=$form field='success_url'} + + {/form_field} - {form_field form=$form field='id'} - - {/form_field} + {form_field form=$form field='id'} + + {/form_field} - {form_field form=$form field='locale'} - - {/form_field} + {form_field form=$form field='locale'} + + {/form_field} - {if #form_error}
#form_error_message
{/if} + {if #form_error}
#form_error_message
{/if} + + {form_field form=$form field='name'} +
+ + +
+ {/form_field} + + {form_field form=$form field='secured'} +
+ +
+ {/form_field} -
+ {form_field form=$form field='title'} +
+ + +
+ {/form_field} - + {form_field form=$form field='subject'} +
+ + +
+ {/form_field} -
- {form_field form=$form field='name'} - - - - {/form_field} -
-
+ {form_field form=$form field='html_message'} +
+ + +
+ {/form_field} -
- + {form_field form=$form field='text_message'} +
+ + +
+ {/form_field} -
- {form_field form=$form field='secured'} - - - - {/form_field} -
-
- - {form_field form=$form field='title'} -
- - -
- - - -
-
- {/form_field} - - {form_field form=$form field='subject'} -
- - -
- - - -
-
- {/form_field} - - {form_field form=$form field='html_message'} -
- - -
- - - -
-
- {/form_field} - - {form_field form=$form field='text_message'} -
- - -
- - - -
-
- {/form_field} - -
-
-

{intl l='Message created on %date_create. Last modification: %date_change' date_create="{format_date date=$CREATE_DATE}" date_change="{format_date date=$UPDATE_DATE}"}}

-
-
-
+
+

{intl l='Message created on %date_create. Last modification: %date_change' date_create="{format_date date=$CREATE_DATE}" date_change="{format_date date=$UPDATE_DATE}"}}

+
+
{/form}
diff --git a/templates/admin/default/messages.html b/templates/admin/default/messages.html index 75ee742bf..08031bd3c 100644 --- a/templates/admin/default/messages.html +++ b/templates/admin/default/messages.html @@ -31,62 +31,65 @@ {/loop} - - {intl l="Purpose"} - {intl l="Name"} + + + {intl l="Purpose"} + {intl l="Name"} - {module_include location='messages_table_header'} + {module_include location='messages_table_header'} -   - +   + + + + + {loop name="mailing-templates" type="message" secured="*" backend_context="1" lang="$lang_id"} + - {loop name="mailing-templates" type="message" secured="*" backend_context="1" lang="$lang_id"} - + {$TITLE} - {$TITLE} - - - {if ! $SECURED} - {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.messages.change"} - {$NAME} - {/loop} - {elseloop rel="can_change"} + + {if ! $SECURED} + {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.messages.change"} + {$NAME} + {/loop} + {elseloop rel="can_change"} + {$NAME} + {/elseloop} + {else} {$NAME} - {/elseloop} - {else} - {$NAME} - {/if} - + {/if} + - {module_include location='messages_table_row'} + {module_include location='messages_table_row'} - - {if ! $SECURED} -
- {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.messages.change"} - - {/loop} + + {if ! $SECURED} +
+ {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.messages.change"} + + {/loop} - {loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.messages.delete"} - - {/loop} -
- {else} - - {/if} - - - {/loop} - - {elseloop rel="mailing-templates"} - - -
- {intl l="No mailing template has been created yet. Click the + button to create one."} -
- - - {/elseloop} + {loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.messages.delete"} + + {/loop} +
+ {else} + + {/if} + + + {/loop} + {elseloop rel="mailing-templates"} + + +
+ {intl l="No mailing template has been created yet. Click the + button to create one."} +
+ + + {/elseloop} +
@@ -101,110 +104,107 @@ {* Adding a new message *} -