[Rt-commit] rt branch 5.0/abstract-dropdown-menu created. rt-5.0.2-32-g401c4bb57a
BPS Git Server
git at git.bestpractical.com
Wed Nov 3 18:34:10 UTC 2021
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".
The branch, 5.0/abstract-dropdown-menu has been created
at 401c4bb57ada89bc442c51680d465a053f702d32 (commit)
- Log -----------------------------------------------------------------
commit 401c4bb57ada89bc442c51680d465a053f702d32
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Nov 3 06:21:47 2021 +0800
Abstract "Return to Search Results" and "Hide unset fields" to DropdownMenu
This is to reuse the snippet in the future, no functionality is changed.
diff --git a/share/html/Elements/DropdownMenu b/share/html/Elements/DropdownMenu
new file mode 100644
index 0000000000..c6cfc745f0
--- /dev/null
+++ b/share/html/Elements/DropdownMenu
@@ -0,0 +1,79 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2021 Best Practical Solutions, LLC
+%# <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+
+<div class="btn-group dropdown">
+% if ( $ShowSearchResults ) {
+ <div class="search-results-page-menu-container">
+ <& /Elements/Menu, menu => SearchResultsPageMenu(), class => 'page-menu page-nav-shadow sf-menu sf-js-enabled sf-shadow', id => 'search-results-page-menu', 'parent_id' => 'page' &>
+ </div>
+% }
+
+% if ( @ShowOptions ) {
+ <a id="metadata-dropdown" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+ <span class="fas fa-cog icon-bordered fa-2x" alt="$alt" data-toggle="tooltip" data-placement="top" data-original-title="<% loc('Options') %>"></span>
+ </a>
+ <ul class="dropdown-menu dropdown-menu-right">
+% for my $item ( @ShowOptions ) {
+% if ( $item eq 'HideUnsetFields' ) {
+% my $show_label = loc("Show unset fields");
+% my $hide_label = loc("Hide unset fields");
+% my $initial_label = $ARGS{HideUnsetFields} ? $show_label : $hide_label;
+ <li class="dropdown-item">
+ <a href="<% "?ARGS{HideUnsetFields}=" . ($ARGS{HideUnsetFields} ? 0 : 1) . ";id=$ARGS{id}" %>" data-show-label="<% $show_label %>" data-hide-label="<% $hide_label %>" onclick="return toggle_hide_unset(this)"><% $initial_label %></a>
+ </li>
+% }
+% }
+ </ul>
+% }
+</div>
+
+<%ARGS>
+$ShowSearchResults => 1
+ at ShowOptions => ('HideUnsetFields')
+</%ARGS>
+
diff --git a/share/html/Ticket/Display.html b/share/html/Ticket/Display.html
index 87883d5419..a878a56c3e 100644
--- a/share/html/Ticket/Display.html
+++ b/share/html/Ticket/Display.html
@@ -58,34 +58,9 @@
% $m->callback( %ARGS, Ticket => $TicketObj, Transactions => $transactions, Attachments => $attachments, CallbackName => 'BeforeShowSummary' );
-<%PERL>
-my $show_label = $m->interp->apply_escapes( loc("Show unset fields"), 'h' );
-my $hide_label = $m->interp->apply_escapes( loc("Hide unset fields"), 'h' );
-my $initial_label = $HideUnsetFields ? $show_label : $hide_label;
-
-my $url = "?HideUnsetFields=" . ($HideUnsetFields ? 0 : 1) . ";id=$ARGS{id}";
-my $url_html = $m->interp->apply_escapes($url, 'h');
-
-my $search_menu = $m->scomp( '/Elements/Menu', menu => HTML::Mason::Commands::SearchResultsPageMenu(), class => 'page-menu page-nav-shadow sf-menu sf-js-enabled sf-shadow', id => 'search-results-page-menu', 'parent_id' => 'page' ) || '';
-my $alt = loc('Options');
-my $titleright = qq{
-<div class="btn-group dropdown">
- <div class="search-results-page-menu-container">
- $search_menu
- </div>
- <a id="metadata-dropdown" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
- <span class="fas fa-cog icon-bordered fa-2x" alt="$alt" data-toggle="tooltip" data-placement="top" data-original-title="$alt"></span>
- </a>
- <ul class="dropdown-menu dropdown-menu-right">
- <li class="dropdown-item">
- <a href="$url_html" data-show-label="$show_label" data-hide-label="$hide_label" onclick="return toggle_hide_unset(this)">$initial_label</a>
- </li>
- </ul>
-</div>};
-</%PERL>
<div class="summary unset-fields-container<% $HideUnsetFields ? ' unset-fields-hidden' : '' %>">
-<&| /Widgets/TitleBox, title => loc('Ticket metadata'), titleright_raw => $titleright, class => 'fullwidth' &>
+<&| /Widgets/TitleBox, title => loc('Ticket metadata'), titleright_raw => $m->scomp('/Elements/DropdownMenu', HideUnsetFields => $HideUnsetFields, %ARGS), class => 'fullwidth' &>
<& /Ticket/Elements/ShowSummary, Ticket => $TicketObj, Attachments => $attachments, InlineEdit => $InlineEdit &>
</&>
</div>
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list