fix on users and projects
[osm/LW-UI.git] / static / src / rolehandler / role_list.js
1 /*
2 Copyright 2019 EveryUP srl
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 */
16
17 function openModalCreateRole(args) {
18
19
20
21 $('#modal_new_role').modal('show');
22 }
23
24 function openModalEditRole(args) {
25 var url = '/admin/roles/' + args.role_id;
26
27 $("#formEditRole").attr("action", url);
28
29
30 $('#modal_edit_role').modal('show');
31 }
32
33 function deleteRole(role_id, name) {
34 var delete_url = '/admin/roles/' + role_id + '/delete';
35 bootbox.confirm("Are you sure want to delete " + name + "?", function (confirm) {
36 if (confirm) {
37 var dialog = bootbox.dialog({
38 message: '<div class="text-center"><i class="fa fa-spin fa-spinner"></i> Loading...</div>',
39 closeButton: false
40 });
41 $.ajax({
42 url: delete_url,
43 dataType: "json",
44 contentType: "application/json;charset=utf-8",
45 success: function (result) {
46 //$('#modal_show_vim_body').empty();
47 dialog.modal('hide');
48 table.ajax.reload();
49 },
50 error: function (result) {
51 dialog.modal('hide');
52 bootbox.alert("An error occurred.");
53 }
54 });
55 }
56 })
57
58 }