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

Craig Kaiser craig at bestpractical.com
Tue Jan 5 10:58:20 EST 2021


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

- Log -----------------------------------------------------------------
commit 1e2fe5f79bd16e86fcf602bcc52aa489c8ea29e5
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..bdcb48fa 100644
--- a/html/RTIR/Display.html
+++ b/html/RTIR/Display.html
@@ -59,66 +59,185 @@
   <div class="boxcontainer col-md-6">
 % $m->callback( %ARGS, Ticket => $Ticket, CallbackName => 'LeftColumnStart' );
 
+<%PERL>
+    my $modify_url = RT::IR->HREFTo("Edit.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 = $InlineEdit ? ($inline_edit_behavior{Basics} || $inline_edit_behavior{_default} || 'link') : 'hide';
+</%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,
     Object       => $Ticket,
-    title_href => RT::IR->HREFTo("Edit.html"),
+    title_href   => RT::IR->HREFTo("Edit.html"),
+    InlineEdit   => ($can_modify || $can_modify_cf) ? $InlineEdit : 0,
+    ActionURL    => RT->Config->Get('WebPath')."/RTIR/Display.html"
 &>
 
 <& /RTIR/Elements/ShowArticles, Ticket => $Ticket &>
@@ -130,18 +249,68 @@
   <div class="boxcontainer col-md-6">
 % $m->callback( %ARGS, Ticket => $Ticket, CallbackName => 'RightColumnStart' );
 
+<%PERL>
+  my $people_url      = RT::IR->HREFTo("Edit.html?id=".$Ticket->Id);
+  my $people_inline   = sprintf( $modify_inline, $m->interp->apply_escapes( $people_url, 'h' ) );
+  my $people_behavior = $InlineEdit ? ($inline_edit_behavior{People} || $inline_edit_behavior{_default} || 'link') : 'hide';
+</%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::IR->HREFTo("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::IR->HREFTo("Edit.html?id=".$Ticket->Id);
+    my $dates_inline   = sprintf( $modify_inline, $m->interp->apply_escapes( $dates_url, 'h' ) );
+    my $dates_behavior = $InlineEdit ? ($inline_edit_behavior{Dates} || $inline_edit_behavior{_default} || 'link') : 'hide';
+</%PERL>
+
+    <&| /Widgets/TitleBox,
+        title => loc("Dates"),
+        title_href => RT::IR->HREFTo("Edit.html?id=". $Ticket->Id),
+        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 +364,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 +431,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 );
@@ -320,4 +503,5 @@ $id => 0
 $Queue => undef
 @SelectedTickets => ()
 $ForceShowHistory => 0
+$InlineEdit       => RT->Config->Get( 'InlineEdit', $session{CurrentUser} )
 </%ARGS>

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

    Add inline edit to Incident/Display.html page

diff --git a/html/RTIR/Incident/Display.html b/html/RTIR/Incident/Display.html
index b67a7365..0c3657f7 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::IR->HREFTo("Edit.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 = $InlineEdit ? ($inline_edit_behavior{Basics} || $inline_edit_behavior{_default} || 'link') : 'hide';
+</%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,149 @@
   <& /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,
     Object       => $TicketObj,
-    title_href => RT::IR->HREFTo("Edit.html"),
+    title_href   => RT::IR->HREFTo("Edit.html"),
+    InlineEdit   => ($can_modify || $can_modify_cf) ? $InlineEdit : 0,
+    ActionURL    => RT->Config->Get('WebPath')."/RTIR/Incident/Display.html"
 &>
 
+<%PERL>
+  my $dates_url      = RT::IR->HREFTo("Edit.html?id=". $TicketObj->Id);
+  my $dates_inline   = sprintf( $modify_inline, $m->interp->apply_escapes( $dates_url, 'h' ) );
+  my $dates_behavior = $InlineEdit ? ($inline_edit_behavior{Dates} || $inline_edit_behavior{_default} || 'link') : 'hide';
+</%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 +418,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 +452,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 ) {
@@ -378,4 +527,5 @@ $Child => undef
 $SelectedTicket => undef
 @SelectedTickets => ()
 $ForceShowHistory => 0
+$InlineEdit       => RT->Config->Get( 'InlineEdit', $session{CurrentUser} )
 </%ARGS>

commit f1fca5b8dea587e677cf26711cf9bd62ec2654e7
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 bdcb48fa..991ca3e8 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