[Rt-commit] rtir branch, 5.0/allow-inline-edit-on-ticket-display, created. 5.0.0-19-gd6e735d3

Craig Kaiser craig at bestpractical.com
Thu Nov 19 09:43:18 EST 2020


The branch, 5.0/allow-inline-edit-on-ticket-display has been created
        at  d6e735d34ef9bb7a5b74feeddbd1288c710dfd7f (commit)

- Log -----------------------------------------------------------------
commit 2ef5dd7f2a435bcf90f8821df9d9c435af4af019
Author: craig kaiser <craig at bestpractical.com>
Date:   Wed Nov 18 08:42:04 2020 -0500

    Add inline edit to RTIR Display.html page

diff --git a/html/RTIR/Display.html b/html/RTIR/Display.html
index c8358da9..56bf0eb9 100644
--- a/html/RTIR/Display.html
+++ b/html/RTIR/Display.html
@@ -59,66 +59,184 @@
   <div class="boxcontainer col-md-6">
 % $m->callback( %ARGS, Ticket => $Ticket, CallbackName => 'LeftColumnStart' );
 
+<%PERL>
+    my $modify_url = RT->Config->Get('WebPath')."/RTIR/Display.html?id=".$Ticket->Id;
+    my $modify_inline
+        = '<a class="inline-edit-toggle edit" href="%s">'
+        . qq{<span class="fas fa-pencil-alt icon-bordered fa-2x" alt="$edit_label" data-toggle="tooltip" data-placement="top" data-original-title="$edit_label"></span>}
+        . '</a>'
+        . '<a class="inline-edit-toggle cancel hidden" href="#">'
+        . qq{<span class="fas fa-times icon-bordered fa-2x" alt="$cancel_label" data-toggle="tooltip" data-placement="top" data-original-title="$cancel_label"></span>}
+        . '</a>';
+    my $modify_basics = sprintf( $modify_inline, $m->interp->apply_escapes( $modify_url, 'h' ) );
+    my $modify_behavior = $inline_edit_behavior{Basics} || $inline_edit_behavior{_default} || 'link';
+</%PERL>
+
 <&| /Widgets/TitleBox,
-    title => loc("The Basics"),
+    title       => loc("The Basics"),
     title_href  => RT::IR->HREFTo("Edit.html?id=".$Ticket->Id),
-    class => 'ticket-info-basics',
+    class       => (join " ", 'ticket-info-basics', ($modify_behavior eq 'always' ? 'editing' : ())),
+    data        => { 'inline-edit-behavior' => $modify_behavior },
+    (($can_modify || $can_modify_cf) && $modify_behavior =~ /^(link|click)$/ ? (titleright_raw => $modify_basics) : ()),
 &>
