woodpecker/pkg/template/pages/admin_users_edit.html

103 lines
3.1 KiB
HTML
Raw Normal View History

2014-02-07 10:10:01 +00:00
{{ define "title" }}Settings · Sysadmin{{ end }}
{{ define "content" }}
<div class="subhead">
<div class="container">
<h1>Sysadmin</h1>
</div><!-- ./container -->
</div><!-- ./subhead -->
<div class="container">
<div class="row">
<div class="col-xs-3">
<ul class="nav nav-pills nav-stacked">
<li><a href="/account/admin/settings">Settings</a></li>
<li class="active"><a href="/account/admin/users">Users</a></li>
</ul>
</div><!-- ./col-xs-3 -->
<div class="col-xs-9" role="main" style="padding-left:20px;">
<div class="alert">Edit the User Account Details</div>
<div class="row">
<div class="col-xs-5">
<form action="/account/admin/users/edit?id={{.EditUser.ID}}" method="POST" role="form">
<label>Full Name:</label>
<div>
<span class="form-control">{{.EditUser.Name}}</span>
</div>
<label>Email Address:</label>
<div>
<span class="form-control">{{.EditUser.Email}}</span>
</div>
<label>Is Administrator:</label>
<div>
<select class="form-control" name="Admin">
{{ if .EditUser.Admin }}
<option value="true" selected>Yes</option>
<option value="false">No</option>
{{ else }}
<option value="trye">Yes</option>
<option value="false" selected>No</option>
{{ end }}
</select>
</div>
<div class="alert alert-success hide" id="successAlert"></div>
<div class="alert alert-error hide" id="failureAlert"></div>
<div class="form-actions">
<input class="btn btn-primary" id="submitButton" type="submit" value="Save" data-loading-text="Saving .." />
<a class="btn btn-default" href="/account/admin/users">Cancel</a>
</div>
</form>
</div>
<div class="col-xs-7">
<a class="avatar-link" href="https://gravatar.com/" target="_blank">
<img src="{{.EditUser.ImageLarge}}" />
</a>
</div>
</div>
<form method="POST" action="/account/admin/users/delete?id={{.EditUser.ID}}">
<div class="alert alert-upgrade">
<input class="btn btn-danger pull-right" type="submit" value="Delete" />
<div>
<strong>Warning</strong>
<span>this action cannot be undone.</span>
</div>
</div>
</form>
</div><!-- ./row -->
</div><!-- ./container -->
{{ end }}
{{ define "script" }}
<script>
document.forms[0].onsubmit = function(event) {
$("#successAlert").hide();
$("#failureAlert").hide();
$('#submitButton').button('loading');
var form = event.target;
var formData = new FormData(form);
xhr = new XMLHttpRequest();
xhr.open('POST', form.action);
xhr.onload = function() {
if (this.status == 200) {
$("#successAlert").text("User data was successfully updated");
$("#successAlert").show().removeClass("hide");
$('#submitButton').button('reset')
} else {
$("#failureAlert").text("Failed to update user data. " + this.response);
$("#failureAlert").show().removeClass("hide");
$('#submitButton').button('reset')
};
};
xhr.send(formData);
return false;
}
</script>
{{ end }}