Hack: display categories & added filter options in post overview

Post Reply
User avatar
padawan
Ssr. Bludit
Posts: 10
Joined: Sun Nov 10, 2019 4:26 pm

Tue Nov 19, 2019 7:03 am

In Bludit 3.10.0, I edited the content.php in bl-kernel\admin\views, because I think it´s a great plus in clarity when I can see the category of each post already in the post overview table. So I added a few lines to have an additional column that contains the category for each page which has the status "published".

The code I added is:

Code: Select all

if ($type=='published') { 
	echo '<th class="border-0" scope="col">'.$L->g('Category').'</th>';
} 
Where the heading of the output table is built, and further down in the loop

Code: Select all

foreach ($list as $pageKey)

I added

Code: Select all

if ($type=='published' && $page->category()) { 
	echo ' <td class="pt-3">'.$page->category().'</td>'; 
} else if ($type=='published' && ($page->category()==null)) { 
	echo ' <td class="pt-3">&ndash;</td>'; 
}; 
Works fine for the present, but as it´s a kernel hack, a.) it will be gone with the next update and b.) it´s hard to make it useful for anybody else than me. Could anybody be so nice and give me a hint how the approach would be to wrap this into a plugin? And any other ideas for clever improvements or other thoughts and comments on my hack?

Or is there a possibility like a template override for the view I can use from within the admin theme (and build an alternative admin theme with my code)? Or some other way to do it not in the core code :? ...

Regards,
padawan

[EDIT]
In the meantime I even added jQuery tablesorter and made the whole post overview table sortable by a click on the column headings. It was so easy! Just 3 or 4 more lines of code. But still a core hack.
[/EDIT]
Last edited by padawan on Wed Nov 20, 2019 11:59 am, edited 2 times in total.
User avatar
Jay
Master Bludit
Posts: 74
Joined: Mon Feb 11, 2019 8:41 pm

Tue Nov 19, 2019 8:27 pm

Changes sounds nice. Somebody asked even for a way to search certain post. Now with your categorization and sorting you should be able to add a simple search box.
Seen long time ago a quite simple.

As of having changes no matter of updates, I've got no idea.


Btw. I needed only a small hack to see pages ID on the list when default page sort is set to date.

If somebody would also need this, just change kernel/admin/views/content.php
from

Code: Select all

<div>
<p style="font-size: 0.8em" class="m-0 text-uppercase text-muted">'.( ($type=='scheduled')?$L->g('Scheduled').': '.$page->date(SCHEDULED_DATE_FORMAT):$page->date(MANAGE_CONTENT_DATE_FORMAT) ).'</p>
</div>
to

Code: Select all

<div class="row  text-muted" style="font-size: 0.8em">
	<p class="col-sm m-0">'.( ($type=='scheduled')?$L->g('Scheduled').': '.$page->date(SCHEDULED_DATE_FORMAT):$page->date(MANAGE_CONTENT_DATE_FORMAT) ).'</p>
	<p class="col-sm m-0">'.$L->g('Position').': '.$page->position().'</p>
</div>
User avatar
padawan
Ssr. Bludit
Posts: 10
Joined: Sun Nov 10, 2019 4:26 pm

Tue Nov 19, 2019 11:25 pm

I attached a screenshot now... looks neat and works like a charm. All together maybe 20-30 lines of code I added, mostly to the content.php in admin/views, and 2 small Javascript libs. Would really be marvellous to turn this into a plugin or alternative admin theme.
Bludit - Manage content.png
Bludit - Manage content.png (68.28 KiB) Viewed 48 times
Last edited by padawan on Wed Nov 20, 2019 11:59 am, edited 1 time in total.
Post Reply