-    <div>
+% unless ($modify_behavior eq 'always') {
+  <div class="inline-edit-display">
 % if (my $constituency = RT::IR->ConstituencyFor($Ticket)) {
-      <div class="form-row">
-        <div class="label col-3">
-          <% loc("Constituency") %>:
-        </div>
-        <div class="value col-9">
-          <span class="current-value"><% $constituency %></span>
-        </div>
+    <div class="form-row">
+      <div class="label col-3">
+        <% loc("Constituency") %>:
+      </div>
+      <div class="value col-9">
+        <span class="current-value"><% $constituency %></span>
       </div>
+    </div>
 % }
-      <div class="form-row">
-        <div class="label col-3">
-          <% loc("Status") %>:
-        </div>
-        <div class="value col-9">
-          <span class="current-value"><% $Ticket->Status %></span>
-        </div>
+    <div class="form-row">
+      <div class="label col-3">
+        <% loc("Status") %>:
       </div>
+      <div class="value col-9">
+        <span class="current-value"><% $Ticket->Status %></span>
+      </div>
+    </div>
 % if ( !$Ticket->QueueObj->SLADisabled ) {
-      <div class="form-row">
-        <div class="label col-3">
-          <&|/l&>SLA</&>:
-        </div>
-        <div class="value col-9">
-          <span class="current-value"><% loc($Ticket->SLA) %></span>
-        </div>
+    <div class="form-row">
+      <div class="label col-3">
+        <&|/l&>SLA</&>:
       </div>
+      <div class="value col-9">
+        <span class="current-value"><% loc($Ticket->SLA) %></span>
+      </div>
+    </div>
 % }
-      <div class="form-row">
-        <div class="label col-3">
-          <% loc("Incident") %>:
-        </div>
-        <div class="value col-9">
-          <& /RTIR/Elements/ShowIncidents, Ticket => $Ticket &>
-        </div>
+    <div class="form-row">
+      <div class="label col-3">
+        <% loc("Incident") %>:
       </div>
-      <div class="form-row">
-        <div class="label col-3">
-          <&|/l&>Time Worked</&>:
-        </div>
-        <div class="value col-9">
-          <span class="current-value"><%loc('[_1] min', $TimeWorked)%></span>
-        </div>
+      <div class="value col-9">
+        <& /RTIR/Elements/ShowIncidents, Ticket => $Ticket, InlineEdit => 0 &>
+      </div>
+    </div>
+    <div class="form-row">
+      <div class="label col-3">
+        <&|/l&>Time Worked</&>:
+      </div>
+      <div class="value col-9">
+        <span class="current-value"><%loc('[_1] min', $TimeWorked)%></span>
+      </div>
+    </div>
+
+    <& /Elements/ShowCustomFields, Grouping => 'Basics', Object => $Ticket, Table => 0 &>
+  </div>
+% }
+% if ($modify_behavior ne 'hide') {
+  <form class="inline-edit" action="<%RT->Config->Get('WebPath')%>/RTIR/Display.html" method="post" enctype="multipart/form-data">
+    <input type="hidden" class="hidden" name="id" value="<% $Ticket->id %>" />
+
+    <div class="form-row">
+      <div class="label col-3">
+        <&|/l&>Subject</&>:
       </div>
+      <div class="value col-9">
+        <input class="form-control" type="text" name="Subject" value="<% $ARGS{'Subject'} || $Ticket->Subject %>" />
+      </div>
+    </div>
 
-  <& /Elements/ShowCustomFields, Grouping => 'Basics', Object => $Ticket, Table => 0 &>
+    <div class="form-row">
+      <div class="label col-3">
+        <% loc("Status") %>:
+      </div>
+      <div class="value col-9">
+% unless ( RT::IR->IsCountermeasureQueue($Ticket->QueueObj) ) {
+        <span class="current-value form-control"><% loc($Ticket->Status) %></span>
+% }
+% else {
+        <& /Ticket/Elements/SelectStatus,
+            Name         => 'Status',
+            Object       => $Ticket->QueueObj,
+            DefaultValue => 0,
+            Default      => $ARGS{'Status'} || $Ticket->Status,
+        &>
+% }
+      </div>
+    </div>
 
+    <div class="form-row">
+      <div class="label col-3">
+        <&|/l&>Owner</&>:
+      </div>
+      <div class="value col-9">
+        <& /Elements/SelectOwner,
+            Name      => 'Owner',
+            Default   => $ARGS{'Owner'} || $Ticket->Owner,
+            TicketObj => $Ticket,
+            QueueObj  => $Ticket->QueueObj,
+        &>
+      </div>
     </div>
 
+    <div class="form-row">
+      <div class="label col-3">
+        <&|/l&>Queue</&>:
+      </div>
+      <div class="value col-9">
+        <& /RTIR/Elements/SelectRTIRQueue,
+            Name                => 'Queue',
+            Default             => $ARGS{'Queue'} || $Ticket->Queue,
+            TicketObj           => $Ticket, Lifecycle => $Ticket->QueueObj->Lifecycle,
+            LimitToConstituency => ($m->{'RTIR_ConstituencyFilter'} || RT::IR->StrictConstituencyLinking) ? 1 : 0,
+            Constituency        => RT::IR->ConstituencyFor($Ticket)
+        &>
+      </div>
+    </div>
+
+% if ( !$Ticket->QueueObj->SLADisabled ) {
+    <div class="form-row">
+      <div class="label col-3">
+        <&|/l&>SLA</&>:
+      </div>
+      <div class="value col-9">
+        <& /Elements/SelectSLA, Default => $Ticket->SLA, TicketObj => $Ticket &>
+      </div>
+    </div>
+% }
+    <div class="form-row">
+      <div class="label col-3">
+        <% loc("Incident") %>:
+      </div>
+      <div class="value col-9">
+        <& /RTIR/Elements/ShowIncidents, Ticket => $Ticket, InlineEdit => 0 &>
+      </div>
+    </div>
+    <div class="form-row">
+      <div class="label col-3">
+        <&|/l&>Time Worked</&>:
+      </div>
+      <div class="value col-9">
+        <& /Elements/EditTimeValue,
+            Name    => 'TimeWorked',
+            Default => $ARGS{'TimeWorked'} || $Ticket->TimeWorked || '',
+            Ticket  => $Ticket
+        &>
+      </div>
+    </div>
+
+    <& /Elements/EditCustomFields, Grouping => 'Basics', Object => $Ticket, Table => 0 &>
+
+    <div class="form-row">
+      <div class="col-12 text-right">
+        <input type="submit" class="button btn btn-primary" value="<&|/l&>Save</&>" />
+      </div>
+    </div>
+
+  </form>
+% }
 </&>
 
