[Rt-commit] rt branch, 4.6/inline-edit, updated. rt-4.4.1-188-g690d31a

Shawn Moore shawn at bestpractical.com
Wed Jan 18 18:37:11 EST 2017


The branch, 4.6/inline-edit has been updated
       via  690d31a967b97ab028964352576b4022f4729cde (commit)
      from  bb2cbc36518a1cd8ebb80abc2afa71cb99dc4e7c (commit)

Summary of changes:
 etc/RT_Config.pm.in                                |  1 +
 share/html/Ticket/Elements/AddWatchers             |  3 ++
 .../Elements/{EditPeople => EditPeopleInline}      | 58 +++++++---------------
 share/html/Ticket/Elements/ShowSummary             | 25 +++++++++-
 4 files changed, 45 insertions(+), 42 deletions(-)
 copy share/html/Ticket/Elements/{EditPeople => EditPeopleInline} (78%)

- Log -----------------------------------------------------------------
commit 690d31a967b97ab028964352576b4022f4729cde
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Jan 18 23:30:17 2017 +0000

    Inline edit for ticket people
    
    This is a slimmed down version of the Modify People page. It does not
    support the search form for users and groups, as that requires
    reloading the page. It also does not show or edit squelching. For such
    advanced needs, Modify People is appropriate.
    
    There are additional measures to make the inline edit panel more svelte,
    such as hiding display of multi-user roles with no members, and combining
    the tables for single-member roles and multi-member roles.
    
    Fixes: T#178730

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 6caf6ed..4dad160 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1516,6 +1516,7 @@ Grouping" are created by the L</%CustomFieldGroupings> setting.
             'Another Grouping'  => 'click',
             'Dates'             => 'always',
             'Links'             => 'hide',
+            'People'            => 'link',
         },
     );
 
