summaryrefslogtreecommitdiffstats
path: root/modules-available/permissionmanager/templates/rolestable.html
blob: d520db330c78ea85fc56d3c25cad8cace03d6aae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<form method="post" action="?do=permissionmanager">
	<input type="hidden" name="token" value="{{token}}">

	<div>
		<input type="text" class="form-control" id="roleNameSearchField" onkeyup="searchFieldFunction()" placeholder="{{lang_searchPlaceholder}}">
	</div>

	<div class="row">
		<div class="col-md-12">
			<table class="table table-condensed table-hover stupidtable">
				<thead>
					<tr>
						<th data-sort="string">{{lang_roles}}</th>
						<th data-sort="string">{{lang_description}}</th>
						<th class="text-center slx-smallcol">
							{{#perms.roles.edit.disabled}}
							{{lang_view}}
							{{/perms.roles.edit.disabled}}
							{{^perms.roles.edit.disabled}}
							{{lang_edit}}
							{{/perms.roles.edit.disabled}}
						</th>
						<th class="text-center slx-smallcol">{{lang_delete}}</th>
					</tr>
				</thead>

				<tbody>
				{{#roles}}
					<tr>
						<td class="rolename">{{rolename}}</td>
						<td class="text-muted"><table class="slx-ellipsis"><tr><td>{{roledescription}}</td></tr></table></td>
						<td class="text-center">
							<a class="btn btn-xs btn-primary" href="?do=permissionmanager&amp;show=roleEditor&amp;roleid={{roleid}}"><span class="glyphicon glyphicon-edit"></span></a>
						</td>
						<td class="text-center">
							<button type="button" class="btn btn-xs btn-danger" data-toggle="modal" data-target="#deleteModal" onclick="deleteRole('{{roleid}}', '{{users}}')" {{perms.roles.edit.disabled}}>
								<span class="glyphicon glyphicon-trash"></span>
							</button>
						</td>
					</tr>
				{{/roles}}
				</tbody>
			</table>
		</div>
	</div>

	<!-- Modals -->
	<div class ="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title" id="myModalLabel">{{lang_delete}}</h4>
				</div>
				<div class="modal-body">
					<p>{{lang_roleDeleteConfirm}}</p>
					{{lang_numAssignedUsers}}: <span id="delete-role-users"></span>
				</div>
				<div class="modal-footer">
					<input type="hidden" id="delete-role-id" name="deleteId" value="">
					<button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button>
					<button type="submit" name="action" value="deleteRole" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> {{lang_delete}}</button>
				</div>
			</div>
		</div>
	</div>

</form>

<div class="text-right">
	<a href="?do=permissionmanager&amp;show=roleEditor" class="btn btn-success {{perms.roles.edit.disabled}}"><span class="glyphicon glyphicon-plus"></span> {{lang_newRole}}</a>
</div>

<script>
	function deleteRole(roleid, users) {
		$("#delete-role-id").val(roleid);
		$("#delete-role-users").text(users);
	}

	function searchFieldFunction() {
		var filter = $("#roleNameSearchField").val().toLowerCase();
		$(".rolename").each(function() {
			if ($(this).text().toLowerCase().indexOf(filter) >= 0) {
				$(this).closest("tr").show();
			} else {
				$(this).closest("tr").hide();
			}
		});
	}
</script>