harness-drone/server/template/repo_feed.amber

84 lines
No EOL
2.3 KiB
Text

extends base
block title
| #{Repo.Name}
block content
article.pure-g
header.pure-u-1
h1
span #{Repo.Owner}
span /
a[href="#"] #{Repo.Name}
a.pure-button[href="/"+Repo.Host+"/"+Repo.Owner+"/"+Repo.Name+"/settings"]
i.fa.fa-cog
$repo=Repo
if Repo.Active
if Commits
section.pure-u-3-5
div.commit-list
each $commit in Commits
a.pure-g.commit-item[data-status=Status][href="/"+$repo.Host+"/"+$repo.Owner+"/"+$repo.Name+"/branch/"+Branch+"/commit/"+Sha]
div.pure-u-1-8
img[src="https://secure.gravatar.com/avatar/"+Gravatar+"?s=48&d=identicon"]
div.pure-u-3-4
h2 #{Message}
span.commit-sha #{ShaShort}
span.commit-branch #{Branch}
span.commit-date.timeago[title=FinishedString]
div.pure-u-2-5
section.pure-g.branches
div.pure-u-1.pure-menu.pure-menu-open
a.pure-menu-heading Recent Branches
ul
each $commit in Branches
li
a[data-status=Status][href="/"+$repo.Host+"/"+$repo.Owner+"/"+$repo.Name+"/branch/"+Branch] #{Branch}
else
section.pure-u-1
div.alert.alert-info
| Your Build history is empty. Push to your remote repository to trigger a build.
else
section.pure-u-1
div.alert.alert-info#alert
| This Repository is not yet active. Please activate to start testing commits.
br
form.pure-form.pure-form-stacked[action="/v1/repos/"+Repo.Host+"/"+Repo.Owner+"/"+Repo.Name]
div.pure-controls
button.pure-button.pure-button-primary Click to Active Repository
block append scripts
script
$(document).ready(function() {
$(".timeago").timeago();
});
if Repo.Active
script
var ws = new WebSocket((window.location.protocol=='http:'?'ws':'wss')+'://'+window.location.host+'/feed?token=#{Channel}');
ws.onmessage = function (e) {
console.log(e);
};
else
script
document.forms[0].onsubmit = function(event) {
var form = event.target;
var formData = new FormData(form);
xhr = new XMLHttpRequest();
xhr.open('POST', form.action);
xhr.onload = function() {
if (this.status == 201) {
window.location.reload();
} else {
$("#alert").text("Failed to activate the repository settings. Please try again");
$("#alert").attr("class", "alert alert-danger");
};
};
xhr.send(formData);
return false;
}