-<& /Elements/ShowCustomFieldCustomGroupings,
+<& /RTIR/Elements/ShowCustomFieldCustomGroupings,
     Object       => $Ticket,
-    title_href => RT::IR->HREFTo("Edit.html"),
+    title_href   => RT::IR->HREFTo("Edit.html"),
+    InlineEdit   => 1
 &>
 
 <& /RTIR/Elements/ShowArticles, Ticket => $Ticket &>
@@ -130,18 +248,67 @@
   <div class="boxcontainer col-md-6">
 % $m->callback( %ARGS, Ticket => $Ticket, CallbackName => 'RightColumnStart' );
 
+<%PERL>
+  my $people_url = RT->Config->Get('WebPath')."/Ticket/ModifyPeople.html?id=".$Ticket->Id;
+  my $people_inline = sprintf( $modify_inline, $m->interp->apply_escapes( $people_url, 'h' ) );
+  my $people_behavior = $inline_edit_behavior{People} || $inline_edit_behavior{_default} || 'link';
+</%PERL>
+
     <&| /Widgets/TitleBox,
-        title => loc('People'), 
-        title_href  => RT::IR->HREFTo("Edit.html?id=". $Ticket->Id),
-        class => 'ticket-info-people',
+        title      => loc('People'),
+        title_href => RT->Config->Get('WebPath')."/RTIR/Edit.html?id=".$Ticket->Id,
+        class      => (join " ", 'ticket-info-people', ($people_behavior eq 'always' ? 'editing' : ())),
+        data       => { 'inline-edit-behavior' => $people_behavior },
+        (($can_modify || $can_modify_people) && $people_behavior =~ /^(link|click)$/ ? (titleright_raw => $people_inline) : ()),
     &>
+
+% unless ($people_behavior eq 'always') {
+  <div class="inline-edit-display">
     <& /RTIR/Elements/ShowPeople, Ticket => $Ticket &>
+  </div>
+% }
+% if ($people_behavior ne 'hide') {
+  <form class="inline-edit" action="<%RT->Config->Get('WebPath')%>/RTIR/Display.html" method="post" enctype="multipart/form-data">
+    <input type="hidden" class="hidden" name="id" value="<% $Ticket->id %>" />
+    <& /RTIR/Elements/EditPeople, Ticket => $Ticket &>
+    <div class="form-row">
+      <div class="col-12 text-right">
+        <input type="submit" class="button btn btn-primary" value="<&|/l&>Save</&>" />
+      </div>
+    </div>
+  </form>
+% }
     </&>
-    <&| /Widgets/TitleBox, title => loc("Dates"),
-    title_href  => RT::IR->HREFTo("Edit.html?id=". $Ticket->Id),
-        class => 'ticket-info-dates',
+
+<%PERL>
+    my $dates_url      = RT->Config->Get('WebPath')."/Ticket/ModifyDates.html?id=".$Ticket->Id;
+    my $dates_inline   = sprintf( $modify_inline, $m->interp->apply_escapes( $dates_url, 'h' ) );
+    my $dates_behavior = $inline_edit_behavior{Dates} || $inline_edit_behavior{_default} || 'link';
+</%PERL>
+
+    <&| /Widgets/TitleBox,
+        title => loc("Dates"),
+        class => (join " ", 'ticket-info-dates', ($modify_behavior eq 'always' ? 'editing' : ())),
+        data  => { 'inline-edit-behavior' => $dates_behavior },
+        ($can_modify ? (title_href => $dates_url) : ()),
+        ($can_modify && $dates_behavior =~ /^(link|click)$/ ? (titleright_raw => $dates_inline) : ()),
     &>
