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

     1  {{ define "title" }}Profile{{ 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  			<div class="col-xs-3">
    15  				<ul class="nav nav-pills nav-stacked">
    16  					<li class="active"><a href="/account/admin/settings">Settings</a></li>
    17  					<li><a href="/account/admin/users">Users</a></li>
    18  				</ul>
    19  			</div><!-- ./col-xs-3 -->
    20  
    21  			<div class="col-xs-9" role="main" style="padding-left:20px;">
    22  				<form action="/account/admin/settings" method="POST">
    23  					<div class="form-group">
    24  						<div class="alert">Website Information</div>
    25  						<label>Scheme and Hostname:</label>
    26  						<select class="form-control form-control-small" name="Scheme">
    27  						{{ if eq .Settings.Scheme "https" }}
    28  							<option value="http">http://</option>
    29  							<option value="https" selected="True">https://</option>
    30  						{{ else }}
    31  							<option value="http" selected="True">http://</option>
    32  							<option value="https">https://</option>
    33  						{{ end }}
    34  						</select>
    35  						<input class="form-control form-control-xlarge" type="text" name="Domain" value="{{.Settings.Domain}}" />
    36  						<label class="checkbox">
    37  							Open invitations <input type="checkbox" name="OpenInvitations" {{ if .Settings.OpenInvitations }} checked {{ end }} />
    38  						</label>
    39  					</div>
    40  					<div class="form-group">
    41  						<div class="alert">GitHub OAuth Consumer Key and Secret</div>
    42  						<label>GitHub Client ID and Secret:</label>
    43  						<div>
    44  							<input class="form-control form-control-large" type="text" name="GitHubKey" value="{{.Settings.GitHubKey}}" />
    45  							<input class="form-control form-control-large" type="password" name="GitHubSecret" value="{{.Settings.GitHubSecret}}" />
    46  						</div>
    47  						<label>GitHub Settings:</label>
    48  						<div>
    49  							<input class="form-control form-control-large" type="text" name="GitHubDomain" value="{{.Settings.GitHubDomain}}" />
    50  							<input class="form-control form-control-large" type="text" name="GitHubApiUrl" value="{{.Settings.GitHubApiUrl}}" />
    51  						</div>
    52  					</div>
    53                      <div class="form-group">
    54                          <div class="alert">GitLab Settings</div>
    55                          <label>Base URL for GitLab: <small>(e.g. https://gitlab.com)</small></label>
    56                          <div>
    57                              <input class="form-control form-control-xlarge" type="text" name="GitlabApiUrl" value="{{.Settings.GitlabApiUrl}}" />
    58                          </div>
    59                      </div>
    60  					<div class="form-group">
    61  						<div class="alert">Bitbucket OAuth Consumer Key and Secret.</div>
    62  						<label>Bitbucket Key and Secret:</label>
    63  						<div>
    64  							<input class="form-control form-control-large" type="text" name="BitbucketKey" value="{{.Settings.BitbucketKey}}" />
    65  							<input class="form-control form-control-large" type="password" name="BitbucketSecret" value="{{.Settings.BitbucketSecret}}" />
    66  						</div>
    67  					</div>
    68  					<div class="form-group">
    69  						<div class="alert">SMTP Server Settings.</div>
    70  						<label>SMTP Server and Port:</label>
    71  						<div>
    72  							<input class="form-control form-control-xlarge" type="text" name="SmtpServer" value="{{.Settings.SmtpServer}}" />
    73  							<input class="form-control form-control-small" type="text" name="SmtpPort" value="{{.Settings.SmtpPort}}" />
    74  						</div>
    75  						<label>SMTP From Address:</label>
    76  						<div>
    77  							<input class="form-control form-control-xlarge" type="text" name="SmtpAddress" value="{{.Settings.SmtpAddress}}" />
    78  						</div>
    79  						<label>SMTP Username and Password:</label>
    80  						<div>
    81  							<input class="form-control form-control-large" type="text" name="SmtpUsername" value="{{.Settings.SmtpUsername}}" />
    82  							<input class="form-control form-control-large" type="password" name="SmtpPassword" value="{{.Settings.SmtpPassword}}" />
    83  						</div>
    84  					</div>
    85  					<div class="alert alert-success hide" id="successAlert"></div>
    86  					<div class="alert alert-error hide" id="failureAlert"></div>
    87  					<div class="form-actions">
    88  						<input class="btn btn-primary" id="submitButton" type="submit" value="Save" data-loading-text="Saving .." />
    89  						<a class="btn btn-default" href="/account/admin/settings">Cancel</a>
    90  					</div>
    91  				</form>
    92  			</div><!-- ./col-xs-9 -->
    93  		</div><!-- ./row -->
    94  
    95  	</div><!-- ./container -->
    96  {{ end }}
    97  
    98  {{ define "script" }}
    99  	<script>
   100  	if ($("input[name=Domain]").val() == "") {
   101  		$("input[name=Domain]").val(window.location.host);
   102  	}
   103  	</script>
   104  	<script>
   105  		document.forms[0].onsubmit = function(event) {
   106  			$("#successAlert").hide();
   107  			$("#failureAlert").hide();
   108  			$('#submitButton').button('loading')
   109  
   110  			var form = event.target;
   111  			var formData = new FormData(form);
   112  			xhr = new XMLHttpRequest();
   113  			xhr.open('POST', form.action);
   114  			xhr.onload = function() {
   115  				if (this.status == 200) {
   116  					$("#successAlert").text("Settings were successfully updated");
   117  					$("#successAlert").show().removeClass("hide")
   118  					$('#submitButton').button('reset')
   119  				} else {
   120  					$("#failureAlert").text("Failed to update settings. " + this.response);
   121  					$("#failureAlert").show().removeClass("hide")
   122  					$('#submitButton').button('reset')
   123  				};
   124  			};
   125  			xhr.send(formData);
   126  			return false;
   127  		};
   128  	</script>
   129  {{ end }}