create language delete event object
This commit is contained in:
@@ -945,6 +945,10 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\LangController::addAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.languages.delete" path="/admin/configuration/languages/delete">
|
||||
<default key="_controller">Thelia\Controller\Admin\LangController::deleteAction</default>
|
||||
</route>
|
||||
|
||||
|
||||
<!-- The default route, to display a template -->
|
||||
|
||||
|
||||
@@ -189,4 +189,11 @@ class LangController extends BaseAdminController
|
||||
return $this->render('languages');
|
||||
|
||||
}
|
||||
|
||||
public function deleteAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::DELETE)) return $response;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
70
core/lib/Thelia/Core/Event/Lang/LangDeleteEvent.php
Normal file
70
core/lib/Thelia/Core/Event/Lang/LangDeleteEvent.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?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\Lang;
|
||||
|
||||
|
||||
/**
|
||||
* Class LangDeleteEvent
|
||||
* @package Thelia\Core\Event\Lang
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class LangDeleteEvent extends LangEvent
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $lang_id;
|
||||
|
||||
/**
|
||||
* @param int $lang_id
|
||||
*/
|
||||
function __construct($lang_id)
|
||||
{
|
||||
$this->lang_id = $lang_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $lang_id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLangId($lang_id)
|
||||
{
|
||||
$this->lang_id = $lang_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getLangId()
|
||||
{
|
||||
return $this->lang_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -66,7 +66,7 @@
|
||||
</a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.configuration.language" access="DELETE"}
|
||||
<a href="#delete_dialog" data-toggle="modal" class="btn btn-default btn-xs" title="{intl l="Delete this language"}">
|
||||
<a href="#delete_dialog" data-toggle="modal" data-id="{$ID}" class="btn btn-default btn-xs lang-delete" title="{intl l="Delete this language"}">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
@@ -222,7 +222,7 @@
|
||||
{* Delete confirmation dialog *}
|
||||
|
||||
{capture "delete_dialog"}
|
||||
<input type="hidden" name="message_id" id="language_delete_id" value="" />
|
||||
<input type="hidden" name="language_id" id="language_delete_id" value="" />
|
||||
|
||||
{module_include location='languages_delete_form'}
|
||||
|
||||
@@ -262,13 +262,6 @@
|
||||
{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'}
|
||||
@@ -307,6 +300,10 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(".lang-delete").click(function(){
|
||||
$("#language_delete_id").val($(this).data("id"));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
Reference in New Issue
Block a user