-    <& /RTIR/Elements/ShowDates, Ticket => $Ticket &>
+% unless ($modify_behavior eq 'always') {
+    <div class="inline-edit-display">
+      <& /RTIR/Elements/ShowDates, Ticket => $Ticket &>
+    </div>
+% }
+% if ($modify_behavior ne 'hide') {
+    <form class="inline-edit" action="<%RT->Config->Get('WebPath')%>/RTIR/Display.html" method="post" enctype="multipart/form-data">
+      <input type="hidden" class="hidden" name="id" value="<% $Ticket->id %>" />
+      <& /Ticket/Elements/EditDates, TicketObj => $Ticket &>
+      <div class="form-row">
+        <div class="col-12 text-right">
+          <input type="submit" class="button btn btn-primary" value="<&|/l&>Save</&>" />
+        </div>
+      </div>
+    </form>
+% }
     </&>
 % $m->callback( %ARGS, Ticket => $Ticket, CallbackName => 'BeforeRequestor' );
     <br />  
@@ -195,6 +362,18 @@ unless ( $id eq 'new' ) {
     $QueueObj->Load($Queue) || Abort(loc("Queue could not be loaded."));
 }
 
+my $edit_label = $m->interp->apply_escapes( loc("Edit"), 'h' );
+my $cancel_label = $m->interp->apply_escapes( loc("Cancel"), 'h' );
+
+my %inline_edit_behavior;
+if (RT->Config->Get('InlineEditPanelBehavior')) {
+    %inline_edit_behavior = %{ RT->Config->Get('InlineEditPanelBehavior')->{'RT::Ticket'} || {} };
+}
+
+my $can_modify         = $Ticket->CurrentUserHasRight( 'ModifyTicket' );
+my $can_modify_cf      = $Ticket->CurrentUserHasRight( 'ModifyCustomField' );
+my $can_modify_people  = $Ticket->CurrentUserHasRight( 'Watch' ) || $Ticket->CurrentUserHasRight( 'WatchAsAdminCc' );
+
 my $Type = RT::IR::TicketType( Lifecycle => $QueueObj->Lifecycle );
 # If it's not an RTIR ticket type, just show the regular 
 # RT ticket display page
@@ -250,6 +429,8 @@ if ( $id eq 'new' ) {
     push @results, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef => \%ARGS, Actions => \@results );
 
     push @results, ProcessTicketBasics(  TicketObj => $Ticket, ARGSRef => \%ARGS );
+    push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $Ticket );
+    push @results, ProcessTicketWatchers(ARGSRef => \%ARGS, TicketObj => $Ticket );
 
     my $strict_acl = RT->Config->Set( StrictLinkACL => 0 );
     push @results, ProcessTicketLinks(   TicketObj => $Ticket, ARGSRef => \%ARGS );
