hexo-theme-stellar/layout/_partial/widgets/ghissues.ejs

45 lines
1.1 KiB
Plaintext
Raw Normal View History

2022-10-26 22:44:50 +08:00
<%
function layoutDiv() {
var el = '';
var repo;
var branch = 'main';
2022-11-22 22:38:25 +08:00
if (page.repo) {
repo = page.repo
} else if (page.layout === 'wiki' && page.wiki) {
2023-12-06 13:20:04 +08:00
let proj = theme.wiki.tree[page.wiki];
2022-10-26 22:44:50 +08:00
if (proj && proj.repo) {
repo = proj.repo;
if (proj.branch != undefined) {
branch = proj.branch;
}
}
}
if (repo == undefined) {
return el;
}
2022-11-06 00:18:15 +08:00
item.api = theme.api_host.ghapi + '/repos/' + repo + '/issues?per_page=' + item.limit;
2022-10-26 22:44:50 +08:00
if (item.labels) {
item.api += '&labels=' + item.labels;
}
2022-11-23 21:54:21 +08:00
el += '<widget class="widget-wrapper timeline">';
2022-10-26 22:44:50 +08:00
if (item.title) {
2024-01-17 00:27:48 +08:00
el += '<div class="widget-header cap dis-select">';
2022-10-26 22:44:50 +08:00
el += '<span class="name">' + item.title + '</span>';
el += '</div>';
}
el += '<div class="widget-body fs14">';
el += '<div class="tag-plugin timeline stellar-timeline-api"';
['api', 'user'].forEach(key => {
if (item[key]) {
el += ' ' + key + '="' + item[key] + '"';
}
});
el += '>';
el += '</div>';
el += '</div>';
2022-11-23 21:54:21 +08:00
el += '</widget>';
2022-10-26 22:44:50 +08:00
return el;
}
%>
<%- layoutDiv() %>