Merge branch 'master' of github.com:thelia/thelia

This commit is contained in:
Manuel Raynaud
2013-09-12 15:41:04 +02:00
11 changed files with 237 additions and 198 deletions

View File

@@ -25,29 +25,27 @@ namespace Thelia\Action;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Model\AttributeQuery; use Thelia\Model\AttributeAvQuery;
use Thelia\Model\Attribute as AttributeModel; use Thelia\Model\AttributeAv as AttributeAvModel;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\AttributeUpdateEvent; use Thelia\Core\Event\AttributeAvUpdateEvent;
use Thelia\Core\Event\AttributeCreateEvent; use Thelia\Core\Event\AttributeAvCreateEvent;
use Thelia\Core\Event\AttributeDeleteEvent; use Thelia\Core\Event\AttributeAvDeleteEvent;
use Thelia\Model\ConfigQuery; use Thelia\Model\ConfigQuery;
use Thelia\Model\AttributeAv;
use Thelia\Model\AttributeAvQuery;
use Thelia\Core\Event\UpdatePositionEvent; use Thelia\Core\Event\UpdatePositionEvent;
class Attribute extends BaseAction implements EventSubscriberInterface class AttributeAv extends BaseAction implements EventSubscriberInterface
{ {
/** /**
* Create a new attribute entry * Create a new attribute entry
* *
* @param AttributeCreateEvent $event * @param AttributeAvCreateEvent $event
*/ */
public function create(AttributeCreateEvent $event) public function create(AttributeAvCreateEvent $event)
{ {
$attribute = new AttributeModel(); $attribute = new AttributeAvModel();
$attribute $attribute
->setDispatcher($this->getDispatcher()) ->setDispatcher($this->getDispatcher())
@@ -58,7 +56,7 @@ class Attribute extends BaseAction implements EventSubscriberInterface
->save() ->save()
; ;
$event->setAttribute($attribute); $event->setAttributeAv($attribute);
// Add atribute to all product templates if required // Add atribute to all product templates if required
if ($event->getAddToAllTemplates() != 0) { if ($event->getAddToAllTemplates() != 0) {
@@ -69,13 +67,13 @@ class Attribute extends BaseAction implements EventSubscriberInterface
/** /**
* Change a product attribute * Change a product attribute
* *
* @param AttributeUpdateEvent $event * @param AttributeAvUpdateEvent $event
*/ */
public function update(AttributeUpdateEvent $event) public function update(AttributeAvUpdateEvent $event)
{ {
$search = AttributeQuery::create(); $search = AttributeAvQuery::create();
if (null !== $attribute = AttributeQuery::create()->findPk($event->getAttributeId())) { if (null !== $attribute = AttributeAvQuery::create()->findPk($event->getAttributeAvId())) {
$attribute $attribute
->setDispatcher($this->getDispatcher()) ->setDispatcher($this->getDispatcher())
@@ -88,26 +86,26 @@ class Attribute extends BaseAction implements EventSubscriberInterface
->save(); ->save();
$event->setAttribute($attribute); $event->setAttributeAv($attribute);
} }
} }
/** /**
* Delete a product attribute entry * Delete a product attribute entry
* *
* @param AttributeDeleteEvent $event * @param AttributeAvDeleteEvent $event
*/ */
public function delete(AttributeDeleteEvent $event) public function delete(AttributeAvDeleteEvent $event)
{ {
if (null !== ($attribute = AttributeQuery::create()->findPk($event->getAttributeId()))) { if (null !== ($attribute = AttributeAvQuery::create()->findPk($event->getAttributeAvId()))) {
$attribute $attribute
->setDispatcher($this->getDispatcher()) ->setDispatcher($this->getDispatcher())
->delete() ->delete()
; ;
$event->setAttribute($attribute); $event->setAttributeAv($attribute);
} }
} }
@@ -118,7 +116,7 @@ class Attribute extends BaseAction implements EventSubscriberInterface
*/ */
public function updatePosition(UpdatePositionEvent $event) public function updatePosition(UpdatePositionEvent $event)
{ {
if (null !== $attribute = AttributeQuery::create()->findPk($event->getObjectId())) { if (null !== $attribute = AttributeAvQuery::create()->findPk($event->getObjectId())) {
$attribute->setDispatcher($this->getDispatcher()); $attribute->setDispatcher($this->getDispatcher());
@@ -140,10 +138,10 @@ class Attribute extends BaseAction implements EventSubscriberInterface
public static function getSubscribedEvents() public static function getSubscribedEvents()
{ {
return array( return array(
TheliaEvents::ATTRIBUTE_CREATE => array("create", 128), TheliaEvents::ATTRIBUTE_AV_CREATE => array("create", 128),
TheliaEvents::ATTRIBUTE_UPDATE => array("update", 128), TheliaEvents::ATTRIBUTE_AV_UPDATE => array("update", 128),
TheliaEvents::ATTRIBUTE_DELETE => array("delete", 128), TheliaEvents::ATTRIBUTE_AV_DELETE => array("delete", 128),
TheliaEvents::ATTRIBUTE_UPDATE_POSITION => array("updatePosition", 128), TheliaEvents::ATTRIBUTE_AV_UPDATE_POSITION => array("updatePosition", 128),
); );
} }
} }

View File

@@ -62,6 +62,11 @@
<tag name="kernel.event_subscriber"/> <tag name="kernel.event_subscriber"/>
</service> </service>
<service id="thelia.action.attributeav" class="Thelia\Action\AttributeAv">
<argument type="service" id="service_container"/>
<tag name="kernel.event_subscriber"/>
</service>
<service id="thelia.action.pageNotFound" class="Thelia\Action\PageNotFound"> <service id="thelia.action.pageNotFound" class="Thelia\Action\PageNotFound">
<argument type="service" id="service_container"/> <argument type="service" id="service_container"/>
<tag name="kernel.event_subscriber"/> <tag name="kernel.event_subscriber"/>

View File

@@ -48,7 +48,7 @@
<route id="admin.order" path="/admin/order"> <route id="admin.order" path="/admin/order">
<default key="_controller">Thelia\Controller\Admin\OrderController::indexAction</default> <default key="_controller">Thelia\Controller\Admin\OrderController::indexAction</default>
</route> </route>
<route id="admin.order.update.view" path="/admin/order/update/{order_id}"> <route id="admin.order.update.view" path="/admin/order/update/{order_id}">
<default key="_controller">Thelia\Controller\Admin\OrderController::viewAction</default> <default key="_controller">Thelia\Controller\Admin\OrderController::viewAction</default>
@@ -68,11 +68,11 @@
</route> </route>
<route id="admin.categories.update" path="/admin/categories/update"> <route id="admin.categories.update" path="/admin/categories/update">
<default key="_controller">Thelia\Controller\Admin\CategoryController::changeAction</default> <default key="_controller">Thelia\Controller\Admin\CategoryController::updateAction</default>
</route> </route>
<route id="admin.categories.save" path="/admin/categories/save"> <route id="admin.categories.save" path="/admin/categories/save">
<default key="_controller">Thelia\Controller\Admin\CategoryController::saveChangeAction</default> <default key="_controller">Thelia\Controller\Admin\CategoryController::processUpdateAction</default>
</route> </route>
<route id="admin.categories.set-default" path="/admin/categories/toggle-online"> <route id="admin.categories.set-default" path="/admin/categories/toggle-online">
@@ -129,11 +129,11 @@
</route> </route>
<route id="admin.configuration.variables.update" path="/admin/configuration/variables/update"> <route id="admin.configuration.variables.update" path="/admin/configuration/variables/update">
<default key="_controller">Thelia\Controller\Admin\ConfigController::changeAction</default> <default key="_controller">Thelia\Controller\Admin\ConfigController::updateAction</default>
</route> </route>
<route id="admin.configuration.variables.save" path="/admin/configuration/variables/save"> <route id="admin.configuration.variables.save" path="/admin/configuration/variables/save">
<default key="_controller">Thelia\Controller\Admin\ConfigController::saveChangeAction</default> <default key="_controller">Thelia\Controller\Admin\ConfigController::processUpdateAction</default>
</route> </route>
<route id="admin.configuration.variables.delete" path="/admin/configuration/variables/delete"> <route id="admin.configuration.variables.delete" path="/admin/configuration/variables/delete">
@@ -151,11 +151,11 @@
</route> </route>
<route id="admin.configuration.messages.update" path="/admin/configuration/messages/update"> <route id="admin.configuration.messages.update" path="/admin/configuration/messages/update">
<default key="_controller">Thelia\Controller\Admin\MessageController::changeAction</default> <default key="_controller">Thelia\Controller\Admin\MessageController::updateAction</default>
</route> </route>
<route id="admin.configuration.messages.save" path="/admin/configuration/messages/save"> <route id="admin.configuration.messages.save" path="/admin/configuration/messages/save">
<default key="_controller">Thelia\Controller\Admin\MessageController::saveChangeAction</default> <default key="_controller">Thelia\Controller\Admin\MessageController::processUpdateAction</default>
</route> </route>
<route id="admin.configuration.messages.delete" path="/admin/configuration/messages/delete"> <route id="admin.configuration.messages.delete" path="/admin/configuration/messages/delete">
@@ -173,11 +173,11 @@
</route> </route>
<route id="admin.configuration.currencies.update" path="/admin/configuration/currencies/update"> <route id="admin.configuration.currencies.update" path="/admin/configuration/currencies/update">
<default key="_controller">Thelia\Controller\Admin\CurrencyController::changeAction</default> <default key="_controller">Thelia\Controller\Admin\CurrencyController::updateAction</default>
</route> </route>
<route id="admin.configuration.currencies.save" path="/admin/configuration/currencies/save"> <route id="admin.configuration.currencies.save" path="/admin/configuration/currencies/save">
<default key="_controller">Thelia\Controller\Admin\CurrencyController::saveChangeAction</default> <default key="_controller">Thelia\Controller\Admin\CurrencyController::processUpdateAction</default>
</route> </route>
<route id="admin.configuration.currencies.set-default" path="/admin/configuration/currencies/set-default"> <route id="admin.configuration.currencies.set-default" path="/admin/configuration/currencies/set-default">
@@ -200,7 +200,8 @@
<default key="_controller">Thelia\Controller\Admin\CurrencyController::updatePositionAction</default> <default key="_controller">Thelia\Controller\Admin\CurrencyController::updatePositionAction</default>
</route> </route>
<!-- attribute and feature routes management -->
<!-- attribute and attributes value management -->
<route id="admin.configuration.attributes.default" path="/admin/configuration/attributes"> <route id="admin.configuration.attributes.default" path="/admin/configuration/attributes">
<default key="_controller">Thelia\Controller\Admin\AttributeController::defaultAction</default> <default key="_controller">Thelia\Controller\Admin\AttributeController::defaultAction</default>
@@ -210,30 +211,43 @@
<default key="_controller">Thelia\Controller\Admin\AttributeController::createAction</default> <default key="_controller">Thelia\Controller\Admin\AttributeController::createAction</default>
</route> </route>
<route id="admin.configuration.attributes.create" path="/admin/configuration/attributes/create-value">
<default key="_controller">Thelia\Controller\Admin\AttributeController::createValueAction</default>
</route>
<route id="admin.configuration.attributes.update" path="/admin/configuration/attributes/update"> <route id="admin.configuration.attributes.update" path="/admin/configuration/attributes/update">
<default key="_controller">Thelia\Controller\Admin\AttributeController::changeAction</default> <default key="_controller">Thelia\Controller\Admin\AttributeController::updateAction</default>
</route> </route>
<route id="admin.configuration.attributes.save" path="/admin/configuration/attributes/save"> <route id="admin.configuration.attributes.save" path="/admin/configuration/attributes/save">
<default key="_controller">Thelia\Controller\Admin\AttributeController::saveChangeAction</default> <default key="_controller">Thelia\Controller\Admin\AttributeController::processUpdateAction</default>
</route> </route>
<route id="admin.configuration.attributes.delete" path="/admin/configuration/attributes/delete"> <route id="admin.configuration.attributes.delete" path="/admin/configuration/attributes/delete">
<default key="_controller">Thelia\Controller\Admin\AttributeController::deleteAction</default> <default key="_controller">Thelia\Controller\Admin\AttributeController::deleteAction</default>
</route> </route>
<route id="admin.configuration.attributes.delete" path="/admin/configuration/attributes/delete-value">
<default key="_controller">Thelia\Controller\Admin\AttributeController::deleteValueAction</default>
</route>
<route id="admin.configuration.attributes.update-position" path="/admin/configuration/attributes/update-position"> <route id="admin.configuration.attributes.update-position" path="/admin/configuration/attributes/update-position">
<default key="_controller">Thelia\Controller\Admin\AttributeController::updatePositionAction</default> <default key="_controller">Thelia\Controller\Admin\AttributeController::updatePositionAction</default>
</route> </route>
<route id="admin.configuration.attributes-av.create" path="/admin/configuration/attributes-av/create">
<default key="_controller">Thelia\Controller\Admin\AttributeAvController::createAction</default>
</route>
<route id="admin.configuration.attributes-av.update" path="/admin/configuration/attributes-av/update">
<default key="_controller">Thelia\Controller\Admin\AttributeAvController::updateAction</default>
</route>
<route id="admin.configuration.attributes-av.save" path="/admin/configuration/attributes-av/save">
<default key="_controller">Thelia\Controller\Admin\AttributeAvController::processUpdateAction</default>
</route>
<route id="admin.configuration.attributes-av.delete" path="/admin/configuration/attributes-av/delete">
<default key="_controller">Thelia\Controller\Admin\AttributeAvController::deleteAction</default>
</route>
<route id="admin.configuration.attributes-av.update-position" path="/admin/configuration/attributes-av/update-position">
<default key="_controller">Thelia\Controller\Admin\AttributeAvController::updatePositionAction</default>
</route>
<!-- end attribute and feature routes management --> <!-- end attribute and feature routes management -->
<!-- The default route, to display a template --> <!-- The default route, to display a template -->

View File

@@ -28,7 +28,7 @@ use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Core\Event\ToggleVisibilityEvent; use Thelia\Core\Event\ToggleVisibilityEvent;
/** /**
* Manages currencies sent by mail * An abstract CRUD controller for Thelia ADMIN, to manage basic CRUD operations on a givent object.
* *
* @author Franck Allimant <franck@cqfdev.fr> * @author Franck Allimant <franck@cqfdev.fr>
*/ */
@@ -53,6 +53,23 @@ abstract class AbstractCrudController extends BaseAdminController
protected $changePositionEventIdentifier; protected $changePositionEventIdentifier;
/**
* @param string $objectName the lower case object name. Example. "message"
*
* @param string $defaultListOrder the default object list order, or null if list is not sortable. Example: manual
*
* @param string $viewPermissionIdentifier the 'view' permission identifier. Example: "admin.configuration.message.view"
* @param string $createPermissionIdentifier the 'create' permission identifier. Example: "admin.configuration.message.create"
* @param string $updatePermissionIdentifier the 'update' permission identifier. Example: "admin.configuration.message.update"
* @param string $deletePermissionIdentifier the 'delete' permission identifier. Example: "admin.configuration.message.delete"
*
* @param string $createEventIdentifier the dispatched create TheliaEvent identifier. Example: TheliaEvents::MESSAGE_CREATE
* @param string $updateEventIdentifier the dispatched update TheliaEvent identifier. Example: TheliaEvents::MESSAGE_UPDATE
* @param string $deleteEventIdentifier the dispatched delete TheliaEvent identifier. Example: TheliaEvents::MESSAGE_DELETE
*
* @param string $visibilityToggleEventIdentifier the dispatched visibility toggle TheliaEvent identifier, or null if the object has no visible options. Example: TheliaEvents::MESSAGE_TOGGLE_VISIBILITY
* @param string $changePositionEventIdentifier the dispatched position change TheliaEvent identifier, or null if the object has no position. Example: TheliaEvents::MESSAGE_UPDATE_POSITION
*/
public function __construct( public function __construct(
$objectName, $objectName,
@@ -187,15 +204,14 @@ abstract class AbstractCrudController extends BaseAdminController
} }
/** /**
* Render the object list, ensuring the sort order is set. * Return the current list order identifier, updating it in the same time.
*
* @return Symfony\Component\HttpFoundation\Response the response
*/ */
protected function renderList() protected function getCurrentListOrder($update_session = true) {
{
$order = null; $order = null;
if ($this->defaultListOrder != null) { if ($this->defaultListOrder) {
$orderSessionIdentifier = sprintf("admin.%s.currentListOrder", $this->objectName); $orderSessionIdentifier = sprintf("admin.%s.currentListOrder", $this->objectName);
// Find the current order // Find the current order
@@ -204,11 +220,20 @@ abstract class AbstractCrudController extends BaseAdminController
$this->getSession()->get($orderSessionIdentifier, $this->defaultListOrder) $this->getSession()->get($orderSessionIdentifier, $this->defaultListOrder)
); );
// Store the current sort order in session if ($update_session) $this->getSession()->set($orderSessionIdentifier, $order);
$this->getSession()->set($orderSessionIdentifier, $order);
} }
return $this->renderListTemplate($order); return $order;
}
/**
* Render the object list, ensuring the sort order is set.
*
* @return Symfony\Component\HttpFoundation\Response the response
*/
protected function renderList()
{
return $this->renderListTemplate($this->getCurrentListOrder());
} }
/** /**
@@ -286,7 +311,7 @@ abstract class AbstractCrudController extends BaseAdminController
* *
* @return Symfony\Component\HttpFoundation\Response the response * @return Symfony\Component\HttpFoundation\Response the response
*/ */
public function changeAction() public function updateAction()
{ {
// Check current user authorization // Check current user authorization
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response; if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
@@ -312,7 +337,7 @@ abstract class AbstractCrudController extends BaseAdminController
* *
* @return Symfony\Component\HttpFoundation\Response the response * @return Symfony\Component\HttpFoundation\Response the response
*/ */
public function saveChangeAction() public function processUpdateAction()
{ {
// Check current user authorization // Check current user authorization
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response; if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;

View File

@@ -122,7 +122,7 @@ class AttributeController extends AbstractCrudController
); );
// Setup the object form // Setup the object form
$changeForm = new AttributeModificationForm($this->getRequest(), "form", $data); return new AttributeModificationForm($this->getRequest(), "form", $data);
} }
protected function getObjectFromEvent($event) { protected function getObjectFromEvent($event) {
@@ -136,7 +136,7 @@ class AttributeController extends AbstractCrudController
} }
protected function getObjectLabel($object) { protected function getObjectLabel($object) {
return $object->getName(); return $object->getTitle();
} }
protected function getObjectId($object) { protected function getObjectId($object) {

View File

@@ -23,7 +23,7 @@
namespace Thelia\Core\Event; namespace Thelia\Core\Event;
class AttributeValueCreateEvent extends AttributeValueEvent class AttributeAvCreateEvent extends AttributeAvEvent
{ {
protected $title; protected $title;
protected $locale; protected $locale;

View File

@@ -23,23 +23,23 @@
namespace Thelia\Core\Event; namespace Thelia\Core\Event;
class AttributeValueDeleteEvent extends AttributeValueEvent class AttributeAvDeleteEvent extends AttributeAvEvent
{ {
protected $attributeValue_id; protected $attributeAv_id;
public function __construct($attributeValue_id) public function __construct($attributeAv_id)
{ {
$this->setAttributeValueId($attributeValue_id); $this->setAttributeAvId($attributeAv_id);
} }
public function getAttributeValueId() public function getAttributeAvId()
{ {
return $this->attributeValue_id; return $this->attributeAv_id;
} }
public function setAttributeValueId($attributeValue_id) public function setAttributeAvId($attributeAv_id)
{ {
$this->attributeValue_id = $attributeValue_id; $this->attributeAv_id = $attributeAv_id;
return $this; return $this;
} }

View File

@@ -24,28 +24,28 @@
namespace Thelia\Core\Event; namespace Thelia\Core\Event;
use Thelia\Model\AttributeAv; use Thelia\Model\AttributeAv;
class AttributeValueEvent extends ActionEvent class AttributeAvEvent extends ActionEvent
{ {
protected $attributeValue = null; protected $attributeAv = null;
public function __construct(AttributeAv $attributeValue = null) public function __construct(AttributeAv $attributeAv = null)
{ {
$this->attributeValue = $attributeValue; $this->attributeAv = $attributeAv;
} }
public function hasAttributeValue() public function hasAttributeAv()
{ {
return ! is_null($this->attributeValue); return ! is_null($this->attributeAv);
} }
public function getAttributeValue() public function getAttributeAv()
{ {
return $this->attributeValue; return $this->attributeAv;
} }
public function setAttributeValue($attributeValue) public function setAttributeAv($attributeAv)
{ {
$this->attributeValue = $attributeValue; $this->attributeAv = $attributeAv;
return $this; return $this;
} }

View File

@@ -23,27 +23,27 @@
namespace Thelia\Core\Event; namespace Thelia\Core\Event;
class AttributeValueUpdateEvent extends AttributeValueCreateEvent class AttributeAvUpdateEvent extends AttributeAvCreateEvent
{ {
protected $attributeValue_id; protected $attributeAv_id;
protected $description; protected $description;
protected $chapo; protected $chapo;
protected $postscriptum; protected $postscriptum;
public function __construct($attributeValue_id) public function __construct($attributeAv_id)
{ {
$this->setAttributeValueId($attributeValue_id); $this->setAttributeAvId($attributeAv_id);
} }
public function getAttributeValueId() public function getAttributeAvId()
{ {
return $this->attributeValue_id; return $this->attributeAv_id;
} }
public function setAttributeValueId($attributeValue_id) public function setAttributeAvId($attributeAv_id)
{ {
$this->attributeValue_id = $attributeValue_id; $this->attributeAv_id = $attributeAv_id;
return $this; return $this;
} }

View File

@@ -365,17 +365,17 @@ final class TheliaEvents
// -- Attributes values management ---------------------------------------- // -- Attributes values management ----------------------------------------
const ATTRIBUTE_VALUE_CREATE = "action.createAttributeValue"; const ATTRIBUTE_AV_CREATE = "action.createAttributeAv";
const ATTRIBUTE_VALUE_UPDATE = "action.updateAttributeValue"; const ATTRIBUTE_AV_UPDATE = "action.updateAttributeAv";
const ATTRIBUTE_VALUE_DELETE = "action.deleteAttributeValue"; const ATTRIBUTE_AV_DELETE = "action.deleteAttributeAv";
const ATTRIBUTE_VALUE_UPDATE_POSITION = "action.updateAttributeValuePosition"; const ATTRIBUTE_AV_UPDATE_POSITION = "action.updateAttributeAvPosition";
const BEFORE_CREATEATTRIBUTE_VALUE = "action.before_createAttributeValue"; const BEFORE_CREATEATTRIBUTE_AV = "action.before_createAttributeAv";
const AFTER_CREATEATTRIBUTE_VALUE = "action.after_createAttributeValue"; const AFTER_CREATEATTRIBUTE_AV = "action.after_createAttributeAv";
const BEFORE_UPDATEATTRIBUTE_VALUE = "action.before_updateAttributeValue"; const BEFORE_UPDATEATTRIBUTE_AV = "action.before_updateAttributeAv";
const AFTER_UPDATEATTRIBUTE_VALUE = "action.after_updateAttributeValue"; const AFTER_UPDATEATTRIBUTE_AV = "action.after_updateAttributeAv";
const BEFORE_DELETEATTRIBUTE_VALUE = "action.before_deleteAttributeValue"; const BEFORE_DELETEATTRIBUTE_AV = "action.before_deleteAttributeAv";
const AFTER_DELETEATTRIBUTE_VALUE = "action.after_deleteAttributeValue"; const AFTER_DELETEATTRIBUTE_AV = "action.after_deleteAttributeAv";
} }

View File

@@ -27,16 +27,15 @@
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<div class="form-container"> <div class="form-container">
{form name="thelia.admin.attribute.modification"}
<form method="POST" action="{url path='/admin/configuration/attributes/save'}" {form_enctype form=$form} class="clearfix">
{include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/configuration/attributes'}"} {include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/configuration/attributes'}"}
<div class="col-md-6"> <div class="col-md-6">
<p class="title title-without-tabs">{intl l='Attribute information'}</p> <p class="title title-without-tabs">{intl l='Attribute information'}</p>
{form name="thelia.admin.attribute.modification"}
<form method="POST" action="{url path='/admin/configuration/attributes/save'}" {form_enctype form=$form} class="clearfix">
{* Be sure to get the attribute ID, even if the form could not be validated *} {* Be sure to get the attribute ID, even if the form could not be validated *}
<input type="hidden" name="attribute_id" value="{$attribute_id}" /> <input type="hidden" name="attribute_id" value="{$attribute_id}" />
@@ -53,114 +52,112 @@
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if} {if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
{include file="includes/standard-description-form-fields.html"} {include file="includes/standard-description-form-fields.html"}
</div>
</form> <div class="col-md-6">
{/form}
</div> <p class="title title-without-tabs">
<div class="col-md-6"> {intl l='Attribute values'}
<p class="title title-without-tabs"> {loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.attribute-values.create"}
<span class="pull-right">
<a data-toggle="modal" href="#creation_dialog" title="Add a new attribute value" class="btn btn-default btn-primary">
<span class="glyphicon glyphicon-plus-sign"></span>
</a>
</span>
{/loop}
</p>
{intl l='Attribute values'} <div class="alert alert-info">
{intl l="Enter here all possible attribute values."}
</div>
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.attribute-values.create"} <table class="table table-striped table-condensed table-left-aligned">
<span class="pull-right"> <thead>
<a data-toggle="modal" href="#creation_dialog" title="Add a new attribute value" class="btn btn-default btn-primary"> <tr>
<span class="glyphicon glyphicon-plus-sign"></span> <th>
</a> {admin_sortable_header
</span> current_order=$order
{/loop} order='id'
</p> reverse_order='id_reverse'
path={url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}
label="{intl l='ID'}"
}
</th>
<div class="alert alert-info"> <th>
{intl l="Enter here all possible attribute values. If you don't enter any value, you will be able to set a free value to this attribute on the product form."} {admin_sortable_header
</div> current_order=$order
order='alpha'
reverse_order='alpha_reverse'
path={url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}
label="{intl l='Value'}"
}
</th>
<table class="table table-striped table-condensed table-left-aligned"> <th class="text-center">
<thead> {admin_sortable_header
<tr> current_order=$order
<th> order='manual'
{admin_sortable_header reverse_order='manual_reverse'
current_order=$order path={url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}
order='id' label="{intl l="Position"}"
reverse_order='id_reverse' }
path={url path='/admin/configuration/attributes/update' attribute_id=$attribute_id} </th>
label="{intl l='ID'}"
}
</th>
<th> {module_include location='attributes_value_table_header'}
{admin_sortable_header
current_order=$order
order='alpha'
reverse_order='alpha_reverse'
path={url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}
label="{intl l='Value'}"
}
</th>
<th class="text-center"> <th class="actions">{intl l="Actions"}</th>
{admin_sortable_header </tr>
current_order=$order </thead>
order='manual'
reverse_order='manual_reverse'
path={url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}
label="{intl l="Position"}"
}
</th>
{module_include location='attributes_value_table_header'} <tbody>
{loop name="list" type="attribute_availability" attribute=$attribute_id backend_context="1" lang=$edit_language_id order=$order}
<tr>
<td>{$ID}</td>
<th class="actions">{intl l="Actions"}</th> <td>
</tr> <input class="js-edit form-control" type="text" name="" value="{$TITLE}" />
</thead> </td>
<tbody> <td class="text-center">
{loop name="list" type="attribute_availability" attribute=$attribute_id backend_context="1" lang=$edit_language_id order=$order} {admin_position_block
<tr> permission="admin.attributes.edit"
<td>{$ID}</td> path="/admin/configuration/attributes/update-value-position"
url_parameter="attribute_id"
in_place_edit_class="positionChange"
position="$POSITION"
id="$ID"
}
</td>
<td> {module_include location='attributes_value_table_row'}
<input class="js-edit form-control" type="text" name="" value="{$TITLE}" />
</td>
<td class="text-center"> <td class="actions">
{admin_position_block <div class="btn-group">
permission="admin.attributes.edit" <a class="btn btn-default btn-xs value-delete" title="{intl l='Delete this value'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
path="/admin/configuration/attributes/update-value-position" </div>
url_parameter="attribute_id" </td>
in_place_edit_class="positionChange" </tr>
position="$POSITION" {/loop}
id="$ID"
}
</td>
{module_include location='attributes_value_table_row'} {elseloop rel="list"}
<tr>
<td class="actions"> <td colspan="4">
<div class="btn-group"> <div class="alert alert-info">
<a class="btn btn-default btn-xs value-delete" title="{intl l='Delete this value'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a> {intl l="No product attribute has been created yet. Click the + button to create one."}
</div> </div>
</td> </td>
</tr> </tr>
{/loop} {/elseloop}
</tbody>
{elseloop rel="list"} </table>
<tr> </div>
<td colspan="4"> </form>
<div class="alert alert-info"> {/form}
{intl l="No product attribute has been created yet. Click the + button to create one."} </div>
</div>
</td>
</tr>
{/elseloop}
</tbody>
</table>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -235,7 +232,7 @@
dialog_ok_label = {intl l="Create this value"} dialog_ok_label = {intl l="Create this value"}
form_action = {url path='/admin/configuration/attributes/create-value'} form_action = {url path='/admin/configuration/attributes-av'}
form_enctype = {form_enctype form=$form} form_enctype = {form_enctype form=$form}
form_error_message = $form_error_message form_error_message = $form_error_message
} }
@@ -254,7 +251,7 @@
dialog_title = {intl l="Delete attribute value"} dialog_title = {intl l="Delete attribute value"}
dialog_message = {intl l="Do you really want to delete this attribute value ?"} dialog_message = {intl l="Do you really want to delete this attribute value ?"}
form_action = {url path='/admin/configuration/attributes/delete-value'} form_action = {url path='/admin/configuration/attributes-av/delete'}
form_content = {$smarty.capture.delete_dialog nofilter} form_content = {$smarty.capture.delete_dialog nofilter}
} }