2013-08-05 09:29:54 +00:00
|
|
|
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
|
|
|
// License: GNU General Public License v3. See license.txt
|
|
|
|
|
2012-11-13 07:02:11 +00:00
|
|
|
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");
|
2013-07-09 09:06:41 +00:00
|
|
|
parent.html('<div class="progress progress-striped active">\
|
|
|
|
<div class="progress-bar" style="width: 100%;"></div></div>')
|
2012-11-13 07:02:11 +00:00
|
|
|
|
2013-07-29 14:00:39 +00:00
|
|
|
return wn.call({
|
2013-07-09 09:06:41 +00:00
|
|
|
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) {
|
2013-07-23 06:50:08 +00:00
|
|
|
if(log.message.indexOf("minor")===-1
|
|
|
|
&& log.message.indexOf("docs")===-1
|
|
|
|
&& log.message.indexOf("[")!==-1) {
|
2013-07-09 09:06:41 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
2013-01-14 09:24:12 +00:00
|
|
|
};
|