[Rt-commit] rt branch, 4.4/sort-dashboards, created. rt-4.4.1-110-gf3df1c3
Jim Brandt
jbrandt at bestpractical.com
Wed Aug 31 14:28:42 EDT 2016
The branch, 4.4/sort-dashboards has been created
at f3df1c32fb11acbc87cceed0c309b1fc4a2e4c45 (commit)
- Log -----------------------------------------------------------------
commit f3df1c32fb11acbc87cceed0c309b1fc4a2e4c45
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Wed Aug 31 14:27:30 2016 -0400
Sort dashboards alphabetically
Provide the dashboard list sorted alphabetically rather than
with no defined order. This makes it easier for users to find
dashboards when their lists get long.
diff --git a/lib/RT/Dashboards.pm b/lib/RT/Dashboards.pm
index a5436c6..4244a23 100644
--- a/lib/RT/Dashboards.pm
+++ b/lib/RT/Dashboards.pm
@@ -104,6 +104,22 @@ sub LimitToPrivacy {
}
}
+=head2 SortDashboards
+
+Sort the list of dashboards. The default is to sort alphabetically.
+
+=cut
+
+sub SortDashboards {
+ my $self = shift;
+
+ # Work directly with the internal data structure since Dashboards
+ # aren't fully backed by a DB table and can't support typical OrderBy, etc.
+ my @sorted = sort { lcfirst($a->Name) cmp lcfirst($b->Name) } @{$self->{'objects'}};
+ @{$self->{'objects'}} = @sorted;
+ return;
+}
+
sub ColumnMapClassName {
return 'RT__Dashboard';
}
diff --git a/share/html/Dashboards/Elements/ShowDashboards b/share/html/Dashboards/Elements/ShowDashboards
index 6e6ef94..50127a9 100644
--- a/share/html/Dashboards/Elements/ShowDashboards
+++ b/share/html/Dashboards/Elements/ShowDashboards
@@ -56,6 +56,7 @@
% }
% $title =~ s/([\\'])/\\$1/g;
% $title = $m->interp->apply_escapes($title, 'h');
+% $Dashboards->SortDashboards();
<& /Elements/CollectionList,
%ARGS,
Format => qq{'<a href="__WebPath__/__ShowURL__">__Name__</a>/TITLE:$title', __Subscription__},
-----------------------------------------------------------------------
More information about the rt-commit
mailing list