Merge branch 'master' of https://github.com/thelia/thelia into coupon

# By Manuel Raynaud (11) and gmorel (1)
# Via Manuel Raynaud (3) and gmorel (3)
* 'master' of https://github.com/thelia/thelia:
  Working - CasperJS : coupon rule
  add missing files
  finishing creating lost password template
  start creating lost password template
  add logo for beta version
  change metadata for product part
  update phpdebugbar dependency
  add TimeDataCollector
  just add Propel information in phpDebugBar
  add some information in propelcollector
  validate customer creation form
  finish registration form
This commit is contained in:
gmorel
2013-09-11 17:48:55 +02:00
24 changed files with 467 additions and 122 deletions

View File

@@ -36,13 +36,12 @@
"simplepie/simplepie": "dev-master",
"imagine/imagine": "dev-master",
"symfony/serializer": "dev-master",
"symfony/icu": "1.0"
},
"require-dev" : {
"phpunit/phpunit": "3.7.*",
"fzaninotto/faker": "dev-master",
"maximebf/debugbar": "1.*"
"maximebf/debugbar": "dev-master"
},
"minimum-stability": "stable",
"config" : {

16
composer.lock generated
View File

@@ -3,8 +3,7 @@
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
"hash": "ba2f3e0943f00c7c3bf0c086bc611b0f",
"hash": "28dfdc7a840f9e70df422581f82a871f",
"packages": [
{
"name": "imagine/imagine",
@@ -1621,16 +1620,16 @@
},
{
"name": "maximebf/debugbar",
"version": "1.5.1",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/maximebf/php-debugbar.git",
"reference": "37dccc40da52bf9f85571c30cf302da696db0d05"
"reference": "7fbe0a5d4ffc7f4e205c2b15542382308d34bd0d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/37dccc40da52bf9f85571c30cf302da696db0d05",
"reference": "37dccc40da52bf9f85571c30cf302da696db0d05",
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/7fbe0a5d4ffc7f4e205c2b15542382308d34bd0d",
"reference": "7fbe0a5d4ffc7f4e205c2b15542382308d34bd0d",
"shasum": ""
},
"require": {
@@ -1666,7 +1665,7 @@
"keywords": [
"debug"
],
"time": "2013-08-17 02:02:49"
"time": "2013-09-11 13:01:19"
},
{
"name": "phpunit/php-code-coverage",
@@ -2048,7 +2047,8 @@
"ptachoire/cssembed": 20,
"simplepie/simplepie": 20,
"imagine/imagine": 20,
"fzaninotto/faker": 20
"fzaninotto/faker": 20,
"maximebf/debugbar": 20
},
"platform": {
"php": ">=5.4"

View File

@@ -41,6 +41,7 @@
<forms>
<form name="thelia.customer.creation" class="Thelia\Form\CustomerCreation"/>
<form name="thelia.customer.modification" class="Thelia\Form\CustomerModification"/>
<form name="thelia.customer.lostpassword" class="Thelia\Form\CustomerLostPasswordForm"/>
<form name="thelia.customer.login" class="Thelia\Form\CustomerLogin"/>
<form name="thelia.admin.login" class="Thelia\Form\AdminLogin"/>

View File

@@ -12,7 +12,7 @@
<!-- Customer routes -->
<route id="customer.create.process" path="/customer/create" methods="post">
<default key="_controller">Thelia\Controller\Front\CustomerController::createAction</default>
<default key="_view">connexion</default>
<default key="_view">register</default>
</route>
<route id="customer.create.view" path="/register">
@@ -34,10 +34,20 @@
<default key="_view">login</default>
</route>
<route id="customer.logout.process" path="/customer/logout">
<route id="customer.logout.process" path="/logout">
<default key="_controller">Thelia\Controller\Front\CustomerController::logoutAction</default>
</route>
<route id="customer.password.retrieve.view" path="/password" methods="get">
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
<default key="_view">password</default>
</route>
<route id="customer.password.retrieve.process" path="/password" methods="post">
<default key="_controller">Thelia\Controller\Front\CustomerController::newPasswordAction</default>
<default key="_view">password</default>
</route>
<!-- end customer routes -->
<!-- customer address routes -->
@@ -57,6 +67,10 @@
<!-- end customer address routes -->
<!-- cart routes -->
<route id="cart.view" path="/cart">
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
<default key="_view">cart</default>
</route>
<route id="cart.add.process" path="/cart/add">
<default key="_controller">Thelia\Controller\Front\CartController::addItem</default>
<default key="_view">cart</default>

View File

@@ -215,8 +215,6 @@ class BaseController extends ContainerAware
$url = $this->getRequest()->get("success_url");
}
echo "url=$url";
if (null !== $url) $this->redirect($url);
}

View File

@@ -24,11 +24,13 @@ namespace Thelia\Controller\Front;
use Thelia\Core\Event\CustomerCreateOrUpdateEvent;
use Thelia\Core\Event\CustomerLoginEvent;
use Thelia\Core\Event\LostPasswordEvent;
use Thelia\Core\Security\Authentication\CustomerUsernamePasswordFormAuthenticator;
use Thelia\Core\Security\Exception\AuthenticationException;
use Thelia\Core\Security\Exception\UsernameNotFoundException;
use Thelia\Form\CustomerCreation;
use Thelia\Form\CustomerLogin;
use Thelia\Form\CustomerLostPasswordForm;
use Thelia\Form\CustomerModification;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Model\Customer;
@@ -44,6 +46,42 @@ use Thelia\Core\Security\Exception\WrongPasswordException;
*/
class CustomerController extends BaseFrontController
{
use \Thelia\Cart\CartTrait;
public function newPasswordAction()
{
if (! $this->getSecurityContext()->hasCustomerUser()) {
$message = false;
$passwordLost = new CustomerLostPasswordForm($this->getRequest());
try {
$form = $this->validateForm($passwordLost);
$event = new LostPasswordEvent($form->get("email")->getData());
$this->dispatch(TheliaEvents::LOST_PASSWORD, $event);
} catch (FormValidationException $e) {
$message = sprintf("Please check your input: %s", $e->getMessage());
} catch (\Exception $e) {
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
}
if ($message !== false) {
Tlog::getInstance()->error(sprintf("Error during customer creation process : %s. Exception was %s", $message, $e->getMessage()));
$passwordLost->setErrorMessage($message);
$this->getParserContext()
->addForm($passwordLost)
->setGeneralError($message)
;
}
}
}
/**
* Create a new customer.
* On success, redirect to success_url if exists, otherwise, display the same view again.
@@ -65,7 +103,12 @@ class CustomerController extends BaseFrontController
$this->processLogin($customerCreateEvent->getCustomer());
$cart = $this->getCart($this->getRequest());
if($cart->getCartItems()->count() > 0) {
$this->redirectToRoute("cart.view");
} else {
$this->redirectSuccess($customerCreation);
}
} catch (FormValidationException $e) {
$message = sprintf("Please check your input: %s", $e->getMessage());
} catch (\Exception $e) {
@@ -232,7 +275,7 @@ class CustomerController extends BaseFrontController
$data["country"],
isset($data["email"])?$data["email"]:null,
isset($data["password"]) ? $data["password"]:null,
$this->getRequest()->getSession()->getLang(),
$this->getRequest()->getSession()->getLang()->getId(),
isset($data["reseller"])?$data["reseller"]:null,
isset($data["sponsor"])?$data["sponsor"]:null,
isset($data["discount"])?$data["discount"]:null

View File

@@ -0,0 +1,51 @@
<?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\Core\Event;
/**
* Class LostPasswordEvent
* @package Thelia\Core\Event
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class LostPasswordEvent extends ActionEvent {
protected $email;
public function __construct($email)
{
$this->email = $email;
}
/**
* @return mixed
*/
public function getEmail()
{
return $this->email;
}
}

View File

@@ -71,6 +71,10 @@ final class TheliaEvents
*/
const CUSTOMER_UPDATEACCOUNT = "action.updateCustomer";
/**
* sent when a customer need a new password
*/
const LOST_PASSWORD = "action.lostPassword";
/**
* Sent before the logout of the administrator.
*/

View File

@@ -65,7 +65,10 @@ class CustomerCreation extends BaseForm
"label_attr" => array(
"for" => "address"
),
"label" => Translator::getInstance()->trans("Street Address")
"label" => Translator::getInstance()->trans("Street Address"),
"label_attr" => array(
"for" => "address1"
)
))
->add("address2", "text", array(
"label" => Translator::getInstance()->trans("Address Line 2"),
@@ -80,7 +83,7 @@ class CustomerCreation extends BaseForm
)
))
->add("company", "text", array(
"label" => Translator::getInstance()->trans("Company name"),
"label" => Translator::getInstance()->trans("Company Name"),
"label_attr" => array(
"for" => "company"
)

View File

@@ -0,0 +1,96 @@
<?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\Callback;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Translation\Translator;
use Thelia\Model\CustomerQuery;
/**
* Class CustomerLostPasswordForm
* @package Thelia\Form
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class CustomerLostPasswordForm extends BaseForm {
/**
*
* in this function you add all the fields you need for your Form.
* Form this you have to call add method on $this->formBuilder attribute :
*
* $this->formBuilder->add("name", "text")
* ->add("email", "email", array(
* "attr" => array(
* "class" => "field"
* ),
* "label" => "email",
* "constraints" => array(
* new \Symfony\Component\Validator\Constraints\NotBlank()
* )
* )
* )
* ->add('age', 'integer');
*
* @return null
*/
protected function buildForm()
{
$this->formBuilder
->add("email", "email", array(
"constraints" => array(
new NotBlank(),
new Email(),
new Callback(array(
"methods" => array(
array($this,
"verifyExistingEmail")
)
))
),
"label" => Translator::getInstance()->trans("Please enter your email address"),
"label_attr" => array(
"for" => "forgot-email"
)
));
}
public function verifyExistingEmail($value, ExecutionContextInterface $context)
{
$customer = CustomerQuery::create()->findOneByEmail($value);
if (null === $customer) {
$context->addViolation("This email does not exists exists");
}
}
/**
* @return string the name of you form. This name must be unique
*/
public function getName()
{
return "thelia_customer_creation";
}
}

View File

@@ -30,7 +30,7 @@
<services>
<service id="debugBar" class="DebugBar\StandardDebugBar"/>
<service id="debugBar" class="DebugBar\DebugBar"/>
<service id="smarty.debugbar" class="DebugBar\Smarty\Plugin\DebugBar">
<argument type="service" id="debugBar"/>

View File

@@ -66,8 +66,8 @@ class PropelCollector extends DataCollector implements Renderable, LoggerInterfa
return array(
'nb_statements' => count($this->statements),
'nb_failed_statements' => 0,
'accumulated_duration' => '10',
'accumulated_duration_str' => $this->formatDuration(1),
'accumulated_duration' => $this->accumulatedTime,
'accumulated_duration_str' => $this->formatDuration($this->accumulatedTime),
'peak_memory_usage' => $this->peakMemory,
'peak_memory_usage_str' => $this->formatBytes($this->peakMemory),
'statements' => $this->statements

View File

@@ -22,7 +22,11 @@
/*************************************************************************************/
namespace DebugBar\Listeners;
use DebugBar\DataCollector\MemoryCollector;
use DebugBar\DataCollector\MessagesCollector;
use DebugBar\DataCollector\PhpInfoCollector;
use DebugBar\DataCollector\PropelCollector;
use DebugBar\DataCollector\TimeDataCollector;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Thelia\Action\BaseAction;
@@ -40,6 +44,12 @@ class DebugBarListeners extends BaseAction implements EventSubscriberInterface {
{
$debugBar = $this->container->get("debugBar");
$debugBar->addCollector(new PhpInfoCollector());
//$debugBar->addCollector(new MessagesCollector());
//$debugBar->addCollector(new RequestDataCollector());
$debugBar->addCollector(new TimeDataCollector());
$debugBar->addCollector(new MemoryCollector());
$debugBar->addCollector(new PropelCollector());
}

View File

@@ -104,23 +104,6 @@ class DebugBar extends AbstractSmartyPlugin
return $render;
}
public function renderHead($params, \Smarty_Internal_Template $template)
{
$render = "";
if ($this->debugMode) {
$javascriptRenderer = $this->debugBar->getJavascriptRenderer();
$assets = $javascriptRenderer->getAssets();
$cssCollection = $assets[0];
$jsCollection = $assets[1];
$render .= sprintf('<style media="screen" type="text/css">%s</style>', $cssCollection->dump());
$render .= sprintf('<script>%s</script>', $jsCollection->dump());
}
return $render;
}
/**
* @return an array of SmartyPluginDescriptor
*/

View File

@@ -224,7 +224,7 @@
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
{debugbar_renderjs}
{debugbar_renderresult}
{block name="after-javascript-include"}{/block}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@@ -40,7 +40,7 @@
line-height: @topBarHeight;
height: @topBarHeight;
background: url("@{imgDir}/top-bar-logo.png") left -3px no-repeat;
padding-left: 100px;
padding-left: 170px;
text-shadow: 0px 1px 1px black;
color: #6d737b;
}

View File

@@ -34,10 +34,8 @@
<li class="item">
<article itemscope itemtype="http://schema.org/Product">
<!-- Use the meta tag to specify content that is not visible on the page in any way -->
<meta itemprop="manufacturer" content="Diesel">
<meta itemprop="category" content="Category1">
<meta itemprop="condition" content="new"> <!-- List of condition : new, used, refurbished -->
<meta itemprop="identifier" content="mpn:925872"> <!-- List of identifier : asin, isbn, mpn, upc, sku -->
<meta itemprop="brand" content="Diesel">
<meta itemprop="productID" content="isbn:925872">
<a href="{$URL}" itemprop="url" tabindex="-1" class="product-image">
{ifloop rel="image_product_new" }
@@ -59,8 +57,11 @@
<div class="product-price">
<div class="price-container" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<meta itemprop="currency" content="{currency attr="code"}"> <!-- List of currency : The currency used to describe the product price, in three-letter ISO format. -->
<link itemprop="availability" href="http://schema.org/InStock" content="In Stock" />
<meta itemprop="category" content="Category1">
<meta itemprop="itemCondition" itemscope itemtype="http://schema.org/NewCondition"> <!-- List of condition : NewCondition, DamagedCondition, UsedCondition, RefurbishedCondition -->
<meta itemprop="priceCurrency" content="{currency attr="code"}"> <!-- List of currency : The currency used to describe the product price, in three-letter ISO format. -->
<link itemprop="availability" href="http://schema.org/InStock" content="in_stock" />
<!-- List of availibility :
out_of_stock : http://schema.org/OutOfStock
in_stock : http://schema.org/InStock
@@ -92,10 +93,8 @@
<li class="item">
<article itemscope itemtype="http://schema.org/Product">
<!-- Use the meta tag to specify content that is not visible on the page in any way -->
<meta itemprop="manufacturer" content="Diesel">
<meta itemprop="category" content="Category1">
<meta itemprop="condition" content="new"> <!-- List of condition : new, used, refurbished -->
<meta itemprop="identifier" content="mpn:925872"> <!-- List of identifier : asin, isbn, mpn, upc, sku -->
<meta itemprop="brand" content="Diesel">
<meta itemprop="productID" content="isbn:925872">
<a href="{$URL}" itemprop="url" tabindex="-1" class="product-image">
{ifloop rel="image_product_promo" }
@@ -117,8 +116,10 @@
<div class="product-price">
<div class="price-container" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<meta itemprop="currency" content="USD"> <!-- List of currency : The currency used to describe the product price, in three-letter ISO format. -->
<link itemprop="availability" href="http://schema.org/InStock" content="In Stock" />
<meta itemprop="category" content="Category1">
<meta itemprop="itemCondition" itemscope itemtype="http://schema.org/NewCondition"> <!-- List of condition : NewCondition, DamagedCondition, UsedCondition, RefurbishedCondition -->
<meta itemprop="priceCurrency" content="{currency attr="code"}"> <!-- List of currency : The currency used to describe the product price, in three-letter ISO format. -->
<link itemprop="availability" href="http://schema.org/InStock" content="in_stock" />
<!-- List of availibility :
out_of_stock : http://schema.org/OutOfStock
in_stock : http://schema.org/InStock

View File

@@ -84,8 +84,15 @@ URL: http://www.thelia.net
{/loop}
</ul>
<ul class="nav navbar-nav navbar-cart navbar-right">
{loop type="auth" name="customer_info_block" roles="CUSTOMER" context="front"}
<li><a href="{url path="/logout"}" class="register">{intl l="Log out!"}</a></li>
<li><a href="{url path="/customer/account"}" class="login">{intl l="My Account"}</a></li>
{/loop}
{elseloop rel="customer_info_block" rel="customer_info_block"}
<li><a href="{url path="/register"}" class="register">{intl l="Register"}!</a></li>
<li><a href="{url path="/login"}" class="login">{intl l="Log In!"}</a></li>
{/elseloop}
<li class="dropdown">
<a href="cart.html" class="dropdown-toggle cart" data-toggle="dropdown">
Cart <span class="badge">2</span>
@@ -113,7 +120,7 @@ URL: http://www.thelia.net
<div class="input-group">
<input type="search" name="q" id="q" placeholder="Search..." class="form-control" aria-required="true" required pattern=". { 2,}" title="Minmimum 2 characters.">
<div class="input-group-btn">
<button type="submit" class="btn btn-search"><span class="icon-search"></span> <span>Search</span></button>
<button type="submit" class="btn btn-search"><i class="icon-search"></i> <span>Search</span></button>
</div>
</div>
</form>

View File

@@ -4,7 +4,7 @@
<nav class="nav-breadcrumb" role="navigation" aria-labelledby="breadcrumb-label">
<strong id="breadcrumb-label">{intl l="You are here"}: </strong>
<ul class="breadcrumb" itemprop="breadcrumb">
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="index.php" itemprop="url"><span itemprop="title">{intl l="Home"}</span></a></li>
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="{url path="/"}" itemprop="url"><span itemprop="title">{intl l="Home"}</span></a></li>
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="active"><span itemprop="title">{intl l="Login"}</span></li>
</ul>
</nav><!-- /.nav-breadcrumb -->
@@ -67,7 +67,7 @@
</fieldset>
<div class="group-btn">
<a href="{url path="/customer/password"}" class="forgot-password">{intl l="Forgot your Password ?"}</a>
<a href="{url path="/password"}" class="forgot-password">{intl l="Forgot your Password ?"}</a>
<button type="submit" class="btn btn-login">{intl l="Next"}</button>
</div>
</form>

View File

@@ -0,0 +1,42 @@
{extends file="layout.tpl"}
{block name="breadcrumb"}
<nav class="nav-breadcrumb" role="navigation" aria-labelledby="breadcrumb-label">
<strong id="breadcrumb-label">{intl l="You are here"} </strong>
<ul class="breadcrumb" itemprop="breadcrumb">
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="{url path="/"}" itemprop="url"><span itemprop="title">{intl l="Home"}</span></a></li>
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="active"><span itemprop="title">{intl l="Password"}</span></li>
</ul>
</nav><!-- /.nav-breadcrumb -->
{/block}
{block name="main-content"}
<div class="main">
<article class="col-main" role="main" aria-labelledby="main-label">
<h1 id="main-label" class="page-header">{intl l="Password Forgotten"}</h1>
{form name="thelia.customer.lostpassword"}
<form id="form-forgotpassword" action="{url path="/password"}" method="post" role="form">
<p>{intl l="Please enter your email address below." {intl l="You will receive a link to reset your password."}</p>
{form_field form=$form field="email"}
<div class="form-group group-email {if $error}has-error{elseif !$error && $value != ""}has-success{/if}">
<label for="{$label_attr.for}">{$label}</label>
<div class="control-input">
<input type="email" name="{$name}" value="{$value}" id="{$label_attr.for}" class="form-control" aria-required="true" autofocus required>
{if $error}
<span class="help-block"><span class="icon-remove"></span> {$message}</span>
{elseif !$error && $value != ""}
<span class="help-block"><span class="icon-ok"></span> {intl l="You will receive a link to reset your password."}</span>
{/if}
</div>
</div>
{/form_field}
<div class="group-btn">
<a href="{url path="/"}" class="btn btn-cancel">{intl l="Cancel"}</a>
<button type="submit" class="btn btn-forgot">{intl l="Send"}</button>
</div>
</form>
{/form}
</article>
</div>
{/block}

View File

@@ -4,7 +4,7 @@
<nav class="nav-breadcrumb" role="navigation" aria-labelledby="breadcrumb-label">
<strong id="breadcrumb-label">{intl l="You are here"}: </strong>
<ul class="breadcrumb" itemprop="breadcrumb">
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="index.php" itemprop="url"><span itemprop="title">{intl l="Home"}</span></a></li>
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="{url path="/"}" itemprop="url"><span itemprop="title">{intl l="Home"}</span></a></li>
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="active"><span itemprop="title">{intl l="Register"}</span></li>
</ul>
</nav><!-- /.nav-breadcrumb -->
@@ -19,18 +19,44 @@
<h1 id="main-label" class="page-header">{intl l="Create New Account"}</h1>
{form name="thelia.customer.creation"}
<form id="form-register" class="form-horizontal" action="{url path="/customer/create"}" method="post" role="form">
{form_field form=$form field='success_url'}
<input type="hidden" name="{$name}" value="{navigate to="return_to"}" /> {* the url the user is redirected to on login success *}
{/form_field}
{form_field form=$form field='error_message'}
<input type="hidden" name="{$name}" value="{intl l="missing or invalid data"}" /> {* the url the user is redirected to on login success *}
{/form_field}
{form_hidden_fields form=$form}
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
<fieldset id="register-info" class="panel panel">
<div class="panel-heading">
1. {intl l="Personal Informations"}
</div>
<div class="panel-body">
{form_field form=$form field="firstname"}
<div class="form-group group-firstname {if $error}has-error{elseif $value != "" && !$error}has_success{/if}">
{form_field form=$form field="title"}
<div class="form-group group-title {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label} <span class="required">*</span></label>
<div class="control-input">
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="John" value="{$value}" autofocus required>
<select name="{$name}" id="{$label_attr.for}" class="form-control" required autofocus>
<option value="">-- {intl l="Select Title"} --</option>
{loop type="title" name="country.list"}
<option value="{$ID}" {if $value == $ID}selected{/if} >{$LONG}</option>
{/loop}
</select>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{elseif $value != "" && !$error}
<span class="help-block"><i class="icon-ok"></i></span>
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
{form_field form=$form field="firstname"}
<div class="form-group group-firstname {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label} <span class="required">*</span></label>
<div class="control-input">
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="John" value="{$value}" required>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{elseif $value != "" && !$error}
@@ -40,7 +66,7 @@
</div><!--/.form-group-->
{/form_field}
{form_field form=$form field="lastname"}
<div class="form-group group-lastname {if $error}has-error{elseif $value != "" && !$error}has_success{/if}">
<div class="form-group group-lastname {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label} <span class="required">*</span></label>
<div class="control-input">
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="John" value="{$value}" autofocus required>
@@ -53,7 +79,7 @@
</div><!--/.form-group-->
{/form_field}
{form_field form=$form field="email"}
<div class="form-group group-email {if $error}has-error{elseif $value != "" && !$error}has_success{/if}">
<div class="form-group group-email {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label} <span class="required">*</span></label>
<div class="control-input">
@@ -67,7 +93,7 @@
</div><!--/.form-group-->
{/form_field}
{form_field form=$form field="phone"}
<div class="form-group group-phone {if $error}has-error{elseif $value != "" && !$error}has_success{/if}">
<div class="form-group group-phone {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label}</label>
<div class="control-input">
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="John" value="{$value}" autofocus>
@@ -80,7 +106,7 @@
</div><!--/.form-group-->
{/form_field}
{form_field form=$form field="cellphone"}
<div class="form-group group-cellphone {if $error}has-error{elseif $value != "" && !$error}has_success{/if}">
<div class="form-group group-cellphone {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label}</label>
<div class="control-input">
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="John" value="{$value}" autofocus>
@@ -101,74 +127,129 @@
</div>
<div class="panel-body">
<div class="form-group group-company">
<label class="control-label" for="company">Company Name: <span class="required">*</span></label>
{form_field form=$form field="company"}
<div class="form-group group-company {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label}</label>
<div class="control-input">
<input type="text" name="company" id="company" class="form-control" placeholder="Thelia" required>
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="Thelia" value="{$value}" autofocus>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{elseif $value != "" && !$error}
<span class="help-block"><i class="icon-ok"></i></span>
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
<div class="form-group group-address">
<label class="control-label" for="address">Street Address: <span class="required">*</span></label>
{form_field form=$form field="address1"}
<div class="form-group group-address1 {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label} <span class="required">*</span></label>
<div class="control-input">
<input type="text" name="asresss" id="address" class="form-control" placeholder="Street address" required>
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="{$label}" value="{$value}" autofocus required>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{elseif $value != "" && !$error}
<span class="help-block"><i class="icon-ok"></i></span>
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
<div class="form-group group-address_2">
<label class="control-label" for="address_2">Address 2:</label>
{form_field form=$form field="address2"}
<div class="form-group group-address2 {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label}</label>
<div class="control-input">
<input type="text" name="address_2" id="address_2" class="form-control" placeholder="">
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="" value="{$value}" autofocus>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{elseif $value != "" && !$error}
<span class="help-block"><i class="icon-ok"></i></span>
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
<div class="form-group group-city">
<label class="control-label" for="city">City: <span class="required">*</span></label>
{form_field form=$form field="city"}
<div class="form-group group-city {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label} <span class="required">*</span></label>
<div class="control-input">
<input type="text" name="city" id="city" class="form-control" placeholder="New york" required>
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="New York" value="{$value}" autofocus required>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{elseif $value != "" && !$error}
<span class="help-block"><i class="icon-ok"></i></span>
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
<div class="form-group group-zip">
<label class="control-label" for="zip">Postal Code: <span class="required">*</span></label>
{form_field form=$form field="zipcode"}
<div class="form-group group-zip {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label} <span class="required">*</span></label>
<div class="control-input">
<input type="text" name="zip" id="zip" class="form-control" placeholder="H2T 2V6" required>
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="H2T 2V6" value="{$value}" autofocus required>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{elseif $value != "" && !$error}
<span class="help-block"><i class="icon-ok"></i></span>
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
<div class="form-group group-country">
<label class="control-label" for="country">Country: <span class="required">*</span></label>
{form_field form=$form field="country"}
<div class="form-group group-country {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label} <span class="required">*</span></label>
<div class="control-input">
<select name"country" id="country" class="form-control" required>
<option value="">-- Select Country --</option>
<option value="1">Country1</option>
<option value="2">Country2</option>
<option value="3">Country3</option>
<option value="4">Country4</option>
<select name="{$name}" id="{$label_attr.for}" class="form-control" required>
<option value="">-- {intl l="Select Country"} --</option>
{loop type="country" name="country.list"}
<option value="{$ID}" {if $value == $ID}selected{/if} >{$TITLE}</option>
{/loop}
</select>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{elseif $value != "" && !$error}
<span class="help-block"><i class="icon-ok"></i></span>
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
</div>
</fieldset>
<fieldset id="register-login" class="panel">
<div class="panel-heading">
3. Login Information
3. {intl l="Login Information"}
</div>
<div class="panel-body">
<div class="form-group group-password">
<label class="control-label" for="password">Password: <span class="required">*</span></label>
{form_field form=$form field="password"}
<div class="form-group group-password {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label} <span class="required">*</span></label>
<div class="control-input">
<input type="password" name="password" id="password" class="form-control" required autocomplete="off">
<input type="password" name="{$name}" id="{$label_attr.for}" class="form-control" required autocomplete="off">
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{elseif $value != "" && !$error}
<span class="help-block"><i class="icon-ok"></i></span>
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
<div class="form-group group-confirm_password">
<label class="control-label" for="confirm_password">Confirm Password: <span class="required">*</span></label>
{form_field form=$form field="password_confirm"}
<div class="form-group group-password_confirm {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label} <span class="required">*</span></label>
<div class="control-input">
<input type="password" name="confirm_password" id="confirm_password" class="form-control" required autocomplete="off">
<input type="password" name="{$name}" id="{$label_attr.for}" class="form-control" required autocomplete="off">
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{elseif $value != "" && !$error}
<span class="help-block"><i class="icon-ok"></i></span>
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
</div>
</fieldset>
@@ -176,7 +257,7 @@
<div class="control-input">
<div class="checkbox">
<label class="control-label" for="agreed">
<input type="checkbox" name="agreed" id="agreed" value="1"> I've read and agreed on <a href="#">Terms &amp; Conditions</a>.
<input type="checkbox" name="agreed" id="agreed" value="1" required> I've read and agreed on <a href="#">Terms &amp; Conditions</a>.
</label>
</div>
</div>

View File

@@ -9,7 +9,7 @@ casper.test.comment('Testing coupons');
//UPDATE COUPON RULE
casper.start(thelia2_login_coupon_update_url, function() {
console.log('Now on : ' + this.getCurrentUrl());
this.capture('tests/functionnal/casperjs/screenshot/coupons/init.png');
this.echo('\nCOUPON RULE - EDIT');
this.test.assertTitle('Update coupon - Thelia Back Office', 'Web page title OK');
// this.test.assertSelectorHasText('#content-header > h1', 'Liste des pays', 'Web page main content OK');
@@ -18,12 +18,10 @@ casper.start(thelia2_login_coupon_update_url, function() {
// Create rule
this.evaluate(function() {
// document.querySelector('select#category-rule').selectedItem = 'thelia.constraint.rule.available_for_x_articles';
$('#category-rule').val('thelia.constraint.rule.available_for_x_articles').change();
return true;
});
this.capture('tests/functionnal/casperjs/pictures/screenshot-category-rule.png');
// this.click('constraint-list > tr:last-child > td > a.constraint-update-btn');
this.capture('tests/functionnal/casperjs/screenshot/coupons/rule-selected.png');
});
casper.wait(1000, function() {
@@ -31,7 +29,21 @@ casper.wait(1000, function() {
});
casper.then(function(){
this.evaluate(function() {
$('#quantity-operator').val('>=').change();
return true;
});
this.sendKeys('input#quantity-value', '4');
this.click('#constraint-save-btn');
});
casper.wait(1000, function() {
this.echo("\nWaiting....");
});
casper.then(function(){
this.capture('tests/functionnal/casperjs/screenshot/coupons/rule-added.png');
this.test.assertSelectorHasText('tbody#constraint-list tr:nth-child(3)', ' If cart products quantity is superior or equals to 4','3rd rule found');
});
////EDIT CHECK