diff --git a/share/html/Ticket/Elements/AddWatchers b/share/html/Ticket/Elements/AddWatchers
index 1cbb6fc..70a6201 100644
--- a/share/html/Ticket/Elements/AddWatchers
+++ b/share/html/Ticket/Elements/AddWatchers
@@ -45,10 +45,12 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
+% if ($ShowLabel) {
 <br />
 <br />
 
 <&|/l&>Add new watchers</&>:<br />
+% }
 
 <table>
 % if ($Users and $Users->Count) {
@@ -140,6 +142,7 @@ for my $addr ( values %{$Ticket->TransactionAddresses} ) {
 </%INIT>
 
 <%ARGS>
+$ShowLabel => 1
 $UserField => 'Name'
 $UserOp => '='
 $UserString => undef
diff --git a/share/html/Ticket/Elements/EditPeopleInline b/share/html/Ticket/Elements/EditPeopleInline
new file mode 100644
index 0000000..b4a4d48
--- /dev/null
+++ b/share/html/Ticket/Elements/EditPeopleInline
@@ -0,0 +1,112 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2016 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 }}}
+<i><&|/l&>Current watchers</&>:</i>
+<table width="100%">
+<tr>
+  <td class="label"><&|/l&>Owner</&>:</td>
+  <td class="value"><& /Elements/SelectOwner, Name => 'Owner', QueueObj => $Ticket->QueueObj, TicketObj => $Ticket, Default => $Ticket->OwnerObj->Id, DefaultValue => 0&></td>
+</tr>
+
+% my @role_fields;
+% my $single_roles = $Ticket->QueueObj->CustomRoles;
+% $single_roles->LimitToSingleValue;
+% while (my $role = $single_roles->Next) {
+<tr>
+  <td class="label"><% $role->Name %>:</td>
+  <td class="value"><& /Elements/SingleUserRoleInput, role => $role, Ticket => $Ticket &></td>
+</tr>
+
+% }
+
+% if ($Ticket->Requestors->MembersObj->Count) {
+<tr>
+  <td class="label"><&|/l&>Requestors</&>:</td>
+  <td class="value"><& EditWatchers, TicketObj => $Ticket, Watchers => $Ticket->Requestors &></td>
+</tr>
+% }
+
+% if ($Ticket->Cc->MembersObj->Count) {
+<tr>
+  <td class="label"><&|/l&>Cc</&>:</td>
+  <td class="value"><& EditWatchers, TicketObj => $Ticket, Watchers => $Ticket->Cc &></td>
+</tr>
+% }
+
+% if ($Ticket->AdminCc->MembersObj->Count) {
+<tr>
+  <td class="label"><&|/l&>AdminCc</&>:</td>
+  <td class="value"><& EditWatchers, TicketObj => $Ticket, Watchers => $Ticket->AdminCc &></td>
+</tr>
+% }
+
+% my $multi_roles = $Ticket->QueueObj->CustomRoles;
+% $multi_roles->LimitToMultipleValue;
+% while (my $role = $multi_roles->Next) {
+% my $group = $Ticket->RoleGroup($role->GroupType);
+% if ($group->Id && $group->MembersObj->Count) {
+<tr>
+  <td class="label"><% $role->Name %>:</td>
+  <td class="value"><& EditWatchers, TicketObj => $Ticket, Watchers => $group &></td>
+</tr>
+% }
+% }
+
+<tr>
+  <td colspan="2">
+    <i><&|/l&>Add new watchers</&>:</i>
+    <& AddWatchers, Ticket => $Ticket, ShowLabel => 0 &>
+  </td>
+</tr>
+
+<& /Elements/EditCustomFields, Object => $Ticket, Grouping => 'People', InTable => 1 &>
+</table>
+
+<%ARGS>
+$Ticket => undef
+</%ARGS>
+
diff --git a/share/html/Ticket/Elements/ShowSummary b/share/html/Ticket/Elements/ShowSummary
index bc487ef..4e5805a 100644
--- a/share/html/Ticket/Elements/ShowSummary
+++ b/share/html/Ticket/Elements/ShowSummary
@@ -85,10 +85,31 @@ my $modify_behavior = $InlineEdit ? ($inline_edit_behavior{Basics} || $inline_ed
         InlineEdit   => $InlineEdit,
         &>
 
+<%PERL>
+my $people_url = RT->Config->Get('WebPath')."/Ticket/ModifyPeople.html?id=".$Ticket->Id;
+my $people_inline = '<a class="inline-edit-toggle" data-edit-label="'.$edit_label.'" data-cancel-label="'.$cancel_label.'" href="'.$m->interp->apply_escapes($people_url, 'h' ).'">'.$edit_label.'</a>';
+my $people_behavior = $InlineEdit ? ($inline_edit_behavior{People} || $inline_edit_behavior{_default} || 'link') : 'hide';
+</%PERL>
     <&| /Widgets/TitleBox, title => loc('People'),
         (($can_modify || $can_modify_owner || $can_modify_people) ? (title_href => RT->Config->Get('WebPath')."/Ticket/ModifyPeople.html?id=".$Ticket->Id) : ()),
-        class => 'ticket-info-people',
-    &><& /Ticket/Elements/ShowPeople, Ticket => $Ticket &></&>
+        class => (join " ", 'ticket-info-people', ($people_behavior eq 'always' ? 'editing' : ())),
+        ($people_behavior =~ /^(link|click)$/ ? (titleright_raw => $people_inline) : ()),
+        data => { 'inline-edit-behavior' => $people_behavior },
+    &>
+%       unless ($people_behavior eq 'always') {
+            <div class="inline-edit-display">
+                <& /Ticket/Elements/ShowPeople, Ticket => $Ticket &>
+            </div>
+%       }
+%       if ($people_behavior ne 'hide') {
+            <form class="inline-edit" action="<%RT->Config->Get('WebPath')%>/Ticket/Display.html" method="post">
+                <input type="hidden" class="hidden" name="id" value="<% $Ticket->id %>" />
+                <& /Ticket/Elements/EditPeopleInline, Ticket => $Ticket &>
+                <div align="right"><input type="submit" class="button" value="<&|/l&>Save</&>" /></div>
+            </form>
+%       }
+</&>
+
 % $m->callback( %ARGS, CallbackName => 'AfterPeople' );
     <& /Ticket/Elements/ShowAttachments, Ticket => $Ticket, Attachments => $Attachments, Count => RT->Config->Get('AttachmentListCount') &>
 % $m->callback( %ARGS, CallbackName => 'AfterAttachments' );

-----------------------------------------------------------------------


More information about the rt-commit mailing list