47 lines
1.6 KiB
JavaScript
47 lines
1.6 KiB
JavaScript
wn.pages['latest-updates'].onload = function(wrapper) {
|
|
wn.ui.make_app_page({
|
|
parent: wrapper,
|
|
title: 'Latest Updates',
|
|
single_column: true
|
|
});
|
|
|
|
var parent = $(wrapper).find(".layout-main");
|
|
parent.html('<div class="progress progress-striped active">\
|
|
<div class="progress-bar" style="width: 100%;"></div></div>')
|
|
|
|
wn.call({
|
|
method:"home.page.latest_updates.latest_updates.get",
|
|
callback: function(r) {
|
|
parent.empty();
|
|
$("<p class='help'>Report issues at\
|
|
<a href='https://github.com/webnotes/erpnext/issues'>GitHub Issues</a></p>\
|
|
<hr><h3>Commit Log</h3>")
|
|
.appendTo(parent);
|
|
|
|
var $tbody = $('<table class="table table-bordered"><tbody></tbody></table>')
|
|
.appendTo(parent).find("tbody");
|
|
$.each(r.message, function(i, log) {
|
|
if(log.message.indexOf("minor")===-1
|
|
&& log.message.indexOf("docs")===-1
|
|
&& log.message.indexOf("[")!==-1) {
|
|
log.message = log.message.replace(/(\[[^\]]*\])/g,
|
|
function(match, p1, offset, string) {
|
|
match = match.toLowerCase();
|
|
var color_class = "";
|
|
$.each(["bug", "fix"], function(i, v) {
|
|
if(!color_class && match.indexOf(v)!==-1)
|
|
color_class = "label-danger";
|
|
});
|
|
return '<span class="label ' + color_class +'">' + p1.slice(1,-1) + '</span> '
|
|
});
|
|
log.repo = log.repo==="lib" ? "wnframework" : "erpnext";
|
|
$(repl('<tr>\
|
|
<td><b><a href="https://github.com/webnotes/%(repo)s/commit/%(commit)s" \
|
|
target="_blank">%(message)s</b>\
|
|
<br><span class="text-muted">By %(author)s on %(date)s</span></td></tr>', log)).appendTo($tbody);
|
|
}
|
|
|
|
})
|
|
}
|
|
})
|
|
}; |