1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/frontend/app/settings/usermanager/usermanager.settings.component.html

97 lines
3.6 KiB
HTML
Raw Normal View History

2018-05-14 04:59:57 +08:00
<div class="card mb-4">
<h5 class="card-header">
<ng-container i18n>Password protection</ng-container>
<div class="switch-wrapper">
2017-07-15 18:47:11 +08:00
<bSwitch
class="switch"
name="enabled"
[switch-on-color]="'success'"
[switch-inverse]="'inverse'"
2018-03-30 08:30:23 +08:00
[switch-off-text]="text.Disabled"
[switch-on-text]="text.Enabled"
2017-07-15 18:47:11 +08:00
[switch-handle-width]="'100'"
[switch-label-width]="'20'"
[switch-disabled]="inProgress"
[(ngModel)]="enabled"
(onChangeState)="switched($event)">
</bSwitch>
</div>
2018-05-14 04:59:57 +08:00
</h5>
<div class="card-body">
2017-07-15 18:47:11 +08:00
<div [hidden]="!error" class="alert alert-danger" role="alert"><strong>Error: </strong>{{error}}</div>
2017-07-15 18:47:11 +08:00
<ng-container *ngIf="enabled">
<table class="table table-hover">
<thead>
<tr>
<th i18n>Name</th>
<th i18n>Role</th>
2017-07-15 18:47:11 +08:00
<th></th>
</tr>
</thead>
<tr *ngFor="let user of users">
<td>{{user.name}}</td>
<td *ngIf="canModifyUser(user)">
<select class="form-control" [(ngModel)]="user.role" (change)="updateRole(user)" required>
<option *ngFor="let repository of userRoles" [value]="repository.key">
{{repository.value}}
</option>
</select>
</td>
<td *ngIf="!canModifyUser(user)">
{{user.role | stringifyRole}}
</td>
<td>
<button [disabled]="!canModifyUser(user)" (click)="deleteUser(user)"
[ngClass]="canModifyUser(user)? 'btn-danger':'btn-default'"
2018-05-14 04:59:57 +08:00
class="btn float-right">
<span class="oi oi-trash" aria-hidden="true" aria-label="Delete"></span>
2017-07-15 18:47:11 +08:00
</button>
</td>
</tr>
</table>
2018-05-14 04:59:57 +08:00
<button class="btn btn-primary float-right"
(click)="initNewUser()" i18n>+ Add user
2017-07-15 18:47:11 +08:00
</button>
</ng-container>
<div class="panel-info" *ngIf="!enabled" i18n>
2017-07-15 22:09:48 +08:00
To protect the site with password / have login enable this.
2017-07-15 18:47:11 +08:00
</div>
2017-07-08 18:43:42 +08:00
</div>
</div>
<!-- Modal -->
2017-07-08 18:43:42 +08:00
<div bsModal #userModal="bs-modal" class="modal fade" id="userModal" tabindex="-1" role="dialog"
aria-labelledby="userModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
2018-05-14 04:59:57 +08:00
<h5 class="modal-title" id="userModalLabel" i18n>Add new User</h5>
<button type="button" class="close" (click)="userModal.hide()" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
2017-07-08 18:43:42 +08:00
</div>
<form #NewUserForm="ngForm">
<div class="modal-body">
2018-11-19 03:26:29 +08:00
<input type="text" class="form-control" i18n-placeholder placeholder="Username"
2017-07-08 18:43:42 +08:00
[(ngModel)]="newUser.name" name="name" required>
<input type="password" class="form-control" i18n-placeholder placeholder="Password"
2017-07-08 18:43:42 +08:00
[(ngModel)]="newUser.password" name="password" required>
<select class="form-control" [(ngModel)]="newUser.role" name="role" required>
<option *ngFor="let repository of userRoles" [value]="repository.key">{{repository.value}}
</option>
</select>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" (click)="userModal.hide()" i18n>Close</button>
2017-07-08 18:43:42 +08:00
<button type="button" class="btn btn-primary" data-dismiss="modal"
(click)="addNewUser()"
[disabled]="!NewUserForm.form.valid" i18n>Add User
2017-07-08 18:43:42 +08:00
</button>
</div>
2017-07-08 18:43:42 +08:00
</form>
</div>
2017-07-08 18:43:42 +08:00
</div>
</div>