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

43 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
2024-01-19 01:05:44 +08:00
} else if (theme.wiki.tree[page.wiki]?.repo) {
const proj = theme.wiki.tree[page.wiki]
repo = proj.repo
if (proj.branch != undefined) {
branch = proj.branch
2022-10-26 22:44:50 +08:00
}
}
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;
}
2024-01-19 01:05:44 +08:00
el += `<widget class="widget-wrapper${scrollreveal(' ')} timeline">`
2022-10-26 22:44:50 +08:00
if (item.title) {
2024-01-17 22:57:52 +08:00
el += '<div class="widget-header 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() %>