harness-drone/pkg/template/pages/repo_settings.html

103 lines
3.3 KiB
HTML
Raw Normal View History

2014-02-07 10:10:01 +00:00
{{ define "title" }}{{.Repo.Slug}} · Settings{{ 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 class="active"><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><a href="/{{.Repo.Slug}}/delete">Delete</a></li>
</ul>
</div><!-- ./col-xs-3 -->
<div class="col-xs-9" role="main">
<div class="alert">Manage your repository settings.</div>
<form method="POST" action="/{{.Repo.Slug}}" role="form">
<div class="checkbox">
<label>
<input class="" type="checkbox" name="Disabled" {{ if not .Repo.Disabled }}checked="True" {{ end }}/>
Enable Build Hooks
</label>
</div>
<div class="checkbox form-group">
<label>
<input class="" type="checkbox" name="DisabledPullRequest" {{ if not .Repo.DisabledPullRequest }}checked="True" {{ end }}/>
Enable Pull Hooks
</label>
</div>
<div class="alert alert-min">Choose the account owner.</div>
<div>
<ul class="account-radio-group">
<li>
<input type="radio" name="Owner" {{ if ne .Repo.UserID 0 }}checked="True"{{ end }} value="">
<img src="{{ .User.Image }}">
<span>Me</span>
</li>
{{ $teamID := .Repo.TeamID}}
{{ range .Teams }}
<li>
<input type="radio" name="Owner" value="{{ .Slug }}" {{ if eq $teamID .ID }}checked="True"{{ end }} />
<img src="{{ .Image }}">
<span>{{ .Name }}</span>
</li>
{{ end }}
</ul>
</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 }}/settings">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 repository settings.");
$("#successAlert").show().removeClass("hide");
$('#submitButton').button('reset')
} else {
$("#failureAlert").text("Failed to invite the repository settings. Please try again");
$("#failureAlert").show().removeClass("hide");
$('#submitButton').button('reset')
};
};
xhr.send(formData);
return false;
}
</script>
{{ end }}