[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX][UX] Improve UX on blog comments page
Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <68fcda6560b39_2c484a048811@gitlab-sidekiq-low-urgency-cpu-bound-v2-854849f664-kd79d.mail> |
Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
5149801c by Landry Bitege at 2025-10-25T14:02:09+00:00
[FIX][UX] Improve UX on blog comments page
---
* [FIX][UX] Improve UX on blog comments page
See merge request tikiwiki/tiki!8145
- - - - -
5 changed files:
- lib/blogs/bloglib.php
- templates/blog_actions.tpl
- templates/tiki-list_blogs.tpl
- templates/tiki-view_blog.tpl
- tiki-list_comments.php
Changes:
=====================================
lib/blogs/bloglib.php
=====================================
@@ -1252,23 +1252,17 @@ class BlogLib extends TikiDb_Bridge
{
$query = 'SELECT `blogId` FROM `tiki_blogs` WHERE `blogId`=?';
- if (is_null($this->getOne($query, [$blogId]))) {
- return false;
- } else {
- return true;
- }
+ return $this->getOne($query, [$blogId]) !== false;
}
/**
* Check if a blog exists
*
* @param int $blogId
- * @return bool true or false if blog exists or not
+ * @return void
*/
public function check_blog_exists($blogId)
{
- $smarty = TikiLib::lib('smarty');
-
if (! $this->blog_exists($blogId)) {
Feedback::errorAndDie(tra('Blog cannot be found'), \Laminas\Http\Response::STATUS_CODE_404);
}
=====================================
templates/blog_actions.tpl
=====================================
@@ -20,7 +20,7 @@
<a class="dropdown-item" href="tiki-edit_blog.php?blogId={$blogId}">
{icon name='edit'} {tr}Edit{/tr}
</a>
- {if $allow_comments eq 'y'}
+ {if $allow_comments eq 'y' and $blog_data.posts ne 0}
<a class="dropdown-item" href='tiki-list_comments.php?types_section=blogs&blogId={$blogId}'>
{icon name='comments'} {tr}Comments{/tr}
</a>
=====================================
templates/tiki-list_blogs.tpl
=====================================
@@ -123,7 +123,7 @@
{/if}
{/if}
{/if}
- {if $tiki_p_blog_admin eq 'y' and $listpages[changes].allow_comments eq 'y'}
+ {if $tiki_p_blog_admin eq 'y' and $listpages[changes].allow_comments eq 'y' and $listpages[changes].posts ne 0}
<action>
<a href='tiki-list_comments.php?types_section=blogs&blogId={$listpages[changes].blogId}'>
{icon name="comments" _menu_text='y' _menu_icon='y' alt="{tr}Comments{/tr}"}
=====================================
templates/tiki-view_blog.tpl
=====================================
@@ -7,7 +7,7 @@
{/if}
{if $use_find eq 'y'}
<div class="search-button-container clearfix">
- <button class="btn btn-info btn-sm mb-2 dropdown-toggle float-end" type="button" data-bs-toggle="collapse" data-bs-target="#searchBlogs" aria-expanded="false" aria-controls="searchBlogs" title="{tr}Search blogs{/tr}" aria-label="{tr}Search blogs{/tr}>
+ <button class="btn btn-info btn-sm mb-2 dropdown-toggle float-end" type="button" data-bs-toggle="collapse" data-bs-target="#searchBlogs" aria-expanded="false" aria-controls="searchBlogs" title="{tr}Search blogs{/tr}" aria-label="{tr}Search blogs{/tr}">
{icon name="search"}
</button>
</div>
=====================================
tiki-list_comments.php
=====================================
@@ -92,6 +92,7 @@ foreach ($sections_enabled as $k => $info) {
// No need to show types choices if there is only one choice that is already choosed
if (count($show_types) == 1 && count($selected_types) == 1) {
$show_types = [];
+ $selected_types = [];
}
$headers = ['title' => 'Title', 'objectType' => 'Type', 'object' => 'Object', 'userName' => 'Author', 'commentDate' => 'Date', 'data' => 'Comment',];
@@ -102,6 +103,8 @@ if (count($selected_types) == 1) {
$headers['object'] = tra(ucwords($selected_types[0]));
}
+$show_types = array_intersect_key($show_types, array_flip($selected_types));
+
$smarty->assign_by_ref('show_types', $show_types);
$smarty->assign_by_ref('selected_types', $selected_types);
$smarty->assign_by_ref('headers', $headers);
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5149801c88695b6c9a7ea4afec72748c2a7129ec
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5149801c88695b6c9a7ea4afec72748c2a7129ec
You're receiving this email because of your account on gitlab.com.
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs