[Rt-commit] rt branch, 5.0/fix-find-user-component-width, created. rt-5.0.0-7-gc712d57a13
Aaron Trevena
ast at bestpractical.com
Fri Aug 21 10:04:53 EDT 2020
The branch, 5.0/fix-find-user-component-width has been created
at c712d57a138423e8279c123137536a6237854a07 (commit)
- Log -----------------------------------------------------------------
commit 72c6f8e973833248dfa596934c378f1744eb2b5c
Author: Aaron Trevena <ast at bestpractical.com>
Date: Fri Aug 21 15:00:32 2020 +0100
Pass ARG indicating component is in sidebar
Allow components to know they're in a sidebar and layout their
elements accordingly
diff --git a/share/html/Dashboards/Elements/ShowPortlet/component b/share/html/Dashboards/Elements/ShowPortlet/component
index cead432fb2..6ded36d428 100644
--- a/share/html/Dashboards/Elements/ShowPortlet/component
+++ b/share/html/Dashboards/Elements/ShowPortlet/component
@@ -51,6 +51,7 @@ $Portlet
$Rows => 20
$Preview => 0
$HasResults
+$in_sidebar => 0
</%args>
<%init>
my $full_path = $Portlet->{path};
@@ -65,5 +66,5 @@ my $allowed = grep { $_ eq $path } @{RT->Config->Get('HomepageComponents')};
% RT->Logger->warning("You may need to replace the component 'Quicksearch' in the HomepageComponents config with 'QueueList'. See the UPGRADING-4.4 document.");
% }
% } else {
-% $m->comp($full_path, HasResults => $HasResults);
+% $m->comp($full_path, HasResults => $HasResults, in_sidebar => $in_sidebar);
% }
diff --git a/share/html/Dashboards/Elements/ShowPortlet/dashboard b/share/html/Dashboards/Elements/ShowPortlet/dashboard
index f9a3c591ad..b7664b5def 100644
--- a/share/html/Dashboards/Elements/ShowPortlet/dashboard
+++ b/share/html/Dashboards/Elements/ShowPortlet/dashboard
@@ -69,6 +69,7 @@ else {
}
}
+my $in_sidebar = (lc($Pane) eq 'sidebar') ? 1 : 0;
my @panes = @{ $current_dashboard->Panes->{$Pane} || [] };
Abort("Possible recursive dashboard detected.") if $Depth > 8;
@@ -83,7 +84,8 @@ for my $portlet (@panes) {
Dashboard => $current_dashboard,
Pane => $Pane,
Depth => $Depth + 1,
- HasResults => $HasResults
+ HasResults => $HasResults,
+ in_sidebar => $in_sidebar
);
}
</%perl>
diff --git a/share/html/Elements/MyRT b/share/html/Elements/MyRT
index 4d9fa81181..b14ffb9398 100644
--- a/share/html/Elements/MyRT
+++ b/share/html/Elements/MyRT
@@ -49,12 +49,12 @@
<div class="myrt row">
<div class="<% 'boxcontainer col-md-' . ( $sidebar ? '8' : '12' ) %>">
-% $show_cb->($_) foreach @$body;
+% $show_cb->($_, 0) foreach @$body;
</div>
% if ( $sidebar ) {
<div class="boxcontainer col-md-4">
-% $show_cb->($_) foreach @$sidebar;
+% $show_cb->($_, 1) foreach @$sidebar;
</div>
% }
@@ -84,7 +84,7 @@ $sidebar = undef unless $sidebar && @$sidebar;
my $Rows = $user->Preferences( 'SummaryRows', ( RT->Config->Get('DefaultSummaryRows') || 10 ) );
my $show_cb = sub {
- my $entry = shift;
+ my ($entry, $in_sidebar) = @_;
my $type = $entry->{type};
my $name = $entry->{'name'};
if ( $type eq 'component' ) {
@@ -96,7 +96,7 @@ my $show_cb = sub {
}
}
else {
- $m->comp( $name, %{ $entry->{arguments} || {} } );
+ $m->comp( $name, %{ $entry->{arguments} || {} }, in_sidebar => $in_sidebar );
}
} elsif ( $type eq 'system' ) {
$m->comp( '/Elements/ShowSearch', Name => $name, Override => { Rows => $Rows } );
commit c712d57a138423e8279c123137536a6237854a07
Author: Aaron Trevena <ast at bestpractical.com>
Date: Fri Aug 21 15:01:43 2020 +0100
Update Find a user component layout in sidebar
When the find user component was in a side bar the search field
was small and squashed, making it hard to use. Use new in_sidebar ARG
to style differently in a sidebar
diff --git a/share/html/Elements/FindUser b/share/html/Elements/FindUser
index 233bbf4b91..de0540c4a4 100644
--- a/share/html/Elements/FindUser
+++ b/share/html/Elements/FindUser
@@ -46,5 +46,5 @@
%#
%# END BPS TAGGED BLOCK }}}
<&|/Widgets/TitleBox, title => loc('Find a user')&>
-<& /Elements/GotoUser &>
+<& /Elements/GotoUser, %ARGS &>
</&>
diff --git a/share/html/Elements/GotoUser b/share/html/Elements/GotoUser
index b2720449bc..b908f5957a 100644
--- a/share/html/Elements/GotoUser
+++ b/share/html/Elements/GotoUser
@@ -47,13 +47,25 @@
%# END BPS TAGGED BLOCK }}}
<form name="UserSearch" method="post" action="<% RT->Config->Get('WebPath') %>/User/Search.html">
<div class="form-row justify-content-center">
- <div class="col-4">
+ <div class="col-<% $ValueCols %>">
<input type="text" class="form-control" name="UserString" value="<% $Default %>" data-autocomplete="Users" data-autocomplete-return="Name" id="autocomplete-UserString" />
</div>
+% if ($in_sidebar) {
+ </div>
+ <div class="form-row">
+ <div class="col-12">
+ <div class="submit">
+ <input type="submit" name="UserSearch" value="<&|/l&>Search</&>" class="button btn btn-primary form-control" />
+ </div>
+ </div>
+ </div>
+% }
+% else {
<div class="col-auto">
<input type="submit" name="UserSearch" value="<&|/l&>Search</&>" class="button btn btn-primary form-control" />
</div>
</div>
+%}
<script type="text/javascript">
jQuery(function(){
// Jump directly to the page if a user is chosen
@@ -65,4 +77,8 @@ jQuery(function(){
</form>
<%ARGS>
$Default => ''
+$in_sidebar => 0
</%ARGS>
+<%INIT>
+my $ValueCols = ($in_sidebar) ? 12 : 4;
+</%INIT>
-----------------------------------------------------------------------
More information about the rt-commit
mailing list