forked from lix-project/hydra
Merge pull request #905 from grahamc/danger-user
User Roles: make checkboxes
This commit is contained in:
commit
f9e30d2550
|
@ -2,17 +2,23 @@
|
||||||
[% PROCESS common.tt %]
|
[% PROCESS common.tt %]
|
||||||
|
|
||||||
[% BLOCK roleoption %]
|
[% BLOCK roleoption %]
|
||||||
<option value="[% role %]"
|
|
||||||
[% checked = false %]
|
[% checked = false %]
|
||||||
[% FOREACH r IN user.userroles %]
|
[% FOREACH r IN user.userroles %]
|
||||||
[% checked = r.role == role %]
|
[% checked = r.role == role %]
|
||||||
[% BREAK IF checked %]
|
[% BREAK IF checked %]
|
||||||
[% END %]
|
[% END %]
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
name="roles"
|
||||||
[% IF checked %]
|
[% IF checked %]
|
||||||
selected="selected"
|
checked="checked"
|
||||||
|
[% END %]
|
||||||
|
[% IF !mutable %]
|
||||||
|
disabled="disabled"
|
||||||
|
[% END %]
|
||||||
|
[% HTML.attributes(id => "role-${role}", value => role) %] />
|
||||||
|
<label [% HTML.attributes(for => "role-${role}") %]> [% role %]</label><br />
|
||||||
[% END %]
|
[% END %]
|
||||||
>[% role %]</option>
|
|
||||||
[% END %]
|
|
||||||
|
|
||||||
<form>
|
<form>
|
||||||
|
|
||||||
|
@ -70,16 +76,22 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
[% IF !create || c.check_user_roles('admin') %]
|
[% IF !create || c.check_user_roles('admin') %]
|
||||||
<div class="form-group row">
|
[% mutable = c.check_user_roles('admin') %]
|
||||||
<label class="col-sm-3">Roles</label>
|
<div class="form-group row card [% mutable ? "border-danger" : "border-light" %]">
|
||||||
<div class="col-sm-9">
|
<div class="card-header">User Roles</div>
|
||||||
<select multiple="multiple" name="roles" class="form-control" [% IF !c.check_user_roles('admin') %]disabled="disabled"[% END %]>
|
<div class="card-body [% mutable ? "text-danger" : "" %]">
|
||||||
[% INCLUDE roleoption role="admin" %]
|
[% IF mutable %]
|
||||||
[% INCLUDE roleoption role="create-projects" %]
|
<h5 class="card-title">Take care, you're allowed to change [% HTML.escape(user.fullname || user.emailaddress || "this user") %]'s roles.</h5>
|
||||||
[% INCLUDE roleoption role="restart-jobs" %]
|
[% ELSE %]
|
||||||
[% INCLUDE roleoption role="bump-to-front" %]
|
<h5 class="card-title">[% HTML.escape(user.fullname || user.emailaddress || "this user") %]'s roles.</h5>
|
||||||
[% INCLUDE roleoption role="cancel-build" %]
|
[% END %]
|
||||||
</select>
|
<p class="card-text">
|
||||||
|
[% INCLUDE roleoption mutable=mutable role="admin" %]
|
||||||
|
[% INCLUDE roleoption mutable=mutable role="create-projects" %]
|
||||||
|
[% INCLUDE roleoption mutable=mutable role="restart-jobs" %]
|
||||||
|
[% INCLUDE roleoption mutable=mutable role="bump-to-front" %]
|
||||||
|
[% INCLUDE roleoption mutable=mutable role="cancel-build" %]
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
[% END %]
|
[% END %]
|
||||||
|
@ -115,7 +127,6 @@
|
||||||
Delete this user
|
Delete this user
|
||||||
</button>
|
</button>
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
Loading…
Reference in a new issue