woodpecker/pkg/template/pages/admin_users_add.html

78 lines
2.5 KiB
HTML

{{ 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">Users will be granted access by Email invitation.</div>
<div class="col-xs-5">
<form action="/account/admin/users" method="POST" role="form">
<label>Email Address:</label>
<div>
<input class="form-control" type="text" name="email" value="" />
</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="Send Invitation" data-loading-text="Inviting .." />
<a class="btn btn-default" href="/account/admin/users">Cancel</a>
</div>
</form>
</div>
</div><!-- ./col-xs-9 -->
</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) {
var msg = "User Invitation was sent successfully";
if (this.responseText != "OK") {
msg = "Email is not currently enabled. In order to invite the user, you'll need to provide them the following link:<br><span class='url'>" + this.responseText + "</span>";
}
$("#successAlert").html(msg);
$("#successAlert").show().removeClass("hide");
$('#submitButton').button('reset')
} else {
$("#failureAlert").text("Failed to send Invitation Email. " + this.response);
$("#failureAlert").show().removeClass("hide");
$('#submitButton').button('reset')
};
};
xhr.send(formData);
return false;
}
</script>
{{ end }}