Working :

- Refactor to bootstrap3
- Label information in Form files
This commit is contained in:
mespeche
2013-09-06 12:12:27 +02:00
parent 7e28c92b0b
commit c015bbe8b5
6 changed files with 83 additions and 87 deletions

View File

@@ -43,12 +43,31 @@ abstract class BaseDescForm extends BaseForm
->add("title", "text", array( ->add("title", "text", array(
"constraints" => array( "constraints" => array(
new NotBlank() new NotBlank()
),
"label" => "Title",
"label_attr" => array(
"for" => "title"
) )
) )
) )
->add("chapo", "text", array()) ->add("chapo", "text", array(
->add("description", "text", array()) "label" => "Summary",
->add("postscriptum", "text", array()) "label_attr" => array(
"for" => "summary"
)
))
->add("description", "text", array(
"label" => "Detailed description",
"label_attr" => array(
"for" => "detailed_description"
)
))
->add("postscriptum", "text", array(
"label" => "Conclusion",
"label_attr" => array(
"for" => "conclusion"
)
))
; ;
} }
} }

View File

@@ -67,7 +67,9 @@ class ConfigCreationForm extends BaseForm
) )
)) ))
->add("hidden", "hidden", array()) ->add("hidden", "hidden", array())
->add("secured", "hidden", array()) ->add("secured", "hidden", array(
"label" => "Prevent variable modification or deletion, except for super-admin"
))
; ;
} }

View File

@@ -44,11 +44,22 @@ class ConfigModificationForm extends BaseDescForm
->add("name", "text", array( ->add("name", "text", array(
"constraints" => array( "constraints" => array(
new NotBlank() new NotBlank()
),
"label" => "Name",
"label_attr" => array(
"for" => "name"
)
))
->add("value", "text", array(
"label" => "Value",
"label_attr" => array(
"for" => "value"
) )
)) ))
->add("value", "text", array())
->add("hidden", "hidden", array()) ->add("hidden", "hidden", array())
->add("secured", "hidden", array()) ->add("secured", "hidden", array(
"label" => "Prevent variable modification or deletion, except for super-admin"
))
; ;
} }

View File

@@ -44,4 +44,10 @@
// Used for a bird's eye view of components dependent on the z-axis // Used for a bird's eye view of components dependent on the z-axis
// Try to avoid customizing these :) // Try to avoid customizing these :)
@zindex-dropdown: 1005; @zindex-dropdown: 1005;
// Forms
// -------------------------
@input-border-focus: @link-color;

View File

@@ -1,60 +1,41 @@
{* The standard description fields, used by many Thelia objects *} {* The standard description fields, used by many Thelia objects *}
{form_field form=$form field='title'} {form_field form=$form field='title'}
<div class="control-group"> <div class="form-group {if $error}has-error{/if}">
<label class="control-label"> <label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
{intl l='Title *'} <input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Title'}" placeholder="{intl l='Title'}" class="form-control" value="{$value|htmlspecialchars}">
</label>
<div class="controls">
<span {if $error}class="error"{/if}>
<input type="text" name="{$name}" required="required" title="{intl l='Title'}" placeholder="{intl l='Title'}" class="input-block-level" value="{$value|htmlspecialchars}">
</span>
</div>
</div> </div>
{/form_field} {/form_field}
{form_field form=$form field='chapo'} {form_field form=$form field='chapo'}
<div class="control-group"> <div class="form-group {if $error}has-error{/if}">
<label class="control-label"> <label for="{$label_attr.for}" class="control-label">
{intl l='Summary'} {intl l="{$label}"} :
<span class="label-help-block">{intl l="A short description, used when a summary or an introduction is required"}</span> <span class="label-help-block">{intl l="A short description, used when a summary or an introduction is required"}</span>
</label> </label>
<div class="controls"> <textarea name="{$name}" id="{$label_attr.for}" rows="3" title="{intl l='Short description'}" placeholder="{intl l='Short description'}" class="form-control">{$value|htmlspecialchars}</textarea>
<span {if $error}class="error"{/if}>
<textarea name="{$name}" rows="3" title="{intl l='Short description'}" placeholder="{intl l='Short description'}" class="input-block-level">{$value|htmlspecialchars}</textarea>
</span>
</div>
</div> </div>
{/form_field} {/form_field}
{form_field form=$form field='description'} {form_field form=$form field='description'}
<div class="control-group"> <div class="form-group {if $error}has-error{/if}">
<label class="control-label"> <label for="{$label_attr.for}" class="control-label">
{intl l='Detailed description'} {intl l="{$label}"} :
<span class="label-help-block">{intl l="The détailed description."}</span> <span class="label-help-block">{intl l="The détailed description."}</span>
</label> </label>
<div class="controls"> <textarea name="{$name}" id="{$label_attr.for}" rows="10" class="form-control">{$value|htmlspecialchars}</textarea>
<span {if $error}class="error"{/if}>
<textarea name="{$name}" rows="10" class="input-block-level">{$value|htmlspecialchars}</textarea>
</span>
</div>
</div> </div>
{/form_field} {/form_field}
{form_field form=$form field='postscriptum'} {form_field form=$form field='postscriptum'}
<div class="control-group"> <div class="form-group {if $error}has-error{/if}">
<label class="control-label"> <label for="{$label_attr.for}" class="control-label">
{intl l='Conclusion'} {intl l="{$label}"} :
<span class="label-help-block">{intl l="A short post-description information"}</span> <span class="label-help-block">{intl l="A short post-description information"}</span>
</label> </label>
<div class="controls"> <textarea name="{$name}" id="{$label_attr.for}" rows="3" title="{intl l='Short conclusion'}" placeholder="{intl l='Short conclusion'}" class="form-control">{$value|htmlspecialchars}</textarea>
<span {if $error}class="error"{/if}>
<textarea name="{$name}" rows="3" title="{intl l='Short conclusion'}" placeholder="{intl l='Short conclusion'}" class="input-block-level">{$value|htmlspecialchars}</textarea>
</span>
</div>
</div> </div>
{/form_field} {/form_field}

