validate country removal
This commit is contained in:
@@ -29,6 +29,7 @@ use Thelia\Core\Event\Country\CountryDeleteEvent;
|
||||
use Thelia\Core\Event\Country\CountryUpdateEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\Country as CountryModel;
|
||||
use Thelia\Model\CountryQuery;
|
||||
|
||||
|
||||
/**
|
||||
@@ -62,7 +63,11 @@ class Country extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
public function delete(CountryDeleteEvent $event)
|
||||
{
|
||||
if (null !== $country = CountryQuery::create()->findPk($event->getCountryId())) {
|
||||
$country->delete();
|
||||
|
||||
$event->setCountry($country);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -420,6 +420,10 @@
|
||||
<requirement key="country_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.countries.delete" path="/admin/configuration/countries/delete">
|
||||
<default key="_controller">Thelia\Controller\Admin\CountryController::deleteAction</default>
|
||||
</route>
|
||||
|
||||
<!-- content routes management -->
|
||||
<route id="admin.content.create" path="/admin/content/create">
|
||||
<default key="_controller">Thelia\Controller\Admin\ContentController::createAction</default>
|
||||
|
||||
@@ -216,10 +216,17 @@
|
||||
<script src="{$asset_url}"></script>
|
||||
|
||||
<script>
|
||||
// Toogle switch on input radio
|
||||
$('.switch-radio').on('switch-change', function () {
|
||||
$('.switch-radio').bootstrapSwitch('toggleRadioState');
|
||||
$(document).ready(function(){
|
||||
// Toogle switch on input radio
|
||||
$('.switch-radio').on('switch-change', function () {
|
||||
$('.switch-radio').bootstrapSwitch('toggleRadioState');
|
||||
});
|
||||
|
||||
$('.country-delete').click(function(ev){
|
||||
$('#country_delete_id').val($(this).data('id'));
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
{/javascripts}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user