Factorized creation and confirmation modal dialogs

This commit is contained in:
franck
2013-09-06 20:00:02 +02:00
parent c6612a0246
commit e8d96937e7
13 changed files with 360 additions and 202 deletions

View File

@@ -0,0 +1,67 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\NotBlank;
class ProductCreationForm extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add("ref", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => "Product reference *",
"label_attr" => array(
"for" => "ref"
)
))
->add("title", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => "Product title *",
"label_attr" => array(
"for" => "title"
)
))
->add("parent", "integer", array(
"constraints" => array(
new NotBlank()
)
))
->add("locale", "text", array(
"constraints" => array(
new NotBlank()
)
))
;
}
public function getName()
{
return "thelia_product_creation";
}
}

View File

@@ -0,0 +1,58 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\NotBlank;
/**
* This form defines all standard description fields:
* - title
* - chapo
* - description
* - postscriptum
*
* @author Franck Allimant <franck@cqfdev.fr>
*/
Trait StandardDescriptionFieldsTrait
{
protected function addStandardDescriptionFields()
{
$this->formBuilder
->add("locale", "hidden", array(
"constraints" => array(
new NotBlank()
)
)
)
->add("title", "text", array(
"constraints" => array(
new NotBlank()
)
)
)
->add("chapo", "text", array())
->add("description", "text", array())
->add("postscriptum", "text", array())
;
}
}