diff --git a/html/RTIR/Elements/ShowCustomFieldCustomGroupings b/html/RTIR/Elements/ShowCustomFieldCustomGroupings
new file mode 100644
index 00000000..846a925f
--- /dev/null
+++ b/html/RTIR/Elements/ShowCustomFieldCustomGroupings
@@ -0,0 +1,132 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2020 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 }}}
+<%perl>
+for my $group ( @Groupings ) {
+    my $CustomFields = $Object->CustomFields;
+    $m->callback(
+        Table        => 1, # default is true
+        %ARGS,
+        CallbackPage => '/Elements/ShowCustomFields',
+        CallbackName => 'MassageCustomFields',
+        Object       => $Object,
+        CustomFields => $CustomFields,
+    );
+
+    $CustomFields->LimitToGrouping( $Object => $group );
+    next unless $CustomFields->First;
+
+    my $modify_url = $title_href ? "$title_href?id=".$Object->id.($group?";Grouping=".$m->interp->apply_escapes($group,'u')."#".CSSClass("$css_class-$group") : "#".$css_class) : undef;
+    my $modify_inline
+        = '<a class="inline-edit-toggle edit" href="'
+        . $m->interp->apply_escapes( ( $modify_url || '#' ), 'h' ) . '">'
+        . qq{<span class="fas fa-pencil-alt icon-bordered fa-2x" alt="$edit_label" data-toggle="tooltip" data-placement="top" data-original-title="$edit_label"></span>}
+        . '</a>'
+        . '<a class="inline-edit-toggle cancel hidden" href="#">'
+        . qq{<span class="fas fa-times icon-bordered fa-2x" alt="$cancel_label" data-toggle="tooltip" data-placement="top" data-original-title="$cancel_label"></span>}
+        . '</a>';
+    my $modify_behavior = $InlineEdit ? ($inline_edit_behavior{$group} || $inline_edit_behavior{_default} || 'link') : 'hide';
+    my @class = $css_class;
+    push @class, CSSClass("$css_class-$group") if $group;
+    push @class, 'editing' if $modify_behavior eq 'always';
+
+    my %grouping_args = (
+        title => $group? loc($group) : loc('Custom Fields'),
+        class => (join " ", @class),
+        hide_empty => 1,
+        title_href => $modify_url,
+        ($modify_behavior =~ /^(link|click)$/ ? (titleright_raw => $modify_inline) : ()),
+        data => { 'inline-edit-behavior' => $modify_behavior },
+        %$TitleBoxARGS,
+    );
+    $m->callback( CallbackName => 'TitleBox', Object => $Object, Grouping => $group, ARGSRef => \%grouping_args );
+</%perl>
+<&| /Widgets/TitleBox, %grouping_args &>
+% unless ($modify_behavior eq 'always') {
+  <div class="inline-edit-display">
+    <& /Elements/ShowCustomFields, %ARGS, Object => $Object, Grouping => $group &>
+  </div>
+% }
+% if ($modify_behavior ne 'hide') {
+  <form class="inline-edit" action="<%RT->Config->Get('WebPath')%>/RTIR/Display.html" method="post" enctype="multipart/form-data">
+    <input type="hidden" class="hidden" name="id" value="<% $Object->id %>" />
+    <& /Elements/EditCustomFields, Object => $Object, Grouping => $group, InTable => 0 &>
+    <div class="form-row">
+      <div class="col-12 text-right">
+        <input type="submit" class="button btn btn-primary" value="<&|/l&>Save</&>" />
+      </div>
+    </div>
+  </form>
+% }
+</&>
+% }
+<%ARGS>
+$Object
+$title_href => ""
+$InlineEdit => 0
+ at Groupings => ()
+</%ARGS>
+<%INIT>
+my $css_class = lc(ref($Object)||$Object);
+$css_class =~ s/^rt:://;
+$css_class =~ s/::/-/g;
+$css_class = CSSClass($css_class);
+$css_class .= '-info-cfs';
+
+my $TitleBoxARGS = delete $ARGS{TitleBoxARGS} || {};
+
+$InlineEdit = 0 unless $Object->isa('RT::Ticket');
+my %inline_edit_behavior;
+if (RT->Config->Get('InlineEditPanelBehavior')) {
+    %inline_edit_behavior = %{ RT->Config->Get('InlineEditPanelBehavior')->{RT::CustomField->_GroupingClass($Object)} || {} };
+}
+
+my $edit_label   = $m->interp->apply_escapes( loc("Edit"), 'h' );
+my $cancel_label = $m->interp->apply_escapes( loc("Cancel"), 'h' );
+
+ at Groupings = (RT::CustomField->CustomGroupings( $Object ), '') unless @Groupings;
+</%INIT>

commit 82028fd66f8aba9b2e32f229fc807b9847313b63
Author: craig kaiser <craig at bestpractical.com>
Date:   Wed Nov 18 13:55:02 2020 -0500

    Add inline edit to Incidents/Display.html page

diff --git a/html/RTIR/Incident/Display.html b/html/RTIR/Incident/Display.html
index b67a7365..6fe419ae 100644
--- a/html/RTIR/Incident/Display.html
+++ b/html/RTIR/Incident/Display.html
@@ -58,22 +58,30 @@
   <div class="boxcontainer col-md-6">
 % $m->callback( %ARGS, Ticket => $TicketObj, CallbackName => 'LeftColumnStart' );
 
