mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-10-22 01:53:29 +00:00
initial public commit
This commit is contained in:
7
pkg/template/emails/activation.html
Normal file
7
pkg/template/emails/activation.html
Normal file
@@ -0,0 +1,7 @@
|
||||
{{ define "title" }}ACCOUNT ACTIVATION{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
<p class="lead" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-weight: normal; font-size: 17px; line-height: 1.3; margin: 0 0 10px; padding: 0; color: #333;">Please follow this link to activate your account:
|
||||
<div><a href="{{.Host}}/register?token={{.Token}}" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; color: #2a6496; font-weight: normal; margin: 0; padding: 0;">{{.Host}}/register?token={{.Token}}</a></div>
|
||||
</p>
|
||||
{{ end }}
|
49
pkg/template/emails/base_email.html
Normal file
49
pkg/template/emails/base_email.html
Normal file
@@ -0,0 +1,49 @@
|
||||
<!-- Inliner Build Version 4380b7741bb759d6cb997545f3add21ad48f010b -->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
|
||||
<head>
|
||||
<!-- If you delete this meta tag, Half Life 3 will never be released. -->
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>Drone CI</title>
|
||||
</head>
|
||||
<body bgcolor="#F7F7F7" style="background:#F7F7F7; background-color:#F7F7F7; font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; margin: 0; padding: 0; padding-bottom:20px; "><style type="text/css">
|
||||
@media only screen and (max-width: 600px) {
|
||||
a[class="btn"] {
|
||||
display: block !important; margin-bottom: 10px !important; background-image: none !important; margin-right: 0 !important;
|
||||
}
|
||||
div[class="column"] {
|
||||
width: auto !important; float: none !important;
|
||||
}
|
||||
table.social div[class="column"] {
|
||||
width: auto !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- HEADER -->
|
||||
<table class="head-wrap" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 100%; margin: 0; padding: 0;"><tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"><td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"></td>
|
||||
<td class="header container" bgcolor="#262829" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; display: block !important; max-width: 600px !important; clear: both !important; border-top-left-radius: 5px; -webkit-border-top-left-radius: 5px; -moz-border-top-left-radius: 5px; border-top-right-radius: 5px; -webkit-border-top-right-radius: 5px; -moz-border-top-right-radius: 5px; margin: 20px auto 0; padding: 0;">
|
||||
<div class="content" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; max-width: 600px; display: block; margin: 0 auto; padding: 15px;">
|
||||
<table bgcolor="#262829" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 100%; margin: 0; padding: 0;"><tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"><td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"></td>
|
||||
<td align="right" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"><h6 class="collapse" color="#EEE" style="font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; line-height: 1.1; color: #999; font-weight: 900; font-size: 14px; text-transform: uppercase; margin: 0; padding: 0;">{{ template "title" . }} <span style="color: #ddd; font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0 0 0 10px;">DRONE</span></h6></td>
|
||||
</tr></table></div>
|
||||
</td>
|
||||
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"></td>
|
||||
</tr></table><!-- /HEADER --><!-- BODY --><table class="body-wrap" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 100%; margin: 0; padding: 0;"><tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"><td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"></td>
|
||||
<td class="container" bgcolor="#FFFFFF" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; display: block !important; max-width: 600px !important; clear: both !important; margin: 0 auto; padding: 0;">
|
||||
<div class="content" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; max-width: 600px; display: block; margin: 0 auto; padding: 15px;">
|
||||
<table style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 100%; margin: 0; padding: 0;"><tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"><td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
|
||||
{{ template "content" . }}
|
||||
|
||||
<!-- Callout Panel -->
|
||||
<p class="callout" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-weight: normal; font-size: 14px; line-height: 1.6; color: #555; border-radius: 5px; -webkit-border-radius: 5px; -moz-border-radius: 5px; background: #EEE; margin: 25px 0 0px; padding: 15px;">
|
||||
To learn more about Drone and all its features, check out our documentation:
|
||||
<a href="http://drone.readthedocs.org/" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; color: #2a6496; font-weight: normal; margin: 0; padding: 0;">http://drone.readthedocs.org/</a>
|
||||
</p><!-- /Callout Panel -->
|
||||
</td>
|
||||
</tr></table></div><!-- /content -->
|
||||
</td>
|
||||
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"></td>
|
||||
</tr></table><!-- /BODY --></body>
|
||||
</html>
|
28
pkg/template/emails/failure.html
Normal file
28
pkg/template/emails/failure.html
Normal file
@@ -0,0 +1,28 @@
|
||||
{{ define "title" }}FAILURE{{end}}
|
||||
|
||||
{{ define "content" }}
|
||||
<!-- Callout Panel -->
|
||||
<p class="callout failure" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-weight: bold; font-size: 22px; line-height: 1.6; color: #a94442; border-radius: 5px; -webkit-border-radius: 5px; -moz-border-radius: 5px; background: #ebccd1; margin: 0px 0 20px; padding: 15px;">
|
||||
Commit {{ .Commit.HashShort }} Failed
|
||||
</p><!-- /Callout Panel -->
|
||||
|
||||
<h3 style="font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; line-height: 1.1; color: #333; font-weight: 500; font-size: 27px; margin: 0 0 15px; padding: 0 0 0 20px;">{{ .Repo.Owner }} / {{ .Repo.Name }}</h3>
|
||||
<table class="commit-table" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 100%; margin: 0; padding: 0;">
|
||||
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
|
||||
<th style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; text-align: left; color: #333; margin: 0; padding: 0 30px 0 20px;" align="left">commit:</th>
|
||||
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 99%; color: #333; margin: 0; padding: 0;"><a href="{{.Host}}/{{.Repo.Slug}}/commit/{{ .Commit.Hash }}" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; color: #2a6496; font-weight: normal; margin: 0; padding: 0;">{{ .Commit.HashShort }}</a></td>
|
||||
</tr>
|
||||
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
|
||||
<th style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; text-align: left; color: #333; margin: 0; padding: 0 30px 0 20px;" align="left">branch:</th>
|
||||
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 99%; color: #333; margin: 0; padding: 0;">{{ .Commit.Branch }}</td>
|
||||
</tr>
|
||||
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
|
||||
<th style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; text-align: left; color: #333; margin: 0; padding: 0 30px 0 20px;" align="left">author:</th>
|
||||
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 99%; color: #333; margin: 0; padding: 0;">{{ .Commit.Author }}</td>
|
||||
</tr>
|
||||
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
|
||||
<th style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; text-align: left; color: #333; margin: 0; padding: 0 30px 0 20px;" align="left">message:</th>
|
||||
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 99%; color: #333; margin: 0; padding: 0;">{{ .Commit.message }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
{{ end }}
|
7
pkg/template/emails/invitation.html
Normal file
7
pkg/template/emails/invitation.html
Normal file
@@ -0,0 +1,7 @@
|
||||
{{ define "title" }}TEAM INVITATION{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
<p class="lead" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-weight: normal; font-size: 17px; line-height: 1.3; margin: 0 0 10px; padding: 0; color: #333;">You are invited to join team <b>{{ .Team.Name }}</b>. Please follow this link to join:
|
||||
<div><a href="{{.Host}}/accept?token={{.Token}}" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; color: #2a6496; font-weight: normal; margin: 0; padding: 0;">{{.Host}}/accept?token={{.Token}}</a></div>
|
||||
</p>
|
||||
{{ end }}
|
7
pkg/template/emails/reset_password.html
Normal file
7
pkg/template/emails/reset_password.html
Normal file
@@ -0,0 +1,7 @@
|
||||
{{ define "title" }}PASSWORD RESET{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
<p class="lead" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-weight: normal; font-size: 17px; line-height: 1.3; margin: 0 0 10px; padding: 0; color: #333;">Please follow this link to activate your account:
|
||||
<div><a href="{{.Host}}/reset?token={{.Token}}" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; color: #2a6496; font-weight: normal; margin: 0; padding: 0;">{{.Host}}/reset?token={{.Token}}</a></div>
|
||||
</p>
|
||||
{{ end }}
|
28
pkg/template/emails/success.html
Normal file
28
pkg/template/emails/success.html
Normal file
@@ -0,0 +1,28 @@
|
||||
{{ define "title" }}FAILURE{{end}}
|
||||
|
||||
{{ define "content" }}
|
||||
<!-- Callout Panel -->
|
||||
<p class="callout failure" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-weight: bold; font-size: 22px; line-height: 1.6; color: #3c763d; border-radius: 5px; -webkit-border-radius: 5px; -moz-border-radius: 5px; background: #dff0d8; margin: 0px 0 20px; padding: 15px;">
|
||||
Commit {{ .Commit.HashShort }} Passed
|
||||
</p><!-- /Callout Panel -->
|
||||
|
||||
<h3 style="font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; line-height: 1.1; color: #333; font-weight: 500; font-size: 27px; margin: 0 0 15px; padding: 0 0 0 20px;">{{ .Repo.Owner }} / {{ .Repo.Name }}</h3>
|
||||
<table class="commit-table" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 100%; margin: 0; padding: 0;">
|
||||
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
|
||||
<th style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; text-align: left; color: #333; margin: 0; padding: 0 30px 0 20px;" align="left">commit:</th>
|
||||
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 99%; color: #333; margin: 0; padding: 0;"><a href="{{.Host}}/{{.Repo.Slug}}/commit/{{ .Commit.Hash }}" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; color: #2a6496; font-weight: normal; margin: 0; padding: 0;">{{ .Commit.HashShort }}</a></td>
|
||||
</tr>
|
||||
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
|
||||
<th style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; text-align: left; color: #333; margin: 0; padding: 0 30px 0 20px;" align="left">branch:</th>
|
||||
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 99%; color: #333; margin: 0; padding: 0;">{{ .Commit.Branch }}</td>
|
||||
</tr>
|
||||
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
|
||||
<th style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; text-align: left; color: #333; margin: 0; padding: 0 30px 0 20px;" align="left">author:</th>
|
||||
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 99%; color: #333; margin: 0; padding: 0;">{{ .Commit.Author }}</td>
|
||||
</tr>
|
||||
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
|
||||
<th style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; text-align: left; color: #333; margin: 0; padding: 0 30px 0 20px;" align="left">message:</th>
|
||||
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 99%; color: #333; margin: 0; padding: 0;">{{ .Commit.message }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
{{ end }}
|
9
pkg/template/pages/403.html
Normal file
9
pkg/template/pages/403.html
Normal file
@@ -0,0 +1,9 @@
|
||||
{{ define "title" }}Forbidden · drone.io{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
<h1>Forbidden</h1>
|
||||
<p>Forbidden</p>
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
{{ end }}
|
9
pkg/template/pages/404.html
Normal file
9
pkg/template/pages/404.html
Normal file
@@ -0,0 +1,9 @@
|
||||
{{ define "title" }}Not Found · drone.io{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
<h1>Oops!</h1>
|
||||
<p>We were unable to find the requested page.</p>
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
{{ end }}
|
9
pkg/template/pages/500.html
Normal file
9
pkg/template/pages/500.html
Normal file
@@ -0,0 +1,9 @@
|
||||
{{ define "title" }}Bad Request · drone.io{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
<h1>Bad Request</h1>
|
||||
<p>Bad Request</p>
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
{{ end }}
|
114
pkg/template/pages/admin_settings.html
Normal file
114
pkg/template/pages/admin_settings.html
Normal file
@@ -0,0 +1,114 @@
|
||||
{{ define "title" }}Profile{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
|
||||
<div class="subhead">
|
||||
<div class="container">
|
||||
<h1>Sysadmin</h1>
|
||||
</div><!-- ./container -->
|
||||
</div><!-- ./subhead -->
|
||||
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
<li class="active"><a href="/account/admin/settings">Settings</a></li>
|
||||
<li><a href="/account/admin/users">Users</a></li>
|
||||
</ul>
|
||||
</div><!-- ./col-xs-3 -->
|
||||
|
||||
<div class="col-xs-9" role="main" style="padding-left:20px;">
|
||||
<form action="/account/admin/settings" method="POST">
|
||||
<div class="form-group">
|
||||
<div class="alert">Website Information</div>
|
||||
<label>Scheme and Hostname:</label>
|
||||
<select class="form-control form-control-small" name="Scheme">
|
||||
{{ if eq .Settings.Scheme "https" }}
|
||||
<option value="http">http://</option>
|
||||
<option value="https" selected="True">https://</option>
|
||||
{{ else }}
|
||||
<option value="http" selected="True">http://</option>
|
||||
<option value="https">https://</option>
|
||||
{{ end }}
|
||||
</select>
|
||||
<input class="form-control form-control-xlarge" type="text" name="Domain" value="{{.Settings.Domain}}" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="alert">GitHub OAuth Consumer Key and Secret</div>
|
||||
<label>GitHub Client ID and Secret:</label>
|
||||
<div>
|
||||
<input class="form-control form-control-large" type="text" name="GitHubKey" value="{{.Settings.GitHubKey}}" />
|
||||
<input class="form-control form-control-large" type="password" name="GitHubSecret" value="{{.Settings.GitHubSecret}}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group hide">
|
||||
<div class="alert">Bitbucket OAuth Consumer Key and Secret.</div>
|
||||
<label>Bitbucket Key and Secret:</label>
|
||||
<div>
|
||||
<input class="form-control form-control-large" type="text" name="BitbucketKey" value="" />
|
||||
<input class="form-control form-control-large" type="password" name="BitbucketSecret" value="" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="alert">SMTP Server Settings.</div>
|
||||
<label>SMTP Server and Port:</label>
|
||||
<div>
|
||||
<input class="form-control form-control-xlarge" type="text" name="SmtpServer" value="{{.Settings.SmtpServer}}" />
|
||||
<input class="form-control form-control-small" type="text" name="SmtpPort" value="{{.Settings.SmtpPort}}" />
|
||||
</div>
|
||||
<label>SMTP From Address:</label>
|
||||
<div>
|
||||
<input class="form-control form-control-xlarge" type="text" name="SmtpAddress" value="{{.Settings.SmtpAddress}}" />
|
||||
</div>
|
||||
<label>SMTP Username and Password:</label>
|
||||
<div>
|
||||
<input class="form-control form-control-large" type="text" name="SmtpUsername" value="{{.Settings.SmtpUsername}}" />
|
||||
<input class="form-control form-control-large" type="password" name="SmtpPassword" value="{{.Settings.SmtpPassword}}" />
|
||||
</div>
|
||||
</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="Save" data-loading-text="Saving .." />
|
||||
<a class="btn btn-default" href="/account/admin/settings">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- ./col-xs-9 -->
|
||||
</div><!-- ./row -->
|
||||
|
||||
</div><!-- ./container -->
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
<script>
|
||||
if ($("input[name=Domain]").val() == "") {
|
||||
$("input[name=Domain]").val(window.location.host);
|
||||
}
|
||||
</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) {
|
||||
$("#successAlert").text("Settings were successfully updated");
|
||||
$("#successAlert").show().removeClass("hide")
|
||||
$('#submitButton').button('reset')
|
||||
} else {
|
||||
$("#failureAlert").text("Failed to update settings. " + this.response);
|
||||
$("#failureAlert").show().removeClass("hide")
|
||||
$('#submitButton').button('reset')
|
||||
};
|
||||
};
|
||||
xhr.send(formData);
|
||||
return false;
|
||||
};
|
||||
</script>
|
||||
{{ end }}
|
53
pkg/template/pages/admin_users.html
Normal file
53
pkg/template/pages/admin_users.html
Normal file
@@ -0,0 +1,53 @@
|
||||
{{ define "title" }}Users · Sysadmin{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
|
||||
<div class="subhead">
|
||||
<div class="container">
|
||||
<h1>Sysadmin</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/admin/settings">Settings</a></li>
|
||||
<li class="active"><a href="/account/admin/users">Users</a></li>
|
||||
</ul>
|
||||
</div><!-- ./col-xs-3 -->
|
||||
|
||||
<div class="col-xs-9" role="main" style="padding-left:20px;">
|
||||
<div class="alert">Manage all users in the System.</div>
|
||||
<div class="row gravatar-list">
|
||||
<span class="col-xs-3">
|
||||
<a class="thumbnail team-add" href="/account/admin/users/add">
|
||||
<span>
|
||||
<i class="fa fa-group"></i>
|
||||
</span>
|
||||
<div class="caption">
|
||||
<h3>add users</h3>
|
||||
</div>
|
||||
</a>
|
||||
</span>
|
||||
{{ range .Users }}
|
||||
<span class="col-xs-3">
|
||||
<a class="thumbnail" href="/account/admin/users/edit?id={{.ID}}">
|
||||
<img src="{{.ImageLarge}}">
|
||||
<div class="caption">
|
||||
<h3>{{.Name}}</h3>
|
||||
</div>
|
||||
</a>
|
||||
</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div><!-- ./col-xs-9 -->
|
||||
</div><!-- ./row -->
|
||||
|
||||
</div><!-- ./container -->
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
{{ end }}
|
78
pkg/template/pages/admin_users_add.html
Normal file
78
pkg/template/pages/admin_users_add.html
Normal file
@@ -0,0 +1,78 @@
|
||||
{{ define "title" }}Settings · Sysadmin{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
|
||||
<div class="subhead">
|
||||
<div class="container">
|
||||
<h1>Sysadmin</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/admin/settings">Settings</a></li>
|
||||
<li class="active"><a href="/account/admin/users">Users</a></li>
|
||||
</ul>
|
||||
</div><!-- ./col-xs-3 -->
|
||||
|
||||
<div class="col-xs-9" role="main" style="padding-left:20px;">
|
||||
<div class="alert">Users will be granted access by Email invitation.</div>
|
||||
|
||||
<div class="col-xs-5">
|
||||
<form action="/account/admin/users" 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="Send Invitation" data-loading-text="Inviting .." />
|
||||
<a class="btn btn-default" href="/account/admin/users">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 = "User Invitation was sent successfully";
|
||||
if (this.responseText != "OK") {
|
||||
msg = "Email is not currently enabled. In order to invite the user, you'll need to provide them the following link: " + this.responseText;
|
||||
}
|
||||
$("#successAlert").text(msg);
|
||||
$("#successAlert").show().removeClass("hide");
|
||||
$('#submitButton').button('reset')
|
||||
|
||||
} else {
|
||||
$("#failureAlert").text("Failed to send Invitation Email. " + this.response);
|
||||
$("#failureAlert").show().removeClass("hide");
|
||||
$('#submitButton').button('reset')
|
||||
};
|
||||
};
|
||||
xhr.send(formData);
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
{{ end }}
|
103
pkg/template/pages/admin_users_edit.html
Normal file
103
pkg/template/pages/admin_users_edit.html
Normal file
@@ -0,0 +1,103 @@
|
||||
{{ define "title" }}Settings · Sysadmin{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
|
||||
<div class="subhead">
|
||||
<div class="container">
|
||||
<h1>Sysadmin</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/admin/settings">Settings</a></li>
|
||||
<li class="active"><a href="/account/admin/users">Users</a></li>
|
||||
</ul>
|
||||
</div><!-- ./col-xs-3 -->
|
||||
|
||||
<div class="col-xs-9" role="main" style="padding-left:20px;">
|
||||
<div class="alert">Edit the User Account Details</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-5">
|
||||
<form action="/account/admin/users/edit?id={{.EditUser.ID}}" method="POST" role="form">
|
||||
<label>Full Name:</label>
|
||||
<div>
|
||||
<span class="form-control">{{.EditUser.Name}}</span>
|
||||
</div>
|
||||
<label>Email Address:</label>
|
||||
<div>
|
||||
<span class="form-control">{{.EditUser.Email}}</span>
|
||||
</div>
|
||||
<label>Is Administrator:</label>
|
||||
<div>
|
||||
<select class="form-control" name="Admin">
|
||||
{{ if .EditUser.Admin }}
|
||||
<option value="true" selected>Yes</option>
|
||||
<option value="false">No</option>
|
||||
{{ else }}
|
||||
<option value="trye">Yes</option>
|
||||
<option value="false" selected>No</option>
|
||||
{{ end }}
|
||||
</select>
|
||||
</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="Save" data-loading-text="Saving .." />
|
||||
<a class="btn btn-default" href="/account/admin/users">Cancel</a>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-xs-7">
|
||||
<a class="avatar-link" href="https://gravatar.com/" target="_blank">
|
||||
<img src="{{.EditUser.ImageLarge}}" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form method="POST" action="/account/admin/users/delete?id={{.EditUser.ID}}">
|
||||
<div class="alert alert-upgrade">
|
||||
<input class="btn btn-danger pull-right" type="submit" value="Delete" />
|
||||
<div>
|
||||
<strong>Warning</strong>
|
||||
<span>this action cannot be undone.</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</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) {
|
||||
$("#successAlert").text("User data was successfully updated");
|
||||
$("#successAlert").show().removeClass("hide");
|
||||
$('#submitButton').button('reset')
|
||||
} else {
|
||||
$("#failureAlert").text("Failed to update user data. " + this.response);
|
||||
$("#failureAlert").show().removeClass("hide");
|
||||
$('#submitButton').button('reset')
|
||||
};
|
||||
};
|
||||
xhr.send(formData);
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
{{ end }}
|
56
pkg/template/pages/base.html
Normal file
56
pkg/template/pages/base.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="author" content="Brad Rydzewski">
|
||||
<title>{{ template "title" . }}</title>
|
||||
|
||||
<link rel="shortcut icon" href="/img/favicon.png" />
|
||||
|
||||
<!-- bootstrap styles -->
|
||||
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
|
||||
<!-- drone bootstrap theme -->
|
||||
<link href="/css/drone.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<!-- fonts -->
|
||||
<link href="//fonts.googleapis.com/css?family=Orbitron" rel="stylesheet" />
|
||||
<link href="//fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" />
|
||||
<link href="//fonts.googleapis.com/css?family=Droid+Sans+Mono" rel="stylesheet" />
|
||||
<link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet" />
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-fixed-top navbar-inverse" role="navigation">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="/dashboard">drone.io</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="/dashboard">Home</a></li>
|
||||
<li><a href="/account/user/profile">Settings</a></li>
|
||||
<li><a href="/help">Help</a></li>
|
||||
<li><a class="btn btn-config" href="/account/admin/settings"><i class="fa fa-cogs"></i></a></li>
|
||||
<li><a href="/new/github.com" class="btn">New Repository</a></li>
|
||||
<li><a href="/logout" class="btn">Logout</a></li>
|
||||
</ul>
|
||||
</div><!-- /.nav-collapse -->
|
||||
</div><!-- /.container -->
|
||||
</div>
|
||||
|
||||
|
||||
{{ template "content" . }}
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
|
||||
{{ template "script" . }}
|
||||
</body>
|
||||
</html>
|
17
pkg/template/pages/forgot.html
Normal file
17
pkg/template/pages/forgot.html
Normal file
@@ -0,0 +1,17 @@
|
||||
{{ define "title" }}Forgot Password?{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
<h1>Forgot Password</h1>
|
||||
<div>
|
||||
<input class="form-control only-child" type="text" name="email" placeholder="Email address" autocomplete="off" spellcheck="off">
|
||||
</div>
|
||||
<div>
|
||||
<input type="submit" value="Send email">
|
||||
</div>
|
||||
<div>
|
||||
<a href="/login">back to login</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
{{ end }}
|
18
pkg/template/pages/forgot_sent.html
Normal file
18
pkg/template/pages/forgot_sent.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{{ define "title" }}Forgot Password?{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
<h1>Forgot Password</h1>
|
||||
<div class="alert alert-success">A Password Reset Email was Sent.</div>
|
||||
<div>
|
||||
<input class="form-control only-child" type="text" name="email" placeholder="Email address" autocomplete="off" spellcheck="off" />
|
||||
</div>
|
||||
<div>
|
||||
<input type="submit" value="Send Email" />
|
||||
</div>
|
||||
<div>
|
||||
<a href="/login">back to login</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
{{ end }}
|
33
pkg/template/pages/form.html
Normal file
33
pkg/template/pages/form.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="author" content="Brad Rydzewski">
|
||||
<title>{{ template "title" . }}</title>
|
||||
|
||||
<link rel="shortcut icon" href="/img/favicon.png" />
|
||||
|
||||
<!-- bootstrap styles -->
|
||||
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<!-- drone bootstrap theme -->
|
||||
<link href="/css/drone.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<!-- fonts -->
|
||||
<link href="//fonts.googleapis.com/css?family=Orbitron" rel="stylesheet" />
|
||||
<link href="//fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" />
|
||||
<style>
|
||||
body{background:#EEE;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<form class="form-centered" method="POST">
|
||||
{{ template "content" . }}
|
||||
</form>
|
||||
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
|
||||
{{ template "script" . }}
|
||||
</body>
|
||||
</html>
|
98
pkg/template/pages/github_add.html
Normal file
98
pkg/template/pages/github_add.html
Normal file
@@ -0,0 +1,98 @@
|
||||
{{ define "title" }}GitHub · Add Repository{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
<div class="subhead">
|
||||
<div class="container">
|
||||
<h1>
|
||||
<span>Repository Setup</span>
|
||||
<small>GitHub</small>
|
||||
</h1>
|
||||
</div><!-- ./container -->
|
||||
</div><!-- ./subhead -->
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
<li class="active"><a href="/github.com/drone/drone/settings">GitHub</a></li>
|
||||
<li><a href="/github.com/drone/drone/secure">Bitbucket <small>(coming soon)</small></a></li>
|
||||
</div><!-- ./col-xs-3 -->
|
||||
|
||||
<div class="col-xs-9" role="main">
|
||||
<div class="alert">
|
||||
Enter your repository details
|
||||
<a class="btn btn-default pull-right" href="/auth/login/github" style="font-size: 18px;background:#f4f4f4;">Re-Link Account</a>
|
||||
</div>
|
||||
<form class="form-repo" method="POST" action="/new/github.com">
|
||||
<div class="field-group">
|
||||
<div>
|
||||
<label>GitHub Owner</label>
|
||||
<div>
|
||||
<input class="form-control form-control-large" type="text" name="owner" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field-separator">/</div>
|
||||
<div class="field-group">
|
||||
<div>
|
||||
<label>Repository Name</label>
|
||||
<div>
|
||||
<input class="form-control form-control-large" type="text" name="name" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="alert">Select your Drone account</div>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="radio" name="team" checked="True">
|
||||
<img src="{{ .User.Image }}?s=32">
|
||||
<span>Me</span>
|
||||
</li>
|
||||
{{ range .Teams }}
|
||||
<li>
|
||||
<input type="radio" name="team" value="{{ .Slug }}">
|
||||
<img src="{{ .Image }}?s=32">
|
||||
<span>{{ .Name }}</span>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
<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="Add" data-loading-text="Saving ..">
|
||||
<a class="btn btn-default" href="/dashboard">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</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 name = $("input[name=name]").val()
|
||||
var owner = $("input[name=owner]").val()
|
||||
window.location.pathname = "/github.com/"+owner+"/"+name
|
||||
} else {
|
||||
$("#failureAlert").text("Unable to setup the Repository");
|
||||
$("#failureAlert").show().removeClass("hide");
|
||||
$('#submitButton').button('reset')
|
||||
};
|
||||
};
|
||||
xhr.send(formData);
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
{{ end }}
|
30
pkg/template/pages/github_link.html
Normal file
30
pkg/template/pages/github_link.html
Normal file
@@ -0,0 +1,30 @@
|
||||
{{ define "title" }}GitHub · Add Repository{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
<div class="subhead">
|
||||
<div class="container">
|
||||
<h1>
|
||||
<span>Repository Setup</span>
|
||||
<small>GitHub</small>
|
||||
</h1>
|
||||
</div><!-- ./container -->
|
||||
</div><!-- ./subhead -->
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
<li class="active"><a href="/github.com/drone/drone/settings">GitHub</a></li>
|
||||
<li><a href="/github.com/drone/drone/secure">Bitbucket <small>(coming soon)</small></a></li>
|
||||
</div><!-- ./col-xs-3 -->
|
||||
|
||||
<div class="col-xs-9" role="main">
|
||||
<div class="alert">Link Your GitHub Account
|
||||
<a class="btn btn-primary pull-right" href="/auth/login/github" style="font-size: 18px;">Link Now</a>
|
||||
</div>
|
||||
</div><!-- ./col-xs-9 -->
|
||||
</div><!-- ./row -->
|
||||
</div><!-- ./container -->
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}{{ end }}
|
21
pkg/template/pages/install.html
Normal file
21
pkg/template/pages/install.html
Normal file
@@ -0,0 +1,21 @@
|
||||
{{ define "title" }}Installation · drone.io{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
<h1>Installation</h1>
|
||||
<div>
|
||||
<input class="form-control" type="text" name="name" placeholder="Full Name (e.g. John Smith)" autocomplete="off" spellcheck="off" />
|
||||
<input class="form-control" type="text" name="email" placeholder="Email Address" autocomplete="off" spellcheck="off" style="border-top:0px;border-radius:0px;" />
|
||||
<input class="form-control" type="password" name="password" placeholder="Password" />
|
||||
</div>
|
||||
<div>
|
||||
<input type="hidden" name="Scheme" />
|
||||
<input type="hidden" name="Domain" />
|
||||
<input type="submit" value="Create Admin" />
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
<script>
|
||||
$("input[name=Domain]").val(window.location.host)
|
||||
</script>
|
||||
{{ end }}
|
18
pkg/template/pages/login.html
Normal file
18
pkg/template/pages/login.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{{ define "title" }}Login · drone.io{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
<h1>Login</h1>
|
||||
<div>
|
||||
<input type="text" name="username" placeholder="Email address" autocomplete="off" spellcheck="false" class="form-control" />
|
||||
<input type="password" name="password" placeholder="Password" class="form-control" />
|
||||
</div>
|
||||
<div>
|
||||
<input type="submit" value="Sign in" />
|
||||
</div>
|
||||
<div>
|
||||
<a href="/forgot">forgot password</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
{{ end }}
|
19
pkg/template/pages/login_error.html
Normal file
19
pkg/template/pages/login_error.html
Normal file
@@ -0,0 +1,19 @@
|
||||
{{ define "title" }}Login · drone.io{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
<h1>Login</h1>
|
||||
<div class="alert alert-danger">Invalid Email Address or Password</div>
|
||||
<div>
|
||||
<input type="text" name="username" placeholder="Email address" autocomplete="off" spellcheck="false" class="form-control" />
|
||||
<input type="password" name="password" placeholder="Password" class="form-control" />
|
||||
</div>
|
||||
<div>
|
||||
<input type="submit" value="Sign in" />
|
||||
</div>
|
||||
<div>
|
||||
<a href="/forgot">forgot password</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
{{ end }}
|
87
pkg/template/pages/members_add.html
Normal file
87
pkg/template/pages/members_add.html
Normal file
@@ -0,0 +1,87 @@
|
||||
{{ 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="col-xs-5">
|
||||
<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: " + this.responseText;
|
||||
}
|
||||
$("#successAlert").text(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 }}
|
110
pkg/template/pages/members_edit.html
Normal file
110
pkg/template/pages/members_edit.html
Normal file
@@ -0,0 +1,110 @@
|
||||
{{ define "title" }}{{.Team.Name}} · Edit Member{{ 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.Slug}}</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">Edit Team Membership for <strong>{{.Member.Name}}</strong></div>
|
||||
<div class="row">
|
||||
<div class="col-xs-5">
|
||||
<form method="POST" role="form" action="/account/team/{{.Team.Slug}}/members/edit?id={{.Member.ID}}">
|
||||
<label>Full Name:</label>
|
||||
<div>
|
||||
<span class="form-control">{{.Member.Name}}</span>
|
||||
</div>
|
||||
<label>Role:</label>
|
||||
<div>
|
||||
<select class="form-control" name="Role">
|
||||
<option value="Owner">Owner</option>
|
||||
<option value="Admin">Admin</option>
|
||||
<option value="Write">Write</option>
|
||||
<option value="Read">Read</option>
|
||||
<option value="{{.Member.Role}}" selected="true">{{.Member.Role}}</option>
|
||||
</select>
|
||||
</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="Save" data-loading-text="Saving .." />
|
||||
<a class="btn btn-default" href="/account/team/{{.Team.Slug}}/members">Cancel</a>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-xs-7">
|
||||
<a class="avatar-link" href="https://gravatar.com/" target="_blank">
|
||||
<img src="{{.Member.ImageLarge}}" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form method="POST" action="/account/team/{{.Team.Slug}}/members/delete?id={{.Member.ID}}">
|
||||
<div class="alert alert-upgrade">
|
||||
<input class="btn btn-danger pull-right" type="submit" value="Delete" />
|
||||
<div>
|
||||
<strong>Warning</strong>
|
||||
<span>this action cannot be undone.</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</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) {
|
||||
$("#successAlert").text("The Team Member's Role was successfully updated.");
|
||||
$("#successAlert").show().removeClass("hide");
|
||||
$('#submitButton').button('reset')
|
||||
} else {
|
||||
$("#failureAlert").text("Failed to update the Team Member's Role. "+this.response);
|
||||
$("#failureAlert").show().removeClass("hide");
|
||||
$('#submitButton').button('reset')
|
||||
};
|
||||
};
|
||||
xhr.send(formData);
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
{{ end }}
|
21
pkg/template/pages/register.html
Normal file
21
pkg/template/pages/register.html
Normal file
@@ -0,0 +1,21 @@
|
||||
{{ define "title" }}Register · drone.io{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
<h1>Registration</h1>
|
||||
{{ if .Error }}
|
||||
<div class="alert alert-danger">{{.Error}}</div>
|
||||
{{ end }}
|
||||
<div>
|
||||
<input class="form-control" type="text" name="name" placeholder="Full Name (e.g. John Smith)" autocomplete="off" spellcheck="off" />
|
||||
<input class="form-control" type="password" name="password" placeholder="Password" />
|
||||
</div>
|
||||
<div>
|
||||
<input type="submit" value="Create Account" />
|
||||
<div>
|
||||
<a href="/login">back to login</a>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
{{ end }}
|
50
pkg/template/pages/repo_badges.html
Normal file
50
pkg/template/pages/repo_badges.html
Normal file
@@ -0,0 +1,50 @@
|
||||
{{ define "title" }}{{.Repo.Slug}} · Badges{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
|
||||
<div class="subhead">
|
||||
<div class="container">
|
||||
<ul class="nav nav-tabs pull-right">
|
||||
<li><a href="/{{.Repo.Slug}}">Commits</a></li>
|
||||
<li class="active"><a href="/{{.Repo.Slug}}/settings">Settings</a></li>
|
||||
</ul> <!-- ./nav -->
|
||||
<h1>
|
||||
<span>{{.Repo.Name}}</span>
|
||||
<small>{{.Repo.Owner}}</small>
|
||||
</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="/{{.Repo.Slug}}/settings">Repository</a></li>
|
||||
<li><a href="/{{.Repo.Slug}}/params">Params</a></li>
|
||||
<li><a href="/{{.Repo.Slug}}/keys">Key Pairs</a></li>
|
||||
<li class="active"><a href="/{{.Repo.Slug}}/badges">Badges</a></li>
|
||||
<li><a href="/{{.Repo.Slug}}/delete">Delete</a></li>
|
||||
</ul>
|
||||
</div><!-- ./col-xs-3 -->
|
||||
|
||||
<div class="col-xs-9" role="main">
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<img class="pull-right" src="{{.Host}}/{{.Repo.Slug}}/status.png?branch=master">
|
||||
<label>Badge, Markdown format</label>
|
||||
<textarea class="form-control" rows="3">[]({{.Host}}/{{.Repo.Name}}/tree/master)</textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Badge, HTML format</label>
|
||||
<textarea class="form-control" rows="3"><a href="{{.Host}}/{{.Repo.Slug}}/tree/master"><img src="{{.Host}}/{{.Repo.Slug}}/status.png?branch=master" /></a></textarea>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- ./col-xs-9 -->
|
||||
</div><!-- ./row -->
|
||||
</div><!-- ./container -->
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
{{ end }}
|
80
pkg/template/pages/repo_commit.html
Normal file
80
pkg/template/pages/repo_commit.html
Normal file
@@ -0,0 +1,80 @@
|
||||
{{ define "title" }}{{.Repo.Slug}} · {{ .Commit.HashShort }}{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
|
||||
<div class="subhead">
|
||||
<div class="container">
|
||||
<ul class="nav nav-tabs pull-right">
|
||||
<li class="active"><a href="/{{.Repo.Slug}}/commit/{{ .Commit.Hash }}">{{ .Commit.HashShort }}</a></li>
|
||||
<li><a href="/{{.Repo.Slug}}">Commits</a></li>
|
||||
<li><a href="/{{.Repo.Slug}}/settings">Settings</a></li>
|
||||
</ul> <!-- ./nav -->
|
||||
<h1>
|
||||
<span>{{.Repo.Name}}</span>
|
||||
<small>{{.Repo.Owner}}</small>
|
||||
</h1>
|
||||
</div><!-- ./container -->
|
||||
</div><!-- ./subhead -->
|
||||
|
||||
<div class="container">
|
||||
<div class="alert alert-build-{{ .Build.Status }}">
|
||||
<a href="/{{.Repo.Slug}}/commit/{{.Commit.Hash }}" class="btn btn-{{ .Build.Status }}"></a>
|
||||
{{ if .Commit.PullRequest }}
|
||||
<span>opened pull request <span># {{ .Commit.PullRequest }}</span></span>
|
||||
{{ else }}
|
||||
<span>commit <span>{{ .Commit.HashShort }}</span> to <span>{{.Commit.Branch}}</span> branch</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="build-details container affix-top" data-spy="affix" data-offset-top="248">
|
||||
<div class="build-summary">
|
||||
<dt>Status</dt>
|
||||
<dd>{{.Build.Status}}</dd>
|
||||
<dt>Started</dt>
|
||||
<dd><span class="timeago" title="{{ .Build.StartedString }}"></span></dd>
|
||||
<dt>Duration</dt>
|
||||
<dd>{{ if .Build.IsRunning }}--{{else}}{{ .Build.HumanDuration }}{{end}}</dd>
|
||||
</div>
|
||||
<img src="{{.Commit.Image}}?d=identicon">
|
||||
<div class="commit-summary">
|
||||
<dt>Commit</dt>
|
||||
<dd><u>{{ .Commit.HashShort }}</u></dd>
|
||||
<dt>Committer</dt>
|
||||
<dd>{{ .Commit.Author }}</dd>
|
||||
<dt>Message</dt>
|
||||
<dd>{{ .Commit.Message }}</dd>
|
||||
</div>
|
||||
</div>
|
||||
<pre id="stdout"></pre>
|
||||
</div><!-- ./container -->
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-timeago/1.1.0/jquery.timeago.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(".timeago").timeago();
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
{{ if .Build.IsRunning }}
|
||||
var outputBox = document.getElementById('stdout');
|
||||
var outputWS = new WebSocket((window.location.protocol=='http:'?'ws':'wss')+'://'+window.location.host+'/feed?token='+{{ .Token }});
|
||||
outputWS.onopen = function () { console.log('output websocket open'); };
|
||||
outputWS.onerror = function (e) { console.log('websocket error: ' + e); };
|
||||
outputWS.onclose = function (e) { window.location.reload(); };
|
||||
outputWS.onmessage = function (e) {
|
||||
outputBox.innerHTML += formatLine(e.data);
|
||||
window.scrollTo(0, document.body.scrollHeight)
|
||||
};
|
||||
var re = /\u001B\[([0-9]+;?)*[Km]/g;
|
||||
var styles = new Array();
|
||||
var formatLine = function(s) {
|
||||
return s;
|
||||
};
|
||||
{{ else }}
|
||||
$.get("/{{ .Repo.Slug }}/commit/{{ .Commit.Hash }}/build/{{ .Build.Slug }}/out.txt", function( data ) {
|
||||
$( "#stdout" ).html( data );
|
||||
});
|
||||
{{ end }}
|
||||
</script>
|
||||
{{ end }}
|
81
pkg/template/pages/repo_dashboard.html
Normal file
81
pkg/template/pages/repo_dashboard.html
Normal file
@@ -0,0 +1,81 @@
|
||||
{{ define "title" }}{{.Repo.Slug}} · Dashboard{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
<div class="subhead">
|
||||
<div class="container">
|
||||
<ul class="nav nav-tabs pull-right">
|
||||
<li class="active"><a href="/{{.Repo.Slug}}">Commits</a></li>
|
||||
<li><a href="/{{.Repo.Slug}}/settings">Settings</a></li>
|
||||
</ul> <!-- ./nav -->
|
||||
<h1>
|
||||
<span>{{.Repo.Name}}</span>
|
||||
<small>{{.Repo.Owner}}</small>
|
||||
</h1>
|
||||
</div><!-- ./container -->
|
||||
</div><!-- ./subhead -->
|
||||
|
||||
{{ $repo := .Repo }}
|
||||
{{ $branch := .Branch }}
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-xs-8" role="main">
|
||||
<a class="btn btn-refresh hide" href="/{{.Repo.Slug}}/tree/{{.Branch}}">
|
||||
<i class="fa fa-rotate-right"></i>
|
||||
<span>0 new</span>
|
||||
</a>
|
||||
|
||||
{{ if .Commits }}
|
||||
<ul class="commit-list commit-list-alt">
|
||||
{{ range .Commits }}
|
||||
<li>
|
||||
<a href="/{{$repo.Slug}}/commit/{{.Hash}}" class="btn btn-{{.Status}}"></a>
|
||||
<h3>
|
||||
<a href="/{{$repo.Slug}}/commit/{{.Hash}}">{{.HashShort}}</a>
|
||||
<small class="timeago" title="{{.CreatedString}}"></small>
|
||||
{{ if .PullRequest }}
|
||||
<p>opened pull request <a href="/{{.Slug}}/commit/{{.Hash}}"># {{.PullRequest}}</a></p>
|
||||
{{ else }}
|
||||
<p>{{.Message}} </p>
|
||||
{{ end }}
|
||||
</h3>
|
||||
<img src="{{.Image}}" />
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
</div><!-- ./col-xs-8 -->
|
||||
|
||||
<div class="col-xs-4" style="padding-left:20px;">
|
||||
<ul class="nav nav-pills nav-stacked nav-branches">
|
||||
{{ range .Branches }}
|
||||
<li{{ if eq $branch .Branch }} class="active"{{end}}>
|
||||
<a href="/{{ $repo.Slug }}/tree/{{.Branch}}">
|
||||
<span class="btn btn-mini btn-{{.Status}} "></span>
|
||||
<span>{{.Branch}}</span>
|
||||
</a>
|
||||
<li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div><!-- ./col-xs-4 -->
|
||||
</div><!-- ./row -->
|
||||
</div><!-- ./container -->
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-timeago/1.1.0/jquery.timeago.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(".timeago").timeago();
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var updates = 0;
|
||||
var ws = new WebSocket((window.location.protocol=='http:'?'ws':'wss')+'://'+window.location.host+'/feed?token='+{{ .Token}});
|
||||
ws.onmessage = function (e) {
|
||||
updates = updates+1;
|
||||
$(".btn-refresh span").text(updates + " new")
|
||||
$(".btn-refresh").show().removeClass("hide");
|
||||
};
|
||||
</script>
|
||||
{{ end }}
|
54
pkg/template/pages/repo_delete.html
Normal file
54
pkg/template/pages/repo_delete.html
Normal file
@@ -0,0 +1,54 @@
|
||||
{{ define "title" }}{{.Repo.Slug}} · Delete{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
|
||||
<div class="subhead">
|
||||
<div class="container">
|
||||
<ul class="nav nav-tabs pull-right">
|
||||
<li><a href="/{{.Repo.Slug}}">Commits</a></li>
|
||||
<li class="active"><a href="/{{.Repo.Slug}}/settings">Settings</a></li>
|
||||
</ul> <!-- ./nav -->
|
||||
<h1>
|
||||
<span>{{.Repo.Name}}</span>
|
||||
<small>{{.Repo.Owner}}</small>
|
||||
</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="/{{.Repo.Slug}}/settings">Repository</a></li>
|
||||
<li><a href="/{{.Repo.Slug}}/params">Params</a></li>
|
||||
<li><a href="/{{.Repo.Slug}}/keys">Key Pairs</a></li>
|
||||
<li><a href="/{{.Repo.Slug}}/badges">Badges</a></li>
|
||||
<li class="active"><a href="/{{.Repo.Slug}}/delete">Delete</a></li>
|
||||
</ul>
|
||||
</div><!-- ./col-xs-3 -->
|
||||
|
||||
<div class="col-xs-9" role="main">
|
||||
<div class="alert">
|
||||
<span>Delete this repository.</span>
|
||||
<strong>Warning:</strong>
|
||||
<span>this action cannot be undone.</span>
|
||||
</div>
|
||||
|
||||
<form method="POST" role="form">
|
||||
<label>Enter your password to confim:</label>
|
||||
<div>
|
||||
<input class="form-control" type="password" name="password" value="" />
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<input class="btn btn-danger" id="submitButton" type="submit" value="Delete Repository" />
|
||||
<a class="btn btn-default" href="/{{.Repo.Slug}}/settings">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- ./col-xs-9 -->
|
||||
</div><!-- ./row -->
|
||||
</div><!-- ./container -->
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
{{ end }}
|
45
pkg/template/pages/repo_keys.html
Normal file
45
pkg/template/pages/repo_keys.html
Normal file
@@ -0,0 +1,45 @@
|
||||
{{ define "title" }}{{.Repo.Slug}} · Keys{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
|
||||
<div class="subhead">
|
||||
<div class="container">
|
||||
<ul class="nav nav-tabs pull-right">
|
||||
<li><a href="/{{.Repo.Slug}}">Commits</a></li>
|
||||
<li class="active"><a href="/{{.Repo.Slug}}/settings">Settings</a></li>
|
||||
</ul> <!-- ./nav -->
|
||||
<h1>
|
||||
<span>{{.Repo.Name}}</span>
|
||||
<small>{{.Repo.Owner}}</small>
|
||||
</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="/{{.Repo.Slug}}/settings">Repository</a></li>
|
||||
<li><a href="/{{.Repo.Slug}}/params">Params</a></li>
|
||||
<li class="active"><a href="/{{.Repo.Slug}}/keys">Key Pairs</a></li>
|
||||
<li><a href="/{{.Repo.Slug}}/badges">Badges</a></li>
|
||||
<li><a href="/{{.Repo.Slug}}/delete">Delete</a></li>
|
||||
</ul>
|
||||
</div><!-- ./col-xs-3 -->
|
||||
|
||||
<div class="col-xs-9" role="main">
|
||||
<div class="alert">Public Key, used for Deployments</div>
|
||||
<form>
|
||||
<label>You can add this Key to your Heroku account, SSH <code>.ssh/authorized_keys</code> file, and more.</label>
|
||||
<div>
|
||||
<textarea name="PublicKey" class="form-control" rows="8" spellcheck="false">{{.Repo.PublicKey}}</textarea>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- ./col-xs-9 -->
|
||||
</div><!-- ./row -->
|
||||
</div><!-- ./container -->
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
{{ end }}
|
76
pkg/template/pages/repo_params.html
Normal file
76
pkg/template/pages/repo_params.html
Normal file
@@ -0,0 +1,76 @@
|
||||
{{ define "title" }}{{.Repo.Slug}} · Secure{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
|
||||
<div class="subhead">
|
||||
<div class="container">
|
||||
<ul class="nav nav-tabs pull-right">
|
||||
<li><a href="/{{.Repo.Slug}}">Commits</a></li>
|
||||
<li class="active"><a href="/{{.Repo.Slug}}/settings">Settings</a></li>
|
||||
</ul> <!-- ./nav -->
|
||||
<h1>
|
||||
<span>{{.Repo.Name}}</span>
|
||||
<small>{{.Repo.Owner}}</small>
|
||||
</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="/{{.Repo.Slug}}/settings">Repository</a></li>
|
||||
<li class="active"><a href="/{{.Repo.Slug}}/params">Params</a></li>
|
||||
<li><a href="/{{.Repo.Slug}}/keys">Key Pairs</a></li>
|
||||
<li><a href="/{{.Repo.Slug}}/badges">Badges</a></li>
|
||||
<li><a href="/{{.Repo.Slug}}/delete">Delete</a></li>
|
||||
</ul>
|
||||
</div><!-- ./col-xs-3 -->
|
||||
|
||||
<div class="col-xs-9" role="main">
|
||||
<div class="alert">Secure build configuration parameters</div>
|
||||
<form method="POST" action="/{{.Repo.Slug}}?action=params">
|
||||
<label>Build parameters are injected in your drone.yml file at runtime.</label>
|
||||
<div>
|
||||
<textarea name="params" class="form-control" rows="5" placeholder="foo: bar" spellcheck="false">{{.Textarea}}</textarea>
|
||||
</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="Save" data-loading-text="Saving ..">
|
||||
<a class="btn btn-default" href="/{{.Repo.Slug}}/params">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</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) {
|
||||
$("#successAlert").text("Successfully updated the secure data.");
|
||||
$("#successAlert").show().removeClass("hide");
|
||||
$('#submitButton').button('reset')
|
||||
} else {
|
||||
$("#failureAlert").text("Failed to invite the secure data. Please try again");
|
||||
$("#failureAlert").show().removeClass("hide");
|
||||
$('#submitButton').button('reset')
|
||||
};
|
||||
};
|
||||
xhr.send(formData);
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
{{ end }}
|
103
pkg/template/pages/repo_settings.html
Normal file
103
pkg/template/pages/repo_settings.html
Normal file
@@ -0,0 +1,103 @@
|
||||
{{ define "title" }}{{.Repo.Slug}} · Settings{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
<div class="subhead">
|
||||
<div class="container">
|
||||
<ul class="nav nav-tabs pull-right">
|
||||
<li><a href="/{{.Repo.Slug}}">Commits</a></li>
|
||||
<li class="active"><a href="/{{.Repo.Slug}}/settings">Settings</a></li>
|
||||
</ul> <!-- ./nav -->
|
||||
<h1>
|
||||
<span>{{.Repo.Name}}</span>
|
||||
<small>{{.Repo.Owner}}</small>
|
||||
</h1>
|
||||
</div><!-- ./container -->
|
||||
</div><!-- ./subhead -->
|
||||
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-xs-3">
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
<li class="active"><a href="/{{.Repo.Slug}}/settings">Repository</a></li>
|
||||
<li><a href="/{{.Repo.Slug}}/params">Params</a></li>
|
||||
<li><a href="/{{.Repo.Slug}}/keys">Key Pairs</a></li>
|
||||
<li><a href="/{{.Repo.Slug}}/badges">Badges</a></li>
|
||||
<li><a href="/{{.Repo.Slug}}/delete">Delete</a></li>
|
||||
</ul>
|
||||
</div><!-- ./col-xs-3 -->
|
||||
|
||||
<div class="col-xs-9" role="main">
|
||||
<div class="alert">Manage your repository settings.</div>
|
||||
<form method="POST" action="/{{.Repo.Slug}}" role="form">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input class="" type="checkbox" name="Disabled" {{ if not .Repo.Disabled }}checked="True" {{ end }}/>
|
||||
Enable Build Hooks
|
||||
</label>
|
||||
</div>
|
||||
<div class="checkbox form-group">
|
||||
<label>
|
||||
<input class="" type="checkbox" name="DisabledPullRequest" {{ if not .Repo.DisabledPullRequest }}checked="True" {{ end }}/>
|
||||
Enable Pull Hooks
|
||||
</label>
|
||||
</div>
|
||||
<div class="alert alert-min">Choose the account owner.</div>
|
||||
<div>
|
||||
<ul class="account-radio-group">
|
||||
<li>
|
||||
<input type="radio" name="Owner" {{ if ne .Repo.UserID 0 }}checked="True"{{ end }} value="">
|
||||
<img src="{{ .User.Image }}">
|
||||
<span>Me</span>
|
||||
</li>
|
||||
{{ $teamID := .Repo.TeamID}}
|
||||
{{ range .Teams }}
|
||||
<li>
|
||||
<input type="radio" name="Owner" value="{{ .Slug }}" {{ if eq $teamID .ID }}checked="True"{{ end }} />
|
||||
<img src="{{ .Image }}">
|
||||
<span>{{ .Name }}</span>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</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="Save" data-loading-text="Saving ..">
|
||||
<a class="btn btn-default" href="/{{ .Repo.Slug }}/settings">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</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) {
|
||||
$("#successAlert").text("Successfully updated the repository settings.");
|
||||
$("#successAlert").show().removeClass("hide");
|
||||
$('#submitButton').button('reset')
|
||||
} else {
|
||||
$("#failureAlert").text("Failed to invite the repository settings. Please try again");
|
||||
$("#failureAlert").show().removeClass("hide");
|
||||
$('#submitButton').button('reset')
|
||||
};
|
||||
};
|
||||
xhr.send(formData);
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
{{ end }}
|
20
pkg/template/pages/reset.html
Normal file
20
pkg/template/pages/reset.html
Normal file
@@ -0,0 +1,20 @@
|
||||
{{ define "title" }}Reset · drone.io{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
<h1>Reset Password</h1>
|
||||
{{ if .Error }}
|
||||
<div class="alert alert-danger">{{ .Error }}</div>
|
||||
{{ end }}
|
||||
<div>
|
||||
<input class="form-control only-child" type="password" name="password" placeholder="New Password" />
|
||||
</div>
|
||||
<div>
|
||||
<input type="submit" value="Reset password" />
|
||||
</div>
|
||||
<div>
|
||||
<a href="/login">back to login</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
{{ end }}
|
111
pkg/template/pages/team_dashboard.html
Normal file
111
pkg/template/pages/team_dashboard.html
Normal file
@@ -0,0 +1,111 @@
|
||||
{{ define "title" }}{{.Team.Name}} · Dashboard{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
|
||||
<div class="subhead">
|
||||
<div class="container">
|
||||
<ul class="nav nav-tabs pull-right">
|
||||
<li class="active">
|
||||
<a href="/dashboard/team/{{.Team.Slug}}">Dashboard</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/account/team/{{.Team.Slug}}/profile">Team 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-8" role="main">
|
||||
<div class="alert alert-feed">
|
||||
<ul class="thumbnails pull-right">
|
||||
<li>
|
||||
<a class="thumbnail" href="/dashboard">
|
||||
<img src="{{.User.Image}}" />
|
||||
</a>
|
||||
</li>
|
||||
{{ range .Teams }}
|
||||
<li>
|
||||
<a class="thumbnail" href="/dashboard/team/{{.Slug}}">
|
||||
<img src="{{.Image}}" />
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
<span class="label">switch dashboard</span>
|
||||
<span>Recent Builds</span>
|
||||
</div><!-- ./alert -->
|
||||
|
||||
{{ if .Commits }}
|
||||
<ul class="commit-list">
|
||||
{{ range $commit := .Commits }}
|
||||
<li>
|
||||
<a href="/{{$commit.Slug}}/commit/{{$commit.Hash}}" class="btn btn-{{$commit.Status}}"></a>
|
||||
<h3>
|
||||
<a href="/{{$commit.Slug}}">{{$commit.Owner}} / {{$commit.Name}}</a>
|
||||
<small class="timeago" title="{{$commit.CreatedString}}"></small>
|
||||
{{ if $commit.PullRequest }}
|
||||
<p>opened pull request <a href="/{{$commit.Slug}}/commit/{{$commit.Hash}}"># {{$commit.PullRequest}}</a></p>
|
||||
{{ else }}
|
||||
<p>commit <a href="/{{$commit.Slug}}/commit/{{$commit.Hash}}">{{$commit.HashShort}}</a> to <a href="/{{$commit.Slug}}/tree/{{$commit.Branch}}">{{$commit.Branch}}</a> branch</p>
|
||||
{{ end }}
|
||||
</h3>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
</div><!-- ./col-xs-8 -->
|
||||
|
||||
<div class="col-xs-4" style="padding-left:20px;">
|
||||
<ul class="nav nav-pills nav-stacked nav-repos">
|
||||
{{ range $repo := .Repos }}
|
||||
<li>
|
||||
<a href="/{{$repo.Slug}}">
|
||||
<span>{{$repo.Owner}} / </span>
|
||||
<span>{{$repo.Name}}</span>
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div><!-- ./col-xs-4 -->
|
||||
</div><!-- ./row -->
|
||||
</div><!-- ./container -->
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-timeago/1.1.0/jquery.timeago.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(".timeago").timeago();
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
if (window.localStorage) {
|
||||
// get the last visited date from local storage
|
||||
var lastVisited = localStorage["lastVisited"];
|
||||
if (lastVisited == "null" || lastVisited == NaN || !lastVisited) {
|
||||
lastVisited = Date.parse("1970-01-01T00:00:00Z");
|
||||
} else {
|
||||
lastVisited = Date.parse(lastVisited);
|
||||
}
|
||||
|
||||
// get created dates for repositories
|
||||
var commits = $(".timeago")
|
||||
$('.timeago').each(function(){
|
||||
var date = Date.parse($(this).attr("title"));
|
||||
if (date > lastVisited) {
|
||||
$(this).parent().parent().append('<span style="position: absolute;left: -60px;background: #f7f7f7;padding: 5px 10px;color: #999;border-radius: 5px;top: 26px;">New</span>');
|
||||
}
|
||||
|
||||
// update the last visited date
|
||||
localStorage["lastVisited"] = Date();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{{ end }}
|
57
pkg/template/pages/team_delete.html
Normal file
57
pkg/template/pages/team_delete.html
Normal file
@@ -0,0 +1,57 @@
|
||||
{{ 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">Team 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><a href="/account/team/{{.Team.Slug}}/members">Members</a></li>
|
||||
<li class="active"><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">Delete this Team account. <b>Warning</b> this action cannot be undone.</div>
|
||||
|
||||
<div class="col-xs-5">
|
||||
<form action="/account/team/{{.Team.Slug}}/delete" method="POST" role="form">
|
||||
<label>Enter your password to confim:</label>
|
||||
<div>
|
||||
<input class="form-control" type="password" name="password" value="" />
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<input class="btn btn-danger" id="submitButton" type="submit" value="Delete Team" />
|
||||
<a class="btn btn-default" href="/account/team/{{.Team.Slug}}/profile">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- ./col-xs-6 -->
|
||||
|
||||
</div><!-- ./col-xs-9 -->
|
||||
</div><!-- ./row -->
|
||||
|
||||
</div><!-- ./container -->
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
{{ end }}
|
65
pkg/template/pages/team_members.html
Normal file
65
pkg/template/pages/team_members.html
Normal file
@@ -0,0 +1,65 @@
|
||||
{{ 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">Team 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">Members share access to all Repositories owned by this Team account.</div>
|
||||
<div class="row gravatar-list">
|
||||
<span class="col-xs-3">
|
||||
<a class="thumbnail team-add" href="/account/team/{{.Team.Slug}}/members/add">
|
||||
<span>
|
||||
<i class="fa fa-group"></i>
|
||||
</span>
|
||||
<div class="caption">
|
||||
<h3>add members</h3>
|
||||
</div>
|
||||
</a>
|
||||
</span>
|
||||
{{ $teamSlug := .Team.Slug }}
|
||||
{{ range .Members }}
|
||||
<span class="col-xs-3">
|
||||
<a class="thumbnail" href="/account/team/{{$teamSlug}}/members/edit?id={{.ID}}">
|
||||
<img src="{{.ImageLarge}}">
|
||||
<div class="caption">
|
||||
<h3>{{.Name}}</h3>
|
||||
</div>
|
||||
</a>
|
||||
</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div><!-- ./col-xs-9 -->
|
||||
</div><!-- ./row -->
|
||||
</div><!-- ./container -->
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
{{ end }}
|
94
pkg/template/pages/team_profile.html
Normal file
94
pkg/template/pages/team_profile.html
Normal file
@@ -0,0 +1,94 @@
|
||||
{{ 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">Team 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 class="active"><a href="/account/team/{{.Team.Slug}}/profile">Profile</a></li>
|
||||
<li><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">Manage your team's Profile.</div>
|
||||
|
||||
<div class="col-xs-5">
|
||||
<form action="/account/team/{{.Team.Slug}}/profile" method="POST" role="form">
|
||||
<label>Team Name:</label>
|
||||
<div>
|
||||
<input class="form-control" type="text" name="name" value="{{.Team.Name}}" />
|
||||
</div>
|
||||
<label>Gravatar Email Address:</label>
|
||||
<div>
|
||||
<input class="form-control" type="text" name="email" value="{{.Team.Email}}" />
|
||||
</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="Save" data-loading-text="Saving .." />
|
||||
<a class="btn btn-default" href="/account/team/{{.Team.Slug}}/profile">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-xs-7">
|
||||
<a class="avatar-link" href="https://gravatar.com/" target="_blank">
|
||||
<img src="{{.Team.ImageLarge}}" />
|
||||
<span>edit gravatar</span>
|
||||
</a>
|
||||
</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) {
|
||||
$("#successAlert").text("The Team profile was successfully updated");
|
||||
$("#successAlert").show().removeClass("hide");
|
||||
$('#submitButton').button('reset')
|
||||
} else {
|
||||
$("#failureAlert").text("Failed to update the Team profile.");
|
||||
$("#failureAlert").show().removeClass("hide");
|
||||
$('#submitButton').button('reset');
|
||||
};
|
||||
};
|
||||
xhr.send(formData);
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
{{ end }}
|
110
pkg/template/pages/user_dashboard.html
Normal file
110
pkg/template/pages/user_dashboard.html
Normal file
@@ -0,0 +1,110 @@
|
||||
{{ define "title" }}Dashboard{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
|
||||
<div class="subhead">
|
||||
<div class="container">
|
||||
<ul class="nav nav-tabs pull-right">
|
||||
<li class="active"><a href="dashboard">Dashboard</a></li>
|
||||
<li><a href="/account/user/profile">Settings</a></li>
|
||||
</ul> <!-- ./nav -->
|
||||
<h1 class="user">
|
||||
<img src="{{.User.Image}}">
|
||||
<span>{{.User.Name}}</span>
|
||||
</h1>
|
||||
</div><!-- ./container -->
|
||||
</div><!-- ./subhead -->
|
||||
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-xs-8" role="main">
|
||||
|
||||
<div class="alert alert-feed">
|
||||
<ul class="thumbnails pull-right">
|
||||
<li>
|
||||
<a class="thumbnail" href="/dashboard">
|
||||
<img src="{{.User.Image}}" />
|
||||
</a>
|
||||
</li>
|
||||
{{ range .Teams }}
|
||||
<li>
|
||||
<a class="thumbnail" href="/dashboard/team/{{.Slug}}">
|
||||
<img src="{{.Image}}" />
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
<span class="label">switch dashboard</span>
|
||||
<span>Recent Builds</span>
|
||||
</div><!-- ./alert -->
|
||||
|
||||
{{ if .Commits }}
|
||||
<ul class="commit-list">
|
||||
{{ range $commit := .Commits }}
|
||||
<li>
|
||||
<a href="/{{$commit.Name}}/commit/{{$commit.Hash}}" class="btn btn-{{$commit.Status}}"></a>
|
||||
<h3>
|
||||
<a href="/{{$commit.Slug}}">{{$commit.Owner}} / {{$commit.Name}}</a>
|
||||
<small class="timeago" title="{{$commit.CreatedString}}"></small>
|
||||
{{ if $commit.PullRequest }}
|
||||
<p>opened pull request <a href="/{{$commit.Slug}}/commit/{{$commit.Hash}}"># {{$commit.PullRequest}}</a></p>
|
||||
{{ else }}
|
||||
<p>commit <a href="/{{$commit.Slug}}/commit/{{$commit.Hash}}">{{$commit.HashShort}}</a> to <a href="/{{$commit.Slug}}/tree/{{$commit.Branch}}">{{$commit.Branch}}</a> branch</p>
|
||||
{{ end }}
|
||||
</h3>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
</div><!-- ./col-xs-8 -->
|
||||
|
||||
<div class="col-xs-4" style="padding-left:20px;">
|
||||
<ul class="nav nav-pills nav-stacked nav-repos">
|
||||
{{ range $repo := .Repos }}
|
||||
<li>
|
||||
<a href="/{{$repo.Slug}}">
|
||||
<span>{{$repo.Owner}} / </span>
|
||||
<span>{{$repo.Name}}</span>
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div><!-- ./col-xs-4 -->
|
||||
</div><!-- ./row -->
|
||||
|
||||
</div><!-- ./container -->
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-timeago/1.1.0/jquery.timeago.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(".timeago").timeago();
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
if (window.localStorage) {
|
||||
// get the last visited date from local storage
|
||||
var lastVisited = localStorage["lastVisited"];
|
||||
|
||||
if (lastVisited == "null" || lastVisited == NaN || !lastVisited) {
|
||||
lastVisited = Date.parse("1970-01-01T00:00:00Z");
|
||||
} else {
|
||||
lastVisited = Date.parse(lastVisited);
|
||||
}
|
||||
|
||||
// get created dates for repositories
|
||||
var commits = $(".timeago");
|
||||
$('.timeago').each(function(){
|
||||
var date = Date.parse($(this).attr("title"));
|
||||
if (date > lastVisited) {
|
||||
$(this).parent().parent().append('<span style="position: absolute;left: -60px;background: #f7f7f7;padding: 5px 10px;color: #999;border-radius: 5px;top: 26px;">New</span>');
|
||||
}
|
||||
|
||||
// update the last visited date
|
||||
localStorage["lastVisited"] = Date();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{{ end }}
|
57
pkg/template/pages/user_delete.html
Normal file
57
pkg/template/pages/user_delete.html
Normal file
@@ -0,0 +1,57 @@
|
||||
{{ define "title" }}{{.User.Name}} · Profile{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
|
||||
<div class="subhead">
|
||||
<div class="container">
|
||||
<ul class="nav nav-tabs pull-right">
|
||||
<li>
|
||||
<a href="/dashboard">Dashboard</a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<a href="/account/user/profile">Settings</a>
|
||||
</li>
|
||||
</ul> <!-- ./nav -->
|
||||
<h1 class="user">
|
||||
<img src="{{.User.Image}}">
|
||||
<span>{{.User.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/user/profile">Profile</a></li>
|
||||
<li><a href="/account/user/password">Password</a></li>
|
||||
<li><a href="/account/user/teams">Teams</a></li>
|
||||
<li class="active"><a href="/account/user/delete">Delete</a></li>
|
||||
</ul>
|
||||
</div><!-- ./col-xs-3 -->
|
||||
|
||||
<div class="col-xs-9" role="main">
|
||||
<div class="alert">Delete your account. <b>Warning</b> this action cannot be undone.</div>
|
||||
<div class="col-xs-5">
|
||||
<form action="/account/user/delete" method="POST" role="form">
|
||||
<label>Enter your password to confim:</label>
|
||||
<div>
|
||||
<input class="form-control" type="password" name="password" value="" />
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<input class="btn btn-danger" id="submitButton" type="submit" value="Delete" />
|
||||
<a class="btn btn-default" href="/account/user/delete">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- ./col-xs-6 -->
|
||||
|
||||
</div><!-- ./col-xs-9 -->
|
||||
</div><!-- ./row -->
|
||||
|
||||
</div><!-- ./container -->
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
{{ end }}
|
84
pkg/template/pages/user_password.html
Normal file
84
pkg/template/pages/user_password.html
Normal file
@@ -0,0 +1,84 @@
|
||||
{{ define "title" }}{{.User.Name}} · Password{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
|
||||
<div class="subhead">
|
||||
<div class="container">
|
||||
<ul class="nav nav-tabs pull-right">
|
||||
<li>
|
||||
<a href="/dashboard">Dashboard</a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<a href="/account/user/profile">Settings</a>
|
||||
</li>
|
||||
</ul> <!-- ./nav -->
|
||||
<h1 class="user">
|
||||
<img src="{{.User.Image}}">
|
||||
<span>{{.User.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/user/profile">Profile</a></li>
|
||||
<li class="active"><a href="/account/user/password">Password</a></li>
|
||||
<li><a href="/account/user/teams">Teams</a></li>
|
||||
<li><a href="/account/user/delete">Delete</a></li>
|
||||
</ul>
|
||||
</div><!-- ./col-xs-3 -->
|
||||
|
||||
<div class="col-xs-9" role="main">
|
||||
<div class="alert">Change your account Password.</div>
|
||||
<div class="col-xs-5">
|
||||
<form action="/account/user/password" method="POST" role="form">
|
||||
<label>New Password:</label>
|
||||
<div>
|
||||
<input class="form-control" type="password" name="password" 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="Save" data-loading-text="Saving ..">
|
||||
<a class="btn btn-default" href="/account/user/password">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- ./col-xs-6 -->
|
||||
|
||||
</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) {
|
||||
$("#successAlert").text("Your password was successfully changed");
|
||||
$("#successAlert").show().removeClass("hide");
|
||||
$('#submitButton').button('reset');
|
||||
} else {
|
||||
$("#failureAlert").text("Failed to update your password. Must be at least 6 chacters long.");
|
||||
$("#failureAlert").show().removeClass("hide");
|
||||
$('#submitButton').button('reset');
|
||||
};
|
||||
};
|
||||
xhr.send(formData);
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
{{ end }}
|
147
pkg/template/pages/user_profile.html
Normal file
147
pkg/template/pages/user_profile.html
Normal file
@@ -0,0 +1,147 @@
|
||||
{{ define "title" }}{{.User.Name}} · Profile{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
|
||||
<div class="subhead">
|
||||
<div class="container">
|
||||
<ul class="nav nav-tabs pull-right">
|
||||
<li><a href="/dashboard">Dashboard</a></li>
|
||||
<li class="active"><a href="/account/user/profile">Settings</a></li>
|
||||
</ul> <!-- ./nav -->
|
||||
<h1 class="user">
|
||||
<img src="{{.User.Image}}">
|
||||
<span>{{.User.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 class="active"><a href="/account/user/profile">Profile</a></li>
|
||||
<li><a href="/account/user/password">Password</a></li>
|
||||
<li><a href="/account/user/teams">Teams</a></li>
|
||||
<li><a href="/account/user/delete">Delete</a></li>
|
||||
</ul>
|
||||
</div><!-- ./col-xs-3 -->
|
||||
|
||||
<div class="col-xs-9" role="main" style="padding-left:20px;">
|
||||
<div class="alert">Manage your account Profile.</div>
|
||||
|
||||
<div class="col-xs-5">
|
||||
<form action="/account/user/profile" method="POST" role="form">
|
||||
<label>Your Name:</label>
|
||||
<div>
|
||||
<input class="form-control" type="text" name="name" value="{{.User.Name}}" />
|
||||
</div>
|
||||
<label>Your Email Address:</label>
|
||||
<div>
|
||||
<input class="form-control" type="text" name="email" value="{{.User.Email}}" />
|
||||
</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="Save" data-loading-text="Saving .." />
|
||||
<a class="btn btn-default" href="/account/user/profile">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-xs-7">
|
||||
<a class="avatar-link" href="https://gravatar.com/" target="_blank">
|
||||
<img src="{{.User.ImageLarge}}" />
|
||||
<span>edit gravatar</span>
|
||||
</a>
|
||||
</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) {
|
||||
$("#successAlert").text("Your profile information was successfully updated");
|
||||
$("#successAlert").show().removeClass("hide");
|
||||
$('#submitButton').button('reset');
|
||||
} else {
|
||||
$("#failureAlert").text("Failed to update your profile information. " + this.response);
|
||||
$("#failureAlert").show().removeClass("hide");
|
||||
$('#submitButton').button('reset');
|
||||
};
|
||||
};
|
||||
xhr.send(formData);
|
||||
return false;
|
||||
};
|
||||
|
||||
$("#saveGeneral").on('click', function () {
|
||||
var data = JSON.stringify({
|
||||
Name : $("#fullname").val(),
|
||||
Email : $("#email").val()
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: "/admin?action=profile",
|
||||
context: document.body,
|
||||
type: "PUT",
|
||||
dataType: "json",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
data: data,
|
||||
success: function(data) {
|
||||
$("#successGeneral").text("Your profile information was successfully updated");
|
||||
$("#successGeneral").show().removeClass("hide");
|
||||
$('#saveGeneral').button('reset')
|
||||
},
|
||||
error: function(data) {
|
||||
$("#failureGeneral").text("Failed to update your profile information. " + data.responseText);
|
||||
$("#failureGeneral").show().removeClass("hide");
|
||||
$('#saveGeneral').button('reset')
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#savePassword").on('click', function () {
|
||||
$("#successPassword").hide();
|
||||
$("#failurePassword").hide();
|
||||
$('#savePassword').button('loading');
|
||||
|
||||
var data = JSON.stringify({
|
||||
Password : $("#old_password").val(),
|
||||
PasswordNew : $("#new_password").val()
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: "/admin?action=password",
|
||||
context: document.body,
|
||||
type: "PUT",
|
||||
dataType: "json",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
data: data,
|
||||
success: function(data) {
|
||||
$("#successPassword").text("Your password was successfully updated");
|
||||
$("#successPassword").show().removeClass("hide");
|
||||
$('#savePassword').button('reset');
|
||||
},
|
||||
error: function(data) {
|
||||
$("#failurePassword").text("Failed to update your password. " + data.responseText);
|
||||
$("#failurePassword").show().removeClass("hide");
|
||||
$('#savePassword').button('reset');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{{ end }}
|
62
pkg/template/pages/user_teams.html
Normal file
62
pkg/template/pages/user_teams.html
Normal file
@@ -0,0 +1,62 @@
|
||||
{{ define "title" }}{{.User.Name}} · Teams{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
|
||||
<div class="subhead">
|
||||
<div class="container">
|
||||
<ul class="nav nav-tabs pull-right">
|
||||
<li><a href="/dashboard">Dashboard</a></li>
|
||||
<li class="active"><a href="/account/user/profile">Settings</a></li>
|
||||
</ul> <!-- ./nav -->
|
||||
<h1 class="user">
|
||||
<img src="{{.User.Image}}">
|
||||
<span>{{.User.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/user/profile">Profile</a></li>
|
||||
<li><a href="/account/user/password">Password</a></li>
|
||||
<li class="active"><a href="/account/user/teams">Teams</a></li>
|
||||
<li><a href="/account/user/delete">Delete</a></li>
|
||||
</ul>
|
||||
</div><!-- ./col-xs-3 -->
|
||||
|
||||
<div class="col-xs-9" role="main" style="padding-left:20px;">
|
||||
<div class="alert">Teams allow you to share your Repositories with other developers.</div>
|
||||
<div class="row gravatar-list">
|
||||
<span class="col-xs-3">
|
||||
<a class="thumbnail team-add" href="/account/user/teams/add">
|
||||
<span>
|
||||
<i class="fa fa-group"></i>
|
||||
</span>
|
||||
<div class="caption">
|
||||
<h3>add team</h3>
|
||||
</div>
|
||||
</a>
|
||||
</span>
|
||||
{{ range $team := .Teams }}
|
||||
<span class="col-xs-3">
|
||||
<a class="thumbnail" href="/account/team/{{$team.Slug}}/profile">
|
||||
<img src="{{$team.ImageLarge}}">
|
||||
<div class="caption">
|
||||
<h3>{{$team.Name}}</h3>
|
||||
</div>
|
||||
</a>
|
||||
</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div><!-- ./col-xs-9 -->
|
||||
</div><!-- ./row -->
|
||||
|
||||
</div><!-- ./container -->
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
{{ end }}
|
85
pkg/template/pages/user_teams_add.html
Normal file
85
pkg/template/pages/user_teams_add.html
Normal file
@@ -0,0 +1,85 @@
|
||||
{{ define "title" }}Profile{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
|
||||
<div class="subhead">
|
||||
<div class="container">
|
||||
<ul class="nav nav-tabs pull-right">
|
||||
<li><a href="/dashboard">Dashboard</a></li>
|
||||
<li class="active"><a href="/account/user/profile">Settings</a></li>
|
||||
</ul> <!-- ./nav -->
|
||||
<h1 class="user">
|
||||
<img src="{{.User.Image}}">
|
||||
<span>{{.User.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/user/profile">Profile</a></li>
|
||||
<li><a href="/account/user/password">Password</a></li>
|
||||
<li class="active"><a href="/account/user/teams">Teams</a></li>
|
||||
<li><a href="/account/user/delete">Delete</a></li>
|
||||
</ul>
|
||||
</div><!-- ./col-xs-3 -->
|
||||
|
||||
<div class="col-xs-9" role="main" style="padding-left:20px;">
|
||||
<div class="alert">Setup a new Team Account.</div>
|
||||
|
||||
<div class="col-xs-5">
|
||||
<form action="/account/user/teams/add" method="POST" role="form">
|
||||
<label>Team Name:</label>
|
||||
<div>
|
||||
<input class="form-control" type="text" name="name" value="" />
|
||||
</div>
|
||||
<label>Email (Gravatar):</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="Save" data-loading-text="Saving .." />
|
||||
<a class="btn btn-default" href="/account/user/teams">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) {
|
||||
$("#successAlert").text("Your team account was successfully created.");
|
||||
$("#successAlert").show().removeClass("hide");
|
||||
$('#submitButton').button('reset');
|
||||
} else {
|
||||
$("#failureAlert").text("Failed to create the Team account. " + this.response);
|
||||
$("#failureAlert").show().removeClass("hide");
|
||||
$('#submitButton').button('reset')
|
||||
};
|
||||
};
|
||||
xhr.send(formData);
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
{{ end }}
|
142
pkg/template/template.go
Normal file
142
pkg/template/template.go
Normal file
@@ -0,0 +1,142 @@
|
||||
package template
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"html/template"
|
||||
"io"
|
||||
|
||||
"github.com/GeertJohan/go.rice"
|
||||
)
|
||||
|
||||
// ErrTemplateNotFound indicates the requested template
|
||||
// does not exists in the TemplateStore.
|
||||
var ErrTemplateNotFound = errors.New("Template Not Found")
|
||||
|
||||
// registry stores a map of Templates where the key
|
||||
// is the template name and the value is the *template.Template.
|
||||
var registry = map[string]*template.Template{}
|
||||
|
||||
// ExecuteTemplate applies the template associated with t that has
|
||||
// the given name to the specified data object and writes the output to wr.
|
||||
func ExecuteTemplate(wr io.Writer, name string, data interface{}) error {
|
||||
templ, ok := registry[name]
|
||||
if !ok {
|
||||
return ErrTemplateNotFound
|
||||
}
|
||||
|
||||
return templ.ExecuteTemplate(wr, "_", data)
|
||||
}
|
||||
|
||||
// all template are loaded on initialization.
|
||||
func init() {
|
||||
// location of templates
|
||||
box := rice.MustFindBox("pages")
|
||||
|
||||
// these are all the files we need to parse. it is
|
||||
// kind of annoying that we can't list files in the
|
||||
// box, and have to enumerate each file here, but it is
|
||||
// a small price to pay to embed everything and simplify
|
||||
// the user installation process :)
|
||||
var files = []string{
|
||||
// these templates use the form.html
|
||||
// shared layout
|
||||
"login.html",
|
||||
"login_error.html",
|
||||
"forgot.html",
|
||||
"forgot_sent.html",
|
||||
"reset.html",
|
||||
"register.html",
|
||||
"install.html",
|
||||
|
||||
// these templates use the default.html
|
||||
// shared layout
|
||||
"403.html",
|
||||
"404.html",
|
||||
"500.html",
|
||||
"user_dashboard.html",
|
||||
"user_password.html",
|
||||
"user_profile.html",
|
||||
"user_delete.html",
|
||||
"user_teams.html",
|
||||
"user_teams_add.html",
|
||||
"team_dashboard.html",
|
||||
"team_profile.html",
|
||||
"team_members.html",
|
||||
"team_delete.html",
|
||||
"members_add.html",
|
||||
"members_edit.html",
|
||||
"repo_dashboard.html",
|
||||
"repo_settings.html",
|
||||
"repo_delete.html",
|
||||
"repo_params.html",
|
||||
"repo_badges.html",
|
||||
"repo_keys.html",
|
||||
"repo_commit.html",
|
||||
"admin_users.html",
|
||||
"admin_users_edit.html",
|
||||
"admin_users_add.html",
|
||||
"admin_settings.html",
|
||||
"github_add.html",
|
||||
"github_link.html",
|
||||
}
|
||||
|
||||
// extract the base template as a string
|
||||
base, err := box.String("base.html")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// extract the base form template as a string
|
||||
form, err := box.String("form.html")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// loop through files and create templates
|
||||
for i, file := range files {
|
||||
// extract template from box
|
||||
page, err := box.String(file)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// HACK: choose which base template to use FOR THE RECORD I
|
||||
// don't really like this, but it works for now.
|
||||
var baseTemplate = base
|
||||
if i < 7 {
|
||||
baseTemplate = form
|
||||
}
|
||||
|
||||
// parse the template and then add to the global map
|
||||
registry[file] = template.Must(template.Must(template.New("_").Parse(baseTemplate)).Parse(page))
|
||||
}
|
||||
|
||||
// location of templates
|
||||
box = rice.MustFindBox("emails")
|
||||
|
||||
files = []string{
|
||||
"activation.html",
|
||||
"failure.html",
|
||||
"success.html",
|
||||
"invitation.html",
|
||||
"reset_password.html",
|
||||
}
|
||||
|
||||
// extract the base template as a string
|
||||
base, err = box.String("base_email.html")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// loop through files and create templates
|
||||
for _, file := range files {
|
||||
// extract template from box
|
||||
email, err := box.String(file)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// parse the template and then add to the global map
|
||||
registry[file] = template.Must(template.Must(template.New("_").Parse(base)).Parse(email))
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user