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

     1  {{ define "title" }}GitHub ยท Add Repository{{ end }}
     2  
     3  {{ define "content" }}
     4  	<div class="subhead">
     5  		<div class="container">
     6  			<h1>
     7  				<span>Repository Setup</span>
     8  				<small>GitHub</small>
     9  			</h1>
    10  		</div><!-- ./container -->
    11   	</div><!-- ./subhead -->
    12  
    13  	<div class="container">
    14  		<div class="row">
    15  			<div class="col-xs-3">
    16  				<ul class="nav nav-pills nav-stacked">
    17  					<li class="active"><a href="/new/github.com">GitHub</a></li>
    18  					<li><a href="/new/bitbucket.org">Bitbucket</a></li>
    19  					<li><a href="/new/gitlab">GitLab</a></li>
    20  				</ul>
    21  			</div><!-- ./col-xs-3 -->
    22  
    23  			<div class="col-xs-9" role="main">
    24  					<div class="alert">
    25  						Enter your repository details
    26  						<a class="btn btn-default pull-right" href="/auth/login/github" style="font-size: 18px;background:#f4f4f4;">Re-Link Account</a>
    27  					</div>
    28  					<form class="form-repo" method="POST" action="/new/github.com">
    29  						<input type="hidden" name="domain" autocomplete="off" value="{{.Settings.GitHubDomain}}">
    30  						<div class="field-group">
    31  							<div>
    32  								<label>GitHub Owner</label>
    33  								<div>
    34  									<input class="form-control form-control-large" type="text" name="owner" autocomplete="off">
    35  								</div>
    36  							</div>
    37  						</div>
    38  						<div class="field-separator">/</div>
    39  							<div class="field-group">
    40  								<div>
    41  									<label>Repository Name</label>
    42  								<div>
    43  									<input class="form-control form-control-large" type="text" name="name" autocomplete="off">
    44  								</div>
    45  							</div>
    46  						</div>
    47  						<br/>
    48  						<div class="alert">Select your Drone account</div>
    49  						<ul>
    50  							<li>
    51  								<input type="radio" name="team" checked="True" value="">
    52  								<img src="{{ .User.Image }}?s=32">
    53  								<span>Me</span>
    54  							</li>
    55  							{{ range .Teams }}
    56  							<li>
    57  								<input type="radio" name="team" value="{{ .Slug }}">
    58  								<img src="{{ .Image }}?s=32">
    59  								<span>{{ .Name }}</span>
    60  							</li>
    61  							{{ end }}
    62  						</ul>
    63  						<div class="alert alert-success hide" id="successAlert"></div>
    64  						<div class="alert alert-error hide" id="failureAlert"></div>
    65  						<div class="form-actions">
    66  							<input class="btn btn-primary" id="submitButton" type="submit" value="Add" data-loading-text="Saving ..">
    67  							<a class="btn btn-default" href="/dashboard">Cancel</a>
    68  						</div>
    69  					</form>
    70  			</div><!-- ./col-xs-9 -->
    71  		</div><!-- ./row -->
    72  	</div><!-- ./container -->
    73  {{ end }}
    74  
    75  {{ define "script" }}
    76  	<script>
    77  		document.forms[0].onsubmit = function(event) {
    78  			$("#successAlert").hide();
    79  			$("#failureAlert").hide();
    80  			$('#submitButton').button('loading')
    81  			
    82  			var form = event.target
    83  			var formData = new FormData(form);
    84  			xhr = new XMLHttpRequest();
    85  			xhr.open('POST', form.action);
    86  			xhr.onload = function() {
    87  				if (this.status == 200) {
    88  					var name = $("input[name=name]").val()
    89  					var owner = $("input[name=owner]").val()
    90  					var domain = $("input[name=domain]").val()
    91  					window.location.pathname = "/" + domain + "/"+owner+"/"+name
    92  				} else {
    93  					$("#failureAlert").text("Unable to setup the Repository");
    94  					$("#failureAlert").show().removeClass("hide");
    95  					$('#submitButton').button('reset')
    96  				};
    97  			};
    98  			xhr.send(formData);
    99  			return false;
   100  		}
   101  	</script>
   102  {{ end }}