+<%PERL>
+    my $modify_url = RT->Config->Get('WebPath')."/RTIR/Incident/Display.html?id=".$TicketObj->Id;
+    my $modify_inline
+        = '<a class="inline-edit-toggle edit" href="%s">'
+        . qq{<span class="fas fa-pencil-alt icon-bordered fa-2x" alt="$edit_label" data-toggle="tooltip" data-placement="top" data-original-title="$edit_label"></span>}
+        . '</a>'
+        . '<a class="inline-edit-toggle cancel hidden" href="#">'
+        . qq{<span class="fas fa-times icon-bordered fa-2x" alt="$cancel_label" data-toggle="tooltip" data-placement="top" data-original-title="$cancel_label"></span>}
+        . '</a>';
+    my $modify_basics = sprintf( $modify_inline, $m->interp->apply_escapes( $modify_url, 'h' ) );
+    my $modify_behavior = $inline_edit_behavior{Basics} || $inline_edit_behavior{_default} || 'link';
+</%PERL>
+
 <&| /Widgets/TitleBox,
-    title => loc('Incident #[_1]', $id), 
-    title_href => RT::IR->HREFTo("Edit.html?id=".$id), 
-    class=> 'ticket-info-basics',
+    title       => loc('Incident #[_1]', $id),
+    title_href  => RT::IR->HREFTo("Edit.html?id=".$TicketObj->Id),
+    class       => (join " ", 'ticket-info-basics', ($modify_behavior eq 'always' ? 'editing' : ())),
+    data        => { 'inline-edit-behavior' => $modify_behavior },
+    (($can_modify || $can_modify_cf) && $modify_behavior =~ /^(link|click)$/ ? (titleright_raw => $modify_basics) : ()),
 &>
-    <div>
-% if (my $constituency = RT::IR->ConstituencyFor($TicketObj)) {
-      <div class="form-row">
-        <div class="label col-3">
-          <% loc("Constituency") %>:
-        </div>
-        <div class="value col-9">
-          <span class="current-value"><% $constituency %></span>
-        </div>
-      </div>
-% }
+
+% unless ($modify_behavior eq 'always') {
+    <div class="inline-edit-display">
+
       <div class="form-row">
         <div class="label col-3">
           <% loc("Queue") %>:
@@ -136,20 +144,148 @@
   <& /Elements/ShowCustomFields, Grouping => 'Basics', Object => $TicketObj, Table => 0 &>
 
     </div>
+% }
+% if ($modify_behavior ne 'hide') {
+  <form class="inline-edit" action="<%RT->Config->Get('WebPath')%>/RTIR/Incident/Display.html" method="post" enctype="multipart/form-data">
+    <input type="hidden" class="hidden" name="id" value="<% $TicketObj->id %>" />
+
+    <div class="form-row">
+      <div class="label col-3">
+        <&|/l&>Subject</&>:
+      </div>
+      <div class="value col-9">
+        <input class="form-control" type="text" name="Subject" value="<% $ARGS{'Subject'} || $TicketObj->Subject %>" />
+      </div>
+    </div>
+
+    <div class="form-row">
+      <div class="label col-3">
+        <% loc("Status") %>:
+      </div>
+      <div class="value col-9">
+% unless ( RT::IR->IsCountermeasureQueue($TicketObj->QueueObj) ) {
+        <span class="current-value form-control"><% loc($TicketObj->Status) %></span>
+% }
+% else {
+        <& /Ticket/Elements/SelectStatus,
+            Name => 'Status',
+            Object => $TicketObj->QueueObj,
+            DefaultValue => 0,
+            Default => $ARGS{'Status'} || $TicketObj->Status,
+        &>
+% }
+      </div>
+    </div>
+
+    <div class="form-row">
+      <div class="label col-3">
+        <&|/l&>Owner</&>:
+      </div>
+      <div class="value col-9">
+        <& /Elements/SelectOwner,
+            Name => 'Owner', Default => $ARGS{'Owner'} || $TicketObj->Owner,
+            TicketObj => $TicketObj, QueueObj => $TicketObj->QueueObj,
+        &>
+      </div>
+    </div>
+
+    <div class="form-row">
+      <div class="label col-3">
+        <&|/l&>Queue</&>:
+      </div>
+      <div class="value col-9">
+        <& /RTIR/Elements/SelectRTIRQueue,
+            Name => 'Queue', Default => $ARGS{'Queue'} || $TicketObj->Queue,
+            TicketObj => $TicketObj, Lifecycle => $TicketObj->QueueObj->Lifecycle,
+            LimitToConstituency => ($m->{'RTIR_ConstituencyFilter'} || RT::IR->StrictConstituencyLinking) ? 1 : 0,
+              Constituency => RT::IR->ConstituencyFor($TicketObj)
+        &>
+      </div>
+    </div>
+
+% if ( !$TicketObj->QueueObj->SLADisabled ) {
+    <div class="form-row">
+      <div class="label col-3">
+        <&|/l&>SLA</&>:
+      </div>
+      <div class="value col-9">
+        <& /Elements/SelectSLA, Default => $TicketObj->SLA, TicketObj => $TicketObj &>
+      </div>
+    </div>
+% }
+    <div class="form-row">
+      <div class="label col-3">
+        <&|/l&>Time Worked</&>:
+      </div>
+      <div class="value col-9">
+        <& /Elements/EditTimeValue,
+            Name    => 'TimeWorked',
+            Default => $ARGS{'TimeWorked'} || $TicketObj->TimeWorked || '',
+            Ticket  => $TicketObj
+        &>
+      </div>
+    </div>
 
+    <div class="form-row">
+      <div class="label col-3">
+        <&|/l&>Priority</&>:
+      </div>
+      <div class="value col-9">
+        <&/Elements/SelectPriority,
+            Name     => 'Priority',
+            Default  => $ARGS{'Priority'} || $TicketObj->Priority,
+            QueueObj => $TicketObj->QueueObj,
+        &>
+      </div>
+    </div>
+
+    <& /Elements/EditCustomFields, Grouping => 'Basics', Object => $TicketObj, Table => 0 &>
+
+    <div class="form-row">
+      <div class="col-12 text-right">
+        <input type="submit" class="button btn btn-primary" value="<&|/l&>Save</&>" />
+      </div>
+    </div>
+
+  </form>
+% }
 </&>
 
