github.com/marinho/drone@v0.2.1-0.20140504195434-d3ba962e89a7/pkg/template/pages/admin_users_edit.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">Edit the User Account Details</div>
    24  				<div class="row">
    25  					<div class="col-xs-5">
    26  						<form action="/account/admin/users/edit?id={{.EditUser.ID}}" method="POST" role="form">
    27  							<label>Full Name:</label>
    28  							<div>
    29  								<span class="form-control">{{.EditUser.Name}}</span>
    30  							</div>
    31  							<label>Email Address:</label>
    32  							<div>
    33  								<span class="form-control">{{.EditUser.Email}}</span>
    34  							</div>
    35  							<label>Is Administrator:</label>
    36  							<div>
    37  								<select class="form-control" name="Admin">
    38  									{{ if .EditUser.Admin }}
    39  									<option value="true" selected>Yes</option>
    40  									<option value="false">No</option>
    41  									{{ else }}
    42  									<option value="true">Yes</option>
    43  									<option value="false" selected>No</option>
    44  									{{ end }}
    45  								</select>
    46  							</div>
    47  							<div class="alert alert-success hide" id="successAlert"></div>
    48  							<div class="alert alert-error hide" id="failureAlert"></div>
    49  							<div class="form-actions">
    50  								<input class="btn btn-primary" id="submitButton" type="submit" value="Save" data-loading-text="Saving .." />
    51  								<a class="btn btn-default" href="/account/admin/users">Cancel</a>
    52  							</div>
    53  
    54  						</form>
    55  					</div>
    56  					<div class="col-xs-7">
    57  						<a class="avatar-link" href="https://gravatar.com/" target="_blank">
    58  							<img src="{{.EditUser.ImageLarge}}" />
    59  						</a>
    60  					</div>
    61  				</div>
    62  
    63  				<form method="POST" action="/account/admin/users/delete?id={{.EditUser.ID}}">
    64  				<div class="alert alert-upgrade">
    65  					<input class="btn btn-danger pull-right" type="submit" value="Delete" />
    66  					<div>
    67  						<strong>Warning</strong>
    68  						<span>this action cannot be undone.</span>
    69  					</div>
    70  				</div>
    71  			</form>
    72  		</div><!-- ./row -->
    73  
    74  	</div><!-- ./container -->
    75  {{ end }}
    76  
    77  {{ define "script" }}
    78  	<script>
    79  		document.forms[0].onsubmit = function(event) {
    80  			$("#successAlert").hide();
    81  			$("#failureAlert").hide();
    82  			$('#submitButton').button('loading');
    83  
    84  			var form = event.target;
    85  			var formData = new FormData(form);
    86  			xhr = new XMLHttpRequest();
    87  			xhr.open('POST', form.action);
    88  			xhr.onload = function() {
    89  			if (this.status == 200) {
    90  					$("#successAlert").text("User data was successfully updated");
    91  					$("#successAlert").show().removeClass("hide");
    92  					$('#submitButton').button('reset')
    93  			} else {
    94  					$("#failureAlert").text("Failed to update user data. " + this.response);
    95  					$("#failureAlert").show().removeClass("hide");
    96  					$('#submitButton').button('reset')
    97  				};
    98  			};
    99  			xhr.send(formData);
   100  			return false;
   101  		}
   102  	</script>
   103  {{ end }}