woodpecker/pkg/template/pages/repo_delete.html

78 lines
2.3 KiB
HTML

{{ define "title" }}{{.Repo.Slug}} · Delete{{ end }}
{{ define "content" }}
<div class="subhead">
<div class="container">
<ul class="nav nav-tabs pull-right">
<li><a href="/{{.Repo.Slug}}">Commits</a></li>
<li class="active"><a href="/{{.Repo.Slug}}/settings">Settings</a></li>
</ul> <!-- ./nav -->
<h1>
<span>{{.Repo.Name}}</span>
<small>{{.Repo.Owner}}</small>
</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="/{{.Repo.Slug}}/settings">Repository</a></li>
<li><a href="/{{.Repo.Slug}}/params">Params</a></li>
<li><a href="/{{.Repo.Slug}}/keys">Key Pairs</a></li>
<li><a href="/{{.Repo.Slug}}/badges">Badges</a></li>
<li class="active"><a href="/{{.Repo.Slug}}/delete">Delete</a></li>
</ul>
</div><!-- ./col-xs-3 -->
<div class="col-xs-9" role="main">
<div class="alert">
<span>Delete this repository.</span>
<strong>Warning:</strong>
<span>this action cannot be undone.</span>
</div>
<form method="POST" role="form">
<label>Enter your password to confim:</label>
<div>
<input class="form-control" type="password" name="password" value="" />
</div>
<div class="alert alert-error hide" id="failureAlert"></div>
<div class="form-actions">
<input class="btn btn-danger" id="submitButton" type="submit" value="Delete Repository" />
<a class="btn btn-default" href="/{{.Repo.Slug}}/settings">Cancel</a>
</div>
</form>
</div><!-- ./col-xs-9 -->
</div><!-- ./row -->
</div><!-- ./container -->
{{ end }}
{{ define "script" }}
<script>
document.forms[0].onsubmit = function(event) {
$("#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 == 400) {
$("#failureAlert").text("The password you entered was incorrect.");
$("#failureAlert").show().removeClass("hide");
$('#submitButton').button('reset')
} else {
window.location.href = "/dashboard";
}
};
xhr.send(formData);
return false;
}
</script>
{{ end }}