harness-drone/pkg/template/pages/members_add.html
2014-02-20 20:55:56 -05:00

87 lines
2.9 KiB
HTML

{{ define "title" }}{{.Team.Name}} · Profile{{ 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.Name}}</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">Invite a collaborator to join your Team.</div>
<div class="row">
<form action="/account/team/{{.Team.Slug}}/members/add" 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="Invite" data-loading-text="Inviting .." />
<a class="btn btn-default" href="/account/team/{{.Team.Slug}}/members">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 = "An invitation has been sent (via email) to join the Team.";
if (this.responseText != "OK") {
msg = "Email is not currently enabled. In order to invite this team member 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 invite the collaborator. Please try again");
$("#failureAlert").show().removeClass("hide");
$('#submitButton').button('reset')
};
};
xhr.send(formData);
return false;
}
</script>
{{ end }}