[Rt-commit] rt branch, 5.0/self-service-homepage-dashboard, updated. rt-5.0.0-20-gbaad623ab1
Dianne Skoll
dianne at bestpractical.com
Fri Oct 2 13:41:24 EDT 2020
The branch, 5.0/self-service-homepage-dashboard has been updated
via baad623ab162b7b102084a322c60218ccec7a41c (commit)
from 7bc0b9c0b9b1254fa3b8e19f4e39f6c7a00d551a (commit)
Summary of changes:
etc/RT_Config.pm.in | 2 +-
.../{SelfServiceTopArticles => SelfServiceNewestArticles} | 4 +++-
share/html/Elements/TopArticles | 13 +++++++------
3 files changed, 11 insertions(+), 8 deletions(-)
copy share/html/Elements/{SelfServiceTopArticles => SelfServiceNewestArticles} (95%)
- Log -----------------------------------------------------------------
commit baad623ab162b7b102084a322c60218ccec7a41c
Author: Dianne Skoll <dianne at bestpractical.com>
Date: Fri Oct 2 13:39:45 2020 -0400
Add a SelfServiceNewestArticles portlet.
NOTE: Unlike Articles/Elements/NewestArticles that sorts by LastUpdated,
this one sorts by Created, which I think was more in line with the intent.
However, we should probably discuss this.
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 945ba235c6..f2511251fe 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -2970,7 +2970,7 @@ If this is not set at all, then $HomepageComponents is used instead.
Set(
$SelfServicePageComponents,
[
- qw(QuickCreate QueueList MyAdminQueues MySupportQueues MyReminders RefreshHomepage Dashboards SavedSearches FindUser MyAssets FindAsset FindGroup SelfServiceTopArticles ) # loc_qw
+ qw(QuickCreate QueueList MyAdminQueues MySupportQueues MyReminders RefreshHomepage Dashboards SavedSearches FindUser MyAssets FindAsset FindGroup SelfServiceTopArticles SelfServiceNewestArticles ) # loc_qw
]
);
diff --git a/share/html/Elements/TopArticles b/share/html/Elements/SelfServiceNewestArticles
similarity index 59%
copy from share/html/Elements/TopArticles
copy to share/html/Elements/SelfServiceNewestArticles
index 824e7d7cbb..ee297c09f5 100644
--- a/share/html/Elements/TopArticles
+++ b/share/html/Elements/SelfServiceNewestArticles
@@ -46,53 +46,13 @@
%#
%# END BPS TAGGED BLOCK }}}
-<&| /Widgets/TitleBox, title => $title &>
-
-% while (my $article = $articles->Next) {
- <div class="form-row">
- <span class="value col-auto">
- <a href="<% RT->Config->Get('WebPath') %>/<% $display_path %>/Display.html?id=<%$article->Id%>"><%$article->Name || loc('(no name)')%>: <%$article->Summary%></a>
- </span>
- </div>
-% }
-</&>
-
-<%INIT>
-$title = loc('Articles');
-# Figure out which class of articles applies, if a classname was given
-my $class;
-
-if ($classname) {
- $class = RT::Class->new( $session{'CurrentUser'} );
- my ($ok, $msg) = $class->LoadByCols( Name => RT->Config->Get('SelfServiceArticleClass') );
- if (!$ok || !$class->Id) {
- # Could not find the class... bail?
- return;
- }
-}
-
-# Get the articles
-my $articles = RT::Articles->new( $session{'CurrentUser'} );
-
-$articles->RowsPerPage($rows);
-
-if ($class) {
- $articles->Search(Class => $class->Id,
- OrderBy => ['SortOrder', 'LastUpdated'],
- Order => ['ASC', 'DESC' ]);
-} else {
- $articles->Search(OrderBy => ['SortOrder', 'LastUpdated'],
- Order => ['ASC', 'DESC' ]);
-}
-
-</%INIT>
+<& /Elements/TopArticles,
+ title => loc('Newest Articles'),
+ display_path => 'SelfService/Article',
+ order_by => ['Created'],
+ order_direction => ['Desc'],
+ classname => (RT->Config->Get('SelfServiceArticleClass') || 'SelfService') &>
<%ARGS>
$title => undef
-$rows => 10
-# Unfortunately, the directory hierarchy under SelfService
-# is just "Article" instead of "Articles/Article", so we have
-# to make to path for displaying an article a parameter.
-$display_path => 'Articles/Article'
-$classname => undef
</%ARGS>
diff --git a/share/html/Elements/TopArticles b/share/html/Elements/TopArticles
index 824e7d7cbb..48cfe178c5 100644
--- a/share/html/Elements/TopArticles
+++ b/share/html/Elements/TopArticles
@@ -58,7 +58,7 @@
</&>
<%INIT>
-$title = loc('Articles');
+$title = loc('Top Articles') unless defined($title);
# Figure out which class of articles applies, if a classname was given
my $class;
@@ -78,21 +78,22 @@ $articles->RowsPerPage($rows);
if ($class) {
$articles->Search(Class => $class->Id,
- OrderBy => ['SortOrder', 'LastUpdated'],
- Order => ['ASC', 'DESC' ]);
+ OrderBy => $order_by,
+ Order => $order_direction);
} else {
- $articles->Search(OrderBy => ['SortOrder', 'LastUpdated'],
- Order => ['ASC', 'DESC' ]);
+ $articles->Search(OrderBy => $order_by, Order => $order_direction);
}
</%INIT>
<%ARGS>
-$title => undef
+$title => loc("Top Articles")
$rows => 10
# Unfortunately, the directory hierarchy under SelfService
# is just "Article" instead of "Articles/Article", so we have
# to make to path for displaying an article a parameter.
$display_path => 'Articles/Article'
$classname => undef
+$order_by => ['SortOrder', 'LastUpdated']
+$order_direction => ['ASC', 'DESC']
</%ARGS>
-----------------------------------------------------------------------
More information about the rt-commit
mailing list