View File

@@ -27,7 +27,7 @@
</div> </div>
<div class="form-container"> <div class="form-container">
<div class="form-horizontal col-md-12"> <div class="col-md-12">
{form name="thelia.admin.config.modification"} {form name="thelia.admin.config.modification"}
<form method="POST" action="{url path='/admin/configuration/variables/save'}" {form_enctype form=$form}> <form method="POST" action="{url path='/admin/configuration/variables/save'}" {form_enctype form=$form}>
<fieldset> <fieldset>
@@ -57,52 +57,29 @@
{/form_field} {/form_field}
{if #form_error}<div class="alert alert-block alert-error">#form_error_message</div>{/if} {if #form_error}<div class="alert alert-block alert-error">#form_error_message</div>{/if}
<div class="control-group"> {form_field form=$form field='name'}
<div class="form-group {if $error}has-error{/if}">
<label class="control-label"> <label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
{intl l='Name *'} <input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value|htmlspecialchars}" title="{intl l='Variable name'}" placeholder="{intl l='Variable name'}" class="form-control">
</label>
<div class="controls">
{form_field form=$form field='name'}
<span {if $error}class="error"{/if}>
<input type="text" required="required" name="{$name}" value="{$value|htmlspecialchars}" title="{intl l='Variable name'}" placeholder="{intl l='Variable name'}" class="input-block-level">
</span>
{/form_field}
</div>
</div> </div>
{/form_field}
<div class="control-group">
<label class="control-label"> {form_field form=$form field='value'}
{intl l='Value'} <div class="form-group {if $error}has-error{/if}">
</label> <label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
<input type="text" id="{$label_attr.for}" name="{$name}" value="{$value|htmlspecialchars}" title="{intl l='Variable value'}" placeholder="{intl l='Variable value'}" class="form-control">
<div class="controls">
{form_field form=$form field='value'}
<span {if $error}class="error"{/if}>
<input type="text" name="{$name}" value="{$value|htmlspecialchars}" title="{intl l='Variable value'}" placeholder="{intl l='Variable value'}" class="input-block-level">
</span>
{/form_field}
</div>
</div> </div>
{/form_field}
<div class="control-group">
<label class="control-label"> {form_field form=$form field='secured'}
{intl l='Secured'} <div class="checkbox {if $error}has-error{/if}">
</label> <label>
<input type="checkbox" name="{$name}" value="1" {if $value == 1}checked="checked"{/if}>
<div class="controls"> {intl l="{$label}"}
{form_field form=$form field='secured'} </label>
<span {if $error}class="error"{/if}>
<label class="checkbox">
<input type="checkbox" name="{$name}" value="1" {if $value == 1}checked="checked"{/if}>
{intl l="Prevent variable modification or deletion, except for super-admin"}
</label>
</span>
{/form_field}
</div>
</div> </div>
{/form_field}
{include file="includes/standard-description-form-fields.html"} {include file="includes/standard-description-form-fields.html"}