Merge branch 'master' into module_management
Conflicts: core/lib/Thelia/Core/Template/Loop/TaxRuleCountry.php core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php
This commit is contained in:
BIN
composer.phar
Executable file
BIN
composer.phar
Executable file
Binary file not shown.
104
core/lib/Thelia/Action/Tax.php
Normal file
104
core/lib/Thelia/Action/Tax.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?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\Action;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\Tax\TaxEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\Tax as TaxModel;
|
||||
use Thelia\Model\TaxQuery;
|
||||
|
||||
class Tax extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
/**
|
||||
* @param TaxEvent $event
|
||||
*/
|
||||
public function create(TaxEvent $event)
|
||||
{
|
||||
$tax = new TaxModel();
|
||||
|
||||
$tax
|
||||
->setDispatcher($this->getDispatcher())
|
||||
->setRequirements($event->getRequirements())
|
||||
->setType($event->getType())
|
||||
->setLocale($event->getLocale())
|
||||
->setTitle($event->getTitle())
|
||||
->setDescription($event->getDescription())
|
||||
;
|
||||
|
||||
$tax->save();
|
||||
|
||||
$event->setTax($tax);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TaxEvent $event
|
||||
*/
|
||||
public function update(TaxEvent $event)
|
||||
{
|
||||
if (null !== $tax = TaxQuery::create()->findPk($event->getId())) {
|
||||
|
||||
$tax
|
||||
->setDispatcher($this->getDispatcher())
|
||||
->setRequirements($event->getRequirements())
|
||||
->setType($event->getType())
|
||||
->setLocale($event->getLocale())
|
||||
->setTitle($event->getTitle())
|
||||
->setDescription($event->getDescription())
|
||||
;
|
||||
|
||||
$tax->save();
|
||||
|
||||
$event->setTax($tax);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TaxEvent $event
|
||||
*/
|
||||
public function delete(TaxEvent $event)
|
||||
{
|
||||
if (null !== $tax = TaxQuery::create()->findPk($event->getId())) {
|
||||
|
||||
$tax
|
||||
->delete()
|
||||
;
|
||||
|
||||
$event->setTax($tax);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
TheliaEvents::TAX_CREATE => array("create", 128),
|
||||
TheliaEvents::TAX_UPDATE => array("update", 128),
|
||||
TheliaEvents::TAX_DELETE => array("delete", 128),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\Tax\TaxRuleEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\Map\TaxRuleTableMap;
|
||||
use Thelia\Model\TaxRuleCountry;
|
||||
use Thelia\Model\TaxRuleCountryQuery;
|
||||
use Thelia\Model\TaxRule as TaxRuleModel;
|
||||
@@ -132,6 +133,23 @@ class TaxRule extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TaxRuleEvent $event
|
||||
*/
|
||||
public function setDefault(TaxRuleEvent $event)
|
||||
{
|
||||
if (null !== $taxRule = TaxRuleQuery::create()->findPk($event->getId())) {
|
||||
|
||||
TaxRuleQuery::create()->update(array(
|
||||
"IsDefault" => 0
|
||||
));
|
||||
|
||||
$taxRule->setIsDefault(1)->save();
|
||||
|
||||
$event->setTaxRule($taxRule);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -142,7 +160,7 @@ class TaxRule extends BaseAction implements EventSubscriberInterface
|
||||
TheliaEvents::TAX_RULE_UPDATE => array("update", 128),
|
||||
TheliaEvents::TAX_RULE_TAXES_UPDATE => array("updateTaxes", 128),
|
||||
TheliaEvents::TAX_RULE_DELETE => array("delete", 128),
|
||||
|
||||
TheliaEvents::TAX_RULE_SET_DEFAULT => array("setDefault", 128),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,6 +111,11 @@
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
<service id="thelia.action.tax" class="Thelia\Action\Tax">
|
||||
<argument type="service" id="service_container"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
<service id="thelia.action.content" class="Thelia\Action\Content">
|
||||
<argument type="service" id="service_container"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
<form name="thelia.install.step3" class="Thelia\Form\InstallStep3Form"/>
|
||||
|
||||
<form name="thelia.customer.creation" class="Thelia\Form\CustomerCreation"/>
|
||||
<form name="thelia.customer.update" class="Thelia\Form\CustomerUpdateForm"/>
|
||||
<form name="thelia.customer.modification" class="Thelia\Form\CustomerModification"/>
|
||||
<form name="thelia.customer.lostpassword" class="Thelia\Form\CustomerLostPasswordForm"/>
|
||||
|
||||
@@ -118,6 +119,10 @@
|
||||
<form name="thelia.admin.taxrule.taxlistupdate" class="Thelia\Form\TaxRuleTaxListUpdateForm"/>
|
||||
<form name="thelia.admin.taxrule.add" class="Thelia\Form\TaxRuleCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.tax.modification" class="Thelia\Form\TaxModificationForm"/>
|
||||
<form name="thelia.admin.tax.taxlistupdate" class="Thelia\Form\TaxTaxListUpdateForm"/>
|
||||
<form name="thelia.admin.tax.add" class="Thelia\Form\TaxCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.template.creation" class="Thelia\Form\TemplateCreationForm"/>
|
||||
<form name="thelia.admin.template.modification" class="Thelia\Form\TemplateModificationForm"/>
|
||||
|
||||
@@ -125,6 +130,10 @@
|
||||
<form name="thelia.admin.country.modification" class="Thelia\Form\CountryModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.profile.modification" class="Thelia\Form\ProfileModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.language.creation" class="Thelia\Form\LanguageCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.admin-profile.creation" class="Thelia\Form\AdminProfileCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.area.create" class="Thelia\Form\Area\AreaCreateForm"/>
|
||||
<form name="thelia.admin.area.modification" class="Thelia\Form\Area\AreaModificationForm"/>
|
||||
|
||||
@@ -4,22 +4,22 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<!-- Route to administration base -->
|
||||
<!-- Route to administration base -->
|
||||
<route id="admin" path="/admin">
|
||||
<default key="_controller">Thelia\Controller\Admin\AdminController::indexAction</default>
|
||||
</route>
|
||||
|
||||
<!-- Route to the administration login page -->
|
||||
<!-- Route to the administration login page -->
|
||||
<route id="admin.login" path="/admin/login">
|
||||
<default key="_controller">Thelia\Controller\Admin\SessionController::showLoginAction</default>
|
||||
</route>
|
||||
|
||||
<!-- Route to the administration logout page -->
|
||||
<!-- Route to the administration logout page -->
|
||||
<route id="admin.logout" path="/admin/logout">
|
||||
<default key="_controller">Thelia\Controller\Admin\SessionController::checkLogoutAction</default>
|
||||
</route>
|
||||
|
||||
<!-- Route to the login check controller -->
|
||||
<!-- Route to the login check controller -->
|
||||
<route id="admin.checklogin" path="/admin/checklogin">
|
||||
<default key="_controller">Thelia\Controller\Admin\SessionController::checkLoginAction</default>
|
||||
</route>
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
|
||||
<!-- Route to the catalog controller -->
|
||||
<!-- Route to the catalog controller -->
|
||||
|
||||
<route id="admin.catalog" path="/admin/catalog">
|
||||
<default key="_controller">Thelia\Controller\Admin\CategoryController::defaultAction</default>
|
||||
@@ -827,7 +827,28 @@
|
||||
|
||||
<!-- end Modules rule management -->
|
||||
|
||||
<!-- taxe rules management -->
|
||||
<!-- tax management -->
|
||||
|
||||
<route id="admin.configuration.taxes.update" path="/admin/configuration/taxes/update/{tax_id}">
|
||||
<default key="_controller">Thelia\Controller\Admin\TaxController::updateAction</default>
|
||||
<requirement key="tax_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.taxes.add" path="/admin/configuration/taxes/add">
|
||||
<default key="_controller">Thelia\Controller\Admin\TaxController::createAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.taxes.save" path="/admin/configuration/taxes/save">
|
||||
<default key="_controller">Thelia\Controller\Admin\TaxController::processUpdateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.taxes.delete" path="/admin/configuration/taxes/delete">
|
||||
<default key="_controller">Thelia\Controller\Admin\TaxController::deleteAction</default>
|
||||
</route>
|
||||
|
||||
<!-- end tax management -->
|
||||
|
||||
<!-- tax rules management -->
|
||||
|
||||
<route id="admin.configuration.taxes-rules.list" path="/admin/configuration/taxes_rules">
|
||||
<default key="_controller">Thelia\Controller\Admin\TaxRuleController::defaultAction</default>
|
||||
@@ -854,10 +875,15 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\TaxRuleController::deleteAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.taxes-rules.set-default" path="/admin/configuration/taxes_rules/update/set_default/{tax_rule_id}">
|
||||
<default key="_controller">Thelia\Controller\Admin\TaxRuleController::setDefaultAction</default>
|
||||
<requirement key="tax_rule_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<!-- end tax rules management -->
|
||||
|
||||
|
||||
<!-- The default route, to display a template -->
|
||||
<!-- The default route, to display a template -->
|
||||
|
||||
<route id="admin.processTemplate" path="/admin/{template}">
|
||||
<default key="_controller">Thelia\Controller\Admin\AdminController::processTemplateAction</default>
|
||||
|
||||
@@ -4,56 +4,75 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="home" path="/" >
|
||||
<route id="home" path="/">
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||
<default key="_view">index</default>
|
||||
</route>
|
||||
|
||||
<!-- Customer routes -->
|
||||
|
||||
<!-- Search routes -->
|
||||
<route id="search" path="/search">
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||
<default key="_view">search</default>
|
||||
</route>
|
||||
|
||||
<route id="view_all" path="/view_all" methods="get">
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||
<default key="_view">view_all</default>
|
||||
</route>
|
||||
|
||||
<!-- Customer routes : Register -->
|
||||
<route id="customer.create.process" path="/register" methods="post">
|
||||
<default key="_controller">Thelia\Controller\Front\CustomerController::createAction</default>
|
||||
<default key="_view">register</default>
|
||||
</route>
|
||||
|
||||
<route id="customer.create.view" path="/register">
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||
<default key="_view">register</default>
|
||||
</route>
|
||||
|
||||
<!-- Customer routes : Login -->
|
||||
<route id="customer.login.process" path="/login" methods="post">
|
||||
<default key="_controller">Thelia\Controller\Front\CustomerController::loginAction</default>
|
||||
<default key="_view">login</default>
|
||||
</route>
|
||||
|
||||
<route id="customer.login.view" path="/login">
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||
<default key="_view">login</default>
|
||||
</route>
|
||||
|
||||
<!-- Customer routes : Logout -->
|
||||
<route id="customer.logout.process" path="/logout">
|
||||
<default key="_controller">Thelia\Controller\Front\CustomerController::logoutAction</default>
|
||||
</route>
|
||||
|
||||
<route id="customer.account.view" path="/customer/account">
|
||||
<!-- Customer routes : Account -->
|
||||
<route id="customer.account.view" path="/account">
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||
<default key="_view">account</default>
|
||||
</route>
|
||||
|
||||
<route id="customer.create.process" path="/customer/create" methods="post">
|
||||
<default key="_controller">Thelia\Controller\Front\CustomerController::createAction</default>
|
||||
<default key="_view">register</default>
|
||||
<route id="customer.update.view" path="/account/update" methods="get">
|
||||
<default key="_controller">Thelia\Controller\Front\CustomerController::viewAction</default>
|
||||
<default key="_view">account-update</default>
|
||||
</route>
|
||||
|
||||
|
||||
<route id="customer.update.process" path="/customer/update" methods="post">
|
||||
<route id="customer.update.process" path="/account/update" methods="post">
|
||||
<default key="_controller">Thelia\Controller\Front\CustomerController::updateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="customer.login.process" path="/customer/login" methods="post">
|
||||
<default key="_controller">Thelia\Controller\Front\CustomerController::loginAction</default>
|
||||
<default key="_view">login</default>
|
||||
<default key="_view">account-update</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">
|
||||
<route id="customer.password.retrieve.process" path="/account/password" methods="post">
|
||||
<default key="_controller">Thelia\Controller\Front\CustomerController::newPasswordAction</default>
|
||||
<default key="_view">password</default>
|
||||
<default key="_view">account-password</default>
|
||||
</route>
|
||||
|
||||
<route id="customer.password.retrieve.view" path="account/password" methods="get">
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||
<default key="_view">account-password</default>
|
||||
</route>
|
||||
|
||||
<!-- end customer routes -->
|
||||
|
||||
33
core/lib/Thelia/TaxEngine/TaxType/FeatureSlicePercentTaxType.php → core/lib/Thelia/Controller/Admin/AdminProfileController.php
Executable file → Normal file
33
core/lib/Thelia/TaxEngine/TaxType/FeatureSlicePercentTaxType.php → core/lib/Thelia/Controller/Admin/AdminProfileController.php
Executable file → Normal file
@@ -20,33 +20,20 @@
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\TaxEngine\TaxType;
|
||||
|
||||
use Thelia\Type\FloatToFloatArrayType;
|
||||
use Thelia\Type\ModelValidIdType;
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*
|
||||
* Class AdminProfileController
|
||||
* @package Thelia\Controller\Admin
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class featureSlicePercentTaxType extends BaseTaxType
|
||||
class AdminProfileController extends BaseAdminController
|
||||
{
|
||||
public function pricePercentRetriever()
|
||||
public function defaultAction()
|
||||
{
|
||||
|
||||
if (null !== $response = $this->checkAuth("admin.admin-profile.view")) return $response;
|
||||
return $this->render("admin-profiles", array("display_admin_profile" => 20));
|
||||
}
|
||||
|
||||
public function fixAmountRetriever(\Thelia\Model\Product $product)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getRequirementsList()
|
||||
{
|
||||
return array(
|
||||
'featureId' => new ModelValidIdType('Currency'),
|
||||
'slices' => new FloatToFloatArrayType(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
39
core/lib/Thelia/Controller/Admin/LanguageController.php
Normal file
39
core/lib/Thelia/Controller/Admin/LanguageController.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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\Controller\Admin;
|
||||
|
||||
/**
|
||||
* Class LanguageController
|
||||
* @package Thelia\Controller\Admin
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class LanguageController extends BaseAdminController
|
||||
{
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.languages.view")) return $response;
|
||||
return $this->render("languages");
|
||||
}
|
||||
|
||||
}
|
||||
39
core/lib/Thelia/Controller/Admin/MailingSystemController.php
Normal file
39
core/lib/Thelia/Controller/Admin/MailingSystemController.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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\Controller\Admin;
|
||||
|
||||
/**
|
||||
* Class MailingSystemController
|
||||
* @package Thelia\Controller\Admin
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class MailingSystemController extends BaseAdminController
|
||||
{
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.mailing-system.view")) return $response;
|
||||
return $this->render("mailing-system");
|
||||
}
|
||||
|
||||
}
|
||||
227
core/lib/Thelia/Controller/Admin/TaxController.php
Normal file
227
core/lib/Thelia/Controller/Admin/TaxController.php
Normal file
@@ -0,0 +1,227 @@
|
||||
<?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\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\Tax\TaxEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Form\TaxCreationForm;
|
||||
use Thelia\Form\TaxModificationForm;
|
||||
use Thelia\Form\TaxTaxListUpdateForm;
|
||||
use Thelia\Model\TaxQuery;
|
||||
|
||||
class TaxController extends AbstractCrudController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
'tax',
|
||||
'manual',
|
||||
'order',
|
||||
|
||||
'admin.configuration.tax.view',
|
||||
'admin.configuration.tax.create',
|
||||
'admin.configuration.tax.update',
|
||||
'admin.configuration.tax.delete',
|
||||
|
||||
TheliaEvents::TAX_CREATE,
|
||||
TheliaEvents::TAX_UPDATE,
|
||||
TheliaEvents::TAX_DELETE
|
||||
);
|
||||
}
|
||||
|
||||
protected function getCreationForm()
|
||||
{
|
||||
return new TaxCreationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getUpdateForm()
|
||||
{
|
||||
return new TaxModificationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getCreationEvent($formData)
|
||||
{
|
||||
$event = new TaxEvent();
|
||||
|
||||
$event->setLocale($formData['locale']);
|
||||
$event->setTitle($formData['title']);
|
||||
$event->setDescription($formData['description']);
|
||||
$event->setType($formData['type']);
|
||||
$event->setRequirements($this->getRequirements($formData['type'], $formData));
|
||||
|
||||
return $event;
|
||||
}
|
||||
|
||||
protected function getUpdateEvent($formData)
|
||||
{
|
||||
$event = new TaxEvent();
|
||||
|
||||
$event->setLocale($formData['locale']);
|
||||
$event->setId($formData['id']);
|
||||
$event->setTitle($formData['title']);
|
||||
$event->setDescription($formData['description']);
|
||||
$event->setType($formData['type']);
|
||||
$event->setRequirements($this->getRequirements($formData['type'], $formData));
|
||||
|
||||
return $event;
|
||||
}
|
||||
|
||||
protected function getDeleteEvent()
|
||||
{
|
||||
$event = new TaxEvent();
|
||||
|
||||
$event->setId(
|
||||
$this->getRequest()->get('tax_id', 0)
|
||||
);
|
||||
|
||||
return $event;
|
||||
}
|
||||
|
||||
protected function eventContainsObject($event)
|
||||
{
|
||||
return $event->hasTax();
|
||||
}
|
||||
|
||||
protected function hydrateObjectForm($object)
|
||||
{
|
||||
$data = array(
|
||||
'id' => $object->getId(),
|
||||
'locale' => $object->getLocale(),
|
||||
'title' => $object->getTitle(),
|
||||
'description' => $object->getDescription(),
|
||||
'type' => $object->getType(),
|
||||
);
|
||||
|
||||
// Setup the object form
|
||||
return new TaxModificationForm($this->getRequest(), "form", $data);
|
||||
}
|
||||
|
||||
protected function getObjectFromEvent($event)
|
||||
{
|
||||
return $event->hasTax() ? $event->getTax() : null;
|
||||
}
|
||||
|
||||
protected function getExistingObject()
|
||||
{
|
||||
return TaxQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->findOneById($this->getRequest()->get('tax_id'));
|
||||
}
|
||||
|
||||
protected function getObjectLabel($object)
|
||||
{
|
||||
return $object->getTitle();
|
||||
}
|
||||
|
||||
protected function getObjectId($object)
|
||||
{
|
||||
return $object->getId();
|
||||
}
|
||||
|
||||
protected function getViewArguments()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
protected function getRouteArguments($tax_id = null)
|
||||
{
|
||||
return array(
|
||||
'tax_id' => $tax_id === null ? $this->getRequest()->get('tax_id') : $tax_id,
|
||||
);
|
||||
}
|
||||
|
||||
protected function renderListTemplate($currentOrder)
|
||||
{
|
||||
// We always return to the feature edition form
|
||||
return $this->render(
|
||||
'taxes-rules',
|
||||
array()
|
||||
);
|
||||
}
|
||||
|
||||
protected function renderEditionTemplate()
|
||||
{
|
||||
// We always return to the feature edition form
|
||||
return $this->render('tax-edit', array_merge($this->getViewArguments(), $this->getRouteArguments()));
|
||||
}
|
||||
|
||||
protected function redirectToEditionTemplate($request = null, $country = null)
|
||||
{
|
||||
// We always return to the feature edition form
|
||||
$this->redirectToRoute(
|
||||
"admin.configuration.taxes.update",
|
||||
$this->getViewArguments($country),
|
||||
$this->getRouteArguments()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Put in this method post object creation processing if required.
|
||||
*
|
||||
* @param TaxEvent $createEvent the create event
|
||||
* @return Response a response, or null to continue normal processing
|
||||
*/
|
||||
protected function performAdditionalCreateAction($createEvent)
|
||||
{
|
||||
$this->redirectToRoute(
|
||||
"admin.configuration.taxes.update",
|
||||
$this->getViewArguments(),
|
||||
$this->getRouteArguments($createEvent->getTax()->getId())
|
||||
);
|
||||
}
|
||||
|
||||
protected function redirectToListTemplate()
|
||||
{
|
||||
$this->redirectToRoute(
|
||||
"admin.configuration.taxes-rules.list"
|
||||
);
|
||||
}
|
||||
|
||||
protected function checkRequirements($formData)
|
||||
{
|
||||
$type = $formData['type'];
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function getRequirements($type, $formData)
|
||||
{
|
||||
$requirements = array();
|
||||
foreach($formData as $data => $value) {
|
||||
if(!strstr($data, ':')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$couple = explode(':', $data);
|
||||
|
||||
if(count($couple) != 2 || $couple[0] != $type) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$requirements[$couple[1]] = $value;
|
||||
}
|
||||
|
||||
return $requirements;
|
||||
}
|
||||
}
|
||||
@@ -236,6 +236,23 @@ class TaxRuleController extends AbstractCrudController
|
||||
return parent::updateAction();
|
||||
}
|
||||
|
||||
public function setDefaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
|
||||
$setDefaultEvent = new TaxRuleEvent();
|
||||
|
||||
$taxRuleId = $this->getRequest()->attributes->get('tax_rule_id');
|
||||
|
||||
$setDefaultEvent->setId(
|
||||
$taxRuleId
|
||||
);
|
||||
|
||||
$this->dispatch(TheliaEvents::TAX_RULE_SET_DEFAULT, $setDefaultEvent);
|
||||
|
||||
$this->redirectToListTemplate();
|
||||
}
|
||||
|
||||
public function processUpdateTaxesAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
|
||||
@@ -31,10 +31,11 @@ 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\CustomerUpdateForm;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Model\Customer;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\CustomerQuery;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Core\Security\Exception\WrongPasswordException;
|
||||
@@ -128,32 +129,56 @@ class CustomerController extends BaseFrontController
|
||||
}
|
||||
}
|
||||
|
||||
protected function getExistingCustomer($customer_id)
|
||||
{
|
||||
return CustomerQuery::create()
|
||||
->findOneById($customer_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update customer data. On success, redirect to success_url if exists.
|
||||
* Otherwise, display the same view again.
|
||||
*/
|
||||
public function viewAction()
|
||||
{
|
||||
$this->checkAuth();
|
||||
|
||||
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||
$data = array(
|
||||
'id' => $customer->getId(),
|
||||
'title' => $customer->getTitleId(),
|
||||
'firstname' => $customer->getFirstName(),
|
||||
'lastname' => $customer->getLastName(),
|
||||
'email' => $customer->getEmail(),
|
||||
);
|
||||
|
||||
$customerUpdateForm = new CustomerUpdateForm($this->getRequest(), 'form', $data);
|
||||
|
||||
// Pass it to the parser
|
||||
$this->getParserContext()->addForm($customerUpdateForm);
|
||||
}
|
||||
|
||||
public function updateAction()
|
||||
{
|
||||
if ($this->getSecurityContext()->hasCustomerUser()) {
|
||||
|
||||
$message = false;
|
||||
|
||||
$customerModification = new CustomerModification($this->getRequest());
|
||||
$customerUpdateForm = new CustomerUpdateForm($this->getRequest());
|
||||
|
||||
try {
|
||||
|
||||
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||
|
||||
$form = $this->validateForm($customerModification, "post");
|
||||
$form = $this->validateForm($customerUpdateForm, "post");
|
||||
|
||||
$customerChangeEvent = $this->createEventInstance($form->getData());
|
||||
$customerChangeEvent->setCustomer($customer);
|
||||
|
||||
$this->dispatch(TheliaEvents::CUSTOMER_UPDATEACCOUNT, $customerChangeEvent);
|
||||
|
||||
$this->processLogin($customerChangeEvent->getCustomer());
|
||||
|
||||
$this->redirectSuccess($customerModification);
|
||||
$this->redirectSuccess($customerUpdateForm);
|
||||
|
||||
} catch (FormValidationException $e) {
|
||||
$message = sprintf("Please check your input: %s", $e->getMessage());
|
||||
@@ -164,10 +189,10 @@ class CustomerController extends BaseFrontController
|
||||
if ($message !== false) {
|
||||
Tlog::getInstance()->error(sprintf("Error during customer modification process : %s.", $message));
|
||||
|
||||
$customerModification->setErrorMessage($message);
|
||||
$customerUpdateForm->setErrorMessage($message);
|
||||
|
||||
$this->getParserContext()
|
||||
->addForm($customerModification)
|
||||
->addForm($customerUpdateForm)
|
||||
->setGeneralError($message)
|
||||
;
|
||||
}
|
||||
@@ -193,31 +218,33 @@ class CustomerController extends BaseFrontController
|
||||
|
||||
$form = $this->validateForm($customerLoginForm, "post");
|
||||
|
||||
$authenticator = new CustomerUsernamePasswordFormAuthenticator($request, $customerLoginForm);
|
||||
// If User is a new customer
|
||||
if ($form->get('account')->getData() == 0 && !$form->get("email")->getErrors()) {
|
||||
$this->redirectToRoute("customer.create.view", array("email" => $form->get("email")->getData()));
|
||||
} else {
|
||||
|
||||
$customer = $authenticator->getAuthentifiedUser();
|
||||
try {
|
||||
|
||||
$this->processLogin($customer);
|
||||
$authenticator = new CustomerUsernamePasswordFormAuthenticator($request, $customerLoginForm);
|
||||
|
||||
$this->redirectSuccess($customerLoginForm);
|
||||
$customer = $authenticator->getAuthentifiedUser();
|
||||
|
||||
} catch (FormValidationException $e) {
|
||||
$this->processLogin($customer);
|
||||
|
||||
if ($request->request->has("account")) {
|
||||
$account = $request->request->get("account");
|
||||
$form = $customerLoginForm->getForm();
|
||||
if ($account == 0 && $form->get("email")->getData() !== null) {
|
||||
$this->redirectToRoute("customer.create.view", array("email" => $form->get("email")->getData()));
|
||||
$this->redirectSuccess($customerLoginForm);
|
||||
|
||||
} catch (UsernameNotFoundException $e) {
|
||||
$message = "Wrong email or password. Please try again";
|
||||
} catch (WrongPasswordException $e) {
|
||||
$message = "Wrong email or password. Please try again";
|
||||
} catch (AuthenticationException $e) {
|
||||
$message = "Wrong email or password. Please try again";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (FormValidationException $e) {
|
||||
$message = sprintf("Please check your input: %s", $e->getMessage());
|
||||
} catch (UsernameNotFoundException $e) {
|
||||
$message = "Wrong email or password. Please try again";
|
||||
} catch (WrongPasswordException $e) {
|
||||
$message = "Wrong email or password. Please try again";
|
||||
} catch (AuthenticationException $e) {
|
||||
$message = "Wrong email or password. Please try again";
|
||||
} catch (\Exception $e) {
|
||||
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
|
||||
}
|
||||
@@ -265,14 +292,14 @@ class CustomerController extends BaseFrontController
|
||||
$data["title"],
|
||||
$data["firstname"],
|
||||
$data["lastname"],
|
||||
$data["address1"],
|
||||
$data["address2"],
|
||||
$data["address3"],
|
||||
$data["phone"],
|
||||
$data["cellphone"],
|
||||
$data["zipcode"],
|
||||
$data["city"],
|
||||
$data["country"],
|
||||
isset($data["address1"])?$data["address1"]:null,
|
||||
isset($data["address2"])?$data["address2"]:null,
|
||||
isset($data["address3"])?$data["address3"]:null,
|
||||
isset($data["phone"])?$data["phone"]:null,
|
||||
isset($data["cellphone"])?$data["cellphone"]:null,
|
||||
isset($data["zipcode"])?$data["zipcode"]:null,
|
||||
isset($data["city"])?$data["city"]:null,
|
||||
isset($data["country"])?$data["country"]:null,
|
||||
isset($data["email"])?$data["email"]:null,
|
||||
isset($data["password"]) ? $data["password"]:null,
|
||||
$this->getRequest()->getSession()->getLang()->getId(),
|
||||
|
||||
120
core/lib/Thelia/Core/Event/Tax/TaxEvent.php
Normal file
120
core/lib/Thelia/Core/Event/Tax/TaxEvent.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<?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\Tax;
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
use Thelia\Model\Tax;
|
||||
|
||||
class TaxEvent extends ActionEvent
|
||||
{
|
||||
protected $tax = null;
|
||||
|
||||
protected $locale;
|
||||
protected $id;
|
||||
protected $title;
|
||||
protected $description;
|
||||
protected $type;
|
||||
protected $requirements;
|
||||
|
||||
public function __construct(Tax $tax = null)
|
||||
{
|
||||
$this->tax = $tax;
|
||||
}
|
||||
|
||||
public function hasTax()
|
||||
{
|
||||
return ! is_null($this->tax);
|
||||
}
|
||||
|
||||
public function getTax()
|
||||
{
|
||||
return $this->tax;
|
||||
}
|
||||
|
||||
public function setTax(Tax $tax)
|
||||
{
|
||||
$this->tax = $tax;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function setLocale($locale)
|
||||
{
|
||||
$this->locale = $locale;
|
||||
}
|
||||
|
||||
public function getLocale()
|
||||
{
|
||||
return $this->locale;
|
||||
}
|
||||
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function setRequirements($requirements)
|
||||
{
|
||||
$this->requirements = $requirements;
|
||||
}
|
||||
|
||||
public function getRequirements()
|
||||
{
|
||||
return $this->requirements;
|
||||
}
|
||||
}
|
||||
@@ -540,6 +540,12 @@ final class TheliaEvents
|
||||
|
||||
const CHANGE_DEFAULT_CURRENCY = 'action.changeDefaultCurrency';
|
||||
|
||||
// -- Tax management ---------------------------------------------
|
||||
|
||||
const TAX_CREATE = "action.createTax";
|
||||
const TAX_UPDATE = "action.updateTax";
|
||||
const TAX_DELETE = "action.deleteTax";
|
||||
|
||||
// -- Tax Rules management ---------------------------------------------
|
||||
|
||||
const TAX_RULE_CREATE = "action.createTaxRule";
|
||||
|
||||
49
core/lib/Thelia/Core/Form/Type/TheliaType.php
Normal file
49
core/lib/Thelia/Core/Form/Type/TheliaType.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
namespace Thelia\Core\Form\Type;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
|
||||
class TheliaType extends AbstractType
|
||||
{
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
//'instance' => false,
|
||||
'type' => false,
|
||||
'options' => false,
|
||||
));
|
||||
|
||||
$resolver->setAllowedTypes(array(
|
||||
//'instance' => array('Thelia\Type\TypeInterface'),
|
||||
));
|
||||
|
||||
$resolver->setAllowedValues(array(
|
||||
'type' => array('text', 'choice'),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$view->vars = array_replace($view->vars, array(
|
||||
//'instance' => $options['instance'],
|
||||
'type' => $options['type'],
|
||||
'options' => $options['options'],
|
||||
));
|
||||
}
|
||||
|
||||
public function getParent()
|
||||
{
|
||||
return 'text';
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'thelia_type';
|
||||
}
|
||||
}
|
||||
@@ -254,7 +254,7 @@ abstract class BaseLoop
|
||||
*
|
||||
* @param $pagination
|
||||
*
|
||||
* @return mixed
|
||||
* @return LoopResult
|
||||
*/
|
||||
abstract public function exec(&$pagination);
|
||||
|
||||
|
||||
@@ -102,6 +102,7 @@ class Cart extends BaseLoop
|
||||
->set("TAXED_PRICE", $cartItem->getTaxedPrice($taxCountry))
|
||||
->set("PROMO_TAXED_PRICE", $cartItem->getTaxedPromoPrice($taxCountry))
|
||||
->set("IS_PROMO", $cartItem->getPromo() === 1 ? 1 : 0);
|
||||
$loopResultRow->set("PRODUCT_SALE_ELEMENTS_ID", $productSaleElement->getId());
|
||||
$result->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,10 +84,14 @@ class CategoryTree extends BaseI18nLoop
|
||||
$loopResultRow = new LoopResultRow();
|
||||
|
||||
$loopResultRow
|
||||
->set("ID", $result->getId())->set("TITLE", $result->getVirtualColumn('i18n_TITLE'))
|
||||
->set("PARENT", $result->getParent())->set("URL", $result->getUrl($locale))
|
||||
->set("VISIBLE", $result->getVisible() ? "1" : "0")->set("LEVEL", $level)
|
||||
->set('CHILD_COUNT', $result->countChild())->set('PREV_LEVEL', $previousLevel)
|
||||
->set("ID", $result->getId())
|
||||
->set("TITLE", $result->getVirtualColumn('i18n_TITLE'))
|
||||
->set("PARENT", $result->getParent())
|
||||
->set("URL", $result->getUrl($locale))
|
||||
->set("VISIBLE", $result->getVisible() ? "1" : "0")
|
||||
->set("LEVEL", $level)
|
||||
->set('CHILD_COUNT', $result->countChild())
|
||||
->set('PREV_LEVEL', $previousLevel)
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
|
||||
@@ -86,6 +86,7 @@ class Content extends BaseI18nLoop
|
||||
*/
|
||||
public function exec(&$pagination)
|
||||
{
|
||||
|
||||
$search = ContentQuery::create();
|
||||
|
||||
/* manage translations */
|
||||
@@ -138,27 +139,15 @@ class Content extends BaseI18nLoop
|
||||
$current_folder = $this->getCurrent_folder();
|
||||
|
||||
if ($current_folder === true) {
|
||||
$search->filterByFolder(
|
||||
FolderQuery::create()->filterByContent(
|
||||
ContentFolderQuery::create()->filterByContentId(
|
||||
$this->request->get("content_id"),
|
||||
Criteria::EQUAL
|
||||
)->find(),
|
||||
Criteria::IN
|
||||
)->find(),
|
||||
Criteria::IN
|
||||
);
|
||||
$current = ContentQuery::create()->findPk($this->request->get("content_id"));
|
||||
|
||||
$search->filterByFolder($current->getFolders(), Criteria::IN);
|
||||
|
||||
} elseif ($current_folder === false) {
|
||||
$search->filterByFolder(
|
||||
FolderQuery::create()->filterByContent(
|
||||
ContentFolderQuery::create()->filterByContentId(
|
||||
$this->request->get("content_id"),
|
||||
Criteria::EQUAL
|
||||
)->find(),
|
||||
Criteria::IN
|
||||
)->find(),
|
||||
Criteria::NOT_IN
|
||||
);
|
||||
|
||||
$current = ContentQuery::create()->findPk($this->request->get("content_id"));
|
||||
|
||||
$search->filterByFolder($current->getFolders(), Criteria::NOT_IN);
|
||||
}
|
||||
|
||||
$visible = $this->getVisible();
|
||||
|
||||
@@ -87,6 +87,7 @@ class Product extends BaseI18nLoop
|
||||
Argument::createIntTypeArgument('depth', 1),
|
||||
Argument::createBooleanOrBothTypeArgument('visible', 1),
|
||||
Argument::createIntTypeArgument('currency'),
|
||||
Argument::createAnyTypeArgument('title'),
|
||||
new Argument(
|
||||
'order',
|
||||
new TypeCollection(
|
||||
@@ -171,6 +172,17 @@ class Product extends BaseI18nLoop
|
||||
$search->filterByRef($ref, Criteria::IN);
|
||||
}
|
||||
|
||||
|
||||
$title = $this->getTitle();
|
||||
|
||||
if(!is_null($title)){
|
||||
|
||||
$search->where(" CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".Criteria::LIKE." ?", "%".$title."%", \PDO::PARAM_STR);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$category = $this->getCategory();
|
||||
$categoryDefault = $this->getCategoryDefault();
|
||||
|
||||
@@ -461,7 +473,7 @@ class Product extends BaseI18nLoop
|
||||
|
||||
$visible = $this->getVisible();
|
||||
|
||||
if ($visible != BooleanOrBothType::ANY) $search->filterByVisible($visible ? 1 : 0);
|
||||
if ($visible !== BooleanOrBothType::ANY) $search->filterByVisible($visible ? 1 : 0);
|
||||
|
||||
$exclude = $this->getExclude();
|
||||
|
||||
|
||||
@@ -152,11 +152,13 @@ class Tax extends BaseI18nLoop
|
||||
$loopResultRow = new LoopResultRow($loopResult, $tax, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
$loopResultRow
|
||||
->set("ID" , $tax->getId())
|
||||
->set("IS_TRANSLATED" , $tax->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE" , $locale)
|
||||
->set("TITLE" , $tax->getVirtualColumn('i18n_TITLE'))
|
||||
->set("DESCRIPTION" , $tax->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("ID" , $tax->getId())
|
||||
->set("TYPE" , $tax->getType())
|
||||
->set("REQUIREMENTS" , $tax->getRequirements())
|
||||
->set("IS_TRANSLATED" , $tax->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE" , $locale)
|
||||
->set("TITLE" , $tax->getVirtualColumn('i18n_TITLE'))
|
||||
->set("DESCRIPTION" , $tax->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
|
||||
@@ -32,9 +32,12 @@ use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Model\CountryQuery;
|
||||
use Thelia\Model\Map\CountryTableMap;
|
||||
use Thelia\Model\Map\TaxRuleCountryTableMap;
|
||||
use Thelia\Model\Map\TaxTableMap;
|
||||
use Thelia\Type\TypeCollection;
|
||||
use Thelia\Type;
|
||||
use Thelia\Model\TaxRuleCountryQuery;
|
||||
|
||||
/**
|
||||
@@ -56,8 +59,14 @@ class TaxRuleCountry extends BaseI18nLoop
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntTypeArgument('country'),
|
||||
Argument::createIntListTypeArgument('taxes'),
|
||||
Argument::createIntTypeArgument('country', null, true),
|
||||
new Argument(
|
||||
'ask',
|
||||
new TypeCollection(
|
||||
new Type\EnumType(array('taxes', 'countries'))
|
||||
),
|
||||
'taxes'
|
||||
),
|
||||
Argument::createIntTypeArgument('tax_rule', null, true)
|
||||
);
|
||||
}
|
||||
@@ -71,40 +80,54 @@ class TaxRuleCountry extends BaseI18nLoop
|
||||
{
|
||||
$search = TaxRuleCountryQuery::create();
|
||||
|
||||
$ask = $this->getAsk();
|
||||
|
||||
$country = $this->getCountry();
|
||||
$taxes = $this->getTaxes();
|
||||
$taxRule = $this->getTax_rule();
|
||||
|
||||
if ((null === $country && null === $taxes)) {
|
||||
throw new \InvalidArgumentException('You must provide either `country` or `taxes` parameter in tax-rule-country loop');
|
||||
}
|
||||
if($ask === 'countries') {
|
||||
$taxCountForOriginCountry = TaxRuleCountryQuery::create()->filterByCountryId($country)->count();
|
||||
|
||||
if ((null === $country && null !== $taxes)) {
|
||||
throw new \InvalidArgumentException('You must provide `country` parameter with `taxes` parameter in tax-rule-country loop');
|
||||
}
|
||||
if($taxCountForOriginCountry > 0) {
|
||||
$search->groupByCountryId();
|
||||
|
||||
if (null !== $taxes) {
|
||||
$search->groupByCountryId();
|
||||
$originalCountryJoin = new Join();
|
||||
$originalCountryJoin->addExplicitCondition(TaxRuleCountryTableMap::TABLE_NAME, 'TAX_RULE_ID', null, TaxRuleCountryTableMap::TABLE_NAME, 'TAX_RULE_ID', 'origin');
|
||||
$originalCountryJoin->addExplicitCondition(TaxRuleCountryTableMap::TABLE_NAME, 'TAX_ID', null, TaxRuleCountryTableMap::TABLE_NAME, 'TAX_ID', 'origin');
|
||||
$originalCountryJoin->addExplicitCondition(TaxRuleCountryTableMap::TABLE_NAME, 'POSITION', null, TaxRuleCountryTableMap::TABLE_NAME, 'POSITION', 'origin');
|
||||
$originalCountryJoin->addExplicitCondition(TaxRuleCountryTableMap::TABLE_NAME, 'COUNTRY_ID', null, TaxRuleCountryTableMap::TABLE_NAME, 'COUNTRY_ID', 'origin', Criteria::NOT_EQUAL);
|
||||
$originalCountryJoin->setJoinType(Criteria::LEFT_JOIN);
|
||||
|
||||
$originalCountryJoin = new Join();
|
||||
$originalCountryJoin->addExplicitCondition(TaxRuleCountryTableMap::TABLE_NAME, 'TAX_RULE_ID', null, TaxRuleCountryTableMap::TABLE_NAME, 'TAX_RULE_ID', 'origin');
|
||||
$originalCountryJoin->addExplicitCondition(TaxRuleCountryTableMap::TABLE_NAME, 'TAX_ID', null, TaxRuleCountryTableMap::TABLE_NAME, 'TAX_ID', 'origin');
|
||||
$originalCountryJoin->addExplicitCondition(TaxRuleCountryTableMap::TABLE_NAME, 'POSITION', null, TaxRuleCountryTableMap::TABLE_NAME, 'POSITION', 'origin');
|
||||
$originalCountryJoin->addExplicitCondition(TaxRuleCountryTableMap::TABLE_NAME, 'COUNTRY_ID', null, TaxRuleCountryTableMap::TABLE_NAME, 'COUNTRY_ID', 'origin', Criteria::NOT_EQUAL);
|
||||
$originalCountryJoin->setJoinType(Criteria::LEFT_JOIN);
|
||||
$search->addJoinObject($originalCountryJoin, 's_to_o');
|
||||
$search->where('`origin`.`COUNTRY_ID`' . Criteria::EQUAL . '?', $country, \PDO::PARAM_INT);
|
||||
|
||||
$search->addJoinObject($originalCountryJoin, 's_to_o');
|
||||
$search->where('`origin`.`COUNTRY_ID`' . Criteria::EQUAL . '?', $country, \PDO::PARAM_INT);
|
||||
$search->having('COUNT(*)=?', $taxCountForOriginCountry, \PDO::PARAM_INT);
|
||||
|
||||
$search->having('COUNT(*)=?', count($taxes), \PDO::PARAM_INT);
|
||||
$search->filterByTaxRuleId($taxRule);
|
||||
|
||||
/* manage tax translation */
|
||||
$this->configureI18nProcessing(
|
||||
$search,
|
||||
array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'),
|
||||
CountryTableMap::TABLE_NAME,
|
||||
'COUNTRY_ID'
|
||||
);
|
||||
} elseif (null !== $country) {
|
||||
/* manage tax translation */
|
||||
$this->configureI18nProcessing(
|
||||
$search,
|
||||
array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'),
|
||||
CountryTableMap::TABLE_NAME,
|
||||
'COUNTRY_ID'
|
||||
);
|
||||
|
||||
$search->addAscendingOrderByColumn('`' . CountryTableMap::TABLE_NAME . '_i18n_TITLE`');
|
||||
} else {
|
||||
$search = CountryQuery::create()
|
||||
->joinTaxRuleCountry('trc', Criteria::LEFT_JOIN);
|
||||
|
||||
/* manage tax translation */
|
||||
$this->configureI18nProcessing(
|
||||
$search
|
||||
);
|
||||
|
||||
$search->where('ISNULL(`trc`.`COUNTRY_ID`)');
|
||||
|
||||
$search->addAscendingOrderByColumn('i18n_TITLE');
|
||||
}
|
||||
} elseif($ask === 'taxes') {
|
||||
$search->filterByCountryId($country);
|
||||
|
||||
/* manage tax translation */
|
||||
@@ -114,13 +137,11 @@ class TaxRuleCountry extends BaseI18nLoop
|
||||
TaxTableMap::TABLE_NAME,
|
||||
'TAX_ID'
|
||||
);
|
||||
|
||||
$search->filterByTaxRuleId($taxRule);
|
||||
$search->orderByPosition(Criteria::ASC);
|
||||
}
|
||||
|
||||
$taxRule = $this->getTax_rule();
|
||||
$search->filterByTaxRuleId($taxRule);
|
||||
|
||||
$search->orderByPosition(Criteria::ASC);
|
||||
|
||||
/* perform search */
|
||||
$taxRuleCountries = $this->search($search, $pagination);
|
||||
|
||||
@@ -130,16 +151,23 @@ class TaxRuleCountry extends BaseI18nLoop
|
||||
|
||||
$loopResultRow = new LoopResultRow($loopResult, $taxRuleCountry, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
if (null !== $taxes) {
|
||||
$loopResultRow
|
||||
->set("TAX_RULE" , $taxRuleCountry->getTaxRuleId())
|
||||
->set("COUNTRY" , $taxRuleCountry->getCountryId())
|
||||
->set("COUNTRY_TITLE" , $taxRuleCountry->getVirtualColumn(CountryTableMap::TABLE_NAME . '_i18n_TITLE'))
|
||||
->set("COUNTRY_CHAPO" , $taxRuleCountry->getVirtualColumn(CountryTableMap::TABLE_NAME . '_i18n_CHAPO'))
|
||||
->set("COUNTRY_DESCRIPTION" , $taxRuleCountry->getVirtualColumn(CountryTableMap::TABLE_NAME . '_i18n_DESCRIPTION'))
|
||||
->set("COUNTRY_POSTSCRIPTUM" , $taxRuleCountry->getVirtualColumn(CountryTableMap::TABLE_NAME . '_i18n_POSTSCRIPTUM'))
|
||||
;
|
||||
} elseif (null !== $country) {
|
||||
if($ask === 'countries') {
|
||||
if($taxCountForOriginCountry > 0) {
|
||||
$loopResultRow
|
||||
->set("COUNTRY" , $taxRuleCountry->getCountryId())
|
||||
->set("COUNTRY_TITLE" , $taxRuleCountry->getVirtualColumn(CountryTableMap::TABLE_NAME . '_i18n_TITLE'))
|
||||
->set("COUNTRY_CHAPO" , $taxRuleCountry->getVirtualColumn(CountryTableMap::TABLE_NAME . '_i18n_CHAPO'))
|
||||
->set("COUNTRY_DESCRIPTION" , $taxRuleCountry->getVirtualColumn(CountryTableMap::TABLE_NAME . '_i18n_DESCRIPTION'))
|
||||
->set("COUNTRY_POSTSCRIPTUM" , $taxRuleCountry->getVirtualColumn(CountryTableMap::TABLE_NAME . '_i18n_POSTSCRIPTUM'));
|
||||
} else {
|
||||
$loopResultRow
|
||||
->set("COUNTRY" , $taxRuleCountry->getId())
|
||||
->set("COUNTRY_TITLE" , $taxRuleCountry->getVirtualColumn('i18n_TITLE'))
|
||||
->set("COUNTRY_CHAPO" , $taxRuleCountry->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("COUNTRY_DESCRIPTION" , $taxRuleCountry->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("COUNTRY_POSTSCRIPTUM" , $taxRuleCountry->getVirtualColumn('i18n_POSTSCRIPTUM'));
|
||||
}
|
||||
} elseif($ask === 'taxes') {
|
||||
$loopResultRow
|
||||
->set("TAX_RULE" , $taxRuleCountry->getTaxRuleId())
|
||||
->set("COUNTRY" , $taxRuleCountry->getCountryId())
|
||||
@@ -150,6 +178,8 @@ class TaxRuleCountry extends BaseI18nLoop
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,11 @@
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Core\Template\Smarty\Plugins;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
|
||||
use Symfony\Component\Form\Extension\Core\View\ChoiceView;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Thelia\Core\Form\Type\TheliaType;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Thelia\Core\Template\Element\Exception\ElementNotFoundException;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -56,6 +60,8 @@ use Thelia\Core\Template\ParserContext;
|
||||
*/
|
||||
class Form extends AbstractSmartyPlugin
|
||||
{
|
||||
static private $taggedFieldsStack = null;
|
||||
static private $taggedFieldsStackPosition = null;
|
||||
|
||||
protected $request;
|
||||
protected $parserContext;
|
||||
@@ -118,14 +124,17 @@ class Form extends AbstractSmartyPlugin
|
||||
|
||||
$template->assign("value", $fieldValue);
|
||||
|
||||
// If Checkbox input type
|
||||
if ($fieldVars['checked'] !== null) {
|
||||
$this->renderFormFieldCheckBox($template, $formFieldView['checked']);
|
||||
}
|
||||
$template->assign("checked", isset($fieldVars['checked']) ? $fieldVars['checked'] : false);
|
||||
|
||||
|
||||
//data
|
||||
$template->assign("data", $fieldVars['data']);
|
||||
|
||||
$template->assign("label", $fieldVars["label"]);
|
||||
$template->assign("label_attr", $fieldVars["label_attr"]);
|
||||
|
||||
$template->assign('required', isset($fieldVars['required']) ? $fieldVars['required'] : false);
|
||||
|
||||
$errors = $fieldVars["errors"];
|
||||
|
||||
$template->assign("error", empty($errors) ? false : true);
|
||||
@@ -141,20 +150,59 @@ class Form extends AbstractSmartyPlugin
|
||||
}
|
||||
|
||||
$template->assign("attr", implode(" ", $attr));
|
||||
$template->assign("attr_list", $fieldVars["attr"]);
|
||||
}
|
||||
|
||||
protected function assignFormTypeValues($template, $formFieldConfig, $formFieldView)
|
||||
{
|
||||
$formFieldType = $formFieldConfig->getType()->getInnerType();
|
||||
|
||||
/* access to choices */
|
||||
if($formFieldType instanceof ChoiceType) {
|
||||
$template->assign("choices", $formFieldView->vars['choices']);
|
||||
}
|
||||
|
||||
/* access to collections */
|
||||
if($formFieldType instanceof CollectionType) {
|
||||
if( true === $formFieldConfig->getOption('prototype') ) {
|
||||
|
||||
} else {
|
||||
/* access to choices */
|
||||
if (isset($formFieldView->vars['choices'])) {
|
||||
$template->assign("choices", $formFieldView->vars['choices']);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* access to thelia type */
|
||||
if($formFieldType instanceof TheliaType) {
|
||||
$template->assign("formType", $formFieldView->vars['type']);
|
||||
|
||||
|
||||
switch($formFieldView->vars['type']) {
|
||||
case "choice":
|
||||
if(!isset($formFieldView->vars['options']['choices']) || !is_array($formFieldView->vars['options']['choices'])) {
|
||||
//throw new
|
||||
}
|
||||
$choices = array();
|
||||
foreach($formFieldView->vars['options']['choices'] as $value => $choice) {
|
||||
$choices[] = new ChoiceView($value, $value, $choice);
|
||||
}
|
||||
$template->assign("choices", $choices);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function renderFormField($params, $content, \Smarty_Internal_Template $template, &$repeat)
|
||||
{
|
||||
if ($repeat) {
|
||||
if ($repeat) {
|
||||
|
||||
$formFieldView = $this->getFormFieldView($params);
|
||||
$formFieldView = $this->getFormFieldView($params);
|
||||
$formFieldConfig = $this->getFormFieldConfig($params);
|
||||
|
||||
$template->assign("options", $formFieldView->vars);
|
||||
|
||||
/* access to choices */
|
||||
if (isset($formFieldView->vars['choices'])) {
|
||||
$template->assign("choices", $formFieldView->vars['choices']);
|
||||
}
|
||||
$this->assignFormTypeValues($template, $formFieldConfig, $formFieldView);
|
||||
|
||||
$value = $formFieldView->vars["value"];
|
||||
/* FIXME: doesnt work. We got "This form should not contain extra fields." error.
|
||||
@@ -185,6 +233,38 @@ $this->assignFieldValues($template, $formFieldView->vars["full_name"], $fieldVar
|
||||
}
|
||||
}
|
||||
|
||||
public function renderTaggedFormFields($params, $content, \Smarty_Internal_Template $template, &$repeat)
|
||||
{
|
||||
if(null === $content) {
|
||||
self::$taggedFieldsStack = $this->getFormFieldsFromTag($params);
|
||||
self::$taggedFieldsStackPosition = 0;
|
||||
} else {
|
||||
self::$taggedFieldsStackPosition++;
|
||||
}
|
||||
|
||||
if(isset(self::$taggedFieldsStack[self::$taggedFieldsStackPosition])) {
|
||||
$this->assignFieldValues(
|
||||
$template,
|
||||
self::$taggedFieldsStack[self::$taggedFieldsStackPosition]['view']->vars["full_name"],
|
||||
self::$taggedFieldsStack[self::$taggedFieldsStackPosition]['view']->vars["value"],
|
||||
self::$taggedFieldsStack[self::$taggedFieldsStackPosition]['view']->vars
|
||||
);
|
||||
|
||||
$this->assignFormTypeValues($template, self::$taggedFieldsStack[self::$taggedFieldsStackPosition]['config'], self::$taggedFieldsStack[self::$taggedFieldsStackPosition]['view']);
|
||||
|
||||
self::$taggedFieldsStack[self::$taggedFieldsStackPosition]['view']->setRendered();
|
||||
|
||||
$repeat = true;
|
||||
}
|
||||
|
||||
if (! $repeat) {
|
||||
self::$taggedFieldsStack = null;
|
||||
self::$taggedFieldsStackPosition = null;
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
public function renderHiddenFormField($params, \Smarty_Internal_Template $template)
|
||||
{
|
||||
$attrFormat = '%s="%s"';
|
||||
@@ -266,6 +346,48 @@ $this->assignFieldValues($template, $formFieldView->vars["full_name"], $fieldVar
|
||||
return $instance->getView()[$fieldName];
|
||||
}
|
||||
|
||||
protected function getFormFieldsFromTag($params)
|
||||
{
|
||||
$instance = $this->getInstanceFromParams($params);
|
||||
|
||||
$tag = $this->getParam($params, 'tag');
|
||||
|
||||
if (null == $tag)
|
||||
throw new \InvalidArgumentException("'tag' parameter is missing");
|
||||
|
||||
$viewList = array();
|
||||
foreach($instance->getView() as $view) {
|
||||
if(isset($view->vars['attr']['tag']) && $tag == $view->vars['attr']['tag']) {
|
||||
$fieldData = $instance->getForm()->all()[$view->vars['name']];
|
||||
$viewList[] = array(
|
||||
'view' => $view,
|
||||
'config' => $fieldData->getConfig(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $viewList;
|
||||
}
|
||||
|
||||
protected function getFormFieldConfig($params)
|
||||
{
|
||||
$instance = $this->getInstanceFromParams($params);
|
||||
|
||||
$fieldName = $this->getParam($params, 'field');
|
||||
|
||||
if (null == $fieldName) {
|
||||
throw new \InvalidArgumentException("'field' parameter is missing");
|
||||
}
|
||||
|
||||
$fieldData = $instance->getForm()->all()[$fieldName];
|
||||
|
||||
if (empty( $fieldData )) {
|
||||
throw new \InvalidArgumentException(sprintf("Field name '%s' not found in form %s children", $fieldName, $instance->getName()));
|
||||
}
|
||||
|
||||
return $fieldData->getConfig();
|
||||
}
|
||||
|
||||
protected function getInstanceFromParams($params)
|
||||
{
|
||||
$instance = $this->getParam($params, 'form');
|
||||
@@ -304,22 +426,10 @@ $this->assignFieldValues($template, $formFieldView->vars["full_name"], $fieldVar
|
||||
return array(
|
||||
new SmartyPluginDescriptor("block", "form", $this, "generateForm"),
|
||||
new SmartyPluginDescriptor("block", "form_field", $this, "renderFormField"),
|
||||
new SmartyPluginDescriptor("block", "form_tagged_fields", $this, "renderTaggedFormFields"),
|
||||
new SmartyPluginDescriptor("function", "form_hidden_fields", $this, "renderHiddenFormField"),
|
||||
new SmartyPluginDescriptor("function", "form_enctype", $this, "formEnctype"),
|
||||
new SmartyPluginDescriptor("block", "form_error", $this, "formError")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Smarty_Internal_Template $template
|
||||
* @param $formFieldView
|
||||
*/
|
||||
public function renderFormFieldCheckBox(\Smarty_Internal_Template $template, $isChecked)
|
||||
{
|
||||
$template->assign("value", 0);
|
||||
if ($isChecked) {
|
||||
$template->assign("value", 1);
|
||||
}
|
||||
$template->assign("value", $isChecked);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ class TheliaLoop extends AbstractSmartyPlugin
|
||||
/**
|
||||
* @param $smartyParams
|
||||
*
|
||||
* @return object
|
||||
* @return BaseLoop
|
||||
* @throws \Thelia\Core\Template\Element\Exception\InvalidElementException
|
||||
* @throws \Thelia\Core\Template\Element\Exception\ElementNotFoundException
|
||||
*/
|
||||
|
||||
65
core/lib/Thelia/Form/AdminProfileCreationForm.php
Normal file
65
core/lib/Thelia/Form/AdminProfileCreationForm.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?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;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
class AdminProfileCreationForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add("wording" , "text" , array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Wording *"),
|
||||
"label_attr" => array(
|
||||
"for" => "wording"
|
||||
))
|
||||
)
|
||||
->add("name" , "text" , array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Name *"),
|
||||
"label_attr" => array(
|
||||
"for" => "name"
|
||||
))
|
||||
)
|
||||
->add("description" , "text" , array(
|
||||
"label" => Translator::getInstance()->trans("Description"),
|
||||
"label_attr" => array(
|
||||
"for" => "description"
|
||||
))
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return "thelia_admin_profile_creation";
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,16 @@ class CustomerCreation extends BaseForm
|
||||
{
|
||||
$this->formBuilder
|
||||
->add("auto_login", "integer")
|
||||
// Personal Informations
|
||||
->add("title", "text", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Title"),
|
||||
"label_attr" => array(
|
||||
"for" => "title"
|
||||
)
|
||||
))
|
||||
->add("firstname", "text", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank()
|
||||
@@ -58,84 +68,6 @@ class CustomerCreation extends BaseForm
|
||||
"for" => "lastname"
|
||||
)
|
||||
))
|
||||
->add("address1", "text", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank()
|
||||
),
|
||||
"label_attr" => array(
|
||||
"for" => "address"
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Street Address"),
|
||||
"label_attr" => array(
|
||||
"for" => "address1"
|
||||
)
|
||||
))
|
||||
->add("address2", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Address Line 2"),
|
||||
"label_attr" => array(
|
||||
"for" => "address2"
|
||||
)
|
||||
))
|
||||
->add("address3", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Address Line 3"),
|
||||
"label_attr" => array(
|
||||
"for" => "address3"
|
||||
)
|
||||
))
|
||||
->add("company", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Company Name"),
|
||||
"label_attr" => array(
|
||||
"for" => "company"
|
||||
)
|
||||
))
|
||||
->add("phone", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Phone"),
|
||||
"label_attr" => array(
|
||||
"for" => "phone"
|
||||
)
|
||||
))
|
||||
->add("cellphone", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Cellphone"),
|
||||
"label_attr" => array(
|
||||
"for" => "cellphone"
|
||||
)
|
||||
))
|
||||
->add("zipcode", "text", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Zip code"),
|
||||
"label_attr" => array(
|
||||
"for" => "zipcode"
|
||||
)
|
||||
))
|
||||
->add("city", "text", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("City"),
|
||||
"label_attr" => array(
|
||||
"for" => "city"
|
||||
)
|
||||
))
|
||||
->add("country", "text", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Country"),
|
||||
"label_attr" => array(
|
||||
"for" => "country"
|
||||
)
|
||||
))
|
||||
->add("title", "text", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Title"),
|
||||
"label_attr" => array(
|
||||
"for" => "title"
|
||||
)
|
||||
))
|
||||
->add("email", "email", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank(),
|
||||
@@ -143,7 +75,7 @@ class CustomerCreation extends BaseForm
|
||||
new Constraints\Callback(array(
|
||||
"methods" => array(
|
||||
array($this,
|
||||
"verifyExistingEmail")
|
||||
"verifyExistingEmail")
|
||||
)
|
||||
))
|
||||
),
|
||||
@@ -163,6 +95,79 @@ class CustomerCreation extends BaseForm
|
||||
),
|
||||
"label" => "email confirmation"
|
||||
))*/
|
||||
->add("phone", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Phone"),
|
||||
"label_attr" => array(
|
||||
"for" => "phone"
|
||||
),
|
||||
"required" => false
|
||||
))
|
||||
->add("cellphone", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Cellphone"),
|
||||
"label_attr" => array(
|
||||
"for" => "cellphone"
|
||||
),
|
||||
"required" => false
|
||||
))
|
||||
// Delivery Informations
|
||||
->add("company", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Company Name"),
|
||||
"label_attr" => array(
|
||||
"for" => "company"
|
||||
),
|
||||
"required" => false
|
||||
))
|
||||
->add("address1", "text", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Street Address"),
|
||||
"label_attr" => array(
|
||||
"for" => "address1"
|
||||
)
|
||||
))
|
||||
->add("address2", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Address Line 2"),
|
||||
"label_attr" => array(
|
||||
"for" => "address2"
|
||||
),
|
||||
"required" => false
|
||||
))
|
||||
->add("address3", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Address Line 3"),
|
||||
"label_attr" => array(
|
||||
"for" => "address3"
|
||||
),
|
||||
"required" => false
|
||||
))
|
||||
->add("city", "text", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("City"),
|
||||
"label_attr" => array(
|
||||
"for" => "city"
|
||||
)
|
||||
))
|
||||
->add("zipcode", "text", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Zip code"),
|
||||
"label_attr" => array(
|
||||
"for" => "zipcode"
|
||||
)
|
||||
))
|
||||
->add("country", "text", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Country"),
|
||||
"label_attr" => array(
|
||||
"for" => "country"
|
||||
)
|
||||
))
|
||||
// Login Information
|
||||
->add("password", "password", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank(),
|
||||
@@ -186,8 +191,14 @@ class CustomerCreation extends BaseForm
|
||||
"for" => "password_confirmation"
|
||||
)
|
||||
))
|
||||
|
||||
;
|
||||
->add("agreed", "checkbox", array(
|
||||
"constraints" => array(
|
||||
new Constraints\True(array("message" => "Please accept the Terms and conditions in order to register."))
|
||||
),
|
||||
"label_attr" => array(
|
||||
"for" => "agreed"
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
public function verifyPasswordField($value, ExecutionContextInterface $context)
|
||||
|
||||
@@ -22,10 +22,19 @@
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Symfony\Component\Validator\Constraints\Email;
|
||||
use Symfony\Component\Validator\ConstraintViolation;
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Model\Base\CustomerQuery;
|
||||
|
||||
/**
|
||||
* Class CustomerLogin
|
||||
* @package Thelia\Form
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class CustomerLogin extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
@@ -33,27 +42,82 @@ class CustomerLogin extends BaseForm
|
||||
$this->formBuilder
|
||||
->add("email", "email", array(
|
||||
"constraints" => array(
|
||||
new NotBlank(),
|
||||
new Email()
|
||||
new Constraints\NotBlank(),
|
||||
new Constraints\Email(),
|
||||
new Constraints\Callback(array(
|
||||
"methods" => array(
|
||||
array($this, "verifyExistingEmail")
|
||||
)
|
||||
))
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Please enter your email address"),
|
||||
"label_attr" => array(
|
||||
"for" => "email"
|
||||
)
|
||||
))
|
||||
->add("account", "choice", array(
|
||||
"constraints" => array(
|
||||
new Constraints\Callback(array(
|
||||
"methods" => array(
|
||||
array($this, "verifyAccount")
|
||||
)
|
||||
))
|
||||
),
|
||||
"required" => true
|
||||
"choices" => array(
|
||||
0 => Translator::getInstance()->trans("No, I am a new customer."),
|
||||
1 => Translator::getInstance()->trans("Yes, I have a password :")
|
||||
),
|
||||
"label_attr" => array(
|
||||
"for" => "account"
|
||||
),
|
||||
"data" => 0
|
||||
))
|
||||
->add("password", "password", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
/*"constraints" => array(
|
||||
new Constraints\NotBlank()
|
||||
),*/
|
||||
"label" => Translator::getInstance()->trans("Please enter your password"),
|
||||
"label_attr" => array(
|
||||
"for" => "password"
|
||||
),
|
||||
"required" => true
|
||||
))
|
||||
->add("remember_me", "checkbox")
|
||||
;
|
||||
"required" => false
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* If the user select "Yes, I have a password", we check the password.
|
||||
*/
|
||||
public function verifyAccount($value, ExecutionContextInterface $context)
|
||||
{
|
||||
if ($value == 1) {
|
||||
$data = $context->getRoot()->getData();
|
||||
if (false === $data['password'] || (empty($data['password']) && '0' != $data['password'])) {
|
||||
|
||||
$context->getViolations()->add(new ConstraintViolation(
|
||||
'This value should not be blank.',
|
||||
'account_password',
|
||||
array(),
|
||||
$context->getRoot(),
|
||||
'children[password].data',
|
||||
'propertyPath'
|
||||
));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If the user select "I'am a new customer", we make sure is email address does not exit in the database.
|
||||
*/
|
||||
public function verifyExistingEmail($value, ExecutionContextInterface $context)
|
||||
{
|
||||
$data = $context->getRoot()->getData();
|
||||
if ($data["account"] == 0) {
|
||||
$customer = CustomerQuery::create()->findOneByEmail($value);
|
||||
if ($customer) {
|
||||
$context->addViolation("A user already exists with this email address. Please login or if you've forgotten your password, go to Reset Your Password.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getName()
|
||||
|
||||
@@ -82,7 +82,7 @@ class CustomerLostPasswordForm extends BaseForm
|
||||
{
|
||||
$customer = CustomerQuery::create()->findOneByEmail($value);
|
||||
if (null === $customer) {
|
||||
$context->addViolation("This email does not exists exists");
|
||||
$context->addViolation("This email does not exists");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
75
core/lib/Thelia/Form/CustomerUpdateForm.php
Executable file
75
core/lib/Thelia/Form/CustomerUpdateForm.php
Executable file
@@ -0,0 +1,75 @@
|
||||
<?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;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
/**
|
||||
* Class CustomerUpdateForm
|
||||
* @package Thelia\Form
|
||||
* @author Christophe Laffont <claffont@openstudio.fr>
|
||||
*/
|
||||
class CustomerUpdateForm extends CustomerCreation
|
||||
{
|
||||
|
||||
protected function buildForm()
|
||||
{
|
||||
parent::buildForm();
|
||||
|
||||
|
||||
$this->formBuilder
|
||||
->remove("auto_login")
|
||||
// Remove From Personal Informations
|
||||
->remove("phone")
|
||||
->remove("cellphone")
|
||||
// Remove Delivery Informations
|
||||
->remove("company")
|
||||
->remove("address1")
|
||||
->remove("address2")
|
||||
->remove("address3")
|
||||
->remove("city")
|
||||
->remove("zipcode")
|
||||
->remove("country")
|
||||
// Remove Login Information
|
||||
->remove("password")
|
||||
->remove("password_confirm")
|
||||
// Remove Terms & conditions
|
||||
->remove("agreed")
|
||||
|
||||
// Add Newsletter
|
||||
->add("newsletter", "checkbox", array(
|
||||
"label" => "I would like to receive the newsletter our the latest news.",
|
||||
"label_attr" => array(
|
||||
"for" => "newsletter"
|
||||
),
|
||||
"required" => false
|
||||
));
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return "thelia_customer_update";
|
||||
}
|
||||
}
|
||||
58
core/lib/Thelia/Form/LanguageCreationForm.php
Normal file
58
core/lib/Thelia/Form/LanguageCreationForm.php
Normal 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;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
class LanguageCreationForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add("title", "text", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Language title *"),
|
||||
"label_attr" => array(
|
||||
"for" => "title"
|
||||
)
|
||||
))
|
||||
->add("isocode", "text", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("ISO Code *"),
|
||||
"label_attr" => array(
|
||||
"for" => "isocode"
|
||||
)
|
||||
))
|
||||
;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return "thelia_language_creation";
|
||||
}
|
||||
}
|
||||
97
core/lib/Thelia/Form/TaxCreationForm.php
Normal file
97
core/lib/Thelia/Form/TaxCreationForm.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?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;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Thelia\Core\Form\Type\TheliaType;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\TaxEngine\TaxEngine;
|
||||
use Thelia\TaxEngine\TaxType;
|
||||
|
||||
class TaxCreationForm extends BaseForm
|
||||
{
|
||||
use StandardDescriptionFieldsTrait;
|
||||
|
||||
protected function buildForm($change_mode = false)
|
||||
{
|
||||
$types = TaxEngine::getInstance()->getTaxTypeList();
|
||||
$typeList = array();
|
||||
$requirementList = array();
|
||||
foreach($types as $type) {
|
||||
$classPath = "\\Thelia\\TaxEngine\\TaxType\\$type";
|
||||
$instance = new $classPath();
|
||||
$typeList[$type] = $instance->getTitle();
|
||||
$requirementList[$type] = $instance->getRequirementsList();
|
||||
}
|
||||
|
||||
$this->formBuilder
|
||||
->add("locale", "text", array(
|
||||
"constraints" => array(new NotBlank())
|
||||
))
|
||||
->add("type", "choice", array(
|
||||
"choices" => $typeList,
|
||||
"required" => true,
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank(),
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Type"),
|
||||
"label_attr" => array("for" => "type_field"),
|
||||
))
|
||||
;
|
||||
|
||||
foreach($requirementList as $type => $requirements) {
|
||||
foreach($requirements as $name => $requirementType) {
|
||||
$this->formBuilder
|
||||
->add($type . ':' . $name, new TheliaType(), array(
|
||||
//"instance" => $requirementType,
|
||||
"constraints" => array(
|
||||
new Constraints\Callback(
|
||||
array(
|
||||
"methods" => array(
|
||||
array($requirementType, "verifyForm"),
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
"attr" => array(
|
||||
"tag" => "requirements",
|
||||
"tax_type" => $type,
|
||||
),
|
||||
"label" => Translator::getInstance()->trans($name),
|
||||
"type" => $requirementType->getFormType(),
|
||||
"options" => $requirementType->getFormOptions(),
|
||||
))
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
$this->addStandardDescFields(array('postscriptum', 'chapo', 'locale'));
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return "thelia_tax_creation";
|
||||
}
|
||||
}
|
||||
66
core/lib/Thelia/Form/TaxModificationForm.php
Normal file
66
core/lib/Thelia/Form/TaxModificationForm.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?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;
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Thelia\Model\TaxQuery;
|
||||
|
||||
class TaxModificationForm extends TaxCreationForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
parent::buildForm(true);
|
||||
|
||||
$this->formBuilder
|
||||
->add("id", "hidden", array(
|
||||
"required" => true,
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank(),
|
||||
new Constraints\Callback(
|
||||
array(
|
||||
"methods" => array(
|
||||
array($this, "verifyTaxId"),
|
||||
),
|
||||
)
|
||||
),
|
||||
)
|
||||
))
|
||||
;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return "thelia_tax_modification";
|
||||
}
|
||||
|
||||
public function verifyTaxId($value, ExecutionContextInterface $context)
|
||||
{
|
||||
$tax = TaxQuery::create()
|
||||
->findPk($value);
|
||||
|
||||
if (null === $tax) {
|
||||
$context->addViolation("Tax ID not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,13 @@ namespace Thelia\Model;
|
||||
|
||||
use Thelia\Exception\TaxEngineException;
|
||||
use Thelia\Model\Base\Tax as BaseTax;
|
||||
use Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
use Thelia\TaxEngine\TaxType\BaseTaxType;
|
||||
|
||||
class Tax extends BaseTax
|
||||
{
|
||||
use ModelEventDispatcherTrait;
|
||||
|
||||
public function calculateTax($amount)
|
||||
{
|
||||
if(false === filter_var($amount, FILTER_VALIDATE_FLOAT)) {
|
||||
|
||||
@@ -36,7 +36,11 @@ trait ModelEventDispatcherTrait {
|
||||
*/
|
||||
protected $dispatcher = null;
|
||||
|
||||
|
||||
/**
|
||||
* @param EventDispatcherInterface $dispatcher
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDispatcher(EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
|
||||
@@ -59,7 +59,7 @@ class RewritingResolver
|
||||
public function load($rewrittenUrl)
|
||||
{
|
||||
$rewrittenUrl = ltrim($rewrittenUrl, '/');
|
||||
|
||||
$rewrittenUrl = urldecode($rewrittenUrl);
|
||||
$this->search = $this->rewritingUrlQuery->getResolverSearch($rewrittenUrl);
|
||||
|
||||
if($this->search->count() == 0) {
|
||||
|
||||
71
core/lib/Thelia/TaxEngine/TaxEngine.php
Executable file
71
core/lib/Thelia/TaxEngine/TaxEngine.php
Executable file
@@ -0,0 +1,71 @@
|
||||
<?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\TaxEngine;
|
||||
|
||||
/**
|
||||
* Class TaxEngine
|
||||
* @package Thelia\TaxEngine
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*/
|
||||
class TaxEngine
|
||||
{
|
||||
static public function getInstance()
|
||||
{
|
||||
return new TaxEngine();
|
||||
}
|
||||
|
||||
private function getTaxTypeDirectory()
|
||||
{
|
||||
return __DIR__ . "/TaxType";
|
||||
}
|
||||
|
||||
public function getTaxTypeList()
|
||||
{
|
||||
$typeList = array();
|
||||
|
||||
try {
|
||||
$directoryBrowser = new \DirectoryIterator($this->getTaxTypeDirectory($this->getTaxTypeDirectory()));
|
||||
} catch (\UnexpectedValueException $e) {
|
||||
return $typeList;
|
||||
}
|
||||
|
||||
/* browse the directory */
|
||||
foreach ($directoryBrowser as $directoryContent) {
|
||||
/* is it a file ? */
|
||||
if (!$directoryContent->isFile()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fileName = $directoryContent->getFilename();
|
||||
$className = substr($fileName, 0, (1+strlen($directoryContent->getExtension())) * -1);
|
||||
|
||||
if($className == "BaseTaxType") {
|
||||
continue;
|
||||
}
|
||||
|
||||
$typeList[] = $className;
|
||||
}
|
||||
|
||||
return $typeList;
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,8 @@ abstract class BaseTaxType
|
||||
|
||||
public abstract function getRequirementsList();
|
||||
|
||||
public abstract function getTitle();
|
||||
|
||||
public function calculate(Product $product, $untaxedPrice)
|
||||
{
|
||||
return $untaxedPrice * $this->pricePercentRetriever() + $this->fixAmountRetriever($product);
|
||||
|
||||
@@ -65,4 +65,9 @@ class FeatureFixAmountTaxType extends BaseTaxType
|
||||
'feature' => new ModelValidIdType('Feature'),
|
||||
);
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return "Fix amount Tax depending on a feature";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,4 +47,9 @@ class FixAmountTaxType extends BaseTaxType
|
||||
'amount' => new FloatType(),
|
||||
);
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return "Fix amount Tax";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,9 @@ class PricePercentTaxType extends BaseTaxType
|
||||
'percent' => new FloatType(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//600 / (1 + 0,10 + 0,10) =/= 600 / (1 + 0,10 ) + 600 / (1 + 0,10 )
|
||||
public function getTitle()
|
||||
{
|
||||
return "Price % Tax";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Thelia\Type;
|
||||
*
|
||||
*/
|
||||
|
||||
class AlphaNumStringListType implements TypeInterface
|
||||
class AlphaNumStringListType extends BaseType
|
||||
{
|
||||
public function getType()
|
||||
{
|
||||
@@ -50,4 +50,14 @@ class AlphaNumStringListType implements TypeInterface
|
||||
{
|
||||
return $this->isValid($values) ? explode(',', $values) : null;
|
||||
}
|
||||
|
||||
public function getFormType()
|
||||
{
|
||||
return 'text';
|
||||
}
|
||||
|
||||
public function getFormOptions()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Thelia\Type;
|
||||
*
|
||||
*/
|
||||
|
||||
class AlphaNumStringType implements TypeInterface
|
||||
class AlphaNumStringType extends BaseType
|
||||
{
|
||||
public function getType()
|
||||
{
|
||||
@@ -44,4 +44,14 @@ class AlphaNumStringType implements TypeInterface
|
||||
{
|
||||
return $this->isValid($value) ? $value : null;
|
||||
}
|
||||
|
||||
public function getFormType()
|
||||
{
|
||||
return 'text';
|
||||
}
|
||||
|
||||
public function getFormOptions()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Thelia\Type;
|
||||
*
|
||||
*/
|
||||
|
||||
class AnyType implements TypeInterface
|
||||
class AnyType extends BaseType
|
||||
{
|
||||
public function getType()
|
||||
{
|
||||
@@ -44,4 +44,14 @@ class AnyType implements TypeInterface
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getFormType()
|
||||
{
|
||||
return 'text';
|
||||
}
|
||||
|
||||
public function getFormOptions()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
46
core/lib/Thelia/Type/BaseType.php
Normal file
46
core/lib/Thelia/Type/BaseType.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?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\Type;
|
||||
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
abstract class BaseType implements TypeInterface
|
||||
{
|
||||
abstract public function getType();
|
||||
abstract public function isValid($value);
|
||||
abstract public function getFormattedValue($value);
|
||||
abstract public function getFormType();
|
||||
abstract public function getFormOptions();
|
||||
|
||||
public function verifyForm($value, ExecutionContextInterface $context)
|
||||
{
|
||||
if( ! $this->isValid($value) ) {
|
||||
$context->addViolation(sprintf("received value `%s` does not match `%s` type", $value, $this->getType()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ namespace Thelia\Type;
|
||||
*
|
||||
*/
|
||||
|
||||
class BooleanOrBothType implements TypeInterface
|
||||
class BooleanOrBothType extends BaseType
|
||||
{
|
||||
|
||||
const ANY = '*';
|
||||
@@ -49,4 +49,14 @@ class BooleanOrBothType implements TypeInterface
|
||||
if ($value === self::ANY) return $value;
|
||||
return $value === null ? null : filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
|
||||
}
|
||||
|
||||
public function getFormType()
|
||||
{
|
||||
return 'text';
|
||||
}
|
||||
|
||||
public function getFormOptions()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Thelia\Type;
|
||||
*
|
||||
*/
|
||||
|
||||
class BooleanType implements TypeInterface
|
||||
class BooleanType extends BaseType
|
||||
{
|
||||
public function getType()
|
||||
{
|
||||
@@ -44,4 +44,14 @@ class BooleanType implements TypeInterface
|
||||
{
|
||||
return $value === null ? null : filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
|
||||
}
|
||||
|
||||
public function getFormType()
|
||||
{
|
||||
return 'text';
|
||||
}
|
||||
|
||||
public function getFormOptions()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Thelia\Type;
|
||||
*
|
||||
*/
|
||||
|
||||
class EnumListType implements TypeInterface
|
||||
class EnumListType extends BaseType
|
||||
{
|
||||
protected $values = array();
|
||||
|
||||
@@ -69,4 +69,14 @@ class EnumListType implements TypeInterface
|
||||
{
|
||||
return in_array($value, $this->values);
|
||||
}
|
||||
|
||||
public function getFormType()
|
||||
{
|
||||
return 'text';
|
||||
}
|
||||
|
||||
public function getFormOptions()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Thelia\Type;
|
||||
*
|
||||
*/
|
||||
|
||||
class EnumType implements TypeInterface
|
||||
class EnumType extends BaseType
|
||||
{
|
||||
protected $values = array();
|
||||
|
||||
@@ -52,4 +52,14 @@ class EnumType implements TypeInterface
|
||||
{
|
||||
return $this->isValid($value) ? $value : null;
|
||||
}
|
||||
|
||||
public function getFormType()
|
||||
{
|
||||
return 'text';
|
||||
}
|
||||
|
||||
public function getFormOptions()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Thelia\Type;
|
||||
*
|
||||
*/
|
||||
|
||||
class FloatToFloatArrayType implements TypeInterface
|
||||
class FloatToFloatArrayType extends BaseType
|
||||
{
|
||||
public function getType()
|
||||
{
|
||||
@@ -54,4 +54,14 @@ class FloatToFloatArrayType implements TypeInterface
|
||||
{
|
||||
return $this->isValid($value) ? $value : null;
|
||||
}
|
||||
|
||||
public function getFormType()
|
||||
{
|
||||
return 'text';
|
||||
}
|
||||
|
||||
public function getFormOptions()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Thelia\Type;
|
||||
*
|
||||
*/
|
||||
|
||||
class FloatType implements TypeInterface
|
||||
class FloatType extends BaseType
|
||||
{
|
||||
public function getType()
|
||||
{
|
||||
@@ -44,4 +44,14 @@ class FloatType implements TypeInterface
|
||||
{
|
||||
return $this->isValid($value) ? $value : null;
|
||||
}
|
||||
|
||||
public function getFormType()
|
||||
{
|
||||
return 'text';
|
||||
}
|
||||
|
||||
public function getFormOptions()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Thelia\Type;
|
||||
*
|
||||
*/
|
||||
|
||||
class IntListType implements TypeInterface
|
||||
class IntListType extends BaseType
|
||||
{
|
||||
public function getType()
|
||||
{
|
||||
@@ -50,4 +50,14 @@ class IntListType implements TypeInterface
|
||||
{
|
||||
return $this->isValid($values) ? explode(',', $values) : null;
|
||||
}
|
||||
|
||||
public function getFormType()
|
||||
{
|
||||
return 'text';
|
||||
}
|
||||
|
||||
public function getFormOptions()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Thelia\Type;
|
||||
*
|
||||
*/
|
||||
|
||||
class IntToCombinedIntsListType implements TypeInterface
|
||||
class IntToCombinedIntsListType extends BaseType
|
||||
{
|
||||
public function getType()
|
||||
{
|
||||
@@ -124,4 +124,14 @@ class IntToCombinedIntsListType implements TypeInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getFormType()
|
||||
{
|
||||
return 'text';
|
||||
}
|
||||
|
||||
public function getFormOptions()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Thelia\Type;
|
||||
*
|
||||
*/
|
||||
|
||||
class IntToCombinedStringsListType implements TypeInterface
|
||||
class IntToCombinedStringsListType extends BaseType
|
||||
{
|
||||
public function getType()
|
||||
{
|
||||
@@ -124,4 +124,14 @@ class IntToCombinedStringsListType implements TypeInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getFormType()
|
||||
{
|
||||
return 'text';
|
||||
}
|
||||
|
||||
public function getFormOptions()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Thelia\Type;
|
||||
*
|
||||
*/
|
||||
|
||||
class IntType implements TypeInterface
|
||||
class IntType extends BaseType
|
||||
{
|
||||
public function getType()
|
||||
{
|
||||
@@ -44,4 +44,14 @@ class IntType implements TypeInterface
|
||||
{
|
||||
return $this->isValid($value) ? $value : null;
|
||||
}
|
||||
|
||||
public function getFormType()
|
||||
{
|
||||
return 'text';
|
||||
}
|
||||
|
||||
public function getFormOptions()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Thelia\Type;
|
||||
*
|
||||
*/
|
||||
|
||||
class JsonType implements TypeInterface
|
||||
class JsonType extends BaseType
|
||||
{
|
||||
public function getType()
|
||||
{
|
||||
@@ -46,4 +46,14 @@ class JsonType implements TypeInterface
|
||||
{
|
||||
return $this->isValid($value) ? json_decode($value, true) : null;
|
||||
}
|
||||
|
||||
public function getFormType()
|
||||
{
|
||||
return 'text';
|
||||
}
|
||||
|
||||
public function getFormOptions()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ use Thelia\Exception\TypeException;
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
class ModelType implements TypeInterface
|
||||
class ModelType extends BaseType
|
||||
{
|
||||
protected $expectedModelActiveRecord = null;
|
||||
|
||||
@@ -63,4 +63,14 @@ class ModelType implements TypeInterface
|
||||
{
|
||||
return $this->isValid($value) ? $value : null;
|
||||
}
|
||||
|
||||
public function getFormType()
|
||||
{
|
||||
return 'text';
|
||||
}
|
||||
|
||||
public function getFormOptions()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ use Thelia\Exception\TypeException;
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
class ModelValidIdType implements TypeInterface
|
||||
class ModelValidIdType extends BaseType
|
||||
{
|
||||
protected $expectedModelActiveRecordQuery = null;
|
||||
|
||||
@@ -67,4 +67,23 @@ class ModelValidIdType implements TypeInterface
|
||||
|
||||
return $this->isValid($value) ? $queryClass::create()->findPk($value) : null;
|
||||
}
|
||||
|
||||
public function getFormType()
|
||||
{
|
||||
return 'choice';
|
||||
}
|
||||
|
||||
public function getFormOptions()
|
||||
{
|
||||
$queryClass = $this->expectedModelActiveRecordQuery;
|
||||
|
||||
$choices = array();
|
||||
foreach($queryClass::create()->find() as $item) {
|
||||
$choices[$item->getId()] = method_exists($item, "getTitle") ? $item->getTitle() : $item->getId();
|
||||
}
|
||||
|
||||
return array(
|
||||
"choices" => $choices,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,13 @@
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Type;
|
||||
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
|
||||
interface TypeInterface
|
||||
{
|
||||
public function getType();
|
||||
@@ -35,4 +36,8 @@ interface TypeInterface
|
||||
public function isValid($value);
|
||||
|
||||
public function getFormattedValue($value);
|
||||
|
||||
public function getFormType();
|
||||
public function getFormOptions();
|
||||
public function verifyForm($value, ExecutionContextInterface $context);
|
||||
}
|
||||
|
||||
@@ -45,13 +45,17 @@ class DebugBarListeners extends BaseAction implements EventSubscriberInterface {
|
||||
{
|
||||
$debugBar = $this->container->get("debugBar");
|
||||
|
||||
$alternativelogger = null;
|
||||
if($this->container->getParameter('kernel.debug')) {
|
||||
$alternativelogger = \Thelia\Log\Tlog::getInstance();
|
||||
}
|
||||
|
||||
$debugBar->addCollector(new PhpInfoCollector());
|
||||
//$debugBar->addCollector(new MessagesCollector());
|
||||
//$debugBar->addCollector(new RequestDataCollector());
|
||||
$debugBar->addCollector(new TimeDataCollector());
|
||||
$debugBar->addCollector(new MemoryCollector());
|
||||
$debugBar->addCollector(new PropelCollector(\Thelia\Log\Tlog::getInstance()));
|
||||
$debugBar->addCollector(new PropelCollector($alternativelogger));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12 clearfix">
|
||||
<div class="version-info pull-left">{intl l='Version %ver' ver="{$THELIA_VERSION}"}</div>
|
||||
|
||||
|
||||
<div class="clearfix pull-right hidden-xs">
|
||||
<div class="btn-group pull-right">
|
||||
<a href="{navigate to="index"}" title="{intl l='View site'}" target="_blank" class="btn btn-default"><span class="glyphicon glyphicon-eye-open"></span> {intl l="View shop"}</a>
|
||||
@@ -74,7 +74,7 @@
|
||||
</div>
|
||||
|
||||
{module_include location='inside_topbar'}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -89,7 +89,7 @@
|
||||
<nav class="navbar navbar-default" role="navigation">
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="btn navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
|
||||
219
templates/admin/default/admin-profiles.html
Normal file
219
templates/admin/default/admin-profiles.html
Normal file
@@ -0,0 +1,219 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="page-title"}{intl l='Admin profiles'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.admin-profiles.view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="admin-profiles">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
<div class="clearfix">
|
||||
<ul class="breadcrumb pull-left">
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration/admin_profiles'}">{intl l="Admin profiles"}</a></li>
|
||||
</ul>
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.admin-profiles.create"}
|
||||
<a class="btn btn-default btn-primary pull-right" title="{intl l='Create a new admin profile'}" href="#creation_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
|
||||
{module_include location='admin_profiles_top'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<form action="">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption>
|
||||
{intl l="Profile"}
|
||||
</caption>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><label for="" class="label-control">{intl l="Profile"}</label></td>
|
||||
<td>
|
||||
<select name="" id="" data-toggle="selectpicker">
|
||||
<option value="">1</option>
|
||||
<option value="">2</option>
|
||||
<option value="">3</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="" class="label-control">{intl l="Wording"}</label></td>
|
||||
<td><input type="text" class="form-control" name="" value="gestionnairecommande" readonly></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="" class="label-control">{intl l="Name"}</label></td>
|
||||
<td><input type="text" class="form-control" name="" value=""></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="" class="label-control">{intl l="Description"}</label></td>
|
||||
<td><textarea type="text" class="form-control" name=""></textarea></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="btn-group pull-right">
|
||||
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {intl l="Save"}</button>
|
||||
<button class="btn btn-default"><span class="glyphicon glyphicon-trash"></span> {intl l="Delete"}</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<form action="">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption>
|
||||
{intl l="General rights"}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l="Authorization"}</th>
|
||||
<th>{intl l="Description"}</th>
|
||||
<th>{intl l="Access"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Access to customers</td>
|
||||
<td>
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aspernatur, saepe, libero, veniam ab quod.
|
||||
</td>
|
||||
<td>
|
||||
<div class="make-switch switch-small" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="checkbox" checked>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Access to orders</td>
|
||||
<td>
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aspernatur, saepe, libero, veniam ab quod.
|
||||
</td>
|
||||
<td>
|
||||
<div class="make-switch switch-small" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="checkbox">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Access to catalog</td>
|
||||
<td>
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aspernatur, saepe, libero, veniam ab quod.
|
||||
</td>
|
||||
<td>
|
||||
<div class="make-switch switch-small" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="checkbox">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<button type="submit" class="btn btn-default btn-primary pull-right"><span class="glyphicon glyphicon-check"></span> {intl l="Save"}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{module_include location='admin_profiles_bottom'}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* Creation dialog *}
|
||||
|
||||
{form name="thelia.admin.admin-profile.creation"}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "creation_dialog"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{* Be sure to get the language_id, even if the form could not be validated *}
|
||||
<input type="hidden" name="language_id" value="{$language_id}" />
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
{* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/admin_profile/update' admin_profile_id='_ID_'}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='wording'}
|
||||
<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" title="{intl l="{$label}"}" placeholder="{intl l='Wording'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{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}" name="{$name}" class="form-control" title="{intl l="{$label}"}" placeholder="{intl l='Name'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='description'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<textarea id="{$label_attr.for}" name="{$name}" class="form-control" title="{intl l="{$label}"}" placeholder="{intl l='Description'}"></textarea>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='admin_profile_create_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "creation_dialog"
|
||||
dialog_title = {intl l="Create a new admin profile"}
|
||||
dialog_body = {$smarty.capture.creation_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Create this admin profile"}
|
||||
|
||||
form_action = {url path='/admin/configuration/admin_profile/create'}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
{/form}
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
|
||||
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
{javascripts file='assets/js/bootstrap-select/bootstrap-select.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
{javascripts file='assets/js/main.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
{/block}
|
||||
@@ -17,6 +17,9 @@
|
||||
}
|
||||
|
||||
}
|
||||
.navbar-nav > li:hover{
|
||||
background-color: @active-menu;
|
||||
}
|
||||
}
|
||||
|
||||
// Inner for background effects
|
||||
@@ -33,7 +36,7 @@
|
||||
// Navbar button for toggling navbar items in responsive layouts
|
||||
// These definitions need to come after '.navbar .btn'
|
||||
.navbar .btn {
|
||||
.button-variant(@btn-primary-color; @btn-primary-bg; @btn-primary-border);
|
||||
.button-variant(@btn-primary-color; @btn-primary-bg; @btn-primary-border);
|
||||
}
|
||||
|
||||
.navbar-default .navbar-toggle .icon-bar{
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
|
||||
@brand-primary: #f39922;
|
||||
|
||||
// Nav
|
||||
// -------------------------
|
||||
@active-menu: #eeeeee;
|
||||
|
||||
// Links
|
||||
// -------------------------
|
||||
|
||||
@@ -5,180 +5,180 @@
|
||||
{block name="check-permissions"}admin.configuration.view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="configuration">
|
||||
<div class="configuration">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
{module_include location='configuration_top'}
|
||||
{module_include location='configuration_top'}
|
||||
|
||||
<h2>{intl l="Thelia configuration"}</h2>
|
||||
<h2>{intl l="Thelia configuration"}</h2>
|
||||
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="menu-list-table general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed">
|
||||
<caption>{intl l='Product catalog configuration'}</caption>
|
||||
<div class="col-md-4">
|
||||
<div class="menu-list-table general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed">
|
||||
<caption>{intl l='Product catalog configuration'}</caption>
|
||||
|
||||
{module_include location='catalog_configuration_top'}
|
||||
{module_include location='catalog_configuration_top'}
|
||||
|
||||
{loop type="auth" name="pcc1" roles="ADMIN" permissions="admin.configuration.templates"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/templates'}">{intl l='Product templates'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/templates'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
{loop type="auth" name="pcc1" roles="ADMIN" permissions="admin.configuration.templates"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/templates'}">{intl l='Product templates'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/templates'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc2" roles="ADMIN" permissions="admin.configuration.attributes"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/attributes'}">{intl l='Product attributes'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/attributes'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
{loop type="auth" name="pcc2" roles="ADMIN" permissions="admin.configuration.attributes"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/attributes'}">{intl l='Product attributes'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/attributes'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc3" roles="ADMIN" permissions="admin.configuration.features"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/features'}">{intl l='Product features'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/features'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
{loop type="auth" name="pcc3" roles="ADMIN" permissions="admin.configuration.features"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/features'}">{intl l='Product features'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/features'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc4" roles="ADMIN" permissions="admin.configuration.messages"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/messages'}">{intl l='Mailing templates'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/messages'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
{loop type="auth" name="pcc4" roles="ADMIN" permissions="admin.configuration.messages"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/messages'}">{intl l='Mailing templates'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/messages'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc5" roles="ADMIN" permissions="admin.configuration.currencies"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/currencies'}">{intl l='Currencies'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/currencies'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
{loop type="auth" name="pcc5" roles="ADMIN" permissions="admin.configuration.currencies"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/currencies'}">{intl l='Currencies'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/currencies'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc6" roles="ADMIN" permissions="admin.configuration.taxe-rules"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/taxes_rules'}">{intl l='Taxes rules'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/taxes_rules'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
{loop type="auth" name="pcc6" roles="ADMIN" permissions="admin.configuration.taxe-rules"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/taxes_rules'}">{intl l='Taxes rules'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/taxes_rules'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{module_include location='catalog_configuration_bottom'}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{module_include location='catalog_configuration_bottom'}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="menu-list-table general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed">
|
||||
<caption>{intl l='Shipping configuration'}</caption>
|
||||
<div class="col-md-4">
|
||||
<div class="menu-list-table general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed">
|
||||
<caption>{intl l='Shipping configuration'}</caption>
|
||||
|
||||
{module_include location='shipping_configuration_top'}
|
||||
{module_include location='shipping_configuration_top'}
|
||||
|
||||
{loop type="auth" name="pcc1" roles="ADMIN" permissions="admin.configuration.contries"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/countries'}">{intl l='Countries'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/countries'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
{loop type="auth" name="pcc1" roles="ADMIN" permissions="admin.configuration.contries"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/countries'}">{intl l='Countries'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/countries'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc2" roles="ADMIN" permissions="admin.configuration.shipping_zones"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/shipping_zones'}">{intl l='Shipping zones'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/shipping_zones'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
{loop type="auth" name="pcc2" roles="ADMIN" permissions="admin.configuration.shipping_zones"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/shipping_zones'}">{intl l='Shipping zones'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/shipping_zones'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc3" roles="ADMIN" permissions="admin.configuration.shipping_configuration"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/shipping_configuration'}">{intl l='Shipping configuration'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/shipping_configuration'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
{loop type="auth" name="pcc3" roles="ADMIN" permissions="admin.configuration.shipping_configuration"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/shipping_configuration'}">{intl l='Shipping configuration'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/shipping_configuration'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{module_include location='shipping_configuration_bottom'}
|
||||
{module_include location='shipping_configuration_bottom'}
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="menu-list-table general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed">
|
||||
<caption>{intl l='System parameters'}</caption>
|
||||
<div class="col-md-4">
|
||||
<div class="menu-list-table general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed">
|
||||
<caption>{intl l='System parameters'}</caption>
|
||||
|
||||
{module_include location='system_configuration_top'}
|
||||
{module_include location='system_configuration_top'}
|
||||
|
||||
{loop type="auth" name="pcc1" roles="ADMIN" permissions="admin.configuration.modules"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/modules'}">{intl l='Modules activation'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/modules'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
{loop type="auth" name="pcc1" roles="ADMIN" permissions="admin.configuration.modules"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/modules'}">{intl l='Modules activation'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/modules'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc2" roles="ADMIN" permissions="admin.configuration.variables"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/variables'}">{intl l='System variables'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/variables'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
{loop type="auth" name="pcc2" roles="ADMIN" permissions="admin.configuration.variables"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/variables'}">{intl l='System variables'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/variables'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc3" roles="ADMIN" permissions="admin.configuration.admin_profiles"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/admin_profiles'}">{intl l='Back-office profiles'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/admin_profiles'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
{loop type="auth" name="pcc3" roles="ADMIN" permissions="admin.configuration.admin_profiles"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/admin_profiles'}">{intl l='Back-office profiles'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/admin_profiles'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc4" roles="ADMIN" permissions="admin.configuration.admin_users"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/admin_users'}">{intl l='Back-office users'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/admin_users'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
{loop type="auth" name="pcc4" roles="ADMIN" permissions="admin.configuration.admin_users"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/admin_users'}">{intl l='Back-office users'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/admin_users'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc5" roles="ADMIN" permissions="admin.configuration.languages"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/languages'}">{intl l='Languages & URLs'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/languages'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
{loop type="auth" name="pcc5" roles="ADMIN" permissions="admin.configuration.languages"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/languages'}">{intl l='Languages & URLs'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/languages'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc6" roles="ADMIN" permissions="admin.configuration.mailing_system"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/mailing_system'}">{intl l='Mailing system'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/mailing_system'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
{loop type="auth" name="pcc6" roles="ADMIN" permissions="admin.configuration.mailing_system"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/mailing_system'}">{intl l='Mailing system'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/mailing_system'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc7" roles="ADMIN" permissions="admin.configuration.admin_logs"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/admin_logs'}">{intl l='Administration logs'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/admin_logs'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
{loop type="auth" name="pcc7" roles="ADMIN" permissions="admin.configuration.admin_logs"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/admin_logs'}">{intl l='Administration logs'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/admin_logs'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc8" roles="ADMIN" permissions="admin.configuration.system_logs"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/system_logs'}">{intl l='System logs'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/system_logs'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
{loop type="auth" name="pcc8" roles="ADMIN" permissions="admin.configuration.system_logs"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/system_logs'}">{intl l='System logs'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/system_logs'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{module_include location='system_configuration_bottom'}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{module_include location='system_configuration_bottom'}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{module_include location='configuration_bottom'}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{module_include location='configuration_bottom'}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
272
templates/admin/default/languages.html
Normal file
272
templates/admin/default/languages.html
Normal file
@@ -0,0 +1,272 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="page-title"}{intl l='Thelia Languages'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.configuration.languages.view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="languages">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration/languages'}">{intl l="Languages"}</a></li>
|
||||
</ul>
|
||||
|
||||
{module_include location='languages_top'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="general-block-decorator">
|
||||
|
||||
<form action="" method="">
|
||||
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption>
|
||||
{intl l="Languages management"}
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.languages.create"}
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new language'}" href="#creation_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l="Language name"}</th>
|
||||
<th>{intl l="ISO 639 Code"}</th>
|
||||
<th>{intl l="Default"}</th>
|
||||
<th>{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><input type="text" class="form-control" name="" value="France"></td>
|
||||
<td><input type="text" class="form-control" name="" value="fr"></td>
|
||||
<td>
|
||||
<div class="make-switch switch-small switch-radio" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="radio" name="" checked>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<a href="#delete_dialog" data-toggle="modal" class="btn btn-default btn-xs" title="{intl l="Delete this language"}"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="text" class="form-control" name="" value="English"></td>
|
||||
<td><input type="text" class="form-control" name="" value="en"></td>
|
||||
<td>
|
||||
<div class="make-switch switch-small switch-radio" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="radio" name="">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<a href="#delete_dialog" data-toggle="modal" class="btn btn-default btn-xs" title="{intl l="Delete this language"}"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="text" class="form-control" name="" value="Spanish"></td>
|
||||
<td><input type="text" class="form-control" name="" value="es"></td>
|
||||
<td>
|
||||
<div class="make-switch switch-small switch-radio" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="radio" name="">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<a href="#delete_dialog" data-toggle="modal" class="btn btn-default btn-xs" title="{intl l="Delete this language"}"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<button type="submit" class="btn btn-default btn-primary pull-right"><span class="glyphicon glyphicon-check"></span> {intl l="Save"}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="general-block-decorator">
|
||||
|
||||
<div class="title title-without-tabs">{intl l="Parameters"}</div>
|
||||
|
||||
<form action="" method="post">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="" class="label-control">{intl l="If a translation is missing or incomplete :"}</label>
|
||||
<div class="input-group">
|
||||
<select name="" id="" data-toggle="selectpicker">
|
||||
<option value="">Replace by the default language</option>
|
||||
<option value="">Strictly use the requested language</option>
|
||||
</select>
|
||||
<div class="input-group-btn">
|
||||
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="general-block-decorator clearfix">
|
||||
|
||||
<div class="title title-without-tabs">{intl l="Association language/URL"}</div>
|
||||
|
||||
<form action="" method="post">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="" class="label-control"><input type="radio" name="" checked> {intl l="Using a same domain for all languages"}</label>
|
||||
<input type="url" class="form-control" name="" placeholder="http://www.domain.com">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="" class="label-control"><input type="radio" name=""> {intl l="Using a domain or subdomain for each language"}</label>
|
||||
</div>
|
||||
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>{intl l="France"}</th>
|
||||
<td><input type="text" class="form-control" name="" placeholder="http://www.domain.com" readonly></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="English"}</th>
|
||||
<td><input type="text" class="form-control" name="" placeholder="http://www.domain.com" readonly></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{intl l="Spanish"}</th>
|
||||
<td><input type="text" class="form-control" name="" placeholder="http://www.domain.com" readonly></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<button type="submit" disabled class="btn btn-default btn-primary pull-right"><span class="glyphicon glyphicon-check"></span> {intl l="Save"}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{module_include location='languages_bottom'}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{form name="thelia.admin.language.creation"}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "creation_dialog"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{* Be sure to get the language_id, even if the form could not be validated *}
|
||||
<input type="hidden" name="language_id" value="{$language_id}" />
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
{* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/languages/update' language_id='_ID_'}" />
|
||||
{/form_field}
|
||||
|
||||
{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>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Language title'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='isocode'}
|
||||
<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='ISO Code'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='language_create_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "creation_dialog"
|
||||
dialog_title = {intl l="Create a new language"}
|
||||
dialog_body = {$smarty.capture.creation_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Create this language"}
|
||||
|
||||
form_action = {url path='/admin/configuration/languages/create'}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
{/form}
|
||||
|
||||
{* Delete confirmation dialog *}
|
||||
|
||||
{capture "delete_dialog"}
|
||||
<input type="hidden" name="message_id" id="language_delete_id" value="" />
|
||||
|
||||
{module_include location='languages_delete_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
dialog_id = "delete_dialog"
|
||||
dialog_title = {intl l="Delete language"}
|
||||
dialog_message = {intl l="Do you really want to delete this language ?"}
|
||||
|
||||
form_action = {url path='/admin/configuration/languages/delete'}
|
||||
form_content = {$smarty.capture.delete_dialog nofilter}
|
||||
}
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
|
||||
<script>
|
||||
// Toogle switch on input radio
|
||||
$('.switch-radio').on('switch-change', function () {
|
||||
$('.switch-radio').bootstrapSwitch('toggleRadioState');
|
||||
});
|
||||
</script>
|
||||
{/javascripts}
|
||||
|
||||
{javascripts file='assets/js/main.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
{javascripts file='assets/js/bootstrap-select/bootstrap-select.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
{/block}
|
||||
102
templates/admin/default/mailing-system.html
Normal file
102
templates/admin/default/mailing-system.html
Normal file
@@ -0,0 +1,102 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="page-title"}{intl l='Thelia Mailing System'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.configuration.mailing-system.view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="mailing-system">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration/mailing_system'}">{intl l="Mailing system"}</a></li>
|
||||
</ul>
|
||||
|
||||
{module_include location='mailing_system_top'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="general-block-decorator">
|
||||
|
||||
<div class="title title-without-tabs">{intl l="Configuration variables"}</div>
|
||||
|
||||
<form action="" method="">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="" class="label-control">{intl l="SMTP Server"}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="" placeholder="{intl l="SMTP Server"}">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default btn-primary"><span class="glyphicon glyphicon-remove"></span></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="" class="label-control">{intl l="Port"}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="" placeholder="{intl l="port"}">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default btn-primary"><span class="glyphicon glyphicon-remove"></span></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="" class="label-control">{intl l="Username"}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="" placeholder="{intl l="username"}">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default btn-primary"><span class="glyphicon glyphicon-remove"></span></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="" class="label-control">{intl l="Password"}</label>
|
||||
<div class="input-group">
|
||||
<input type="password" class="form-control" name="" placeholder="{intl l="password"}">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default btn-primary"><span class="glyphicon glyphicon-remove"></span></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="" class="label-control">{intl l="Protocol"}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="" placeholder="{intl l="protocol"}">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default btn-primary"><span class="glyphicon glyphicon-remove"></span></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="" class="label-control">{intl l="Active ?"}</label>
|
||||
|
||||
<div class="make-switch switch-small" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="checkbox" name="" id="" checked>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{module_include location='mailing_system_bottom'}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
{/block}
|
||||
157
templates/admin/default/tax-edit.html
Normal file
157
templates/admin/default/tax-edit.html
Normal file
@@ -0,0 +1,157 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="page-title"}{intl l='Edit a tax'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.configuration.taxes.edit{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
|
||||
<div class="taxes-rules edit-taxes-rules">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration/taxes_rules'}">{intl l="Taxes"}</a></li>
|
||||
<li>{intl l='Editing tax'}</li>
|
||||
</ul>
|
||||
|
||||
{loop type="tax" name="tax" id=$tax_id backend_context="1" lang=$edit_language_id}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 general-block-decorator clearfix">
|
||||
|
||||
<div class="form-container">
|
||||
|
||||
{form name="thelia.admin.tax.modification"}
|
||||
|
||||
<form method="POST" action="{url path="/admin/configuration/taxes/save"}" {form_enctype form=$form} >
|
||||
|
||||
{include
|
||||
file = "includes/inner-form-toolbar.html"
|
||||
hide_submit_buttons = false
|
||||
|
||||
page_url = {url path="/admin/configuration/taxes/update/$tax_id"}
|
||||
close_url = {url path="/admin/configuration/taxes_rules"}
|
||||
}
|
||||
|
||||
{* Be sure to get the product ID, even if the form could not be validated *}
|
||||
<input type="hidden" name="tax_id" value="{$ID}" />
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path="/admin/configuration/taxes_rules"}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='locale'}
|
||||
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
|
||||
{/form_field}
|
||||
|
||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||
|
||||
{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>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Title'}" placeholder="{intl l='Title'}" class="form-control" value="{if $form_error}{$value}{else}{if $IS_TRANSLATED == 1}{$TITLE}{/if}{/if}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='description'}
|
||||
<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 detailed description."}</span>
|
||||
</label>
|
||||
|
||||
<textarea name="{$name}" id="{$label_attr.for}" rows="10" class="form-control wysiwyg">{if $form_error}{$value}{else}{if $IS_TRANSLATED == 1}{$DESCRIPTION}{/if}{/if}</textarea>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='type'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">
|
||||
{intl l=$label} :
|
||||
</label>
|
||||
|
||||
<div class="form-group">
|
||||
<select name="{$name}" class="js-change-tax-type" data-toggle="selectpicker">
|
||||
{foreach $choices as $choice}
|
||||
<option value="{$choice->value}" {if !$form_error && $choice->value == $TYPE || $form_error && $choice->value == $value}selected="selected" {/if}>{$choice->label}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{$typeValue = $value}
|
||||
{/form_field}
|
||||
|
||||
{form_tagged_fields form=$form tag='requirements'}
|
||||
<div class="form-group {if $error}has-error{/if} js-tax-requirements" data-tax-type="{$attr_list.tax_type}" {if !$form_error && $attr_list.tax_type != $TYPE || $form_error && $attr_list.tax_type != $typeValue}style="display: none"{/if}>
|
||||
<label for="{$label_attr.for}" class="control-label">
|
||||
{intl l=$label}
|
||||
</label>
|
||||
{if $formType == 'choice'}
|
||||
<select name="{$name}" data-toggle="selectpicker" {if !$form_error && $attr_list.tax_type != $TYPE || $form_error && $attr_list.tax_type != $typeValue}disabled="disabled"{/if}>
|
||||
{foreach $choices as $choice}
|
||||
<option value="{$choice->value}" {if !$form_error && $REQUIREMENTS.$label == $choice->value || $form_error && $value == $choice->value}selected="selected" {/if}>{$choice->label}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
{/if}
|
||||
{if $formType == 'text'}
|
||||
<input type="text" {if !$form_error && $attr_list.tax_type != $TYPE || $form_error && $attr_list.tax_type != $typeValue}disabled="disabled"{/if} id="{$label_attr.for}" name="{$name}" required="required" class="form-control" value="{if $form_error}{$value}{else}{$REQUIREMENTS.$label}{/if}">
|
||||
{/if}
|
||||
</div>
|
||||
{/form_tagged_fields}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="control-group">
|
||||
<label> </label>
|
||||
<div class="controls">
|
||||
<p>{intl l='Tax created on %date_create. Last modification: %date_change' date_create={format_date date=$CREATE_DATE} date_change={format_date date=$UPDATE_DATE}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/loop}
|
||||
|
||||
</div>
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
|
||||
{javascripts file='assets/js/bootstrap-select/bootstrap-select.js'}
|
||||
<script src='{$asset_url}'></script>
|
||||
{/javascripts}
|
||||
|
||||
{javascripts file='assets/js/main.js'}
|
||||
<script src='{$asset_url}'></script>
|
||||
{/javascripts}
|
||||
|
||||
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('.js-change-tax-type').change(function(e){
|
||||
$('.js-tax-requirements').children('select, input').attr('disabled', true);
|
||||
$('.js-tax-requirements').hide();
|
||||
$('.js-tax-requirements[data-tax-type="' + $(this).val() + '"]').children('select, input').attr('disabled', false);
|
||||
$('.js-tax-requirements[data-tax-type="' + $(this).val() + '"]').children('select').selectpicker("refresh");
|
||||
$('.js-tax-requirements[data-tax-type="' + $(this).val() + '"]').show();
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
{block name="main-content"}
|
||||
|
||||
{assign oder_tab {$smarty.get.tab|default:$smarty.post.tab|default:'data'}}
|
||||
{assign asked_country {$smarty.get.country|default:{country ask="default" attr="id"}}}
|
||||
{assign oder_tab {$smarty.get.tab|default:$smarty.post.tab|default:'data'}}
|
||||
{assign asked_country {$smarty.get.country|default:{country ask="default" attr="id"}}}
|
||||
|
||||
<div class="taxes-rules edit-taxes-rules">
|
||||
<div class="taxes-rules edit-taxes-rules">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
@@ -35,63 +35,63 @@
|
||||
|
||||
<div class="form-container">
|
||||
|
||||
{form name="thelia.admin.taxrule.modification"}
|
||||
{form name="thelia.admin.taxrule.modification"}
|
||||
|
||||
<form method="POST" action="{url path="/admin/configuration/taxes_rules/save"}" {form_enctype form=$form} >
|
||||
<form method="POST" action="{url path="/admin/configuration/taxes_rules/save"}" {form_enctype form=$form} >
|
||||
|
||||
{include
|
||||
file = "includes/inner-form-toolbar.html"
|
||||
hide_submit_buttons = false
|
||||
{include
|
||||
file = "includes/inner-form-toolbar.html"
|
||||
hide_submit_buttons = false
|
||||
|
||||
page_url = {url path="/admin/configuration/taxes_rules/update/$tax_rule_id" tab=data}
|
||||
close_url = {url path="/admin/configuration/taxes_rules"}
|
||||
}
|
||||
page_url = {url path="/admin/configuration/taxes_rules/update/$tax_rule_id" tab=data}
|
||||
close_url = {url path="/admin/configuration/taxes_rules"}
|
||||
}
|
||||
|
||||
{* Be sure to get the product ID, even if the form could not be validated *}
|
||||
<input type="hidden" name="tax_rule_id" value="{$ID}" />
|
||||
{* Be sure to get the product ID, even if the form could not be validated *}
|
||||
<input type="hidden" name="tax_rule_id" value="{$ID}" />
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path="/admin/configuration/taxes_rules"}" />
|
||||
{/form_field}
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path="/admin/configuration/taxes_rules"}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='locale'}
|
||||
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
|
||||
{/form_field}
|
||||
{form_field form=$form field='locale'}
|
||||
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
|
||||
{/form_field}
|
||||
|
||||
{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}
|
||||
|
||||
{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>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Title'}" placeholder="{intl l='Title'}" class="form-control" value="{if $error}{$value}{else}{if $IS_TRANSLATED == 1}{$TITLE}{/if}{/if}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='description'}
|
||||
<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 detailed description."}</span>
|
||||
</label>
|
||||
|
||||
<textarea name="{$name}" id="{$label_attr.for}" rows="10" class="form-control wysiwyg">{if $error}{$value}{else}{if $IS_TRANSLATED == 1}{$DESCRIPTION}{/if}{/if}</textarea>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="control-group">
|
||||
<label> </label>
|
||||
<div class="controls">
|
||||
<p>{intl l='Tax rule created on %date_create. Last modification: %date_change' date_create={format_date date=$CREATE_DATE} date_change={format_date date=$UPDATE_DATE}}</p>
|
||||
{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>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Title'}" placeholder="{intl l='Title'}" class="form-control" value="{if $error}{$value}{else}{if $IS_TRANSLATED == 1}{$TITLE}{/if}{/if}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
</form>
|
||||
{form_field form=$form field='description'}
|
||||
<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 detailed description."}</span>
|
||||
</label>
|
||||
|
||||
<textarea name="{$name}" id="{$label_attr.for}" rows="10" class="form-control wysiwyg">{if $error}{$value}{else}{if $IS_TRANSLATED == 1}{$DESCRIPTION}{/if}{/if}</textarea>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="control-group">
|
||||
<label> </label>
|
||||
<div class="controls">
|
||||
<p>{intl l='Tax rule created on %date_create. Last modification: %date_change' date_create={format_date date=$CREATE_DATE} date_change={format_date date=$UPDATE_DATE}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
|
||||
@@ -116,12 +116,12 @@
|
||||
</div>
|
||||
|
||||
<p><strong>{intl l="Countries that have the same tax rule"} :<strong></p>
|
||||
<p class="lead">
|
||||
<p class="lead js-collapse" id="same_countries" data-collapse-height="86">
|
||||
|
||||
{$matchedCountries.first=$asked_country}
|
||||
|
||||
{loop type="tax-rule-country" name="same-country-list" tax_rule=$ID taxes="1,2,3" country=$asked_country}
|
||||
{$matchedCountries[]=$COUNTRY}
|
||||
{loop type="tax-rule-country" name="same-country-list" tax_rule=$ID ask="countries" country=$asked_country}
|
||||
{$matchedCountries[]=$COUNTRY}
|
||||
<span class="label label-info">{$COUNTRY_TITLE}</span>
|
||||
{/loop}
|
||||
|
||||
@@ -129,6 +129,7 @@
|
||||
<span class="label label-danger">{intl l="NONE"}</span>
|
||||
{/elseloop}
|
||||
</p>
|
||||
<button data-collapse-block="same_countries" type="button" class="btn btn-info btn-sm btn-block js-collapse-btn" style="margin-bottom: 15px">See all countries</button>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
@@ -140,125 +141,130 @@
|
||||
<div class="panel-body">
|
||||
{assign lastPosition 0}
|
||||
{loop type="tax-rule-country" name="existing-tax-list" tax_rule=$ID country=$asked_country}
|
||||
{if $POSITION != $lastPosition}
|
||||
{assign lastPosition $POSITION}
|
||||
{if $LOOP_COUNT > 1}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="drop-group droppable add-to-group">
|
||||
<p class="drop-message">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
<span class="message">{intl l="Add tax to this group"}</span>
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
<div class="drag" data-id="{$TAX}">{$TAX_TITLE}</div>
|
||||
|
||||
{if $LOOP_COUNT == $LOOP_TOTAL}
|
||||
</div>
|
||||
{/if}
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="existing-tax-list"}
|
||||
<div class="drop-group droppable add-to-group">
|
||||
<p class="drop-message">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
<span class="message">{intl l="Add tax to this group"}</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/elseloop}
|
||||
|
||||
{if $POSITION != $lastPosition}
|
||||
{assign lastPosition $POSITION}
|
||||
{if $LOOP_COUNT > 1}
|
||||
</div>
|
||||
<div class="panel-footer droppable create-group">
|
||||
{/if}
|
||||
<div class="drop-group droppable add-to-group">
|
||||
<p class="drop-message">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
<span class="message">{intl l="Drop tax here to create a tax group"}</span>
|
||||
<span class="message">{intl l="Add tax to this group"}</span>
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
<div class="drag" data-id="{$TAX}">{$TAX_TITLE}</div>
|
||||
|
||||
{if $LOOP_COUNT == $LOOP_TOTAL}
|
||||
</div>
|
||||
{/if}
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="existing-tax-list"}
|
||||
<div class="drop-group droppable add-to-group">
|
||||
<p class="drop-message">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
<span class="message">{intl l="Add tax to this group"}</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/elseloop}
|
||||
|
||||
</div>
|
||||
|
||||
<a href="#tax_list_update_dialog" data-toggle="modal" id="apply-taxes-rules" class="btn btn-default btn-primary btn-block"><span class="glyphicon glyphicon-check"></span> {intl l="Apply"}</a>
|
||||
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
|
||||
<div id="panel-list" class="panel panel-default take">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Available taxes</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
{loop type="tax" name="tax-list" exclude_tax_rule=$ID country=$asked_country}
|
||||
<div class="draggable" data-id="{$ID}">{$TITLE}</div>
|
||||
{/loop}
|
||||
</div>
|
||||
<div class="panel-footer droppable remove-from-group">
|
||||
<p class="drop-message">
|
||||
<span class="glyphicon glyphicon-minus"></span>
|
||||
<span class="message">{intl l="Drop tax here to delete from group"}</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="panel-footer droppable create-group">
|
||||
<p class="drop-message">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
<span class="message">{intl l="Drop tax here to create a tax group"}</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<a href="#tax_list_update_dialog" data-toggle="modal" id="apply-taxes-rules" class="btn btn-default btn-primary btn-block"><span class="glyphicon glyphicon-check"></span> {intl l="Apply"}</a>
|
||||
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
|
||||
<div id="panel-list" class="panel panel-default take">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Available taxes</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
{loop type="tax" name="tax-list" exclude_tax_rule=$ID country=$asked_country}
|
||||
<div class="draggable" data-id="{$ID}">{$TITLE}</div>
|
||||
{/loop}
|
||||
</div>
|
||||
<div class="panel-footer droppable remove-from-group">
|
||||
<p class="drop-message">
|
||||
<span class="glyphicon glyphicon-minus"></span>
|
||||
<span class="message">{intl l="Drop tax here to delete from group"}</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/loop}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/loop}
|
||||
|
||||
</div>
|
||||
|
||||
{* Confirmation dialog *}
|
||||
|
||||
{* Confirmation dialog *}
|
||||
{form name="thelia.admin.taxrule.taxlistupdate"}
|
||||
|
||||
{if $form_error_message}
|
||||
{$taxUpdateError = true}
|
||||
{else}
|
||||
{$taxUpdateError = false}
|
||||
{/if}
|
||||
{if $form_error_message}
|
||||
{$taxUpdateError = true}
|
||||
{else}
|
||||
{$taxUpdateError = false}
|
||||
{/if}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "tax_list_update_dialog"}
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "tax_list_update_dialog"}
|
||||
|
||||
<input type="hidden" name="tax_rule_id" value="{$tax_rule_id}">
|
||||
<input type="hidden" name="tab" value="taxes">
|
||||
<input type="hidden" name="tax_rule_id" value="{$tax_rule_id}">
|
||||
<input type="hidden" name="tab" value="taxes">
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='country_list'}
|
||||
{form_field form=$form field='country_list'}
|
||||
|
||||
<p>{intl l="Tax rule taxes will be update for the following countries :"}</p>
|
||||
<div class="form-group">
|
||||
<select name="{$name}" data-toggle="selectpicker" multiple>
|
||||
{loop type="country" name="country-list"}
|
||||
<option value='{$ID}' {if (!$value AND in_array($ID, $matchedCountries)) OR ($value AND in_array($ID, $value))}selected="selected"{/if}>{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
<div class="input-group">
|
||||
<select id="countries-select" class="" name="{$name}" data-toggle="selectpicker" multiple>
|
||||
{loop type="country" name="country-list"}
|
||||
<option value='{$ID}' {if (!$value AND in_array($ID, $matchedCountries)) OR ($value AND in_array($ID, $value))}selected="selected"{/if}>{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-primary js-uncheck-all" data-uncheck-select="countries-select">{intl l="uncheck all"}</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/form_field}
|
||||
{/form_field}
|
||||
|
||||
{/capture}
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "tax_list_update_dialog"
|
||||
dialog_title = {intl l="Update tax rule taxes"}
|
||||
dialog_body = {$smarty.capture.tax_list_update_dialog nofilter}
|
||||
dialog_id = "tax_list_update_dialog"
|
||||
dialog_title = {intl l="Update tax rule taxes"}
|
||||
dialog_body = {$smarty.capture.tax_list_update_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Edit tax rule taxes"}
|
||||
dialog_cancel_label = {intl l="Cancel"}
|
||||
dialog_ok_label = {intl l="Edit tax rule taxes"}
|
||||
dialog_cancel_label = {intl l="Cancel"}
|
||||
|
||||
form_action = {url path="/admin/configuration/taxes_rules/saveTaxes"}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
form_action = {url path="/admin/configuration/taxes_rules/saveTaxes"}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
|
||||
{/form}
|
||||
|
||||
@@ -279,11 +285,34 @@
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
{if $taxUpdateError == true}
|
||||
{if $taxUpdateError == true}
|
||||
$('#tax_list_update_dialog').modal();
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{literal}
|
||||
|
||||
$('.js-collapse').each(function(k, v) {
|
||||
var h = $(v).data('collapse-height');
|
||||
if( $(v).height() > h ) {
|
||||
$(v).css('overflow', 'hidden').css('height', h + 'px');
|
||||
} else {
|
||||
$('[data-collapse-block=' + $(v).attr('id') + ']').hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('.js-collapse-btn').click(function(e) {
|
||||
e.preventDefault();
|
||||
var block = $(this).data('collapseBlock');
|
||||
$('#' + block).css('overflow', 'initial').css('height', 'initial');
|
||||
$(this).unbind().remove();
|
||||
});
|
||||
|
||||
$('.js-uncheck-all').click(function(e) {
|
||||
e.preventDefault();
|
||||
var selectId = $(this).data('uncheckSelect');
|
||||
$('#' + selectId).selectpicker('deselectAll');
|
||||
});
|
||||
|
||||
{literal}
|
||||
$('#country-selector').change(function(e) {
|
||||
$('#country-selector-form').submit();
|
||||
});
|
||||
@@ -295,7 +324,7 @@
|
||||
// Build array of taxes rules
|
||||
$('#apply-taxes-rules').click(function(){
|
||||
var taxesRules = [],
|
||||
index;
|
||||
index;
|
||||
|
||||
$('.drop-group', $group).each(function(i){
|
||||
var $this = $(this);
|
||||
@@ -308,7 +337,6 @@
|
||||
});
|
||||
});
|
||||
|
||||
console.log(taxesRules);
|
||||
$('#tax_list').val(JSON.stringify(taxesRules));
|
||||
});
|
||||
|
||||
@@ -354,13 +382,13 @@
|
||||
|
||||
// Make the new group droppable
|
||||
$drop
|
||||
.droppable(dropOptions)
|
||||
.sortable(sortOptions);
|
||||
.droppable(dropOptions)
|
||||
.sortable(sortOptions);
|
||||
}
|
||||
}
|
||||
|
||||
$("<div></div>").addClass('drag').attr('data-id', ui.draggable.data('id')).text( ui.draggable.text()).appendTo( $drop );
|
||||
ui.draggable.remove();
|
||||
ui.draggable.remove();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -371,24 +399,24 @@
|
||||
|
||||
// let the drop-group be droppable & sortable, accepting the tax items
|
||||
$('.droppable', $group)
|
||||
.droppable(dropOptions)
|
||||
.sortable(sortOptions);
|
||||
.droppable(dropOptions)
|
||||
.sortable(sortOptions);
|
||||
|
||||
$('.place .panel-body').sortable(sortOptions);
|
||||
|
||||
// let the gallery be droppable as well, accepting items from the trash
|
||||
$('.remove-from-group', $list)
|
||||
.droppable({
|
||||
accept: "#panel .drag",
|
||||
hoverClass: 'over',
|
||||
drop: function( event, ui ) {
|
||||
$("<div></div>").addClass('draggable').text( ui.draggable.text() ).attr('data-id', ui.draggable.data('id')).draggable(dragOptions).appendTo( $list.find('.panel-body') );
|
||||
ui.draggable.remove();
|
||||
.droppable({
|
||||
accept: "#panel .drag",
|
||||
hoverClass: 'over',
|
||||
drop: function( event, ui ) {
|
||||
$("<div></div>").addClass('draggable').text( ui.draggable.text() ).attr('data-id', ui.draggable.data('id')).draggable(dragOptions).appendTo( $list.find('.panel-body') );
|
||||
ui.draggable.remove();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
{/literal}
|
||||
{/literal}
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -5,164 +5,376 @@
|
||||
{block name="check-permissions"}admin.taxes-rules.view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="taxes-rules">
|
||||
<div class="taxes-rules">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
<div class="clearfix">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration/taxes_rules'}">{intl l="Taxes rules"}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
{module_include location='taxes_rules_top'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption class="clearfix">
|
||||
{intl l="Taxes rules"}
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.taxes-rules.create"}
|
||||
<a class="btn btn-default btn-primary pull-right" title="{intl l='Create a new tax rule'}" href="#tax_rule_create_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l="Name"}</th>
|
||||
<th>{intl l="Description"}</th>
|
||||
<th>{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{loop type="tax-rule" name="taxes-rules"}
|
||||
|
||||
<tr>
|
||||
<td>{$TITLE}</td>
|
||||
<td>{$DESCRIPTION}</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.taxes-rules.change"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Change this tax rule'}" href="{url path="/admin/configuration/taxes_rules/update/$ID"}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.taxes-rules.change"}
|
||||
<a class="btn btn-default btn-xs js-delete-tax-rule" title="{intl l='Delete this tax rule'}" href="#tax_rule_delete_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{/loop}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration/taxes_rules'}">{intl l="Taxes rules"}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{module_include location='taxes_rules_top'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<div class="alert alert-info">
|
||||
<p>{intl l="In order to manges your shop taxes you can manage"} <strong>{intl l="taxes"}</strong> {intl l="and"} <strong>{intl l="tax rules"}</strong>.</p>
|
||||
<p>{intl l="Taxes define the amount of money which is add to a bought product."}</p>
|
||||
<p>
|
||||
{intl l="Example :"}
|
||||
<ul>
|
||||
<li>{intl l="French 19.6% VAT is a tax which add a 19.6% tax to the product price."}</li>
|
||||
<li>{intl l="Ecotax is a tax wich add a defined amount (throug a product feature) to the product price."}</li>
|
||||
</ul>
|
||||
</p>
|
||||
<p>{intl l="Tax rules are combination of different taxes."}</p>
|
||||
<p>
|
||||
{intl l="Example :"}
|
||||
<ul>
|
||||
<li>{intl l="French 19.6% VAT with ecotax is the applicance of the ecotax (on the product price) then the applicance of the 19.6% tax (on the product price + the ecotax amount)."}</li>
|
||||
</ul>
|
||||
</p>
|
||||
<p>{intl l="you can combine taxes in tax rules and chose if they are applied one after the other or at the same time : it allows to apply taxes on an already taxed price or not."}</p>
|
||||
</div>
|
||||
|
||||
<div class="general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption class="clearfix">
|
||||
{intl l="Taxes"}
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.taxes.create"}
|
||||
<a class="btn btn-default btn-primary pull-right" title="{intl l='Create a new tax'}" href="#tax_create_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-md-3">{intl l="Name"}</th>
|
||||
<th class="col-md-5">{intl l="Description"}</th>
|
||||
<th class="col-md-1">{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{loop type="tax" name="taxes" backend_context="1"}
|
||||
|
||||
<tr>
|
||||
<td>{$TITLE}</td>
|
||||
<td>{$DESCRIPTION}</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.taxes.change"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Change this tax'}" href="{url path="/admin/configuration/taxes/update/$ID"}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.taxes.change"}
|
||||
<a class="btn btn-default btn-xs js-delete-tax" title="{intl l='Delete this tax'}" href="#tax_delete_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{/loop}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption class="clearfix">
|
||||
{intl l="Taxes rules"}
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.taxes-rules.create"}
|
||||
<a class="btn btn-default btn-primary pull-right" title="{intl l='Create a new tax rule'}" href="#tax_rule_create_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-md-3">{intl l="Name"}</th>
|
||||
<th class="col-md-4">{intl l="Description"}</th>
|
||||
<th class="col-md-1">{intl l="Default"}</th>
|
||||
<th class="col-md-1">{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{loop type="tax-rule" name="taxes-rules" backend_context="1"}
|
||||
|
||||
<tr>
|
||||
<td>{$TITLE}</td>
|
||||
<td>{$DESCRIPTION}</td>
|
||||
<td>
|
||||
{if $IS_DEFAULT == 1}
|
||||
<span class="glyphicon glyphicon-ok"></span>
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.taxes-rules.change"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Change this tax rule'}" href="{url path="/admin/configuration/taxes_rules/update/$ID"}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Set as default tax rule'}" href="{url path="/admin/configuration/taxes_rules/update/set_default/$ID"}" {if $IS_DEFAULT == 1}disabled{/if}><span class="glyphicon glyphicon-star"></span></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.taxes-rules.dele"}
|
||||
<a class="btn btn-default btn-xs js-delete-tax-rule" title="{intl l='Delete this tax rule'}" href="#tax_rule_delete_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{/loop}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{module_include location='taxes_rules_bottom'}
|
||||
|
||||
</div>
|
||||
|
||||
{module_include location='taxes_rules_bottom'}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* -- Add tax rule confirmation dialog ----------------------------------- *}
|
||||
{form name="thelia.admin.taxrule.add"}
|
||||
{* -- Add tax confirmation dialog ----------------------------------- *}
|
||||
{form name="thelia.admin.tax.add"}
|
||||
|
||||
{if $form_error_message}
|
||||
{$taxCreateError = true}
|
||||
{else}
|
||||
{$taxCreateError = false}
|
||||
{/if}
|
||||
{if $form_error_message}
|
||||
{$taxCreateError = true}
|
||||
{else}
|
||||
{$taxCreateError = false}
|
||||
{/if}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "tax_rule_create_dialog"}
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "tax_create_dialog"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='locale'}
|
||||
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
|
||||
{/form_field}
|
||||
{form_field form=$form field='locale'}
|
||||
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
|
||||
{/form_field}
|
||||
|
||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||
{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>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Title'}" placeholder="{intl l='Title'}" class="form-control" value="{if $form_error}{$value}{else}{if $IS_TRANSLATED == 1}{$TITLE}{/if}{/if}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{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>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Title'}" placeholder="{intl l='Title'}" class="form-control" value="{if $error}{$value}{else}{if $IS_TRANSLATED == 1}{$TITLE}{/if}{/if}">
|
||||
</div>
|
||||
{/form_field}
|
||||
{form_field form=$form field='description'}
|
||||
<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 detailed description."}</span>
|
||||
</label>
|
||||
|
||||
{form_field form=$form field='description'}
|
||||
<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 detailed description."}</span>
|
||||
</label>
|
||||
<textarea name="{$name}" id="{$label_attr.for}" rows="10" class="form-control wysiwyg">{if $form_error}{$value}{else}{if $IS_TRANSLATED == 1}{$DESCRIPTION}{/if}{/if}</textarea>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
<textarea name="{$name}" id="{$label_attr.for}" rows="10" class="form-control wysiwyg">{if $error}{$value}{else}{if $IS_TRANSLATED == 1}{$DESCRIPTION}{/if}{/if}</textarea>
|
||||
</div>
|
||||
{/form_field}
|
||||
{form_field form=$form field='type'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">
|
||||
{intl l=$label} :
|
||||
</label>
|
||||
|
||||
{/capture}
|
||||
<div class="form-group">
|
||||
<select name="{$name}" class="js-change-tax-type" data-toggle="selectpicker">
|
||||
{$typeValueWithError = $value}
|
||||
{foreach from=$choices key=key item=choice}
|
||||
{if $key == 0}
|
||||
{$typeValue = $choice->value}
|
||||
{/if}
|
||||
<option value="{$choice->value}" {if $form_error && $choice->value == $value || !$form_error && $key == 0}selected="selected" {/if}>{$choice->label}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_tagged_fields form=$form tag='requirements'}
|
||||
<div class="form-group {if $error}has-error{/if} js-tax-requirements" data-tax-type="{$attr_list.tax_type}" {if !$form_error && $attr_list.tax_type != $typeValue || $form_error && $attr_list.tax_type != $typeValueWithError}style="display: none"{/if}>
|
||||
<label for="{$label_attr.for}" class="control-label">
|
||||
{intl l=$label}
|
||||
</label>
|
||||
{if $formType == 'choice'}
|
||||
<select name="{$name}" data-toggle="selectpicker" {if !$form_error && $attr_list.tax_type != $typeValue || $form_error && $attr_list.tax_type != $typeValueWithError}disabled="disabled"{/if}>
|
||||
{foreach $choices as $choice}
|
||||
<option value="{$choice->value}" {if !$form_error && $REQUIREMENTS.$label == $choice->value || $form_error && $value == $choice->value}selected="selected" {/if}>{$choice->label}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
{/if}
|
||||
{if $formType == 'text'}
|
||||
<input type="text" {if !$form_error && $attr_list.tax_type != $typeValue || $form_error && $attr_list.tax_type != $typeValueWithError}disabled="disabled"{/if} id="{$label_attr.for}" name="{$name}" required="required" class="form-control" value="{if $form_error}{$value}{else}{$REQUIREMENTS.$label}{/if}">
|
||||
{/if}
|
||||
</div>
|
||||
{/form_tagged_fields}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "tax_create_dialog"
|
||||
dialog_title = {intl l="Create a new tax"}
|
||||
dialog_body = {$smarty.capture.tax_create_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Create"}
|
||||
dialog_cancel_label = {intl l="Cancel"}
|
||||
|
||||
form_action = {url path="/admin/configuration/taxes/add"}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
|
||||
{/form}
|
||||
|
||||
{* -- Delete tax confirmation dialog ----------------------------------- *}
|
||||
|
||||
{capture "tax_delete_dialog"}
|
||||
<input type="hidden" name="tax_id" id="tax_delete_id" value="" />
|
||||
|
||||
{module_include location='tax_delete_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
dialog_id = "tax_delete_dialog"
|
||||
dialog_title = {intl l="Delete tax"}
|
||||
dialog_message = {intl l="Do you really want to delete this tax ?"}
|
||||
|
||||
form_action = {url path='/admin/configuration/taxes/delete'}
|
||||
form_content = {$smarty.capture.tax_delete_dialog nofilter}
|
||||
}
|
||||
|
||||
{* -- Add tax rule confirmation dialog ----------------------------------- *}
|
||||
{form name="thelia.admin.taxrule.add"}
|
||||
|
||||
{if $form_error_message}
|
||||
{$taxRuleCreateError = true}
|
||||
{else}
|
||||
{$taxRuleCreateError = false}
|
||||
{/if}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "tax_rule_create_dialog"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='locale'}
|
||||
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
|
||||
{/form_field}
|
||||
|
||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||
|
||||
{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>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Title'}" placeholder="{intl l='Title'}" class="form-control" value="{if $error}{$value}{else}{if $IS_TRANSLATED == 1}{$TITLE}{/if}{/if}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='description'}
|
||||
<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 detailed description."}</span>
|
||||
</label>
|
||||
|
||||
<textarea name="{$name}" id="{$label_attr.for}" rows="10" class="form-control wysiwyg">{if $error}{$value}{else}{if $IS_TRANSLATED == 1}{$DESCRIPTION}{/if}{/if}</textarea>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "tax_rule_create_dialog"
|
||||
dialog_title = {intl l="Create a new tax rule"}
|
||||
dialog_body = {$smarty.capture.tax_rule_create_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Create"}
|
||||
dialog_cancel_label = {intl l="Cancel"}
|
||||
dialog_ok_label = {intl l="Create"}
|
||||
dialog_cancel_label = {intl l="Cancel"}
|
||||
|
||||
form_action = {url path="/admin/configuration/taxes_rules/add"}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
form_action = {url path="/admin/configuration/taxes_rules/add"}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
|
||||
{/form}
|
||||
{/form}
|
||||
|
||||
{* -- Delete tax rule confirmation dialog ----------------------------------- *}
|
||||
|
||||
{capture "tax_rule_delete_dialog"}
|
||||
<input type="hidden" name="tax_rule_id" id="tax_rule_delete_id" value="" />
|
||||
{capture "tax_rule_delete_dialog"}
|
||||
<input type="hidden" name="tax_rule_id" id="tax_rule_delete_id" value="" />
|
||||
|
||||
{module_include location='tax_rule_delete_form'}
|
||||
{module_include location='tax_rule_delete_form'}
|
||||
|
||||
{/capture}
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
dialog_id = "tax_rule_delete_dialog"
|
||||
dialog_title = {intl l="Delete tax rule"}
|
||||
dialog_message = {intl l="Do you really want to delete this tax rule ?"}
|
||||
|
||||
form_action = {url path='/admin/configuration/taxes_rules/delete'}
|
||||
form_content = {$smarty.capture.tax_rule_delete_dialog nofilter}
|
||||
form_action = {url path='/admin/configuration/taxes_rules/delete'}
|
||||
form_content = {$smarty.capture.tax_rule_delete_dialog nofilter}
|
||||
}
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
|
||||
<script type="text/javascript">
|
||||
{javascripts file='assets/js/bootstrap-select/bootstrap-select.js'}
|
||||
<script src='{$asset_url}'></script>
|
||||
{/javascripts}
|
||||
|
||||
{if $taxCreateError == true}
|
||||
$('#tax_rule_create_dialog').modal();
|
||||
{/if}
|
||||
{javascripts file='assets/js/main.js'}
|
||||
<script src='{$asset_url}'></script>
|
||||
{/javascripts}
|
||||
|
||||
$(".js-delete-tax-rule").click(function(e){
|
||||
$('#tax_rule_delete_id').val($(this).data('id'))
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
|
||||
{if $taxRuleCreateError == true}
|
||||
$('#tax_rule_create_dialog').modal();
|
||||
{/if}
|
||||
|
||||
{if $taxCreateError == true}
|
||||
$('#tax_create_dialog').modal();
|
||||
{/if}
|
||||
|
||||
$(".js-delete-tax-rule").click(function(e){
|
||||
$('#tax_rule_delete_id').val($(this).data('id'))
|
||||
});
|
||||
|
||||
$(".js-delete-tax").click(function(e){
|
||||
$('#tax_delete_id').val($(this).data('id'))
|
||||
});
|
||||
|
||||
$('.js-change-tax-type').change(function(e){
|
||||
$('.js-tax-requirements').children('select, input').attr('disabled', true);
|
||||
$('.js-tax-requirements').hide();
|
||||
$('.js-tax-requirements[data-tax-type="' + $(this).val() + '"]').children('select, input').attr('disabled', false);
|
||||
$('.js-tax-requirements[data-tax-type="' + $(this).val() + '"]').children('select').selectpicker("refresh");
|
||||
$('.js-tax-requirements[data-tax-type="' + $(this).val() + '"]').show();
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
131
templates/default/account-update.html
Normal file
131
templates/default/account-update.html
Normal file
@@ -0,0 +1,131 @@
|
||||
{extends file="layout.tpl"}
|
||||
|
||||
{* Body Class *}
|
||||
{block name="body-class"}page-account-update{/block}
|
||||
|
||||
{* Breadcrumb *}
|
||||
{block name='no-return-functions' append}
|
||||
{$breadcrumbs = [['title' => {intl l="Account"}, 'url'=>{url path="/account"}]]}
|
||||
{$breadcrumbs = [
|
||||
['title' => {intl l="Account"}, 'url'=>{url path="/account"}],
|
||||
['title' => {intl l="Update Profil"}, 'url'=>{url path="/account/update"}]
|
||||
]}
|
||||
{/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="Update Profil"}</h1>
|
||||
|
||||
{form name="thelia.customer.update"}
|
||||
{assign var="isPost" value="{$smarty.post|count}"}
|
||||
<form id="form-register" class="form-horizontal" action="{url path="/account/update"}" method="post" role="form">
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path="/account"}" />
|
||||
{/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">
|
||||
{intl l="Personal Informations"}
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
{form_field form=$form field="title"}
|
||||
<div class="form-group group-title {if $error}has-error{elseif $isPost && $value != "" && !$error}has-success{/if}">
|
||||
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
|
||||
<div class="control-input">
|
||||
<select name="{$name}" id="{$label_attr.for}" class="form-control"{if $required} aria-required="true" required{/if}{if !$value || $error} autofocus{/if}>
|
||||
<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>
|
||||
{assign var="error_focus" value="true"}
|
||||
{elseif !$value}
|
||||
{assign var="error_focus" value="true"}
|
||||
{elseif $isPost && $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 $isPost && $value != "" && !$error}has-success{/if}">
|
||||
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
|
||||
<div class="control-input">
|
||||
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="John" value="{$value}" {if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
|
||||
{if $error }
|
||||
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||
{assign var="error_focus" value="true"}
|
||||
{elseif $isPost && $value != "" && !$error}
|
||||
<span class="help-block"><i class="icon-ok"></i></span>
|
||||
{/if}
|
||||
</div>
|
||||
</div><!--/.form-group-->
|
||||
{/form_field}
|
||||
{form_field form=$form field="lastname"}
|
||||
<div class="form-group group-lastname {if $error}has-error{elseif $isPost && $value != "" && !$error}has-success{/if}">
|
||||
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
|
||||
<div class="control-input">
|
||||
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="Doe" value="{$value}" {if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
|
||||
{if $error }
|
||||
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||
{assign var="error_focus" value="true"}
|
||||
{elseif $isPost && $value != "" && !$error}
|
||||
<span class="help-block"><i class="icon-ok"></i></span>
|
||||
{/if}
|
||||
</div>
|
||||
</div><!--/.form-group-->
|
||||
{/form_field}
|
||||
{form_field form=$form field="email"}
|
||||
<div class="form-group group-email {if $error}has-error{elseif $isPost && $value != "" && !$error}has-success{/if}">
|
||||
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
|
||||
|
||||
<div class="control-input">
|
||||
<input type="email" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="johndoe@domain.com" value="{$smarty.get.email|default:$value}"{if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
|
||||
{if $error }
|
||||
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||
{assign var="error_focus" value="true"}
|
||||
{elseif $isPost && $value != "" && !$error}
|
||||
<span class="help-block"><i class="icon-ok"></i></span>
|
||||
{/if}
|
||||
</div>
|
||||
</div><!--/.form-group-->
|
||||
{/form_field}
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
{form_field form=$form field="newsletter"}
|
||||
<div class="form-group group-newsletter{if $error} has-error{/if}">
|
||||
<div class="control-input">
|
||||
<div class="checkbox">
|
||||
<label class="control-label" for="{$label_attr.for}">
|
||||
<input type="checkbox" name="{$name}" id="{$label_attr.for}" value="{$value}"{if $checked} checked{/if} {if $required} aria-required="true" required{/if}>{$label}
|
||||
</label>
|
||||
{if $error }
|
||||
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div><!--/.form-group-->
|
||||
{/form_field}
|
||||
|
||||
<div class="form-group group-btn">
|
||||
<div class="control-btn">
|
||||
<button type="submit" class="btn btn-register">{intl l="Update"}</button>
|
||||
</div>
|
||||
</div><!--/.form-group-->
|
||||
</form>
|
||||
{/form}
|
||||
</article>
|
||||
|
||||
</div><!-- /.layout -->
|
||||
{/block}
|
||||
@@ -1,19 +1,18 @@
|
||||
{extends file="layout.tpl"}
|
||||
|
||||
{block name="no-return-functions"}
|
||||
{block name="no-return-functions" prepend}
|
||||
{check_auth context="front" roles="CUSTOMER" login_tpl="login"}
|
||||
{/block}
|
||||
|
||||
{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="{navigate to="index"}" 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="Account"}</span></li>
|
||||
</ul>
|
||||
</nav><!-- /.nav-breadcrumb -->
|
||||
{* Breadcrumb *}
|
||||
{block name='no-return-functions' append}
|
||||
{$breadcrumbs = [
|
||||
['title' => {intl l="Account"}, 'url'=>{url path="/account"}]
|
||||
]}
|
||||
{/block}
|
||||
|
||||
{block name="body-class"}page-account{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="main">
|
||||
|
||||
@@ -40,13 +39,13 @@
|
||||
<address class="adr">
|
||||
<span class="street-address">{$ADDRESS1}</span><br>
|
||||
{if $ADDRESS2 != ""}
|
||||
<span class="street-address">{$ADDRESS2}</span><br>
|
||||
<span class="extended-address">{$ADDRESS2}</span><br>
|
||||
{/if}
|
||||
{if $ADDRESS3 != ""}
|
||||
<span class="street-address">{$ADDRESS3}</span><br>
|
||||
<span class="extended-address">{$ADDRESS3}</span><br>
|
||||
{/if}
|
||||
<span class="postal-code">{$ZIPCODE}</span>
|
||||
<span class="locality">{$CITY}, <span class="country-name">{loop type="country" name="customer.country.info" id=$COUNTRY}{$TITLE}{/loop}</span></span>
|
||||
<span class="locality">{$CITY}<br><span class="country-name">{loop type="country" name="customer.country.info" id=$COUNTRY}{$TITLE}{/loop}</span></span>
|
||||
</address>
|
||||
</li>
|
||||
<li>
|
||||
@@ -56,11 +55,11 @@
|
||||
{if $PHONE != ""}
|
||||
<span class="tel">{$PHONE}</span>
|
||||
{/if}
|
||||
<span class="email"><a href="mailto:{$EMAIL}">{$EMAIL}</a></span>
|
||||
<span class="email">{mailto address="{$EMAIL}" encode="hex"}</span>
|
||||
</li>
|
||||
<li class="group-btn">
|
||||
<a href="#" class="btn btn-change-account"><i class="icon-pencil"></i> Change my account informations</a>
|
||||
<a href="#" class="btn btn-change-password"><i class="icon-lock"></i> Change my password</a>
|
||||
<a href="{url path="/account/update"}" class="btn btn-change-account"><i class="icon-pencil"></i> {intl l="Change my account informations"}</a>
|
||||
<a href="{url path="/account/password"}" class="btn btn-change-password"><i class="icon-lock"></i> {intl l="Change my password"}</a>
|
||||
</li>
|
||||
</ul>
|
||||
{/loop}
|
||||
@@ -83,7 +82,7 @@
|
||||
<tbody>
|
||||
{loop type="address" name="customer.addresses" customer="current"}
|
||||
<tr class="{if $DEFAULT == 1}address-primary{else}address-additional{/if}" id="customer-address-{$ID}">
|
||||
<th>{$LABEL}</th>
|
||||
<th>{$LABEL|default:"{intl l='Address %nb' nb={$LOOP_COUNT}}"}</th>
|
||||
<td>
|
||||
<ul class="list-address">
|
||||
<li>
|
||||
@@ -117,9 +116,9 @@
|
||||
</td>
|
||||
<td>
|
||||
<div class="group-btn">
|
||||
<a href="{url path="/address/update/{$ID}"}" class="btn btn-edit-address" data-toggle="tooltip" title="Edit this address"><i class="icon-pencil"></i> <span>{intl l="Edit"}</span></a>
|
||||
<a href="{url path="/address/update/{$ID}"}" class="btn btn-edit-address" data-toggle="tooltip" title="{intl l="Edit this address"}"><i class="icon-pencil"></i> <span>{intl l="Edit"}</span></a>
|
||||
{if $DEFAULT != 1}
|
||||
<a href="{url path="/address/delete/{$ID}"}" class="btn btn-remove-address remove-address" title="{intl l="Remove this address"}" data-toggle="tooltip"><i class="icon-remove"></i> <span>{intl l="Cancel"}</span></a>
|
||||
<a href="{url path="/address/delete/s{$ID}"}" class="btn btn-remove-address" data-toggle="popover" title="Do you really want to delete this address ?" data-content="And here's some amazing content. It's very engaging. right?" title="{intl l="Remove this address"}" ><i class="icon-remove"></i> <span>{intl l="Cancel"}</span></a>
|
||||
{/if}
|
||||
</div>
|
||||
</td>
|
||||
@@ -140,6 +139,7 @@
|
||||
</div>
|
||||
<div id="account-orders" class="panel-collapse collapse">
|
||||
<div class="panel-body table-responsive">
|
||||
{ifloop rel="customer.orders"}
|
||||
<table class="table table-orders" summary="{intl l="List of orders"}">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -163,9 +163,10 @@
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
{/ifloop}
|
||||
{elseloop rel="customer.orders"}
|
||||
<div class="orders-warning">
|
||||
<strong>{intl l="Warning"}!</strong> {intl l="You don't have orders yet"}
|
||||
<strong>{intl l="Warning"}!</strong> {intl l="You don't have orders yet."}
|
||||
</div>
|
||||
{/elseloop}
|
||||
</div>
|
||||
@@ -175,38 +176,6 @@
|
||||
</article>
|
||||
|
||||
</div><!-- /.layout -->
|
||||
|
||||
<div class="modal fade" id="address-delete-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>{intl l="Delete address"}</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
{intl l="Do you really want to delete this address ?"}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span> {intl l="No"}</a>
|
||||
<a href="#" id="address-delete-link" type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {intl l="Yes"}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="after-javascript-include"}
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$(".remove-address").click(function(e){
|
||||
e.preventDefault();
|
||||
$("#address-delete-link").attr("href", $(this).attr("href"));
|
||||
$('#address-delete-modal').modal('show');
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
{block name="after-javascript-include"}{/block}
|
||||
@@ -4,15 +4,15 @@
|
||||
{check_auth context="front" roles="CUSTOMER" login_tpl="login"}
|
||||
{/block}
|
||||
|
||||
{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="{navigate to="index"}" itemprop="url"><span itemprop="title">{intl l="Home"}</span></a></li>
|
||||
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">{intl l="Account"}</span></li>
|
||||
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="active"><span itemprop="title">{intl l="Address"}</span></li>
|
||||
</ul>
|
||||
</nav><!-- /.nav-breadcrumb -->
|
||||
{* Body Class *}
|
||||
{block name="body-class"}page-address{/block}
|
||||
|
||||
{* Breadcrumb *}
|
||||
{block name='no-return-functions' append}
|
||||
{$breadcrumbs = [
|
||||
['title' => {intl l="Account"}, 'url'=>{url path="/account"}],
|
||||
['title' => {intl l="Address Update"}, 'url'=>{url path="/address"}]
|
||||
]}
|
||||
{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
@@ -25,7 +25,7 @@
|
||||
{loop name="customer.update" type="address" customer="current" id="{$address_id}"}
|
||||
<form id="form-address" class="form-horizontal" action="{url path="/address/update/{$address_id}"}" method="post" role="form">
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path="/customer/account"}" /> {* the url the user is redirected to on login success *}
|
||||
<input type="hidden" name="{$name}" value="{url path="/account"}" /> {* the url the user is redirected to on login success *}
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='error_message'}
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
{check_auth context="front" roles="CUSTOMER" login_tpl="login"}
|
||||
{/block}
|
||||
|
||||
{block name="breadcrumb"}
|
||||
<nav class="nav-breadcrumb" role="navigation" aria-labelledby="breadcrumb-label">
|
||||
<strong id="breadcrumb-label">You are here: </strong>
|
||||
<ul class="breadcrumb" itemprop="breadcrumb">
|
||||
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="{navigate to="index"}" itemprop="url"><span itemprop="title">Home</span></a></li>
|
||||
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="{url path="/customer/account"}" itemprop="url"><span itemprop="title">Account</span></a></li>
|
||||
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="active"><span itemprop="title">{intl l="Address"}</span></li>
|
||||
</ul>
|
||||
</nav><!-- /.nav-breadcrumb -->
|
||||
{* Body Class *}
|
||||
{block name="body-class"}page-address{/block}
|
||||
|
||||
{* Breadcrumb *}
|
||||
{block name='no-return-functions' append}
|
||||
{$breadcrumbs = [
|
||||
['title' => {intl l="Account"}, 'url'=>{url path="/account"}],
|
||||
['title' => {intl l="Address"}, 'url'=>{url path="/address"}]
|
||||
]}
|
||||
{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
@@ -24,7 +24,7 @@
|
||||
{form name="thelia.address.create"}
|
||||
<form id="form-address" class="form-horizontal" action="{url path="/address/create"}" method="post" role="form">
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path="/customer/account"}" /> {* the url the user is redirected to on login success *}
|
||||
<input type="hidden" name="{$name}" value="{url path="/account"}" /> {* the url the user is redirected to on login success *}
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='error_message'}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
.magnify {
|
||||
position: relative;
|
||||
cursor: none
|
||||
}
|
||||
|
||||
.magnify-large {
|
||||
position: absolute;
|
||||
display: none;
|
||||
width: 175px;
|
||||
height: 175px;
|
||||
|
||||
-webkit-box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.85), 0 0 7px 7px rgba(0, 0, 0, 0.25), inset 0 0 40px 2px rgba(0, 0, 0, 0.25);
|
||||
-moz-box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.85), 0 0 7px 7px rgba(0, 0, 0, 0.25), inset 0 0 40px 2px rgba(0, 0, 0, 0.25);
|
||||
box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.85), 0 0 7px 7px rgba(0, 0, 0, 0.25), inset 0 0 40px 2px rgba(0, 0, 0, 0.25);
|
||||
|
||||
-webkit-border-radius: 100%;
|
||||
-moz-border-radius: 100%;
|
||||
border-radius: 100%
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
.magnify{position:relative;cursor:none}.magnify-large{position:absolute;display:none;width:175px;height:175px;-webkit-box-shadow:0 0 0 7px rgba(255,255,255,0.85),0 0 7px 7px rgba(0,0,0,0.25),inset 0 0 40px 2px rgba(0,0,0,0.25);-moz-box-shadow:0 0 0 7px rgba(255,255,255,0.85),0 0 7px 7px rgba(0,0,0,0.25),inset 0 0 40px 2px rgba(0,0,0,0.25);box-shadow:0 0 0 7px rgba(255,255,255,0.85),0 0 7px 7px rgba(0,0,0,0.25),inset 0 0 40px 2px rgba(0,0,0,0.25);-webkit-border-radius:100%;-moz-border-radius:100%;border-radius:100%}
|
||||
BIN
templates/default/assets/img/ajax-loader.gif
Normal file
BIN
templates/default/assets/img/ajax-loader.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -1,126 +0,0 @@
|
||||
/* ========================================================================
|
||||
* Bootstrap: affix.js v3.0.0
|
||||
* http://twbs.github.com/bootstrap/javascript.html#affix
|
||||
* ========================================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
+function ($) { "use strict";
|
||||
|
||||
// AFFIX CLASS DEFINITION
|
||||
// ======================
|
||||
|
||||
var Affix = function (element, options) {
|
||||
this.options = $.extend({}, Affix.DEFAULTS, options)
|
||||
this.$window = $(window)
|
||||
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
|
||||
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
|
||||
|
||||
this.$element = $(element)
|
||||
this.affixed =
|
||||
this.unpin = null
|
||||
|
||||
this.checkPosition()
|
||||
}
|
||||
|
||||
Affix.RESET = 'affix affix-top affix-bottom'
|
||||
|
||||
Affix.DEFAULTS = {
|
||||
offset: 0
|
||||
}
|
||||
|
||||
Affix.prototype.checkPositionWithEventLoop = function () {
|
||||
setTimeout($.proxy(this.checkPosition, this), 1)
|
||||
}
|
||||
|
||||
Affix.prototype.checkPosition = function () {
|
||||
if (!this.$element.is(':visible')) return
|
||||
|
||||
var scrollHeight = $(document).height()
|
||||
var scrollTop = this.$window.scrollTop()
|
||||
var position = this.$element.offset()
|
||||
var offset = this.options.offset
|
||||
var offsetTop = offset.top
|
||||
var offsetBottom = offset.bottom
|
||||
|
||||
if (typeof offset != 'object') offsetBottom = offsetTop = offset
|
||||
if (typeof offsetTop == 'function') offsetTop = offset.top()
|
||||
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
|
||||
|
||||
var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
|
||||
offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
|
||||
offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
|
||||
|
||||
if (this.affixed === affix) return
|
||||
if (this.unpin) this.$element.css('top', '')
|
||||
|
||||
this.affixed = affix
|
||||
this.unpin = affix == 'bottom' ? position.top - scrollTop : null
|
||||
|
||||
this.$element.removeClass(Affix.RESET).addClass('affix' + (affix ? '-' + affix : ''))
|
||||
|
||||
if (affix == 'bottom') {
|
||||
this.$element.offset({ top: document.body.offsetHeight - offsetBottom - this.$element.height() })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// AFFIX PLUGIN DEFINITION
|
||||
// =======================
|
||||
|
||||
var old = $.fn.affix
|
||||
|
||||
$.fn.affix = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('bs.affix')
|
||||
var options = typeof option == 'object' && option
|
||||
|
||||
if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
|
||||
if (typeof option == 'string') data[option]()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.affix.Constructor = Affix
|
||||
|
||||
|
||||
// AFFIX NO CONFLICT
|
||||
// =================
|
||||
|
||||
$.fn.affix.noConflict = function () {
|
||||
$.fn.affix = old
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
// AFFIX DATA-API
|
||||
// ==============
|
||||
|
||||
$(window).on('load', function () {
|
||||
$('[data-spy="affix"]').each(function () {
|
||||
var $spy = $(this)
|
||||
var data = $spy.data()
|
||||
|
||||
data.offset = data.offset || {}
|
||||
|
||||
if (data.offsetBottom) data.offset.bottom = data.offsetBottom
|
||||
if (data.offsetTop) data.offset.top = data.offsetTop
|
||||
|
||||
$spy.affix(data)
|
||||
})
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
||||
@@ -1,98 +0,0 @@
|
||||
/* ========================================================================
|
||||
* Bootstrap: alert.js v3.0.0
|
||||
* http://twbs.github.com/bootstrap/javascript.html#alerts
|
||||
* ========================================================================
|
||||
* Copyright 2013 Twitter, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
+function ($) { "use strict";
|
||||
|
||||
// ALERT CLASS DEFINITION
|
||||
// ======================
|
||||
|
||||
var dismiss = '[data-dismiss="alert"]'
|
||||
var Alert = function (el) {
|
||||
$(el).on('click', dismiss, this.close)
|
||||
}
|
||||
|
||||
Alert.prototype.close = function (e) {
|
||||
var $this = $(this)
|
||||
var selector = $this.attr('data-target')
|
||||
|
||||
if (!selector) {
|
||||
selector = $this.attr('href')
|
||||
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
|
||||
}
|
||||
|
||||
var $parent = $(selector)
|
||||
|
||||
if (e) e.preventDefault()
|
||||
|
||||
if (!$parent.length) {
|
||||
$parent = $this.hasClass('alert') ? $this : $this.parent()
|
||||
}
|
||||
|
||||
$parent.trigger(e = $.Event('close.bs.alert'))
|
||||
|
||||
if (e.isDefaultPrevented()) return
|
||||
|
||||
$parent.removeClass('in')
|
||||
|
||||
function removeElement() {
|
||||
$parent.trigger('closed.bs.alert').remove()
|
||||
}
|
||||
|
||||
$.support.transition && $parent.hasClass('fade') ?
|
||||
$parent
|
||||
.one($.support.transition.end, removeElement)
|
||||
.emulateTransitionEnd(150) :
|
||||
removeElement()
|
||||
}
|
||||
|
||||
|
||||
// ALERT PLUGIN DEFINITION
|
||||
// =======================
|
||||
|
||||
var old = $.fn.alert
|
||||
|
||||
$.fn.alert = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('bs.alert')
|
||||
|
||||
if (!data) $this.data('bs.alert', (data = new Alert(this)))
|
||||
if (typeof option == 'string') data[option].call($this)
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.alert.Constructor = Alert
|
||||
|
||||
|
||||
// ALERT NO CONFLICT
|
||||
// =================
|
||||
|
||||
$.fn.alert.noConflict = function () {
|
||||
$.fn.alert = old
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
// ALERT DATA-API
|
||||
// ==============
|
||||
|
||||
$(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
|
||||
|
||||
}(window.jQuery);
|
||||
1999
templates/default/assets/js/bootstrap/bootstrap.js
vendored
Executable file
1999
templates/default/assets/js/bootstrap/bootstrap.js
vendored
Executable file
File diff suppressed because it is too large
Load Diff
6
templates/default/assets/js/bootstrap/bootstrap.min.js
vendored
Executable file
6
templates/default/assets/js/bootstrap/bootstrap.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
@@ -1,109 +0,0 @@
|
||||
/* ========================================================================
|
||||
* Bootstrap: button.js v3.0.0
|
||||
* http://twbs.github.com/bootstrap/javascript.html#buttons
|
||||
* ========================================================================
|
||||
* Copyright 2013 Twitter, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
+function ($) { "use strict";
|
||||
|
||||
// BUTTON PUBLIC CLASS DEFINITION
|
||||
// ==============================
|
||||
|
||||
var Button = function (element, options) {
|
||||
this.$element = $(element)
|
||||
this.options = $.extend({}, Button.DEFAULTS, options)
|
||||
}
|
||||
|
||||
Button.DEFAULTS = {
|
||||
loadingText: 'loading...'
|
||||
}
|
||||
|
||||
Button.prototype.setState = function (state) {
|
||||
var d = 'disabled'
|
||||
var $el = this.$element
|
||||
var val = $el.is('input') ? 'val' : 'html'
|
||||
var data = $el.data()
|
||||
|
||||
state = state + 'Text'
|
||||
|
||||
if (!data.resetText) $el.data('resetText', $el[val]())
|
||||
|
||||
$el[val](data[state] || this.options[state])
|
||||
|
||||
// push to event loop to allow forms to submit
|
||||
setTimeout(function () {
|
||||
state == 'loadingText' ?
|
||||
$el.addClass(d).attr(d, d) :
|
||||
$el.removeClass(d).removeAttr(d);
|
||||
}, 0)
|
||||
}
|
||||
|
||||
Button.prototype.toggle = function () {
|
||||
var $parent = this.$element.closest('[data-toggle="buttons"]')
|
||||
|
||||
if ($parent.length) {
|
||||
var $input = this.$element.find('input')
|
||||
.prop('checked', !this.$element.hasClass('active'))
|
||||
.trigger('change')
|
||||
if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active')
|
||||
}
|
||||
|
||||
this.$element.toggleClass('active')
|
||||
}
|
||||
|
||||
|
||||
// BUTTON PLUGIN DEFINITION
|
||||
// ========================
|
||||
|
||||
var old = $.fn.button
|
||||
|
||||
$.fn.button = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('bs.button')
|
||||
var options = typeof option == 'object' && option
|
||||
|
||||
if (!data) $this.data('bs.button', (data = new Button(this, options)))
|
||||
|
||||
if (option == 'toggle') data.toggle()
|
||||
else if (option) data.setState(option)
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.button.Constructor = Button
|
||||
|
||||
|
||||
// BUTTON NO CONFLICT
|
||||
// ==================
|
||||
|
||||
$.fn.button.noConflict = function () {
|
||||
$.fn.button = old
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
// BUTTON DATA-API
|
||||
// ===============
|
||||
|
||||
$(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {
|
||||
var $btn = $(e.target)
|
||||
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
|
||||
$btn.button('toggle')
|
||||
e.preventDefault()
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
||||
@@ -1,217 +0,0 @@
|
||||
/* ========================================================================
|
||||
* Bootstrap: carousel.js v3.0.0
|
||||
* http://twbs.github.com/bootstrap/javascript.html#carousel
|
||||
* ========================================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
+function ($) { "use strict";
|
||||
|
||||
// CAROUSEL CLASS DEFINITION
|
||||
// =========================
|
||||
|
||||
var Carousel = function (element, options) {
|
||||
this.$element = $(element)
|
||||
this.$indicators = this.$element.find('.carousel-indicators')
|
||||
this.options = options
|
||||
this.paused =
|
||||
this.sliding =
|
||||
this.interval =
|
||||
this.$active =
|
||||
this.$items = null
|
||||
|
||||
this.options.pause == 'hover' && this.$element
|
||||
.on('mouseenter', $.proxy(this.pause, this))
|
||||
.on('mouseleave', $.proxy(this.cycle, this))
|
||||
}
|
||||
|
||||
Carousel.DEFAULTS = {
|
||||
interval: 5000
|
||||
, pause: 'hover'
|
||||
, wrap: true
|
||||
}
|
||||
|
||||
Carousel.prototype.cycle = function (e) {
|
||||
e || (this.paused = false)
|
||||
|
||||
this.interval && clearInterval(this.interval)
|
||||
|
||||
this.options.interval
|
||||
&& !this.paused
|
||||
&& (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
Carousel.prototype.getActiveIndex = function () {
|
||||
this.$active = this.$element.find('.item.active')
|
||||
this.$items = this.$active.parent().children()
|
||||
|
||||
return this.$items.index(this.$active)
|
||||
}
|
||||
|
||||
Carousel.prototype.to = function (pos) {
|
||||
var that = this
|
||||
var activeIndex = this.getActiveIndex()
|
||||
|
||||
if (pos > (this.$items.length - 1) || pos < 0) return
|
||||
|
||||
if (this.sliding) return this.$element.one('slid', function () { that.to(pos) })
|
||||
if (activeIndex == pos) return this.pause().cycle()
|
||||
|
||||
return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
|
||||
}
|
||||
|
||||
Carousel.prototype.pause = function (e) {
|
||||
e || (this.paused = true)
|
||||
|
||||
if (this.$element.find('.next, .prev').length && $.support.transition.end) {
|
||||
this.$element.trigger($.support.transition.end)
|
||||
this.cycle(true)
|
||||
}
|
||||
|
||||
this.interval = clearInterval(this.interval)
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
Carousel.prototype.next = function () {
|
||||
if (this.sliding) return
|
||||
return this.slide('next')
|
||||
}
|
||||
|
||||
Carousel.prototype.prev = function () {
|
||||
if (this.sliding) return
|
||||
return this.slide('prev')
|
||||
}
|
||||
|
||||
Carousel.prototype.slide = function (type, next) {
|
||||
var $active = this.$element.find('.item.active')
|
||||
var $next = next || $active[type]()
|
||||
var isCycling = this.interval
|
||||
var direction = type == 'next' ? 'left' : 'right'
|
||||
var fallback = type == 'next' ? 'first' : 'last'
|
||||
var that = this
|
||||
|
||||
if (!$next.length) {
|
||||
if (!this.options.wrap) return
|
||||
$next = this.$element.find('.item')[fallback]()
|
||||
}
|
||||
|
||||
this.sliding = true
|
||||
|
||||
isCycling && this.pause()
|
||||
|
||||
var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
|
||||
|
||||
if ($next.hasClass('active')) return
|
||||
|
||||
if (this.$indicators.length) {
|
||||
this.$indicators.find('.active').removeClass('active')
|
||||
this.$element.one('slid', function () {
|
||||
var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
|
||||
$nextIndicator && $nextIndicator.addClass('active')
|
||||
})
|
||||
}
|
||||
|
||||
if ($.support.transition && this.$element.hasClass('slide')) {
|
||||
this.$element.trigger(e)
|
||||
if (e.isDefaultPrevented()) return
|
||||
$next.addClass(type)
|
||||
$next[0].offsetWidth // force reflow
|
||||
$active.addClass(direction)
|
||||
$next.addClass(direction)
|
||||
$active
|
||||
.one($.support.transition.end, function () {
|
||||
$next.removeClass([type, direction].join(' ')).addClass('active')
|
||||
$active.removeClass(['active', direction].join(' '))
|
||||
that.sliding = false
|
||||
setTimeout(function () { that.$element.trigger('slid') }, 0)
|
||||
})
|
||||
.emulateTransitionEnd(600)
|
||||
} else {
|
||||
this.$element.trigger(e)
|
||||
if (e.isDefaultPrevented()) return
|
||||
$active.removeClass('active')
|
||||
$next.addClass('active')
|
||||
this.sliding = false
|
||||
this.$element.trigger('slid')
|
||||
}
|
||||
|
||||
isCycling && this.cycle()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
// CAROUSEL PLUGIN DEFINITION
|
||||
// ==========================
|
||||
|
||||
var old = $.fn.carousel
|
||||
|
||||
$.fn.carousel = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('bs.carousel')
|
||||
var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
var action = typeof option == 'string' ? option : options.slide
|
||||
|
||||
if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
|
||||
if (typeof option == 'number') data.to(option)
|
||||
else if (action) data[action]()
|
||||
else if (options.interval) data.pause().cycle()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.carousel.Constructor = Carousel
|
||||
|
||||
|
||||
// CAROUSEL NO CONFLICT
|
||||
// ====================
|
||||
|
||||
$.fn.carousel.noConflict = function () {
|
||||
$.fn.carousel = old
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
// CAROUSEL DATA-API
|
||||
// =================
|
||||
|
||||
$(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
|
||||
var $this = $(this), href
|
||||
var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
||||
var options = $.extend({}, $target.data(), $this.data())
|
||||
var slideIndex = $this.attr('data-slide-to')
|
||||
if (slideIndex) options.interval = false
|
||||
|
||||
$target.carousel(options)
|
||||
|
||||
if (slideIndex = $this.attr('data-slide-to')) {
|
||||
$target.data('bs.carousel').to(slideIndex)
|
||||
}
|
||||
|
||||
e.preventDefault()
|
||||
})
|
||||
|
||||
$(window).on('load', function () {
|
||||
$('[data-ride="carousel"]').each(function () {
|
||||
var $carousel = $(this)
|
||||
$carousel.carousel($carousel.data())
|
||||
})
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
||||
@@ -1,179 +0,0 @@
|
||||
/* ========================================================================
|
||||
* Bootstrap: collapse.js v3.0.0
|
||||
* http://twbs.github.com/bootstrap/javascript.html#collapse
|
||||
* ========================================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
+function ($) { "use strict";
|
||||
|
||||
// COLLAPSE PUBLIC CLASS DEFINITION
|
||||
// ================================
|
||||
|
||||
var Collapse = function (element, options) {
|
||||
this.$element = $(element)
|
||||
this.options = $.extend({}, Collapse.DEFAULTS, options)
|
||||
this.transitioning = null
|
||||
|
||||
if (this.options.parent) this.$parent = $(this.options.parent)
|
||||
if (this.options.toggle) this.toggle()
|
||||
}
|
||||
|
||||
Collapse.DEFAULTS = {
|
||||
toggle: true
|
||||
}
|
||||
|
||||
Collapse.prototype.dimension = function () {
|
||||
var hasWidth = this.$element.hasClass('width')
|
||||
return hasWidth ? 'width' : 'height'
|
||||
}
|
||||
|
||||
Collapse.prototype.show = function () {
|
||||
if (this.transitioning || this.$element.hasClass('in')) return
|
||||
|
||||
var startEvent = $.Event('show.bs.collapse')
|
||||
this.$element.trigger(startEvent)
|
||||
if (startEvent.isDefaultPrevented()) return
|
||||
|
||||
var actives = this.$parent && this.$parent.find('> .panel > .in')
|
||||
|
||||
if (actives && actives.length) {
|
||||
var hasData = actives.data('bs.collapse')
|
||||
if (hasData && hasData.transitioning) return
|
||||
actives.collapse('hide')
|
||||
hasData || actives.data('bs.collapse', null)
|
||||
}
|
||||
|
||||
var dimension = this.dimension()
|
||||
|
||||
this.$element
|
||||
.removeClass('collapse')
|
||||
.addClass('collapsing')
|
||||
[dimension](0)
|
||||
|
||||
this.transitioning = 1
|
||||
|
||||
var complete = function () {
|
||||
this.$element
|
||||
.removeClass('collapsing')
|
||||
.addClass('in')
|
||||
[dimension]('auto')
|
||||
this.transitioning = 0
|
||||
this.$element.trigger('shown.bs.collapse')
|
||||
}
|
||||
|
||||
if (!$.support.transition) return complete.call(this)
|
||||
|
||||
var scrollSize = $.camelCase(['scroll', dimension].join('-'))
|
||||
|
||||
this.$element
|
||||
.one($.support.transition.end, $.proxy(complete, this))
|
||||
.emulateTransitionEnd(350)
|
||||
[dimension](this.$element[0][scrollSize])
|
||||
}
|
||||
|
||||
Collapse.prototype.hide = function () {
|
||||
if (this.transitioning || !this.$element.hasClass('in')) return
|
||||
|
||||
var startEvent = $.Event('hide.bs.collapse')
|
||||
this.$element.trigger(startEvent)
|
||||
if (startEvent.isDefaultPrevented()) return
|
||||
|
||||
var dimension = this.dimension()
|
||||
|
||||
this.$element
|
||||
[dimension](this.$element[dimension]())
|
||||
[0].offsetHeight
|
||||
|
||||
this.$element
|
||||
.addClass('collapsing')
|
||||
.removeClass('collapse')
|
||||
.removeClass('in')
|
||||
|
||||
this.transitioning = 1
|
||||
|
||||
var complete = function () {
|
||||
this.transitioning = 0
|
||||
this.$element
|
||||
.trigger('hidden.bs.collapse')
|
||||
.removeClass('collapsing')
|
||||
.addClass('collapse')
|
||||
}
|
||||
|
||||
if (!$.support.transition) return complete.call(this)
|
||||
|
||||
this.$element
|
||||
[dimension](0)
|
||||
.one($.support.transition.end, $.proxy(complete, this))
|
||||
.emulateTransitionEnd(350)
|
||||
}
|
||||
|
||||
Collapse.prototype.toggle = function () {
|
||||
this[this.$element.hasClass('in') ? 'hide' : 'show']()
|
||||
}
|
||||
|
||||
|
||||
// COLLAPSE PLUGIN DEFINITION
|
||||
// ==========================
|
||||
|
||||
var old = $.fn.collapse
|
||||
|
||||
$.fn.collapse = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('bs.collapse')
|
||||
var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
|
||||
if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
|
||||
if (typeof option == 'string') data[option]()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.collapse.Constructor = Collapse
|
||||
|
||||
|
||||
// COLLAPSE NO CONFLICT
|
||||
// ====================
|
||||
|
||||
$.fn.collapse.noConflict = function () {
|
||||
$.fn.collapse = old
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
// COLLAPSE DATA-API
|
||||
// =================
|
||||
|
||||
$(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
|
||||
var $this = $(this), href
|
||||
var target = $this.attr('data-target')
|
||||
|| e.preventDefault()
|
||||
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
|
||||
var $target = $(target)
|
||||
var data = $target.data('bs.collapse')
|
||||
var option = data ? 'toggle' : $this.data()
|
||||
var parent = $this.attr('data-parent')
|
||||
var $parent = parent && $(parent)
|
||||
|
||||
if (!data || !data.transitioning) {
|
||||
if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
|
||||
$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
|
||||
}
|
||||
|
||||
$target.collapse(option)
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
||||
@@ -1,154 +0,0 @@
|
||||
/* ========================================================================
|
||||
* Bootstrap: dropdown.js v3.0.0
|
||||
* http://twbs.github.com/bootstrap/javascript.html#dropdowns
|
||||
* ========================================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
+function ($) { "use strict";
|
||||
|
||||
// DROPDOWN CLASS DEFINITION
|
||||
// =========================
|
||||
|
||||
var backdrop = '.dropdown-backdrop'
|
||||
var toggle = '[data-toggle=dropdown]'
|
||||
var Dropdown = function (element) {
|
||||
var $el = $(element).on('click.bs.dropdown', this.toggle)
|
||||
}
|
||||
|
||||
Dropdown.prototype.toggle = function (e) {
|
||||
var $this = $(this)
|
||||
|
||||
if ($this.is('.disabled, :disabled')) return
|
||||
|
||||
var $parent = getParent($this)
|
||||
var isActive = $parent.hasClass('open')
|
||||
|
||||
clearMenus()
|
||||
|
||||
if (!isActive) {
|
||||
if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
|
||||
// if mobile we we use a backdrop because click events don't delegate
|
||||
$('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
|
||||
}
|
||||
|
||||
$parent.trigger(e = $.Event('show.bs.dropdown'))
|
||||
|
||||
if (e.isDefaultPrevented()) return
|
||||
|
||||
$parent
|
||||
.toggleClass('open')
|
||||
.trigger('shown.bs.dropdown')
|
||||
|
||||
$this.focus()
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
Dropdown.prototype.keydown = function (e) {
|
||||
if (!/(38|40|27)/.test(e.keyCode)) return
|
||||
|
||||
var $this = $(this)
|
||||
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
|
||||
if ($this.is('.disabled, :disabled')) return
|
||||
|
||||
var $parent = getParent($this)
|
||||
var isActive = $parent.hasClass('open')
|
||||
|
||||
if (!isActive || (isActive && e.keyCode == 27)) {
|
||||
if (e.which == 27) $parent.find(toggle).focus()
|
||||
return $this.click()
|
||||
}
|
||||
|
||||
var $items = $('[role=menu] li:not(.divider):visible a', $parent)
|
||||
|
||||
if (!$items.length) return
|
||||
|
||||
var index = $items.index($items.filter(':focus'))
|
||||
|
||||
if (e.keyCode == 38 && index > 0) index-- // up
|
||||
if (e.keyCode == 40 && index < $items.length - 1) index++ // down
|
||||
if (!~index) index=0
|
||||
|
||||
$items.eq(index).focus()
|
||||
}
|
||||
|
||||
function clearMenus() {
|
||||
$(backdrop).remove()
|
||||
$(toggle).each(function (e) {
|
||||
var $parent = getParent($(this))
|
||||
if (!$parent.hasClass('open')) return
|
||||
$parent.trigger(e = $.Event('hide.bs.dropdown'))
|
||||
if (e.isDefaultPrevented()) return
|
||||
$parent.removeClass('open').trigger('hidden.bs.dropdown')
|
||||
})
|
||||
}
|
||||
|
||||
function getParent($this) {
|
||||
var selector = $this.attr('data-target')
|
||||
|
||||
if (!selector) {
|
||||
selector = $this.attr('href')
|
||||
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
||||
}
|
||||
|
||||
var $parent = selector && $(selector)
|
||||
|
||||
return $parent && $parent.length ? $parent : $this.parent()
|
||||
}
|
||||
|
||||
|
||||
// DROPDOWN PLUGIN DEFINITION
|
||||
// ==========================
|
||||
|
||||
var old = $.fn.dropdown
|
||||
|
||||
$.fn.dropdown = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('dropdown')
|
||||
|
||||
if (!data) $this.data('dropdown', (data = new Dropdown(this)))
|
||||
if (typeof option == 'string') data[option].call($this)
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.dropdown.Constructor = Dropdown
|
||||
|
||||
|
||||
// DROPDOWN NO CONFLICT
|
||||
// ====================
|
||||
|
||||
$.fn.dropdown.noConflict = function () {
|
||||
$.fn.dropdown = old
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
// APPLY TO STANDARD DROPDOWN ELEMENTS
|
||||
// ===================================
|
||||
|
||||
$(document)
|
||||
.on('click.bs.dropdown.data-api', clearMenus)
|
||||
.on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
||||
.on('click.bs.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
|
||||
.on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
|
||||
|
||||
}(window.jQuery);
|
||||
@@ -1,246 +0,0 @@
|
||||
/* ========================================================================
|
||||
* Bootstrap: modal.js v3.0.0
|
||||
* http://twbs.github.com/bootstrap/javascript.html#modals
|
||||
* ========================================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
+function ($) { "use strict";
|
||||
|
||||
// MODAL CLASS DEFINITION
|
||||
// ======================
|
||||
|
||||
var Modal = function (element, options) {
|
||||
this.options = options
|
||||
this.$element = $(element)
|
||||
this.$backdrop =
|
||||
this.isShown = null
|
||||
|
||||
if (this.options.remote) this.$element.load(this.options.remote)
|
||||
}
|
||||
|
||||
Modal.DEFAULTS = {
|
||||
backdrop: true
|
||||
, keyboard: true
|
||||
, show: true
|
||||
}
|
||||
|
||||
Modal.prototype.toggle = function (_relatedTarget) {
|
||||
return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
|
||||
}
|
||||
|
||||
Modal.prototype.show = function (_relatedTarget) {
|
||||
var that = this
|
||||
var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
|
||||
|
||||
this.$element.trigger(e)
|
||||
|
||||
if (this.isShown || e.isDefaultPrevented()) return
|
||||
|
||||
this.isShown = true
|
||||
|
||||
this.escape()
|
||||
|
||||
this.$element.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
|
||||
|
||||
this.backdrop(function () {
|
||||
var transition = $.support.transition && that.$element.hasClass('fade')
|
||||
|
||||
if (!that.$element.parent().length) {
|
||||
that.$element.appendTo(document.body) // don't move modals dom position
|
||||
}
|
||||
|
||||
that.$element.show()
|
||||
|
||||
if (transition) {
|
||||
that.$element[0].offsetWidth // force reflow
|
||||
}
|
||||
|
||||
that.$element
|
||||
.addClass('in')
|
||||
.attr('aria-hidden', false)
|
||||
|
||||
that.enforceFocus()
|
||||
|
||||
var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
|
||||
|
||||
transition ?
|
||||
that.$element.find('.modal-dialog') // wait for modal to slide in
|
||||
.one($.support.transition.end, function () {
|
||||
that.$element.focus().trigger(e)
|
||||
})
|
||||
.emulateTransitionEnd(300) :
|
||||
that.$element.focus().trigger(e)
|
||||
})
|
||||
}
|
||||
|
||||
Modal.prototype.hide = function (e) {
|
||||
if (e) e.preventDefault()
|
||||
|
||||
e = $.Event('hide.bs.modal')
|
||||
|
||||
this.$element.trigger(e)
|
||||
|
||||
if (!this.isShown || e.isDefaultPrevented()) return
|
||||
|
||||
this.isShown = false
|
||||
|
||||
this.escape()
|
||||
|
||||
$(document).off('focusin.bs.modal')
|
||||
|
||||
this.$element
|
||||
.removeClass('in')
|
||||
.attr('aria-hidden', true)
|
||||
.off('click.dismiss.modal')
|
||||
|
||||
$.support.transition && this.$element.hasClass('fade') ?
|
||||
this.$element
|
||||
.one($.support.transition.end, $.proxy(this.hideModal, this))
|
||||
.emulateTransitionEnd(300) :
|
||||
this.hideModal()
|
||||
}
|
||||
|
||||
Modal.prototype.enforceFocus = function () {
|
||||
$(document)
|
||||
.off('focusin.bs.modal') // guard against infinite focus loop
|
||||
.on('focusin.bs.modal', $.proxy(function (e) {
|
||||
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
|
||||
this.$element.focus()
|
||||
}
|
||||
}, this))
|
||||
}
|
||||
|
||||
Modal.prototype.escape = function () {
|
||||
if (this.isShown && this.options.keyboard) {
|
||||
this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
|
||||
e.which == 27 && this.hide()
|
||||
}, this))
|
||||
} else if (!this.isShown) {
|
||||
this.$element.off('keyup.dismiss.bs.modal')
|
||||
}
|
||||
}
|
||||
|
||||
Modal.prototype.hideModal = function () {
|
||||
var that = this
|
||||
this.$element.hide()
|
||||
this.backdrop(function () {
|
||||
that.removeBackdrop()
|
||||
that.$element.trigger('hidden.bs.modal')
|
||||
})
|
||||
}
|
||||
|
||||
Modal.prototype.removeBackdrop = function () {
|
||||
this.$backdrop && this.$backdrop.remove()
|
||||
this.$backdrop = null
|
||||
}
|
||||
|
||||
Modal.prototype.backdrop = function (callback) {
|
||||
var that = this
|
||||
var animate = this.$element.hasClass('fade') ? 'fade' : ''
|
||||
|
||||
if (this.isShown && this.options.backdrop) {
|
||||
var doAnimate = $.support.transition && animate
|
||||
|
||||
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
||||
.appendTo(document.body)
|
||||
|
||||
this.$element.on('click.dismiss.modal', $.proxy(function (e) {
|
||||
if (e.target !== e.currentTarget) return
|
||||
this.options.backdrop == 'static'
|
||||
? this.$element[0].focus.call(this.$element[0])
|
||||
: this.hide.call(this)
|
||||
}, this))
|
||||
|
||||
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
|
||||
|
||||
this.$backdrop.addClass('in')
|
||||
|
||||
if (!callback) return
|
||||
|
||||
doAnimate ?
|
||||
this.$backdrop
|
||||
.one($.support.transition.end, callback)
|
||||
.emulateTransitionEnd(150) :
|
||||
callback()
|
||||
|
||||
} else if (!this.isShown && this.$backdrop) {
|
||||
this.$backdrop.removeClass('in')
|
||||
|
||||
$.support.transition && this.$element.hasClass('fade')?
|
||||
this.$backdrop
|
||||
.one($.support.transition.end, callback)
|
||||
.emulateTransitionEnd(150) :
|
||||
callback()
|
||||
|
||||
} else if (callback) {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MODAL PLUGIN DEFINITION
|
||||
// =======================
|
||||
|
||||
var old = $.fn.modal
|
||||
|
||||
$.fn.modal = function (option, _relatedTarget) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('bs.modal')
|
||||
var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
|
||||
if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
|
||||
if (typeof option == 'string') data[option](_relatedTarget)
|
||||
else if (options.show) data.show(_relatedTarget)
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.modal.Constructor = Modal
|
||||
|
||||
|
||||
// MODAL NO CONFLICT
|
||||
// =================
|
||||
|
||||
$.fn.modal.noConflict = function () {
|
||||
$.fn.modal = old
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
// MODAL DATA-API
|
||||
// ==============
|
||||
|
||||
$(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
|
||||
var $this = $(this)
|
||||
var href = $this.attr('href')
|
||||
var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
|
||||
var option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
|
||||
|
||||
e.preventDefault()
|
||||
|
||||
$target
|
||||
.modal(option, this)
|
||||
.one('hide', function () {
|
||||
$this.is(':visible') && $this.focus()
|
||||
})
|
||||
})
|
||||
|
||||
$(document)
|
||||
.on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
|
||||
.on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
|
||||
|
||||
}(window.jQuery);
|
||||
@@ -1,117 +0,0 @@
|
||||
/* ========================================================================
|
||||
* Bootstrap: popover.js v3.0.0
|
||||
* http://twbs.github.com/bootstrap/javascript.html#popovers
|
||||
* ========================================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
+function ($) { "use strict";
|
||||
|
||||
// POPOVER PUBLIC CLASS DEFINITION
|
||||
// ===============================
|
||||
|
||||
var Popover = function (element, options) {
|
||||
this.init('popover', element, options)
|
||||
}
|
||||
|
||||
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
|
||||
|
||||
Popover.DEFAULTS = $.extend({} , $.fn.tooltip.Constructor.DEFAULTS, {
|
||||
placement: 'right'
|
||||
, trigger: 'click'
|
||||
, content: ''
|
||||
, template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
|
||||
})
|
||||
|
||||
|
||||
// NOTE: POPOVER EXTENDS tooltip.js
|
||||
// ================================
|
||||
|
||||
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
|
||||
|
||||
Popover.prototype.constructor = Popover
|
||||
|
||||
Popover.prototype.getDefaults = function () {
|
||||
return Popover.DEFAULTS
|
||||
}
|
||||
|
||||
Popover.prototype.setContent = function () {
|
||||
var $tip = this.tip()
|
||||
var title = this.getTitle()
|
||||
var content = this.getContent()
|
||||
|
||||
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
|
||||
$tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
|
||||
|
||||
$tip.removeClass('fade top bottom left right in')
|
||||
|
||||
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
|
||||
// this manually by checking the contents.
|
||||
if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
|
||||
}
|
||||
|
||||
Popover.prototype.hasContent = function () {
|
||||
return this.getTitle() || this.getContent()
|
||||
}
|
||||
|
||||
Popover.prototype.getContent = function () {
|
||||
var $e = this.$element
|
||||
var o = this.options
|
||||
|
||||
return $e.attr('data-content')
|
||||
|| (typeof o.content == 'function' ?
|
||||
o.content.call($e[0]) :
|
||||
o.content)
|
||||
}
|
||||
|
||||
Popover.prototype.arrow = function () {
|
||||
return this.$arrow = this.$arrow || this.tip().find('.arrow')
|
||||
}
|
||||
|
||||
Popover.prototype.tip = function () {
|
||||
if (!this.$tip) this.$tip = $(this.options.template)
|
||||
return this.$tip
|
||||
}
|
||||
|
||||
|
||||
// POPOVER PLUGIN DEFINITION
|
||||
// =========================
|
||||
|
||||
var old = $.fn.popover
|
||||
|
||||
$.fn.popover = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('bs.popover')
|
||||
var options = typeof option == 'object' && option
|
||||
|
||||
if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
|
||||
if (typeof option == 'string') data[option]()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.popover.Constructor = Popover
|
||||
|
||||
|
||||
// POPOVER NO CONFLICT
|
||||
// ===================
|
||||
|
||||
$.fn.popover.noConflict = function () {
|
||||
$.fn.popover = old
|
||||
return this
|
||||
}
|
||||
|
||||
}(window.jQuery);
|
||||
@@ -1,158 +0,0 @@
|
||||
/* ========================================================================
|
||||
* Bootstrap: scrollspy.js v3.0.0
|
||||
* http://twbs.github.com/bootstrap/javascript.html#scrollspy
|
||||
* ========================================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
+function ($) { "use strict";
|
||||
|
||||
// SCROLLSPY CLASS DEFINITION
|
||||
// ==========================
|
||||
|
||||
function ScrollSpy(element, options) {
|
||||
var href
|
||||
var process = $.proxy(this.process, this)
|
||||
|
||||
this.$element = $(element).is('body') ? $(window) : $(element)
|
||||
this.$body = $('body')
|
||||
this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process)
|
||||
this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
|
||||
this.selector = (this.options.target
|
||||
|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
||||
|| '') + ' .nav li > a'
|
||||
this.offsets = $([])
|
||||
this.targets = $([])
|
||||
this.activeTarget = null
|
||||
|
||||
this.refresh()
|
||||
this.process()
|
||||
}
|
||||
|
||||
ScrollSpy.DEFAULTS = {
|
||||
offset: 10
|
||||
}
|
||||
|
||||
ScrollSpy.prototype.refresh = function () {
|
||||
var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
|
||||
|
||||
this.offsets = $([])
|
||||
this.targets = $([])
|
||||
|
||||
var self = this
|
||||
var $targets = this.$body
|
||||
.find(this.selector)
|
||||
.map(function () {
|
||||
var $el = $(this)
|
||||
var href = $el.data('target') || $el.attr('href')
|
||||
var $href = /^#\w/.test(href) && $(href)
|
||||
|
||||
return ($href
|
||||
&& $href.length
|
||||
&& [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null
|
||||
})
|
||||
.sort(function (a, b) { return a[0] - b[0] })
|
||||
.each(function () {
|
||||
self.offsets.push(this[0])
|
||||
self.targets.push(this[1])
|
||||
})
|
||||
}
|
||||
|
||||
ScrollSpy.prototype.process = function () {
|
||||
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
|
||||
var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
|
||||
var maxScroll = scrollHeight - this.$scrollElement.height()
|
||||
var offsets = this.offsets
|
||||
var targets = this.targets
|
||||
var activeTarget = this.activeTarget
|
||||
var i
|
||||
|
||||
if (scrollTop >= maxScroll) {
|
||||
return activeTarget != (i = targets.last()[0]) && this.activate(i)
|
||||
}
|
||||
|
||||
for (i = offsets.length; i--;) {
|
||||
activeTarget != targets[i]
|
||||
&& scrollTop >= offsets[i]
|
||||
&& (!offsets[i + 1] || scrollTop <= offsets[i + 1])
|
||||
&& this.activate( targets[i] )
|
||||
}
|
||||
}
|
||||
|
||||
ScrollSpy.prototype.activate = function (target) {
|
||||
this.activeTarget = target
|
||||
|
||||
$(this.selector)
|
||||
.parents('.active')
|
||||
.removeClass('active')
|
||||
|
||||
var selector = this.selector
|
||||
+ '[data-target="' + target + '"],'
|
||||
+ this.selector + '[href="' + target + '"]'
|
||||
|
||||
var active = $(selector)
|
||||
.parents('li')
|
||||
.addClass('active')
|
||||
|
||||
if (active.parent('.dropdown-menu').length) {
|
||||
active = active
|
||||
.closest('li.dropdown')
|
||||
.addClass('active')
|
||||
}
|
||||
|
||||
active.trigger('activate')
|
||||
}
|
||||
|
||||
|
||||
// SCROLLSPY PLUGIN DEFINITION
|
||||
// ===========================
|
||||
|
||||
var old = $.fn.scrollspy
|
||||
|
||||
$.fn.scrollspy = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('bs.scrollspy')
|
||||
var options = typeof option == 'object' && option
|
||||
|
||||
if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
|
||||
if (typeof option == 'string') data[option]()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.scrollspy.Constructor = ScrollSpy
|
||||
|
||||
|
||||
// SCROLLSPY NO CONFLICT
|
||||
// =====================
|
||||
|
||||
$.fn.scrollspy.noConflict = function () {
|
||||
$.fn.scrollspy = old
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
// SCROLLSPY DATA-API
|
||||
// ==================
|
||||
|
||||
$(window).on('load', function () {
|
||||
$('[data-spy="scroll"]').each(function () {
|
||||
var $spy = $(this)
|
||||
$spy.scrollspy($spy.data())
|
||||
})
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
||||
@@ -1,135 +0,0 @@
|
||||
/* ========================================================================
|
||||
* Bootstrap: tab.js v3.0.0
|
||||
* http://twbs.github.com/bootstrap/javascript.html#tabs
|
||||
* ========================================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
+function ($) { "use strict";
|
||||
|
||||
// TAB CLASS DEFINITION
|
||||
// ====================
|
||||
|
||||
var Tab = function (element) {
|
||||
this.element = $(element)
|
||||
}
|
||||
|
||||
Tab.prototype.show = function () {
|
||||
var $this = this.element
|
||||
var $ul = $this.closest('ul:not(.dropdown-menu)')
|
||||
var selector = $this.attr('data-target')
|
||||
|
||||
if (!selector) {
|
||||
selector = $this.attr('href')
|
||||
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
||||
}
|
||||
|
||||
if ($this.parent('li').hasClass('active')) return
|
||||
|
||||
var previous = $ul.find('.active:last a')[0]
|
||||
var e = $.Event('show.bs.tab', {
|
||||
relatedTarget: previous
|
||||
})
|
||||
|
||||
$this.trigger(e)
|
||||
|
||||
if (e.isDefaultPrevented()) return
|
||||
|
||||
var $target = $(selector)
|
||||
|
||||
this.activate($this.parent('li'), $ul)
|
||||
this.activate($target, $target.parent(), function () {
|
||||
$this.trigger({
|
||||
type: 'shown.bs.tab'
|
||||
, relatedTarget: previous
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Tab.prototype.activate = function (element, container, callback) {
|
||||
var $active = container.find('> .active')
|
||||
var transition = callback
|
||||
&& $.support.transition
|
||||
&& $active.hasClass('fade')
|
||||
|
||||
function next() {
|
||||
$active
|
||||
.removeClass('active')
|
||||
.find('> .dropdown-menu > .active')
|
||||
.removeClass('active')
|
||||
|
||||
element.addClass('active')
|
||||
|
||||
if (transition) {
|
||||
element[0].offsetWidth // reflow for transition
|
||||
element.addClass('in')
|
||||
} else {
|
||||
element.removeClass('fade')
|
||||
}
|
||||
|
||||
if (element.parent('.dropdown-menu')) {
|
||||
element.closest('li.dropdown').addClass('active')
|
||||
}
|
||||
|
||||
callback && callback()
|
||||
}
|
||||
|
||||
transition ?
|
||||
$active
|
||||
.one($.support.transition.end, next)
|
||||
.emulateTransitionEnd(150) :
|
||||
next()
|
||||
|
||||
$active.removeClass('in')
|
||||
}
|
||||
|
||||
|
||||
// TAB PLUGIN DEFINITION
|
||||
// =====================
|
||||
|
||||
var old = $.fn.tab
|
||||
|
||||
$.fn.tab = function ( option ) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('bs.tab')
|
||||
|
||||
if (!data) $this.data('bs.tab', (data = new Tab(this)))
|
||||
if (typeof option == 'string') data[option]()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.tab.Constructor = Tab
|
||||
|
||||
|
||||
// TAB NO CONFLICT
|
||||
// ===============
|
||||
|
||||
$.fn.tab.noConflict = function () {
|
||||
$.fn.tab = old
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
// TAB DATA-API
|
||||
// ============
|
||||
|
||||
$(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
|
||||
e.preventDefault()
|
||||
$(this).tab('show')
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
||||
@@ -1,386 +0,0 @@
|
||||
/* ========================================================================
|
||||
* Bootstrap: tooltip.js v3.0.0
|
||||
* http://twbs.github.com/bootstrap/javascript.html#tooltip
|
||||
* Inspired by the original jQuery.tipsy by Jason Frame
|
||||
* ========================================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
+function ($) { "use strict";
|
||||
|
||||
// TOOLTIP PUBLIC CLASS DEFINITION
|
||||
// ===============================
|
||||
|
||||
var Tooltip = function (element, options) {
|
||||
this.type =
|
||||
this.options =
|
||||
this.enabled =
|
||||
this.timeout =
|
||||
this.hoverState =
|
||||
this.$element = null
|
||||
|
||||
this.init('tooltip', element, options)
|
||||
}
|
||||
|
||||
Tooltip.DEFAULTS = {
|
||||
animation: true
|
||||
, placement: 'top'
|
||||
, selector: false
|
||||
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
|
||||
, trigger: 'hover focus'
|
||||
, title: ''
|
||||
, delay: 0
|
||||
, html: false
|
||||
, container: false
|
||||
}
|
||||
|
||||
Tooltip.prototype.init = function (type, element, options) {
|
||||
this.enabled = true
|
||||
this.type = type
|
||||
this.$element = $(element)
|
||||
this.options = this.getOptions(options)
|
||||
|
||||
var triggers = this.options.trigger.split(' ')
|
||||
|
||||
for (var i = triggers.length; i--;) {
|
||||
var trigger = triggers[i]
|
||||
|
||||
if (trigger == 'click') {
|
||||
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
|
||||
} else if (trigger != 'manual') {
|
||||
var eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
|
||||
var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
|
||||
|
||||
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
|
||||
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
|
||||
}
|
||||
}
|
||||
|
||||
this.options.selector ?
|
||||
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
|
||||
this.fixTitle()
|
||||
}
|
||||
|
||||
Tooltip.prototype.getDefaults = function () {
|
||||
return Tooltip.DEFAULTS
|
||||
}
|
||||
|
||||
Tooltip.prototype.getOptions = function (options) {
|
||||
options = $.extend({}, this.getDefaults(), this.$element.data(), options)
|
||||
|
||||
if (options.delay && typeof options.delay == 'number') {
|
||||
options.delay = {
|
||||
show: options.delay
|
||||
, hide: options.delay
|
||||
}
|
||||
}
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
Tooltip.prototype.getDelegateOptions = function () {
|
||||
var options = {}
|
||||
var defaults = this.getDefaults()
|
||||
|
||||
this._options && $.each(this._options, function (key, value) {
|
||||
if (defaults[key] != value) options[key] = value
|
||||
})
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
Tooltip.prototype.enter = function (obj) {
|
||||
var self = obj instanceof this.constructor ?
|
||||
obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
|
||||
|
||||
clearTimeout(self.timeout)
|
||||
|
||||
self.hoverState = 'in'
|
||||
|
||||
if (!self.options.delay || !self.options.delay.show) return self.show()
|
||||
|
||||
self.timeout = setTimeout(function () {
|
||||
if (self.hoverState == 'in') self.show()
|
||||
}, self.options.delay.show)
|
||||
}
|
||||
|
||||
Tooltip.prototype.leave = function (obj) {
|
||||
var self = obj instanceof this.constructor ?
|
||||
obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
|
||||
|
||||
clearTimeout(self.timeout)
|
||||
|
||||
self.hoverState = 'out'
|
||||
|
||||
if (!self.options.delay || !self.options.delay.hide) return self.hide()
|
||||
|
||||
self.timeout = setTimeout(function () {
|
||||
if (self.hoverState == 'out') self.hide()
|
||||
}, self.options.delay.hide)
|
||||
}
|
||||
|
||||
Tooltip.prototype.show = function () {
|
||||
var e = $.Event('show.bs.'+ this.type)
|
||||
|
||||
if (this.hasContent() && this.enabled) {
|
||||
this.$element.trigger(e)
|
||||
|
||||
if (e.isDefaultPrevented()) return
|
||||
|
||||
var $tip = this.tip()
|
||||
|
||||
this.setContent()
|
||||
|
||||
if (this.options.animation) $tip.addClass('fade')
|
||||
|
||||
var placement = typeof this.options.placement == 'function' ?
|
||||
this.options.placement.call(this, $tip[0], this.$element[0]) :
|
||||
this.options.placement
|
||||
|
||||
var autoToken = /\s?auto?\s?/i
|
||||
var autoPlace = autoToken.test(placement)
|
||||
if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
|
||||
|
||||
$tip
|
||||
.detach()
|
||||
.css({ top: 0, left: 0, display: 'block' })
|
||||
.addClass(placement)
|
||||
|
||||
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
|
||||
|
||||
var pos = this.getPosition()
|
||||
var actualWidth = $tip[0].offsetWidth
|
||||
var actualHeight = $tip[0].offsetHeight
|
||||
|
||||
if (autoPlace) {
|
||||
var $parent = this.$element.parent()
|
||||
|
||||
var orgPlacement = placement
|
||||
var docScroll = document.documentElement.scrollTop || document.body.scrollTop
|
||||
var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth()
|
||||
var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight()
|
||||
var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left
|
||||
|
||||
placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' :
|
||||
placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' :
|
||||
placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' :
|
||||
placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' :
|
||||
placement
|
||||
|
||||
$tip
|
||||
.removeClass(orgPlacement)
|
||||
.addClass(placement)
|
||||
}
|
||||
|
||||
var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
|
||||
|
||||
this.applyPlacement(calculatedOffset, placement)
|
||||
this.$element.trigger('shown.bs.' + this.type)
|
||||
}
|
||||
}
|
||||
|
||||
Tooltip.prototype.applyPlacement = function(offset, placement) {
|
||||
var replace
|
||||
var $tip = this.tip()
|
||||
var width = $tip[0].offsetWidth
|
||||
var height = $tip[0].offsetHeight
|
||||
|
||||
// manually read margins because getBoundingClientRect includes difference
|
||||
var marginTop = parseInt($tip.css('margin-top'), 10)
|
||||
var marginLeft = parseInt($tip.css('margin-left'), 10)
|
||||
|
||||
// we must check for NaN for ie 8/9
|
||||
if (isNaN(marginTop)) marginTop = 0
|
||||
if (isNaN(marginLeft)) marginLeft = 0
|
||||
|
||||
offset.top = offset.top + marginTop
|
||||
offset.left = offset.left + marginLeft
|
||||
|
||||
$tip
|
||||
.offset(offset)
|
||||
.addClass('in')
|
||||
|
||||
// check to see if placing tip in new offset caused the tip to resize itself
|
||||
var actualWidth = $tip[0].offsetWidth
|
||||
var actualHeight = $tip[0].offsetHeight
|
||||
|
||||
if (placement == 'top' && actualHeight != height) {
|
||||
replace = true
|
||||
offset.top = offset.top + height - actualHeight
|
||||
}
|
||||
|
||||
if (/bottom|top/.test(placement)) {
|
||||
var delta = 0
|
||||
|
||||
if (offset.left < 0) {
|
||||
delta = offset.left * -2
|
||||
offset.left = 0
|
||||
|
||||
$tip.offset(offset)
|
||||
|
||||
actualWidth = $tip[0].offsetWidth
|
||||
actualHeight = $tip[0].offsetHeight
|
||||
}
|
||||
|
||||
this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
|
||||
} else {
|
||||
this.replaceArrow(actualHeight - height, actualHeight, 'top')
|
||||
}
|
||||
|
||||
if (replace) $tip.offset(offset)
|
||||
}
|
||||
|
||||
Tooltip.prototype.replaceArrow = function(delta, dimension, position) {
|
||||
this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
|
||||
}
|
||||
|
||||
Tooltip.prototype.setContent = function () {
|
||||
var $tip = this.tip()
|
||||
var title = this.getTitle()
|
||||
|
||||
$tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
|
||||
$tip.removeClass('fade in top bottom left right')
|
||||
}
|
||||
|
||||
Tooltip.prototype.hide = function () {
|
||||
var that = this
|
||||
var $tip = this.tip()
|
||||
var e = $.Event('hide.bs.' + this.type)
|
||||
|
||||
function complete() {
|
||||
if (that.hoverState != 'in') $tip.detach()
|
||||
}
|
||||
|
||||
this.$element.trigger(e)
|
||||
|
||||
if (e.isDefaultPrevented()) return
|
||||
|
||||
$tip.removeClass('in')
|
||||
|
||||
$.support.transition && this.$tip.hasClass('fade') ?
|
||||
$tip
|
||||
.one($.support.transition.end, complete)
|
||||
.emulateTransitionEnd(150) :
|
||||
complete()
|
||||
|
||||
this.$element.trigger('hidden.bs.' + this.type)
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
Tooltip.prototype.fixTitle = function () {
|
||||
var $e = this.$element
|
||||
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
|
||||
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
|
||||
}
|
||||
}
|
||||
|
||||
Tooltip.prototype.hasContent = function () {
|
||||
return this.getTitle()
|
||||
}
|
||||
|
||||
Tooltip.prototype.getPosition = function () {
|
||||
var el = this.$element[0]
|
||||
return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
|
||||
width: el.offsetWidth
|
||||
, height: el.offsetHeight
|
||||
}, this.$element.offset())
|
||||
}
|
||||
|
||||
Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
|
||||
return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
|
||||
placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
|
||||
placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
|
||||
/* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
|
||||
}
|
||||
|
||||
Tooltip.prototype.getTitle = function () {
|
||||
var title
|
||||
var $e = this.$element
|
||||
var o = this.options
|
||||
|
||||
title = $e.attr('data-original-title')
|
||||
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
|
||||
|
||||
return title
|
||||
}
|
||||
|
||||
Tooltip.prototype.tip = function () {
|
||||
return this.$tip = this.$tip || $(this.options.template)
|
||||
}
|
||||
|
||||
Tooltip.prototype.arrow = function () {
|
||||
return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')
|
||||
}
|
||||
|
||||
Tooltip.prototype.validate = function () {
|
||||
if (!this.$element[0].parentNode) {
|
||||
this.hide()
|
||||
this.$element = null
|
||||
this.options = null
|
||||
}
|
||||
}
|
||||
|
||||
Tooltip.prototype.enable = function () {
|
||||
this.enabled = true
|
||||
}
|
||||
|
||||
Tooltip.prototype.disable = function () {
|
||||
this.enabled = false
|
||||
}
|
||||
|
||||
Tooltip.prototype.toggleEnabled = function () {
|
||||
this.enabled = !this.enabled
|
||||
}
|
||||
|
||||
Tooltip.prototype.toggle = function (e) {
|
||||
var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this
|
||||
self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
|
||||
}
|
||||
|
||||
Tooltip.prototype.destroy = function () {
|
||||
this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
|
||||
}
|
||||
|
||||
|
||||
// TOOLTIP PLUGIN DEFINITION
|
||||
// =========================
|
||||
|
||||
var old = $.fn.tooltip
|
||||
|
||||
$.fn.tooltip = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('bs.tooltip')
|
||||
var options = typeof option == 'object' && option
|
||||
|
||||
if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
|
||||
if (typeof option == 'string') data[option]()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.tooltip.Constructor = Tooltip
|
||||
|
||||
|
||||
// TOOLTIP NO CONFLICT
|
||||
// ===================
|
||||
|
||||
$.fn.tooltip.noConflict = function () {
|
||||
$.fn.tooltip = old
|
||||
return this
|
||||
}
|
||||
|
||||
}(window.jQuery);
|
||||
@@ -1,56 +0,0 @@
|
||||
/* ========================================================================
|
||||
* Bootstrap: transition.js v3.0.0
|
||||
* http://twbs.github.com/bootstrap/javascript.html#transitions
|
||||
* ========================================================================
|
||||
* Copyright 2013 Twitter, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
+function ($) { "use strict";
|
||||
|
||||
// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
|
||||
// ============================================================
|
||||
|
||||
function transitionEnd() {
|
||||
var el = document.createElement('bootstrap')
|
||||
|
||||
var transEndEventNames = {
|
||||
'WebkitTransition' : 'webkitTransitionEnd'
|
||||
, 'MozTransition' : 'transitionend'
|
||||
, 'OTransition' : 'oTransitionEnd otransitionend'
|
||||
, 'transition' : 'transitionend'
|
||||
}
|
||||
|
||||
for (var name in transEndEventNames) {
|
||||
if (el.style[name] !== undefined) {
|
||||
return { end: transEndEventNames[name] }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// http://blog.alexmaccaw.com/css-transitions
|
||||
$.fn.emulateTransitionEnd = function (duration) {
|
||||
var called = false, $el = this
|
||||
$(this).one($.support.transition.end, function () { called = true })
|
||||
var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
|
||||
setTimeout(callback, duration)
|
||||
return this
|
||||
}
|
||||
|
||||
$(function () {
|
||||
$.support.transition = transitionEnd()
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
||||
604
templates/default/assets/js/plugins/bootbox/bootbox.js
vendored
Normal file
604
templates/default/assets/js/plugins/bootbox/bootbox.js
vendored
Normal file
@@ -0,0 +1,604 @@
|
||||
/**
|
||||
* bootbox.js v4.0.0
|
||||
*
|
||||
* http://bootboxjs.com/license.txt
|
||||
*/
|
||||
// @see https://github.com/makeusabrew/bootbox/issues/71
|
||||
window.bootbox = window.bootbox || (function init($, undefined) {
|
||||
"use strict";
|
||||
|
||||
// the base DOM structure needed to create a modal
|
||||
var templates = {
|
||||
dialog:
|
||||
"<div class='bootbox modal' tabindex='-1' role='dialog'>" +
|
||||
"<div class='modal-dialog'>" +
|
||||
"<div class='modal-content'>" +
|
||||
"<div class='modal-body'><div class='bootbox-body'></div></div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>",
|
||||
header:
|
||||
"<div class='modal-header'>" +
|
||||
"<h4 class='modal-title'></h4>" +
|
||||
"</div>",
|
||||
footer:
|
||||
"<div class='modal-footer'></div>",
|
||||
closeButton:
|
||||
"<button type='button' class='bootbox-close-button close'>×</button>",
|
||||
form:
|
||||
"<form class='bootbox-form'></form>",
|
||||
inputs: {
|
||||
text:
|
||||
"<input class='bootbox-input form-control' autocomplete=off type=text />"
|
||||
}
|
||||
};
|
||||
|
||||
// cache a reference to the jQueryfied body element
|
||||
var appendTo = $("body");
|
||||
|
||||
var defaults = {
|
||||
// default language
|
||||
locale: "en",
|
||||
// show backdrop or not
|
||||
backdrop: true,
|
||||
// animate the modal in/out
|
||||
animate: true,
|
||||
// additional class string applied to the top level dialog
|
||||
className: null,
|
||||
// whether or not to include a close button
|
||||
closeButton: true,
|
||||
// show the dialog immediately by default
|
||||
show: true
|
||||
};
|
||||
|
||||
// our public object; augmented after our private API
|
||||
var exports = {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
function _t(key) {
|
||||
var locale = locales[defaults.locale];
|
||||
return locale ? locale[key] : locales.en[key];
|
||||
}
|
||||
|
||||
function processCallback(e, dialog, callback) {
|
||||
e.preventDefault();
|
||||
|
||||
// by default we assume a callback will get rid of the dialog,
|
||||
// although it is given the opportunity to override this
|
||||
|
||||
// so, if the callback can be invoked and it *explicitly returns false*
|
||||
// then we'll set a flag to keep the dialog active...
|
||||
var preserveDialog = $.isFunction(callback) && callback(e) === false;
|
||||
|
||||
// ... otherwise we'll bin it
|
||||
if (!preserveDialog) {
|
||||
dialog.modal("hide");
|
||||
}
|
||||
}
|
||||
|
||||
function getKeyLength(obj) {
|
||||
// @TODO defer to Object.keys(x).length if available?
|
||||
var k, t = 0;
|
||||
for (k in obj) {
|
||||
t ++;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
function each(collection, iterator) {
|
||||
var index = 0;
|
||||
$.each(collection, function(key, value) {
|
||||
iterator(key, value, index++);
|
||||
});
|
||||
}
|
||||
|
||||
function sanitize(options) {
|
||||
var buttons;
|
||||
var total;
|
||||
|
||||
|
||||
if (typeof options !== "object") {
|
||||
throw new Error("Please supply an object of options");
|
||||
}
|
||||
|
||||
if (!options.message) {
|
||||
throw new Error("Please specify a message");
|
||||
}
|
||||
|
||||
// make sure any supplied options take precedence over defaults
|
||||
options = $.extend({}, defaults, options);
|
||||
|
||||
if (!options.buttons) {
|
||||
options.buttons = {};
|
||||
}
|
||||
|
||||
// we only support Bootstrap's "static" and false backdrop args
|
||||
// supporting true would mean you could dismiss the dialog without
|
||||
// explicitly interacting with it
|
||||
options.backdrop = options.backdrop ? "static" : false;
|
||||
|
||||
buttons = options.buttons;
|
||||
|
||||
total = getKeyLength(buttons);
|
||||
|
||||
each(buttons, function(key, button, index) {
|
||||
|
||||
if ($.isFunction(button)) {
|
||||
// short form, assume value is our callback. Since button
|
||||
// isn't an object it isn't a reference either so re-assign it
|
||||
button = buttons[key] = {
|
||||
callback: button
|
||||
};
|
||||
}
|
||||
|
||||
// before any further checks make sure by now button is the correct type
|
||||
if ($.type(button) !== "object") {
|
||||
throw new Error("button with key " + key + " must be an object");
|
||||
}
|
||||
|
||||
if (!button.label) {
|
||||
// the lack of an explicit label means we'll assume the key is good enough
|
||||
button.label = key;
|
||||
}
|
||||
|
||||
if (!button.className) {
|
||||
if (total <= 2 && index === total-1) {
|
||||
// always add a primary to the main option in a two-button dialog
|
||||
button.className = "btn-primary";
|
||||
} else {
|
||||
button.className = "btn-default";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
function mapArguments(args, properties) {
|
||||
var argn = args.length;
|
||||
var options = {};
|
||||
|
||||
if (argn < 1 || argn > 2) {
|
||||
throw new Error("Invalid argument length");
|
||||
}
|
||||
|
||||
if (argn === 2 || typeof args[0] === "string") {
|
||||
options[properties[0]] = args[0];
|
||||
options[properties[1]] = args[1];
|
||||
} else {
|
||||
options = args[0];
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
function mergeArguments(defaults, args, properties) {
|
||||
return $.extend(true, {}, defaults, mapArguments(args, properties));
|
||||
}
|
||||
|
||||
function mergeButtons(labels, args, properties) {
|
||||
return validateButtons(
|
||||
mergeArguments(createButtons.apply(null, labels), args, properties),
|
||||
labels
|
||||
);
|
||||
}
|
||||
|
||||
function createLabels() {
|
||||
var buttons = {};
|
||||
|
||||
for (var i = 0, j = arguments.length; i < j; i++) {
|
||||
var argument = arguments[i];
|
||||
var key = argument.toLowerCase();
|
||||
var value = argument.toUpperCase();
|
||||
|
||||
buttons[key] = {
|
||||
label: _t(value)
|
||||
};
|
||||
}
|
||||
|
||||
return buttons;
|
||||
}
|
||||
|
||||
function createButtons() {
|
||||
return {
|
||||
buttons: createLabels.apply(null, arguments)
|
||||
};
|
||||
}
|
||||
|
||||
function validateButtons(options, buttons) {
|
||||
var allowedButtons = {};
|
||||
each(buttons, function(key, value) {
|
||||
allowedButtons[value] = true;
|
||||
});
|
||||
|
||||
each(options.buttons, function(key) {
|
||||
if (allowedButtons[key] === undefined) {
|
||||
throw new Error("button key " + key + " is not allowed (options are " + buttons.join("\n") + ")");
|
||||
}
|
||||
});
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
exports.alert = function() {
|
||||
var options;
|
||||
|
||||
options = mergeButtons(["ok"], arguments, ["message", "callback"]);
|
||||
|
||||
if (options.callback && !$.isFunction(options.callback)) {
|
||||
throw new Error("alert requires callback property to be a function when provided");
|
||||
}
|
||||
|
||||
/**
|
||||
* overrides
|
||||
*/
|
||||
options.buttons.ok.callback = options.onEscape = function() {
|
||||
if ($.isFunction(options.callback)) {
|
||||
return options.callback();
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
return exports.dialog(options);
|
||||
};
|
||||
|
||||
exports.confirm = function() {
|
||||
var options;
|
||||
|
||||
options = mergeButtons(["cancel", "confirm"], arguments, ["message", "callback"]);
|
||||
|
||||
/**
|
||||
* overrides; undo anything the user tried to set they shouldn't have
|
||||
*/
|
||||
options.buttons.cancel.callback = options.onEscape = function() {
|
||||
return options.callback(false);
|
||||
};
|
||||
|
||||
options.buttons.confirm.callback = function() {
|
||||
return options.callback(true);
|
||||
};
|
||||
|
||||
// confirm specific validation
|
||||
if (!$.isFunction(options.callback)) {
|
||||
throw new Error("confirm requires a callback");
|
||||
}
|
||||
|
||||
return exports.dialog(options);
|
||||
};
|
||||
|
||||
exports.prompt = function() {
|
||||
var options;
|
||||
var defaults;
|
||||
var dialog;
|
||||
var form;
|
||||
var input;
|
||||
var shouldShow;
|
||||
|
||||
// we have to create our form first otherwise
|
||||
// its value is undefined when gearing up our options
|
||||
// @TODO this could be solved by allowing message to
|
||||
// be a function instead...
|
||||
form = $(templates.form);
|
||||
|
||||
defaults = {
|
||||
buttons: createLabels("cancel", "confirm"),
|
||||
value: ""
|
||||
};
|
||||
|
||||
options = validateButtons(
|
||||
mergeArguments(defaults, arguments, ["title", "callback"]),
|
||||
["cancel", "confirm"]
|
||||
);
|
||||
|
||||
// capture the user's show value; we always set this to false before
|
||||
// spawning the dialog to give us a chance to attach some handlers to
|
||||
// it, but we need to make sure we respect a preference not to show it
|
||||
shouldShow = (options.show === undefined) ? true : options.show;
|
||||
|
||||
/**
|
||||
* overrides; undo anything the user tried to set they shouldn't have
|
||||
*/
|
||||
options.message = form;
|
||||
|
||||
options.buttons.cancel.callback = options.onEscape = function() {
|
||||
return options.callback(null);
|
||||
};
|
||||
|
||||
options.buttons.confirm.callback = function() {
|
||||
return options.callback(input.val());
|
||||
};
|
||||
|
||||
options.show = false;
|
||||
|
||||
// prompt specific validation
|
||||
if (!options.title) {
|
||||
throw new Error("prompt requires a title");
|
||||
}
|
||||
|
||||
if (!$.isFunction(options.callback)) {
|
||||
throw new Error("prompt requires a callback");
|
||||
}
|
||||
|
||||
// create the input
|
||||
input = $(templates.inputs.text);
|
||||
input.val(options.value);
|
||||
|
||||
// now place it in our form
|
||||
form.append(input);
|
||||
|
||||
form.on("submit", function(e) {
|
||||
e.preventDefault();
|
||||
// @TODO can we actually click *the* button object instead?
|
||||
// e.g. buttons.confirm.click() or similar
|
||||
dialog.find(".btn-primary").click();
|
||||
});
|
||||
|
||||
dialog = exports.dialog(options);
|
||||
|
||||
// clear the existing handler focusing the submit button...
|
||||
dialog.off("shown.bs.modal");
|
||||
|
||||
// ...and replace it with one focusing our input, if possible
|
||||
dialog.on("shown.bs.modal", function() {
|
||||
input.focus();
|
||||
});
|
||||
|
||||
if (shouldShow === true) {
|
||||
dialog.modal("show");
|
||||
}
|
||||
|
||||
return dialog;
|
||||
};
|
||||
|
||||
exports.dialog = function(options) {
|
||||
options = sanitize(options);
|
||||
|
||||
var dialog = $(templates.dialog);
|
||||
var body = dialog.find(".modal-body");
|
||||
var buttons = options.buttons;
|
||||
var buttonStr = "";
|
||||
var callbacks = {
|
||||
onEscape: options.onEscape
|
||||
};
|
||||
|
||||
each(buttons, function(key, button) {
|
||||
|
||||
// @TODO I don't like this string appending to itself; bit dirty. Needs reworking
|
||||
// can we just build up button elements instead? slower but neater. Then button
|
||||
// can just become a template too
|
||||
buttonStr += "<button data-bb-handler='" + key + "' type='button' class='btn " + button.className + "'>" + button.label + "</button>";
|
||||
callbacks[key] = button.callback;
|
||||
});
|
||||
|
||||
body.find(".bootbox-body").html(options.message);
|
||||
|
||||
if (options.animate === true) {
|
||||
dialog.addClass("fade");
|
||||
}
|
||||
|
||||
if (options.className) {
|
||||
dialog.addClass(options.className);
|
||||
}
|
||||
|
||||
if (options.title) {
|
||||
body.before(templates.header);
|
||||
}
|
||||
|
||||
if (options.closeButton) {
|
||||
var closeButton = $(templates.closeButton);
|
||||
|
||||
if (options.title) {
|
||||
dialog.find(".modal-header").prepend(closeButton);
|
||||
} else {
|
||||
closeButton.css("margin-top", "-10px").prependTo(body);
|
||||
}
|
||||
}
|
||||
|
||||
if (options.title) {
|
||||
dialog.find(".modal-title").html(options.title);
|
||||
}
|
||||
|
||||
if (buttonStr.length) {
|
||||
body.after(templates.footer);
|
||||
dialog.find(".modal-footer").html(buttonStr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Bootstrap event listeners; used handle extra
|
||||
* setup & teardown required after the underlying
|
||||
* modal has performed certain actions
|
||||
*/
|
||||
|
||||
dialog.on("hidden.bs.modal", function(e) {
|
||||
// ensure we don't accidentally intercept hidden events triggered
|
||||
// by children of the current dialog. We shouldn't anymore now BS
|
||||
// namespaces its events; but still worth doing
|
||||
if (e.target === this) {
|
||||
dialog.remove();
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
dialog.on("show.bs.modal", function() {
|
||||
// sadly this doesn't work; show is called *just* before
|
||||
// the backdrop is added so we'd need a setTimeout hack or
|
||||
// otherwise... leaving in as would be nice
|
||||
if (options.backdrop) {
|
||||
dialog.next(".modal-backdrop").addClass("bootbox-backdrop");
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
dialog.on("shown.bs.modal", function() {
|
||||
dialog.find(".btn-primary:first").focus();
|
||||
});
|
||||
|
||||
/**
|
||||
* Bootbox event listeners; experimental and may not last
|
||||
* just an attempt to decouple some behaviours from their
|
||||
* respective triggers
|
||||
*/
|
||||
|
||||
dialog.on("escape.close.bb", function(e) {
|
||||
if (callbacks.onEscape) {
|
||||
processCallback(e, dialog, callbacks.onEscape);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Standard jQuery event listeners; used to handle user
|
||||
* interaction with our dialog
|
||||
*/
|
||||
|
||||
dialog.on("click", ".modal-footer button", function(e) {
|
||||
var callbackKey = $(this).data("bb-handler");
|
||||
|
||||
processCallback(e, dialog, callbacks[callbackKey]);
|
||||
|
||||
});
|
||||
|
||||
dialog.on("click", ".bootbox-close-button", function(e) {
|
||||
// onEscape might be falsy but that's fine; the fact is
|
||||
// if the user has managed to click the close button we
|
||||
// have to close the dialog, callback or not
|
||||
processCallback(e, dialog, callbacks.onEscape);
|
||||
});
|
||||
|
||||
dialog.on("keyup", function(e) {
|
||||
if (e.which === 27) {
|
||||
dialog.trigger("escape.close.bb");
|
||||
}
|
||||
});
|
||||
|
||||
// the remainder of this method simply deals with adding our
|
||||
// dialogent to the DOM, augmenting it with Bootstrap's modal
|
||||
// functionality and then giving the resulting object back
|
||||
// to our caller
|
||||
|
||||
appendTo.append(dialog);
|
||||
|
||||
dialog.modal({
|
||||
backdrop: options.backdrop,
|
||||
keyboard: false,
|
||||
show: false
|
||||
});
|
||||
|
||||
if (options.show) {
|
||||
dialog.modal("show");
|
||||
}
|
||||
|
||||
// @TODO should we return the raw element here or should
|
||||
// we wrap it in an object on which we can expose some neater
|
||||
// methods, e.g. var d = bootbox.alert(); d.hide(); instead
|
||||
// of d.modal("hide");
|
||||
|
||||
/*
|
||||
function BBDialog(elem) {
|
||||
this.elem = elem;
|
||||
}
|
||||
|
||||
BBDialog.prototype = {
|
||||
hide: function() {
|
||||
return this.elem.modal("hide");
|
||||
},
|
||||
show: function() {
|
||||
return this.elem.modal("show");
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
return dialog;
|
||||
|
||||
};
|
||||
|
||||
exports.setDefaults = function(values) {
|
||||
$.extend(defaults, values);
|
||||
};
|
||||
|
||||
exports.hideAll = function() {
|
||||
$(".bootbox").modal("hide");
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* standard locales. Please add more according to ISO 639-1 standard. Multiple language variants are
|
||||
* unlikely to be required. If this gets too large it can be split out into separate JS files.
|
||||
*/
|
||||
var locales = {
|
||||
br : {
|
||||
OK : "OK",
|
||||
CANCEL : "Cancelar",
|
||||
CONFIRM : "Sim"
|
||||
},
|
||||
da : {
|
||||
OK : "OK",
|
||||
CANCEL : "Annuller",
|
||||
CONFIRM : "Accepter"
|
||||
},
|
||||
de : {
|
||||
OK : "OK",
|
||||
CANCEL : "Abbrechen",
|
||||
CONFIRM : "Akzeptieren"
|
||||
},
|
||||
en : {
|
||||
OK : "OK",
|
||||
CANCEL : "Cancel",
|
||||
CONFIRM : "OK"
|
||||
},
|
||||
es : {
|
||||
OK : "OK",
|
||||
CANCEL : "Cancelar",
|
||||
CONFIRM : "Aceptar"
|
||||
},
|
||||
fi : {
|
||||
OK : "OK",
|
||||
CANCEL : "Peruuta",
|
||||
CONFIRM : "OK"
|
||||
},
|
||||
fr : {
|
||||
OK : "OK",
|
||||
CANCEL : "Annuler",
|
||||
CONFIRM : "D'accord"
|
||||
},
|
||||
it : {
|
||||
OK : "OK",
|
||||
CANCEL : "Annulla",
|
||||
CONFIRM : "Conferma"
|
||||
},
|
||||
nl : {
|
||||
OK : "OK",
|
||||
CANCEL : "Annuleren",
|
||||
CONFIRM : "Accepteren"
|
||||
},
|
||||
pl : {
|
||||
OK : "OK",
|
||||
CANCEL : "Anuluj",
|
||||
CONFIRM : "Potwierdź"
|
||||
},
|
||||
ru : {
|
||||
OK : "OK",
|
||||
CANCEL : "Отмена",
|
||||
CONFIRM : "Применить"
|
||||
},
|
||||
zh_CN : {
|
||||
OK : "OK",
|
||||
CANCEL : "取消",
|
||||
CONFIRM : "确认"
|
||||
},
|
||||
zh_TW : {
|
||||
OK : "OK",
|
||||
CANCEL : "取消",
|
||||
CONFIRM : "確認"
|
||||
}
|
||||
};
|
||||
|
||||
exports.init = function(_$) {
|
||||
window.bootbox = init(_$ || $);
|
||||
};
|
||||
|
||||
return exports;
|
||||
|
||||
}(window.jQuery));
|
||||
6
templates/default/assets/js/plugins/bootbox/bootbox.min.js
vendored
Normal file
6
templates/default/assets/js/plugins/bootbox/bootbox.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -1,120 +0,0 @@
|
||||
!function ($) {
|
||||
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* MAGNIFY PUBLIC CLASS DEFINITION
|
||||
* =============================== */
|
||||
|
||||
var Magnify = function (element, options) {
|
||||
this.init('magnify', element, options)
|
||||
}
|
||||
|
||||
Magnify.prototype = {
|
||||
|
||||
constructor: Magnify
|
||||
|
||||
, init: function (type, element, options) {
|
||||
var event = 'mousemove'
|
||||
, eventOut = 'mouseleave';
|
||||
|
||||
this.type = type
|
||||
this.$element = $(element)
|
||||
this.options = this.getOptions(options)
|
||||
this.nativeWidth = 0
|
||||
this.nativeHeight = 0
|
||||
|
||||
this.$element.wrap('<div class="magnify" \>');
|
||||
this.$element.parent('.magnify').append('<div class="magnify-large" \>');
|
||||
this.$element.siblings(".magnify-large").css("background","url('" + this.$element.attr("src") + "') no-repeat");
|
||||
|
||||
this.$element.parent('.magnify').on(event + '.' + this.type, $.proxy(this.check, this));
|
||||
this.$element.parent('.magnify').on(eventOut + '.' + this.type, $.proxy(this.check, this));
|
||||
}
|
||||
|
||||
, getOptions: function (options) {
|
||||
options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
|
||||
|
||||
if (options.delay && typeof options.delay == 'number') {
|
||||
options.delay = {
|
||||
show: options.delay
|
||||
, hide: options.delay
|
||||
}
|
||||
}
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
, check: function (e) {
|
||||
var container = $(e.currentTarget);
|
||||
var self = container.children('img');
|
||||
var mag = container.children(".magnify-large");
|
||||
|
||||
// Get the native dimensions of the image
|
||||
if(!this.nativeWidth && !this.nativeHeight) {
|
||||
var image = new Image();
|
||||
image.src = self.attr("src");
|
||||
|
||||
this.nativeWidth = image.width;
|
||||
this.nativeHeight = image.height;
|
||||
|
||||
} else {
|
||||
|
||||
var magnifyOffset = container.offset();
|
||||
var mx = e.pageX - magnifyOffset.left;
|
||||
var my = e.pageY - magnifyOffset.top;
|
||||
|
||||
if (mx < container.width() && my < container.height() && mx > 0 && my > 0) {
|
||||
mag.fadeIn(100);
|
||||
} else {
|
||||
mag.fadeOut(100);
|
||||
}
|
||||
|
||||
if(mag.is(":visible"))
|
||||
{
|
||||
var rx = Math.round(mx/container.width()*this.nativeWidth - mag.width()/2)*-1;
|
||||
var ry = Math.round(my/container.height()*this.nativeHeight - mag.height()/2)*-1;
|
||||
var bgp = rx + "px " + ry + "px";
|
||||
|
||||
var px = mx - mag.width()/2;
|
||||
var py = my - mag.height()/2;
|
||||
|
||||
mag.css({left: px, top: py, backgroundPosition: bgp});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* MAGNIFY PLUGIN DEFINITION
|
||||
* ========================= */
|
||||
|
||||
$.fn.magnify = function ( option ) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
, data = $this.data('magnify')
|
||||
, options = typeof option == 'object' && option
|
||||
if (!data) $this.data('tooltip', (data = new Magnify(this, options)))
|
||||
if (typeof option == 'string') data[option]()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.magnify.Constructor = Magnify
|
||||
|
||||
$.fn.magnify.defaults = {
|
||||
delay: 0
|
||||
}
|
||||
|
||||
|
||||
/* MAGNIFY DATA-API
|
||||
* ================ */
|
||||
|
||||
$(window).on('load', function () {
|
||||
$('[data-toggle="magnify"]').each(function () {
|
||||
var $mag = $(this);
|
||||
$mag.magnify()
|
||||
})
|
||||
})
|
||||
|
||||
} ( window.jQuery );
|
||||
@@ -1 +0,0 @@
|
||||
!function(e){"use strict";var t=function(e,t){this.init("magnify",e,t)};t.prototype={constructor:t,init:function(t,n,r){var i="mousemove",s="mouseleave";this.type=t;this.$element=e(n);this.options=this.getOptions(r);this.nativeWidth=0;this.nativeHeight=0;this.$element.wrap('<div class="magnify" >');this.$element.parent(".magnify").append('<div class="magnify-large" >');this.$element.siblings(".magnify-large").css("background","url('"+this.$element.attr("src")+"') no-repeat");this.$element.parent(".magnify").on(i+"."+this.type,e.proxy(this.check,this));this.$element.parent(".magnify").on(s+"."+this.type,e.proxy(this.check,this))},getOptions:function(t){t=e.extend({},e.fn[this.type].defaults,t,this.$element.data());t.delay&&typeof t.delay=="number"&&(t.delay={show:t.delay,hide:t.delay});return t},check:function(t){var n=e(t.currentTarget),r=n.children("img"),i=n.children(".magnify-large");if(!this.nativeWidth&&!this.nativeHeight){var s=new Image;s.src=r.attr("src");this.nativeWidth=s.width;this.nativeHeight=s.height}else{var o=n.offset(),u=t.pageX-o.left,a=t.pageY-o.top;u<n.width()&&a<n.height()&&u>0&&a>0?i.fadeIn(100):i.fadeOut(100);if(i.is(":visible")){var f=Math.round(u/n.width()*this.nativeWidth-i.width()/2)*-1,l=Math.round(a/n.height()*this.nativeHeight-i.height()/2)*-1,c=f+"px "+l+"px",h=u-i.width()/2,p=a-i.height()/2;i.css({left:h,top:p,backgroundPosition:c})}}}};e.fn.magnify=function(n){return this.each(function(){var r=e(this),i=r.data("magnify"),s=typeof n=="object"&&n;i||r.data("tooltip",i=new t(this,s));typeof n=="string"&&i[n]()})};e.fn.magnify.Constructor=t;e.fn.magnify.defaults={delay:0};e(window).on("load",function(){e('[data-toggle="magnify"]').each(function(){var t=e(this);t.magnify()})})}(window.jQuery);
|
||||
@@ -1,323 +0,0 @@
|
||||
/**
|
||||
* menu-aim is a jQuery plugin for dropdown menus that can differentiate
|
||||
* between a user trying hover over a dropdown item vs trying to navigate into
|
||||
* a submenu's contents.
|
||||
*
|
||||
* menu-aim assumes that you have are using a menu with submenus that expand
|
||||
* to the menu's right. It will fire events when the user's mouse enters a new
|
||||
* dropdown item *and* when that item is being intentionally hovered over.
|
||||
*
|
||||
* __________________________
|
||||
* | Monkeys >| Gorilla |
|
||||
* | Gorillas >| Content |
|
||||
* | Chimps >| Here |
|
||||
* |___________|____________|
|
||||
*
|
||||
* In the above example, "Gorillas" is selected and its submenu content is
|
||||
* being shown on the right. Imagine that the user's cursor is hovering over
|
||||
* "Gorillas." When they move their mouse into the "Gorilla Content" area, they
|
||||
* may briefly hover over "Chimps." This shouldn't close the "Gorilla Content"
|
||||
* area.
|
||||
*
|
||||
* This problem is normally solved using timeouts and delays. menu-aim tries to
|
||||
* solve this by detecting the direction of the user's mouse movement. This can
|
||||
* make for quicker transitions when navigating up and down the menu. The
|
||||
* experience is hopefully similar to amazon.com/'s "Shop by Department"
|
||||
* dropdown.
|
||||
*
|
||||
* Use like so:
|
||||
*
|
||||
* $("#menu").menuAim({
|
||||
* activate: $.noop, // fired on row activation
|
||||
* deactivate: $.noop // fired on row deactivation
|
||||
* });
|
||||
*
|
||||
* ...to receive events when a menu's row has been purposefully (de)activated.
|
||||
*
|
||||
* The following options can be passed to menuAim. All functions execute with
|
||||
* the relevant row's HTML element as the execution context ('this'):
|
||||
*
|
||||
* .menuAim({
|
||||
* // Function to call when a row is purposefully activated. Use this
|
||||
* // to show a submenu's content for the activated row.
|
||||
* activate: function() {},
|
||||
*
|
||||
* // Function to call when a row is deactivated.
|
||||
* deactivate: function() {},
|
||||
*
|
||||
* // Function to call when mouse enters a menu row. Entering a row
|
||||
* // does not mean the row has been activated, as the user may be
|
||||
* // mousing over to a submenu.
|
||||
* enter: function() {},
|
||||
*
|
||||
* // Function to call when mouse exits a menu row.
|
||||
* exit: function() {},
|
||||
*
|
||||
* // Selector for identifying which elements in the menu are rows
|
||||
* // that can trigger the above events. Defaults to "> li".
|
||||
* rowSelector: "> li",
|
||||
*
|
||||
* // You may have some menu rows that aren't submenus and therefore
|
||||
* // shouldn't ever need to "activate." If so, filter submenu rows w/
|
||||
* // this selector. Defaults to "*" (all elements).
|
||||
* submenuSelector: "*",
|
||||
*
|
||||
* // Direction the submenu opens relative to the main menu. Can be
|
||||
* // left, right, above, or below. Defaults to "right".
|
||||
* submenuDirection: "right"
|
||||
* });
|
||||
*
|
||||
* https://github.com/kamens/jQuery-menu-aim
|
||||
*/
|
||||
(function($) {
|
||||
|
||||
$.fn.menuAim = function(opts) {
|
||||
// Initialize menu-aim for all elements in jQuery collection
|
||||
this.each(function() {
|
||||
init.call(this, opts);
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
function init(opts) {
|
||||
var $menu = $(this),
|
||||
activeRow = null,
|
||||
mouseLocs = [],
|
||||
lastDelayLoc = null,
|
||||
timeoutId = null,
|
||||
options = $.extend({
|
||||
rowSelector: "> li",
|
||||
submenuSelector: "*",
|
||||
submenuDirection: "right",
|
||||
tolerance: 75, // bigger = more forgivey when entering submenu
|
||||
enter: $.noop,
|
||||
exit: $.noop,
|
||||
activate: $.noop,
|
||||
deactivate: $.noop,
|
||||
exitMenu: $.noop
|
||||
}, opts);
|
||||
|
||||
var MOUSE_LOCS_TRACKED = 3, // number of past mouse locations to track
|
||||
DELAY = 300; // ms delay when user appears to be entering submenu
|
||||
|
||||
/**
|
||||
* Keep track of the last few locations of the mouse.
|
||||
*/
|
||||
var mousemoveDocument = function(e) {
|
||||
mouseLocs.push({x: e.pageX, y: e.pageY});
|
||||
|
||||
if (mouseLocs.length > MOUSE_LOCS_TRACKED) {
|
||||
mouseLocs.shift();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Cancel possible row activations when leaving the menu entirely
|
||||
*/
|
||||
var mouseleaveMenu = function() {
|
||||
if (timeoutId) {
|
||||
clearTimeout(timeoutId);
|
||||
}
|
||||
|
||||
// If exitMenu is supplied and returns true, deactivate the
|
||||
// currently active row on menu exit.
|
||||
if (options.exitMenu(this)) {
|
||||
if (activeRow) {
|
||||
options.deactivate(activeRow);
|
||||
}
|
||||
|
||||
activeRow = null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Trigger a possible row activation whenever entering a new row.
|
||||
*/
|
||||
var mouseenterRow = function() {
|
||||
if (timeoutId) {
|
||||
// Cancel any previous activation delays
|
||||
clearTimeout(timeoutId);
|
||||
}
|
||||
|
||||
options.enter(this);
|
||||
possiblyActivate(this);
|
||||
},
|
||||
mouseleaveRow = function() {
|
||||
options.exit(this);
|
||||
};
|
||||
|
||||
/*
|
||||
* Immediately activate a row if the user clicks on it.
|
||||
*/
|
||||
var clickRow = function() {
|
||||
activate(this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Activate a menu row.
|
||||
*/
|
||||
var activate = function(row) {
|
||||
if (row == activeRow) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeRow) {
|
||||
options.deactivate(activeRow);
|
||||
}
|
||||
|
||||
options.activate(row);
|
||||
activeRow = row;
|
||||
};
|
||||
|
||||
/**
|
||||
* Possibly activate a menu row. If mouse movement indicates that we
|
||||
* shouldn't activate yet because user may be trying to enter
|
||||
* a submenu's content, then delay and check again later.
|
||||
*/
|
||||
var possiblyActivate = function(row) {
|
||||
var delay = activationDelay();
|
||||
|
||||
if (delay) {
|
||||
timeoutId = setTimeout(function() {
|
||||
possiblyActivate(row);
|
||||
}, delay);
|
||||
} else {
|
||||
activate(row);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the amount of time that should be used as a delay before the
|
||||
* currently hovered row is activated.
|
||||
*
|
||||
* Returns 0 if the activation should happen immediately. Otherwise,
|
||||
* returns the number of milliseconds that should be delayed before
|
||||
* checking again to see if the row should be activated.
|
||||
*/
|
||||
var activationDelay = function() {
|
||||
if (!activeRow || !$(activeRow).is(options.submenuSelector)) {
|
||||
// If there is no other submenu row already active, then
|
||||
// go ahead and activate immediately.
|
||||
return 0;
|
||||
}
|
||||
|
||||
var offset = $menu.offset(),
|
||||
upperLeft = {
|
||||
x: offset.left,
|
||||
y: offset.top - options.tolerance
|
||||
},
|
||||
upperRight = {
|
||||
x: offset.left + $menu.outerWidth(),
|
||||
y: upperLeft.y
|
||||
},
|
||||
lowerLeft = {
|
||||
x: offset.left,
|
||||
y: offset.top + $menu.outerHeight() + options.tolerance
|
||||
},
|
||||
lowerRight = {
|
||||
x: offset.left + $menu.outerWidth(),
|
||||
y: lowerLeft.y
|
||||
},
|
||||
loc = mouseLocs[mouseLocs.length - 1],
|
||||
prevLoc = mouseLocs[0];
|
||||
|
||||
if (!loc) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!prevLoc) {
|
||||
prevLoc = loc;
|
||||
}
|
||||
|
||||
if (prevLoc.x < offset.left || prevLoc.x > lowerRight.x ||
|
||||
prevLoc.y < offset.top || prevLoc.y > lowerRight.y) {
|
||||
// If the previous mouse location was outside of the entire
|
||||
// menu's bounds, immediately activate.
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (lastDelayLoc &&
|
||||
loc.x == lastDelayLoc.x && loc.y == lastDelayLoc.y) {
|
||||
// If the mouse hasn't moved since the last time we checked
|
||||
// for activation status, immediately activate.
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Detect if the user is moving towards the currently activated
|
||||
// submenu.
|
||||
//
|
||||
// If the mouse is heading relatively clearly towards
|
||||
// the submenu's content, we should wait and give the user more
|
||||
// time before activating a new row. If the mouse is heading
|
||||
// elsewhere, we can immediately activate a new row.
|
||||
//
|
||||
// We detect this by calculating the slope formed between the
|
||||
// current mouse location and the upper/lower right points of
|
||||
// the menu. We do the same for the previous mouse location.
|
||||
// If the current mouse location's slopes are
|
||||
// increasing/decreasing appropriately compared to the
|
||||
// previous's, we know the user is moving toward the submenu.
|
||||
//
|
||||
// Note that since the y-axis increases as the cursor moves
|
||||
// down the screen, we are looking for the slope between the
|
||||
// cursor and the upper right corner to decrease over time, not
|
||||
// increase (somewhat counterintuitively).
|
||||
function slope(a, b) {
|
||||
return (b.y - a.y) / (b.x - a.x);
|
||||
};
|
||||
|
||||
var decreasingCorner = upperRight,
|
||||
increasingCorner = lowerRight;
|
||||
|
||||
// Our expectations for decreasing or increasing slope values
|
||||
// depends on which direction the submenu opens relative to the
|
||||
// main menu. By default, if the menu opens on the right, we
|
||||
// expect the slope between the cursor and the upper right
|
||||
// corner to decrease over time, as explained above. If the
|
||||
// submenu opens in a different direction, we change our slope
|
||||
// expectations.
|
||||
if (options.submenuDirection == "left") {
|
||||
decreasingCorner = lowerLeft;
|
||||
increasingCorner = upperLeft;
|
||||
} else if (options.submenuDirection == "below") {
|
||||
decreasingCorner = lowerRight;
|
||||
increasingCorner = lowerLeft;
|
||||
} else if (options.submenuDirection == "above") {
|
||||
decreasingCorner = upperLeft;
|
||||
increasingCorner = upperRight;
|
||||
}
|
||||
|
||||
var decreasingSlope = slope(loc, decreasingCorner),
|
||||
increasingSlope = slope(loc, increasingCorner),
|
||||
prevDecreasingSlope = slope(prevLoc, decreasingCorner),
|
||||
prevIncreasingSlope = slope(prevLoc, increasingCorner);
|
||||
|
||||
if (decreasingSlope < prevDecreasingSlope &&
|
||||
increasingSlope > prevIncreasingSlope) {
|
||||
// Mouse is moving from previous location towards the
|
||||
// currently activated submenu. Delay before activating a
|
||||
// new menu row, because user may be moving into submenu.
|
||||
lastDelayLoc = loc;
|
||||
return DELAY;
|
||||
}
|
||||
|
||||
lastDelayLoc = null;
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Hook up initial menu events
|
||||
*/
|
||||
$menu
|
||||
.mouseleave(mouseleaveMenu)
|
||||
.find(options.rowSelector)
|
||||
.mouseenter(mouseenterRow)
|
||||
.mouseleave(mouseleaveRow)
|
||||
.click(clickRow);
|
||||
|
||||
$(document).mousemove(mousemoveDocument);
|
||||
|
||||
};
|
||||
})(jQuery);
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
/* JQUERY PREVENT CONFLICT */
|
||||
(function($) {
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
onLoad Function -------------------------------------------------- */
|
||||
$(document).ready(function(){
|
||||
|
||||
// Loader
|
||||
var $loader = $('<div class="loader"></div>');
|
||||
$('body').append($loader);
|
||||
|
||||
// Display loader if we do ajax call
|
||||
$(document)
|
||||
.ajaxStart(function() { $loader.show(); })
|
||||
.ajaxStop(function(){ $loader.hide(); });
|
||||
|
||||
// Main Navigation Hover
|
||||
$('.nav-main')
|
||||
@@ -30,6 +37,29 @@
|
||||
selector: '[data-toggle=tooltip]'
|
||||
});
|
||||
|
||||
// Confirm Dialog
|
||||
$(document).on('click.confirm', '[data-toggle="confirm"]', function (e) {
|
||||
var $this = $(this),
|
||||
href = $this.attr('href'),
|
||||
title = $this.attr('data-confirm-title') ? $this.attr('data-confirm-title') : 'Are you sure?';
|
||||
|
||||
bootbox.confirm(title, function(confirm) {
|
||||
if(confirm){
|
||||
if(href){
|
||||
window.location.href = href;
|
||||
} else {
|
||||
// If forms
|
||||
var $form = $this.closest("form");
|
||||
if($form.size() > 0){
|
||||
$form.submit();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// Toolbar
|
||||
var $category_products = $('#category-products');
|
||||
if($category_products.size() > 0){
|
||||
@@ -40,7 +70,9 @@
|
||||
if( ($(this).hasClass('btn-grid') && $parent.hasClass('grid')) || ($(this).hasClass('btn-list') && $parent.hasClass('list')))
|
||||
return;
|
||||
|
||||
$parent.toggleClass('grid').toggleClass('list');
|
||||
// Add loader effect
|
||||
$loader.show();
|
||||
setTimeout(function(){ $parent.toggleClass('grid').toggleClass('list'); $loader.hide(); }, 400);
|
||||
|
||||
return false;
|
||||
});
|
||||
@@ -89,6 +121,7 @@
|
||||
|
||||
$form
|
||||
.on('change.filter', ':checkbox', function(){
|
||||
$loader.show();
|
||||
$form.submit();
|
||||
})
|
||||
.find('.group-btn > .btn').addClass('sr-only');
|
||||
@@ -126,6 +159,78 @@
|
||||
}).filter(':has(:checked)').addClass('active');
|
||||
});
|
||||
|
||||
|
||||
if($("body").is(".page-product")){
|
||||
|
||||
var $quantityInput = $("#quantity");
|
||||
|
||||
|
||||
var $btnAddToCart = $(".btn_add_to_cart", $("#form-product-details"));
|
||||
|
||||
var $productMeta = $("#stockInformations");
|
||||
|
||||
var $inStock = $(".in",$productMeta);
|
||||
var $outOfStock = $(".out",$productMeta);
|
||||
|
||||
var $old_price_container = $(".old-price", $("#product-details"));
|
||||
|
||||
|
||||
// Switch Quantity in product page
|
||||
$("select", $(".product-options")).change(function(){
|
||||
var $select_quantity = $(this).find(":selected").attr("data-quantity");
|
||||
var $old_price = $(this).find(":selected").attr("data-old-price");
|
||||
|
||||
var $best_price = $(this).find(":selected").attr("data-price");
|
||||
|
||||
$quantityInput.attr("max", $select_quantity);
|
||||
|
||||
// Show Out Of Stock OR In Stock
|
||||
if($select_quantity == 0){
|
||||
$btnAddToCart.attr("disabled", true);
|
||||
|
||||
$productMeta.removeClass("in-stock");
|
||||
$productMeta.addClass("out-of-stock");
|
||||
|
||||
$productMeta.attr("href", "http://schema.org/OutOfStock");
|
||||
|
||||
$outOfStock.show();
|
||||
$inStock.hide();
|
||||
|
||||
}else{
|
||||
$btnAddToCart.attr("disabled", false);
|
||||
|
||||
$productMeta.removeClass("out-of-stock");
|
||||
$productMeta.addClass("in-stock");
|
||||
|
||||
$productMeta.attr("href", "http://schema.org/InStock");
|
||||
|
||||
$inStock.show();
|
||||
$outOfStock.hide();
|
||||
}
|
||||
|
||||
if(parseInt($quantityInput.val()) > parseInt($select_quantity)){
|
||||
$quantityInput.val($select_quantity);
|
||||
}
|
||||
|
||||
if($old_price_container.size() > 0 ){
|
||||
$(".price", $old_price_container).html($old_price);
|
||||
$(".price", $(".special-price")).html($best_price);
|
||||
}else{
|
||||
$(".price", $(".regular-price")).html($best_price);
|
||||
}
|
||||
|
||||
}).change();
|
||||
|
||||
$quantityInput.focusout(function() {
|
||||
$quantityInput.attr("max", $select_quantity);
|
||||
if(parseInt($quantityInput.val()) > parseInt($select_quantity)){
|
||||
$quantityInput.val($select_quantity);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
$('#limit-top').change(function(e){
|
||||
window.location = $(this).val()
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* FONT PATH
|
||||
* -------------------------- */
|
||||
|
||||
/*
|
||||
@font-face {
|
||||
font-family: 'FontAwesome';
|
||||
src: url('@{FontAwesomePath}/fontawesome-webfont.eot?v=@{FontAwesomeVersion}');
|
||||
@@ -11,4 +12,15 @@
|
||||
// src: url('@{FontAwesomePath}/FontAwesome.otf') format('opentype'); // used when developing fonts
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}*/
|
||||
@font-face {
|
||||
font-family: 'FontAwesome';
|
||||
src: url('@{FontAwesomePath}/fontawesome-webfont.eot?v=3');
|
||||
src: url('@{FontAwesomePath}/fontawesome-webfont.eot?#iefix&v=3') format('embedded-opentype'),
|
||||
url('@{FontAwesomePath}/fontawesome-webfont.woff?v=3') format('woff'),
|
||||
url('@{FontAwesomePath}/fontawesome-webfont.ttf?v=3') format('truetype'),
|
||||
url('@{FontAwesomePath}/fontawesome-webfont.svg?v=3#fontawesomeregular') format('svg');
|
||||
// src: url('@{FontAwesomePath}/FontAwesome.otf') format('opentype'); // used when developing fonts
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
//
|
||||
// Magnifier
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Parent container
|
||||
.magnify {
|
||||
position: relative;
|
||||
cursor:none;
|
||||
}
|
||||
|
||||
// Magnifying glass
|
||||
.magnify-large {
|
||||
position: absolute;
|
||||
display: none;
|
||||
width: 175px; height: 175px;
|
||||
@shadow: 0 0 0 7px rgba(255, 255, 255, 0.85), 0 0 7px 7px rgba(0, 0, 0, 0.25), inset 0 0 40px 2px rgba(0, 0, 0, 0.25);
|
||||
.box-shadow(@shadow);
|
||||
.border-radius(100%);
|
||||
z-index:10;
|
||||
}
|
||||
@@ -2,9 +2,6 @@
|
||||
/* Bootstrap */
|
||||
@import "bootstrap/bootstrap.less";
|
||||
|
||||
// Magnifying glass
|
||||
@import "plugins/bootstrap-magnify/bootstrap-magnify.less";
|
||||
|
||||
/* FontAwesome */
|
||||
@import "fontawesome/font-awesome.less";
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user