-<& /Elements/ShowCustomFieldCustomGroupings,
+<& /RTIR/Elements/ShowCustomFieldCustomGroupings,
     Object       => $TicketObj,
-    title_href => RT::IR->HREFTo("Edit.html"),
+    title_href   => RT::IR->HREFTo("Edit.html"),
+    InlineEdit   => 1
 &>
 
+<%PERL>
+  my $dates_url      = RT->Config->Get('WebPath')."/Ticket/ModifyDates.html?id=".$TicketObj->Id;
+  my $dates_inline   = sprintf( $modify_inline, $m->interp->apply_escapes( $dates_url, 'h' ) );
+  my $dates_behavior = $inline_edit_behavior{Dates} || $inline_edit_behavior{_default} || 'link';
+</%PERL>
+
 <&| /Widgets/TitleBox,
-    title => loc("Dates"),
-    title_href =>RT::IR->HREFTo("Edit.html?id=".$id),
-    class => 'ticket-info-dates',
-&>
-<& /RTIR/Elements/ShowDates, Ticket => $TicketObj &>
+        title      => loc("Dates"),
+        title_href => RT::IR->HREFTo("Edit.html?id=".$id),
+        class      => (join " ", 'ticket-info-dates', ($modify_behavior eq 'always' ? 'editing' : ())),
+        data       => { 'inline-edit-behavior' => $dates_behavior },
+        ($can_modify && $dates_behavior =~ /^(link|click)$/ ? (titleright_raw => $dates_inline) : ()),
+    &>
+% unless ($modify_behavior eq 'always') {
+  <div class="inline-edit-display">
+    <& /RTIR/Elements/ShowDates, Ticket => $TicketObj &>
+  </div>
+% }
+% if ($modify_behavior ne 'hide') {
+  <form class="inline-edit" action="<%RT->Config->Get('WebPath')%>/RTIR/Incident/Display.html" method="post" enctype="multipart/form-data">
+    <input type="hidden" class="hidden" name="id" value="<% $TicketObj->id %>" />
+    <& /Ticket/Elements/EditDates, TicketObj => $TicketObj &>
+    <div class="form-row">
+      <div class="col-12 text-right">
+        <input type="submit" class="button btn btn-primary" value="<&|/l&>Save</&>" />
+      </div>
+    </div>
+  </form>
+% }
 </&>
 
 
