[Admin] Adjust channel form for new functionality

This commit is contained in:
Mateusz Zalewski 2017-02-14 12:01:28 +01:00
parent e6ef7b8332
commit 54b3b565fa
No known key found for this signature in database
GPG key ID: BE101BD4D91463A4
7 changed files with 29 additions and 6 deletions

View file

@ -31,6 +31,7 @@ Feature: Adding a new channel
And I define its color as "blue"
And I choose "Euro" as the base currency
And I choose "English (United States)" as a default locale
And I allow to skip shipping step if only one shipping method is available
And I add it
Then I should be notified that it has been successfully created
And the channel "Mobile channel" should appear in the registry

View file

@ -119,6 +119,14 @@ final class ManagingChannelsContext implements Context
$this->createPage->chooseDefaultLocale($locale);
}
/**
* @When I allow to skip shipping step if only one shipping method is available
*/
public function iAllowToSkipShippingStepIfOnlyOneShippingMethodIsAvailable()
{
$this->createPage->allowToSkipShippingStep();
}
/**
* @When I add it
* @When I try to add it

View file

@ -105,6 +105,11 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface
$this->getDocument()->selectFieldOption('Tax calculation strategy', $taxZone);
}
public function allowToSkipShippingStep()
{
$this->getDocument()->checkField('Skip shipping step if only one shipping method is available?');
}
/**
* {@inheritdoc}
*/

View file

@ -81,4 +81,6 @@ interface CreatePageInterface extends BaseCreatePageInterface
* @param string $taxCalculationStrategy
*/
public function chooseTaxCalculationStrategy($taxCalculationStrategy);
public function allowToSkipShippingStep();
}

View file

@ -34,6 +34,7 @@
{{ form_row(form.baseCurrency) }}
{{ form_row(form.defaultTaxZone) }}
{{ form_row(form.taxCalculationStrategy) }}
{{ form_row(form.skippingShippingStepAllowed) }}
</div>
</div>
</div>

View file

@ -20,6 +20,7 @@ use Sylius\Bundle\CurrencyBundle\Form\Type\CurrencyChoiceType;
use Sylius\Bundle\LocaleBundle\Form\Type\LocaleChoiceType;
use Sylius\Bundle\ThemeBundle\Form\Type\ThemeNameChoiceType;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\FormBuilderInterface;
@ -68,6 +69,10 @@ final class ChannelTypeExtension extends AbstractTypeExtension
'label' => 'sylius.form.channel.contact_email',
'required' => false,
])
->add('skippingShippingStepAllowed', CheckboxType::class, [
'label' => 'sylius.form.channel.skipping_shipping_step_allowed',
'required' => false,
])
->addEventSubscriber(new AddBaseCurrencySubscriber())
->addEventSubscriber(new ChannelFormSubscriber())
;

View file

@ -22,18 +22,19 @@ sylius:
name: Name
roles: Roles
channel:
taxonomies: Taxonomies
contact_email: Contact email
currencies: Currencies
currency_base: Base currency
hostname: Hostname
locale_default: Default locale
locales: Locales
contact_email: Contact email
currency_base: Base currency
currencies: Currencies
shipping_methods: Shipping Methods
payment_methods: Payment Methods
shipping_methods: Shipping Methods
skipping_shipping_step_allowed: Skip shipping step if only one shipping method is available?
tax_calculation_strategy: Tax calculation strategy
tax_zone_default: Default tax zone
taxonomies: Taxonomies
theme: Theme
hostname: Hostname
image:
type: Type
file: Image