[Rt-commit] rt branch, 4.6/link-transaction-to-ticket-page, created. rt-4.4.4-651-g4c3feb4823
Michel Rodriguez
michel at bestpractical.com
Fri Jan 24 13:25:43 EST 2020
The branch, 4.6/link-transaction-to-ticket-page has been created
at 4c3feb48236d464f983165543dba38cce0f1ebab (commit)
- Log -----------------------------------------------------------------
commit 4f8bb50439a34066fd2e04a2f21501851d904c22
Author: michel <michel at bestpractical.com>
Date: Mon Jan 13 14:39:26 2020 +0100
Add link back to the ticket to a single transaction page.
diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 41b6b4c2c3..74b8f8b035 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -308,7 +308,6 @@ sub BuildMainNav {
}
}
-
if ( $request_path =~ m{^/Ticket/} ) {
if ( ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} || '' ) =~ /^(\d+)$/ ) {
my $id = $1;
@@ -454,6 +453,24 @@ sub BuildMainNav {
}
}
+ # display "Back to <object>" link in transactions
+ if ( $request_path =~ m{^/Transaction/Display.html} ) {
+ if ( ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} || '' ) =~ /^(\d+)$/ ) {
+ my $txn_id = $1;
+ my $txn = RT::Transaction->new( $current_user );
+ $txn->Load( $txn_id );
+ if ( $txn and $txn->Id ) {
+ my $object = $txn->Object;
+ if ( $object ) {
+ my( $object_type ) = $object->RecordType;
+ # This assumes that the object type can be used to describe the object (in "Back to $object_type")
+ # and that displaying the object is done in /$object_type/Display.html?id=<id>
+ $page->child( object_type => title => loc( "Back to [_1]", loc( $object_type ) ), path => "/$object_type/Display.html?id=" . $object->Id );
+ }
+ }
+ }
+ }
+
# Scope here so we can share in the Privileged callback
my $args = '';
my $has_query = '';
commit 912e7457863ca2fd9b9201839b703fee7c8c07d7
Author: michel <michel at bestpractical.com>
Date: Fri Jan 24 13:26:35 2020 +0100
Generate links to single transaction display in the Ticket history page.
Allow for other object types to generate links to the single transaction
page.
diff --git a/share/html/Elements/ShowTransaction b/share/html/Elements/ShowTransaction
index e6b797fb3c..01e22bd312 100644
--- a/share/html/Elements/ShowTransaction
+++ b/share/html/Elements/ShowTransaction
@@ -52,7 +52,7 @@
% }
<span class="type">
<a name="txn-<% $Transaction->id %>" \
-% if ( $DisplayPath ) {
+% if ( $DisplayPath && ! ( $DisplayPath eq 'History.html' && $can_display_transaction ) ) {
href="<% $DisplayPath %>?id=<% $Object->id %>#txn-<% $Transaction->id %>" \
% } elsif ( $HTML::Mason::Commands::r->path_info =~ m{^/SelfService/} ) {
href="<% RT->Config->Get('WebPath') %>/SelfService/Transaction/Display.html?id=<% $Transaction->id %>" \
@@ -112,6 +112,10 @@ $EmailRecordPath => undef
<%INIT>
my $record_type = $Object->RecordType;
my $type_class = $Object->ClassifyTransaction( $Transaction );
+# this is the list of object types that support displaying individual transactions
+# only tickets for now
+my %can_display_transaction = map { $_ => 1 } qw( Ticket );
+my $can_display_transaction = $can_display_transaction{$record_type};
$m->callback(
CallbackName => 'MassageTypeClass',
commit 4c3feb48236d464f983165543dba38cce0f1ebab
Author: michel <michel at bestpractical.com>
Date: Fri Jan 24 18:51:17 2020 +0100
Add a hash of button texts to make translation easier.
"Return to ticket" in French would be "Retour au ticket", but
"Return to article" would be "Retour à l'article", the article
changes depending on the gender and first letter of the noun.
diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 74b8f8b035..2e4e360877 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -463,9 +463,12 @@ sub BuildMainNav {
my $object = $txn->Object;
if ( $object ) {
my( $object_type ) = $object->RecordType;
+ # the button_text is here to make translation support easier: "Return to $object_type" does not have a
+ # single translation in many languages
+ my %button_text = ( Ticket => loc( "Return to ticket" ) );
# This assumes that the object type can be used to describe the object (in "Back to $object_type")
# and that displaying the object is done in /$object_type/Display.html?id=<id>
- $page->child( object_type => title => loc( "Back to [_1]", loc( $object_type ) ), path => "/$object_type/Display.html?id=" . $object->Id );
+ $page->child( object_type => title => $button_text{$object_type}, path => "/$object_type/Display.html?id=" . $object->Id );
}
}
}
-----------------------------------------------------------------------
More information about the rt-commit
mailing list