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(
"constraints" => array(
new NotBlank()
),
"label" => "Title",
"label_attr" => array(
"for" => "title"
)
)
)
->add("chapo", "text", array())
->add("description", "text", array())
->add("postscriptum", "text", array())
->add("chapo", "text", array(
"label" => "Summary",
"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("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(
"constraints" => array(
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("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
// 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 *}
{form_field form=$form field='title'}
<div class="control-group">
<label class="control-label">
{intl l='Title *'}
</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 class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
<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}">
</div>
{/form_field}
{form_field form=$form field='chapo'}
<div class="control-group">
<label class="control-label">
{intl l='Summary'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">
{intl l="{$label}"} :
<span class="label-help-block">{intl l="A short description, used when a summary or an introduction is required"}</span>
</label>
<div class="controls">
<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>
<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>
</div>
{/form_field}
{form_field form=$form field='description'}
<div class="control-group">
<label class="control-label">
{intl l='Detailed description'}
<span class="label-help-block">{intl l="The détailed description."}</span>
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">
{intl l="{$label}"} :
<span class="label-help-block">{intl l="The détailed description."}</span>
</label>
<div class="controls">
<span {if $error}class="error"{/if}>
<textarea name="{$name}" rows="10" class="input-block-level">{$value|htmlspecialchars}</textarea>
</span>
</div>
<textarea name="{$name}" id="{$label_attr.for}" rows="10" class="form-control">{$value|htmlspecialchars}</textarea>
</div>
{/form_field}
{form_field form=$form field='postscriptum'}
<div class="control-group">
<label class="control-label">
{intl l='Conclusion'}
<span class="label-help-block">{intl l="A short post-description information"}</span>
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">
{intl l="{$label}"} :
<span class="label-help-block">{intl l="A short post-description information"}</span>
</label>
<div class="controls">
<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>
<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>
</div>
{/form_field}

View File

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