woodpecker/pkg/template/pages/repo_params.html
2014-02-07 03:10:01 -07:00

76 lines
No EOL
2.5 KiB
HTML

{{ define "title" }}{{.Repo.Slug}} · Secure{{ 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 class="active"><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><a href="/{{.Repo.Slug}}/delete">Delete</a></li>
</ul>
</div><!-- ./col-xs-3 -->
<div class="col-xs-9" role="main">
<div class="alert">Secure build configuration parameters</div>
<form method="POST" action="/{{.Repo.Slug}}?action=params">
<label>Build parameters are injected in your drone.yml file at runtime.</label>
<div>
<textarea name="params" class="form-control" rows="5" placeholder="foo: bar" spellcheck="false">{{.Textarea}}</textarea>
</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="/{{.Repo.Slug}}/params">Cancel</a>
</div>
</form>
</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) {
$("#successAlert").text("Successfully updated the secure data.");
$("#successAlert").show().removeClass("hide");
$('#submitButton').button('reset')
} else {
$("#failureAlert").text("Failed to invite the secure data. Please try again");
$("#failureAlert").show().removeClass("hide");
$('#submitButton').button('reset')
};
};
xhr.send(formData);
return false;
}
</script>
{{ end }}