Created AbstractCrudController, and refactored existing controllers

This commit is contained in:
franck
2013-09-12 13:02:40 +02:00
parent 0671c2ce7d
commit c85ec2a9e3
31 changed files with 1033 additions and 566 deletions

View File

@@ -10,9 +10,9 @@
<div id="wrapper" class="container">
{loop name="customer_edit" type="customer" current="false" id="$customer_id" backend_context="1" lang="$edit_language_id"}
<ul class="breadcrumb">
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
<li><a href="{url path='/admin/customers'}">{intl l="Customers"}</a></li>
<li>{intl l='Editing customer "%name"' name="{$FIRSTNAME} {$LASTNAME}"}</li>
</ul>
@@ -34,7 +34,7 @@
{* Be sure to get the customer ID, even if the form could not be validated *}
<input type="hidden" name="customer_id" value="{$customer_id}" />
{include file="includes/inner-form-toolbar.html"}
{include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/customers'}"}
{form_hidden_fields form=$form}
@@ -44,18 +44,18 @@
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
<div class="col-md-6">
<div class="col-md-6">
<p class="title title-without-tabs">{intl l="Customer informations"}</p>
{form_field form=$form field='title'}
{form_field form=$form field='title'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
<select name="{$name}" id="{$label_attr.for}" class="form-control">
{loop type="title" name="title1"}
<option value="{$ID}">{$LONG}</option>
{/loop}
</select>
</select>
</div>
{/form_field}
@@ -74,7 +74,7 @@
{/form_field}
{loop name="address" type="address" customer="$customer_id" backend_context="1" default="true"}
<p class="title title-without-tabs">{intl l="Default address"}</p>
{form_field form=$form field='address1'}
@@ -85,16 +85,16 @@
{/form_field}
{form_field form=$form field='address2'}
<div class="form-group">
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$ADDRESS2}" title="{intl l="{$label}"}" placeholder="{intl l='Additional address'}">
<div class="form-group">
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$ADDRESS2}" title="{intl l="{$label}"}" placeholder="{intl l='Additional address'}">
</div>
{/form_field}
{/form_field}
{form_field form=$form field='address3'}
<div class="form-group">
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$ADDRESS3}" title="{intl l="{$label}"}" placeholder="{intl l='Additional address'}">
<div class="form-group">
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$ADDRESS3}" title="{intl l="{$label}"}" placeholder="{intl l='Additional address'}">
</div>
{/form_field}
{/form_field}
{form_field form=$form field='zipcode'}
<div class="form-group {if $error}has-error{/if}">
@@ -119,16 +119,16 @@
{/loop}
</select>
</div>
{/form_field}
{/form_field}
{/loop}
{/loop}
</div>
<div class="col-md-6">
<p class="title title-without-tabs clearfix">
{intl l="Other addresses"}
<span class="pull-right">
<span class="pull-right">
<a class="btn btn-default btn-primary" title="{intl l='Add a new address'}" href="#address_creation_dialog" data-toggle="modal">
<span class="glyphicon glyphicon-plus-sign"></span>
</a>
@@ -154,11 +154,11 @@
</td>
<td>
<div class="btn-group">
<a class="btn btn-default btn-xs" title="{intl l='Edit this address'}" href="#edit_address_dialog" data-toggle="modal">
<span class="glyphicon glyphicon-edit"></span>
</a>
<a class="btn btn-default btn-xs" title="{intl l='Use this address by default'}" href="#use_address_dialog" data-toggle="modal" rel="tooltip">
<span class="glyphicon glyphicon-pushpin"></span>
</a>
@@ -166,7 +166,7 @@
<a class="btn btn-default btn-xs customer-delete" title="{intl l='Delete this customer and all his orders'}" href="#delete_address_dialog" data-id="{$ID}" data-toggle="modal">
<span class="glyphicon glyphicon-trash"></span>
</a>
</div>
</td>
</tr>
@@ -181,11 +181,11 @@
</td>
<td>
<div class="btn-group">
<a class="btn btn-default btn-xs" title="{intl l='Edit this address'}" href="#edit_address_dialog" data-toggle="modal">
<span class="glyphicon glyphicon-edit"></span>
</a>
<a class="btn btn-default btn-xs" title="{intl l='Use this address by default'}" href="#use_address_dialog" data-toggle="modal" rel="tooltip">
<span class="glyphicon glyphicon-pushpin"></span>
</a>
@@ -193,7 +193,7 @@
<a class="btn btn-default btn-xs customer-delete" title="{intl l='Delete this customer and all his orders'}" href="#delete_address_dialog" data-id="{$ID}" data-toggle="modal">
<span class="glyphicon glyphicon-trash"></span>
</a>
</div>
</td>
</tr>
@@ -208,11 +208,11 @@
</td>
<td>
<div class="btn-group">
<a class="btn btn-default btn-xs" title="{intl l='Edit this address'}" href="#edit_address_dialog" data-toggle="modal">
<span class="glyphicon glyphicon-edit"></span>
</a>
<a class="btn btn-default btn-xs" title="{intl l='Use this address by default'}" href="#use_address_dialog" data-toggle="modal" rel="tooltip">
<span class="glyphicon glyphicon-pushpin"></span>
</a>
@@ -220,7 +220,7 @@
<a class="btn btn-default btn-xs customer-delete" title="{intl l='Delete this customer and all his orders'}" href="#delete_address_dialog" data-id="{$ID}" data-toggle="modal">
<span class="glyphicon glyphicon-trash"></span>
</a>
</div>
</td>
</tr>
@@ -258,12 +258,12 @@
{* Add an Address *}
{form name="thelia.address.create"}
{* Capture the dialog body, to pass it to the generic dialog *}
{capture "address_creation_dialog"}
{form_hidden_fields form=$form}
{form_field form=$form field='label'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
@@ -277,16 +277,16 @@
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Company'}">
</div>
{/form_field}
{form_field form=$form field='title'}
{form_field form=$form field='title'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
<select name="{$name}" id="{$label_attr.for}" class="form-control">
{loop type="title" name="title1"}
<option value="{$ID}">{$LONG}</option>
{/loop}
</select>
</select>
</div>
{/form_field}
@@ -307,13 +307,13 @@
{form_field form=$form field='address1'}
<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}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Address'}">
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Address'}">
</div>
<div class="form-group">
{form_field form=$form field='address2'}
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Additional address'}">
{/form_field}
{/form_field}
</div>
<div class="form-group">
@@ -346,10 +346,10 @@
{/loop}
</select>
</div>
{/form_field}
{/form_field}
{/capture}
{include
file = "includes/generic-create-dialog.html"
@@ -370,12 +370,12 @@
{* Update an Address *}
{form name="thelia.address.update"}
{* Capture the dialog body, to pass it to the generic dialog *}
{capture "edit_address_dialog"}
{form_hidden_fields form=$form}
{form_field form=$form field='label'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
@@ -389,16 +389,16 @@
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Company'}">
</div>
{/form_field}
{form_field form=$form field='title'}
{form_field form=$form field='title'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
<select name="{$name}" id="{$label_attr.for}" class="form-control">
{loop type="title" name="title1"}
<option value="{$ID}">{$LONG}</option>
{/loop}
</select>
</select>
</div>
{/form_field}
@@ -419,13 +419,13 @@
{form_field form=$form field='address1'}
<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}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Address'}">
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Address'}">
</div>
<div class="form-group">
{form_field form=$form field='address2'}
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Additional address'}">
{/form_field}
{/form_field}
</div>
<div class="form-group">
@@ -458,10 +458,10 @@
{/loop}
</select>
</div>
{/form_field}
{/form_field}
{/capture}
{include
file = "includes/generic-create-dialog.html"
@@ -478,8 +478,8 @@
}
{/form}
{* Default confirmation dialog *}
{capture "use_address_dialog"}