Remove js with group delete comfirm from style files

This commit is contained in:
Dmitriy Simushev 2014-10-10 11:10:28 +00:00
parent 01e2d8f2a7
commit ed6252bb38
3 changed files with 6 additions and 10 deletions

View File

@ -18,12 +18,10 @@
(function(Mibew, $) { (function(Mibew, $) {
$(document).ready(function(){ $(document).ready(function(){
$('a.removelink').click(function(){ $('a.remove-link').click(function(){
var groupName = $.trim($("#t" + this.id).text());
return confirm(Mibew.Localization.trans( return confirm(Mibew.Localization.trans(
'Are you sure that you want to delete the group "{0}"?', 'Are you sure that you want to delete the group "{0}"?',
groupName $(this).data('group-name')
)); ));
}); });
}); });

View File

@ -82,6 +82,8 @@ class ManagementController extends AbstractController
$page['menuid'] = 'groups'; $page['menuid'] = 'groups';
$page = array_merge($page, prepare_menu($operator)); $page = array_merge($page, prepare_menu($operator));
$this->getAssetManager()->attachJs('js/compiled/groups.js');
return $this->render('groups', $page); return $this->render('groups', $page);
} }

View File

@ -1,10 +1,6 @@
{{#extends "_layout"}} {{#extends "_layout"}}
{{#override "menu"}}{{> _menu}}{{/override}} {{#override "menu"}}{{> _menu}}{{/override}}
{{#override "head"}}
<script type="text/javascript" src="{{asset "@CurrentStyle/js/groups.js"}}"></script>
{{/override}}
{{#override "content"}} {{#override "content"}}
{{l10n "This page displays a list of groups. Each group can have separate button and canned responses."}} {{l10n "This page displays a list of groups. Each group can have separate button and canned responses."}}
@ -76,7 +72,7 @@
{{#each groups}} {{#each groups}}
<tr> <tr>
<td class="notlast level{{level}}"> <td class="notlast level{{level}}">
<a href="{{route "group_edit" group_id=groupid}}" id="ti{{groupid}}" class="man"> <a href="{{route "group_edit" group_id=groupid}}" class="man">
{{vclocalname}} {{vclocalname}}
</a> </a>
</td> </td>
@ -113,7 +109,7 @@
{{#if ../canmodify}} {{#if ../canmodify}}
<td> <td>
<a href="{{csrfProtectedRoute "group_delete" group_id=groupid}}" id="i{{groupid}}" class="removelink"> <a href="{{csrfProtectedRoute "group_delete" group_id=groupid}}" class="remove-link" data-group-name="{{vclocalname}}">
{{l10n "remove"}} {{l10n "remove"}}
</a> </a>
</td> </td>