woodpecker/template/amber/_feed.amber
2015-09-29 18:21:17 -07:00

71 lines
2.4 KiB
Text

extends base
block append head
title Dashboard
block menu
li
a[href="/"] Home
li
a[href="/settings/profile"] Profile
if User.Admin
li
a[href="/settings/people"] People
li
a[href="/settings/nodes"] Nodes
block content
h1 Feed
hr
table
tbody[data-bind="foreach: feed"]
tr
td
a[data-bind="text: full_name, attr: {href: full_name() + '/' + number() }"]
td[data-bind="text: $data.full_name"]
td[data-bind="text: $data.owner"]
td[data-bind="text: $data.name"]
td[data-bind="text: $data.private"]
td[data-bind="text: $data.trusted"]
td[data-bind="text: $data.avatar_url"]
td[data-bind="text: $data.clone_url"]
td[data-bind="text: $data.number"]
td[data-bind="text: $data.commit"]
td[data-bind="text: $data.branch"]
td[data-bind="text: $data.author"]
td[data-bind="text: $data.status"]
block append scripts
script
var feed = #{json(Feed)};
function Activity(data) {
this.full_name = ko.observable(data.full_name);
this.owner = ko.observable(data.owner);
this.name = ko.observable(data.name);
this.private = ko.observable(data.private);
this.trusted = ko.observable(data.trusted);
this.avatar_url = ko.observable(data.avatar);
this.clone_url = ko.observable(data.clone_url);
this.link_url = ko.observable(data.link_url);
this.number = ko.observable(data.number);
this.commit = ko.observable(data.commit);
this.started_at = ko.observable(data.started_at);
this.finished_at = ko.observable(data.finished_at);
this.exit_code = ko.observable(data.exit_code);
this.status = ko.observable(data.status);
this.environment = ko.observable(data.environment);
}
function FeedViewModel() {
var self = this;
var mapped = $.map(feed, function(activity) {
return new Activity(activity)
});
self.feed = ko.observableArray(mapped);
}
ko.applyBindings(new FeedViewModel());