woodpecker/pkg/template/pages/members_edit.html

110 lines
3.6 KiB
HTML
Raw Normal View History

2014-02-07 10:10:01 +00:00
{{ define "title" }}{{.Team.Name}} · Edit Member{{ end }}
{{ define "content" }}
<div class="subhead">
<div class="container">
<ul class="nav nav-tabs pull-right">
<li>
<a href="/dashboard/team/{{.Team.Slug}}">Dashboard</a>
</li>
<li class="active">
<a href="/account/team/{{.Team.Slug}}/profile">Settings</a>
</li>
</ul> <!-- ./nav -->
<h1 class="user">
<img src="{{.Team.Image}}">
<span>{{.Team.Slug}}</span>
</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/team/{{.Team.Slug}}/profile">Profile</a></li>
<li class="active"><a href="/account/team/{{.Team.Slug}}/members">Members</a></li>
<li><a href="/account/team/{{.Team.Slug}}/delete">Delete</a></li>
</ul>
</div><!-- ./col-xs-3 -->
<div class="col-xs-9" role="main" style="padding-left:20px;">
<div class="alert">Edit Team Membership for <strong>{{.Member.Name}}</strong></div>
<div class="row">
<div class="col-xs-5">
<form method="POST" role="form" action="/account/team/{{.Team.Slug}}/members/edit?id={{.Member.ID}}">
<label>Full Name:</label>
<div>
<span class="form-control">{{.Member.Name}}</span>
</div>
<label>Role:</label>
<div>
<select class="form-control" name="Role">
<option value="Owner">Owner</option>
<option value="Admin">Admin</option>
<option value="Write">Write</option>
<option value="Read">Read</option>
<option value="{{.Member.Role}}" selected="true">{{.Member.Role}}</option>
</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/team/{{.Team.Slug}}/members">Cancel</a>
</div>
</form>
</div>
<div class="col-xs-7">
<a class="avatar-link" href="https://gravatar.com/" target="_blank">
<img src="{{.Member.ImageLarge}}" />
</a>
</div>
</div>
<form method="POST" action="/account/team/{{.Team.Slug}}/members/delete?id={{.Member.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><!-- ./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("The Team Member's Role was successfully updated.");
$("#successAlert").show().removeClass("hide");
$('#submitButton').button('reset')
} else {
$("#failureAlert").text("Failed to update the Team Member's Role. "+this.response);
$("#failureAlert").show().removeClass("hide");
$('#submitButton').button('reset')
};
};
xhr.send(formData);
return false;
}
</script>
{{ end }}