github.com/marinho/drone@v0.2.1-0.20140504195434-d3ba962e89a7/pkg/template/pages/admin_users_add.html (about)

     1  {{ define "title" }}Settings ยท Sysadmin{{ end }}
     2  
     3  {{ define "content" }}
     4  
     5  	<div class="subhead">
     6  		<div class="container">
     7  			<h1>Sysadmin</h1>
     8  		</div><!-- ./container -->
     9  	</div><!-- ./subhead -->
    10  
    11  
    12  	<div class="container">
    13  		<div class="row">
    14  
    15  			<div class="col-xs-3">
    16  				<ul class="nav nav-pills nav-stacked">
    17  					<li><a href="/account/admin/settings">Settings</a></li>
    18  					<li class="active"><a href="/account/admin/users">Users</a></li>
    19  				</ul>
    20  			</div><!-- ./col-xs-3 -->
    21  
    22  			<div class="col-xs-9" role="main" style="padding-left:20px;">
    23  				<div class="alert">Users will be granted access by Email invitation.</div>
    24  
    25  					<div class="row">
    26  						<form action="/account/admin/users" method="POST" role="form">
    27  							<label>Email Address:</label>
    28  							<div>
    29  								<input class="form-control" type="text" name="email" value="" />
    30  							</div>
    31  							<div class="alert alert-success hide" id="successAlert"></div>
    32  							<div class="alert alert-error hide" id="failureAlert"></div>
    33  							<div class="form-actions">
    34  								<input class="btn btn-primary" id="submitButton" type="submit" value="Send Invitation" data-loading-text="Inviting .." />
    35  								<a class="btn btn-default" href="/account/admin/users">Cancel</a>
    36  							</div>
    37  						</form>
    38  					</div>
    39  
    40  			</div><!-- ./col-xs-9 -->
    41  		</div><!-- ./row -->
    42  
    43  	</div><!-- ./container -->
    44  {{ end }}
    45  
    46  {{ define "script" }}
    47  	<script>
    48  		document.forms[0].onsubmit = function(event) {
    49  
    50  						$("#successAlert").hide();
    51  						$("#failureAlert").hide();
    52  						$('#submitButton').button('loading');
    53  
    54  						var form = event.target
    55  						var formData = new FormData(form);
    56  						xhr = new XMLHttpRequest();
    57  						xhr.open('POST', form.action);
    58  						xhr.onload = function() {
    59  								if (this.status == 200) {
    60  										var msg = "User Invitation was sent successfully";
    61  										if (this.responseText != "OK") {
    62  												msg = "Email is not currently enabled.  In order to invite the user, you'll need to provide them the following link:<br><span class='url'>" + this.responseText + "</span>";
    63  										}
    64  										$("#successAlert").html(msg);
    65  										$("#successAlert").show().removeClass("hide");
    66  										$('#submitButton').button('reset')
    67  										
    68  								} else {
    69  										$("#failureAlert").text("Failed to send Invitation Email. " + this.response);
    70  										$("#failureAlert").show().removeClass("hide");
    71  										$('#submitButton').button('reset')
    72  								};
    73  						};
    74  						xhr.send(formData);
    75  						return false;
    76  				}
    77  	</script>
    78  {{ end }}