@@ -281,6 +417,16 @@ if ( $id eq 'new' ) {
     $TicketObj = LoadTicket( $id );
 }
 
+my $edit_label = $m->interp->apply_escapes( loc("Edit"), 'h' );
+my $cancel_label = $m->interp->apply_escapes( loc("Cancel"), 'h' );
+
+my %inline_edit_behavior;
+if (RT->Config->Get('InlineEditPanelBehavior')) {
+    %inline_edit_behavior = %{ RT->Config->Get('InlineEditPanelBehavior')->{'RT::Ticket'} || {} };
+}
+my $can_modify    = $TicketObj->CurrentUserHasRight( 'ModifyTicket' );
+my $can_modify_cf = $TicketObj->CurrentUserHasRight( 'ModifyCustomField' );
+
 $m->callback(CallbackName => 'ProcessArguments', 
             Ticket => $TicketObj,
             ARGSRef => \%ARGS,  
@@ -305,6 +451,8 @@ if ( $ARGS{'Action'} && $ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/ )
 
 unless( $new_ticket ) {
     push @results, ProcessTicketBasics( ARGSRef => \%ARGS, TicketObj => $TicketObj );
+    push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $TicketObj );
+    push @results, ProcessTicketDates( ARGSRef => \%ARGS, TicketObj => $TicketObj );
 }
 
 if ( $ARGS{'BulkLink'} || $Child ) {

commit d6e735d34ef9bb7a5b74feeddbd1288c710dfd7f
Author: craig kaiser <craig at bestpractical.com>
Date:   Thu Nov 19 09:33:24 2020 -0500

    Add ARG for /RTIR/Elements/ShowIncidents to add classes when in a form
    
    When values are inside of a form the alighment of the label and value
    are adjusted with CSS. This means when we display the results of
    ShowIncidents during inline edit we need to add these CSS classes.
    
    This also fixes the alignment issue on the Edit.html page when showing
    no linked incidents (none).

diff --git a/html/RTIR/Display.html b/html/RTIR/Display.html
index 56bf0eb9..b116df2d 100644
--- a/html/RTIR/Display.html
+++ b/html/RTIR/Display.html
@@ -205,7 +205,7 @@
         <% loc("Incident") %>:
       </div>
       <div class="value col-9">
-        <& /RTIR/Elements/ShowIncidents, Ticket => $Ticket, InlineEdit => 0 &>
+        <& /RTIR/Elements/ShowIncidents, Ticket => $Ticket, InlineEdit => 0, InForm => 1 &>
       </div>
     </div>
     <div class="form-row">
diff --git a/html/RTIR/Edit.html b/html/RTIR/Edit.html
index 79f29037..ca179efe 100644
--- a/html/RTIR/Edit.html
+++ b/html/RTIR/Edit.html
@@ -133,7 +133,7 @@
         <%loc("Incident")%>:
       </div>
       <div class="value col-9">
-        <& /RTIR/Elements/ShowIncidents, Ticket => $Ticket, InlineEdit => 0 &>
+        <& /RTIR/Elements/ShowIncidents, Ticket => $Ticket, InlineEdit => 0, InForm => 1 &>
       </div>
     </div>
 % }
diff --git a/html/RTIR/Elements/ShowIncidents b/html/RTIR/Elements/ShowIncidents
index 69312785..e1a45e7b 100644
--- a/html/RTIR/Elements/ShowIncidents
+++ b/html/RTIR/Elements/ShowIncidents
@@ -45,7 +45,7 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-<span class="incidents">
+<span class="incidents <% $InForm ? 'current-value form-control' : '' %>">
 <& /RTIR/Search/Elements/ShowResults,
     Query         => $query,
     Rows          => 0,
@@ -111,4 +111,5 @@ if ( $show_unlink ) {
 <%ARGS>
 $Ticket => undef
 $InlineEdit => RT->Config->Get('InlineEdit', $session{CurrentUser})
+$InForm     => undef
 </%ARGS>

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


More information about the rt-commit mailing list