mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-02 03:30:54 +00:00
Add news reader (#3445)
* add model for feed entries * add task to update feed entries * Add API routes * Fix name in model * rename model * fix read endpoint * reduce duplication in NewsFeed API endpoints * reduce duplicated code * add ui elements to index * add missing migrations * add ressource route * add new model to admin * reorder fields * format timestamp * make title linked * reduce migrations to 1 * fix merge * fix js style * add model to ruleset
This commit is contained in:
58
InvenTree/templates/js/translated/news.js
Normal file
58
InvenTree/templates/js/translated/news.js
Normal file
@ -0,0 +1,58 @@
|
||||
{% load i18n %}
|
||||
{% load inventree_extras %}
|
||||
|
||||
/* exported
|
||||
loadNewsFeedTable,
|
||||
*/
|
||||
|
||||
/*
|
||||
* Load notification table
|
||||
*/
|
||||
function loadNewsFeedTable(table, options={}, enableDelete=false) {
|
||||
setupFilterList('news', table);
|
||||
|
||||
$(table).inventreeTable({
|
||||
url: options.url,
|
||||
name: 'news',
|
||||
groupBy: false,
|
||||
queryParams: {
|
||||
ordering: 'published',
|
||||
},
|
||||
paginationVAlign: 'bottom',
|
||||
formatNoMatches: function() {
|
||||
return '{% trans "No news found" %}';
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
field: 'pk',
|
||||
title: '{% trans "ID" %}',
|
||||
visible: false,
|
||||
switchable: false,
|
||||
},
|
||||
{
|
||||
field: 'title',
|
||||
title: '{% trans "Title" %}',
|
||||
sortable: 'true',
|
||||
formatter: function(value, row) {
|
||||
return `<a href="` + row.link + `">` + value + `</a>`;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'summary',
|
||||
title: '{% trans "Summary" %}',
|
||||
},
|
||||
{
|
||||
field: 'author',
|
||||
title: '{% trans "Author" %}',
|
||||
},
|
||||
{
|
||||
field: 'published',
|
||||
title: '{% trans "Published" %}',
|
||||
sortable: 'true',
|
||||
formatter: function(value) {
|
||||
return renderDate(value);
|
||||
}
|
||||
},
|
||||
]
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user