[Rt-commit] rt branch, 4.4/toggle-unset-fields, repushed
Shawn Moore
shawn at bestpractical.com
Mon May 2 15:34:31 EDT 2016
The branch 4.4/toggle-unset-fields was deleted and repushed:
was e552469f241fc62c1943c59e4adf8f305022c112
now 2f9d771b186a04c203813bfa2a1a940b79f7b4c7
1: 31e5560 ! 1: 3b0f4ba Use CSS, rather than excluding HTML elements, for "hide unset fields"
@@ -33,7 +33,7 @@
% for my $type (@display) {
-% if ( !RT->Config->Get('HideUnsetFieldsOnDisplay', $session{CurrentUser}) || $clone{$type} || $Object->$type->Count ) {
- <tr>
-+ <tr<% $clone{$type} || $Object->$type->Count ? q{} : q{ class="unset-field"}|n%>>
++ <tr class="<%$type%><% $clone{$type} || $Object->$type->Count ? q{} : q{ unset-field}%>">
<td class="labeltop">
<& ShowRelationLabel, Object => $Object, Label => $labels{$type}.':', Relation => $type &>
% if ($clone{$type}) {
@@ -77,7 +77,7 @@
% $m->callback( %ARGS, CallbackName => 'AfterCreated', TicketObj => $Ticket );
-% if ( !$hide_unset_fields || $Ticket->StartsObj->Unix ) {
- <tr class="date starts">
-+ <tr class="date starts<% $Ticket->StartsObj->Unix ? q{} : q{ unset-field} |n%>">
++ <tr class="date starts<% $Ticket->StartsObj->Unix ? q{} : q{ unset-field}%>">
<td class="label"><&|/l&>Starts</&>:</td>\
<td class="value"><% $Ticket->StartsObj->AsString %></td>
</tr>
@@ -85,7 +85,7 @@
-% }
-% if ( !$hide_unset_fields || $Ticket->StartedObj->Unix ) {
- <tr class="date started">
-+ <tr class="date started<% $Ticket->StartedObj->Unix ? q{} : q{ unset-field} |n%>">
++ <tr class="date started<% $Ticket->StartedObj->Unix ? q{} : q{ unset-field}%>">
<td class="label"><&|/l&>Started</&>:</td>\
<td class="value"><% $Ticket->StartedObj->AsString %></td>
</tr>
@@ -93,7 +93,7 @@
-% }
-% if ( !$hide_unset_fields || $Ticket->ToldObj->Unix || $Ticket->CurrentUserHasRight('ModifyTicket') ) {
- <tr class="date told">
-+ <tr class="date told<% $Ticket->ToldObj->Unix || $Ticket->CurrentUserHasRight('ModifyTicket') ? q{} : q{ unset-field} |n%>">
++ <tr class="date told<% $Ticket->ToldObj->Unix || $Ticket->CurrentUserHasRight('ModifyTicket') ? q{} : q{ unset-field}%>">
<td class="label">
% if ( $Ticket->CurrentUserHasRight('ModifyTicket' ) ) {
<a href="<% RT->Config->Get('WebPath') %>/Ticket/Display.html?id=<% $Ticket->id %>&Action=SetTold"><&|/l&>Last Contact</&></a>:
@@ -105,7 +105,7 @@
-% if ( !$hide_unset_fields || $Ticket->DueObj->Unix ) {
- <tr class="date due">
-+ <tr class="date due<% $Ticket->DueObj->Unix ? q{} : q{ unset-field} |n%>">
++ <tr class="date due<% $Ticket->DueObj->Unix ? q{} : q{ unset-field}%>">
<td class="label"><&|/l&>Due</&>:</td>\
% my $due = $Ticket->DueObj;
-% if ( !$hide_unset_fields || $due && $due->IsSet && $due->Diff < 0 && $Ticket->QueueObj->IsActiveStatus($Ticket->Status) ) {
@@ -120,7 +120,7 @@
-% if ( !$hide_unset_fields || $Ticket->ResolvedObj->Unix ) {
- <tr class="date resolved">
-+ <tr class="date resolved<% $Ticket->ResolvedObj->Unix ? q{} : q{ unset-field} |n%>">
++ <tr class="date resolved<% $Ticket->ResolvedObj->Unix ? q{} : q{ unset-field}%>">
<td class="label"><&|/l&>Closed</&>:</td>\
<td class="value"><% $Ticket->ResolvedObj->AsString %></td>
</tr>
@@ -143,19 +143,33 @@
--- a/share/html/Ticket/Elements/ShowPeople
+++ b/share/html/Ticket/Elements/ShowPeople
@@
+ %#
+ %# END BPS TAGGED BLOCK }}}
+ <table>
+- <tr>
++ <tr class="owner">
+ <td class="label"><&|/l&>Owner</&>:</td>
+ % my $owner = $Ticket->OwnerObj;
+ <td class="value"><& /Elements/ShowUser, User => $owner, Ticket => $Ticket &>
+@@
+ </tr>
+ % }
+
+- <tr>
++ <tr class="requestors">
<td class="labeltop"><&|/l&>Requestors</&>:</td>
<td class="value"><& ShowGroupMembers, Group => $Ticket->Requestors, Ticket => $Ticket &></td>
</tr>
-% if ( !$hide_unset_fields || $Ticket->Cc->MembersObj->Count ) {
- <tr>
-+ <tr<% $Ticket->Cc->MembersObj->Count ? q{} : q{ class="unset-field"} |n%>>
++ <tr class="cc<% $Ticket->Cc->MembersObj->Count ? q{} : q{ unset-field}%>">
<td class="labeltop"><&|/l&>Cc</&>:</td>
<td class="value"><& ShowGroupMembers, Group => $Ticket->Cc, Ticket => $Ticket &></td>
</tr>
-% }
-% if ( !$hide_unset_fields || $Ticket->AdminCc->MembersObj->Count ) {
- <tr>
-+ <tr<% $Ticket->AdminCc->MembersObj->Count ? q{} : q{ class="unset-field"} |n%>>
++ <tr class="admincc<% $Ticket->AdminCc->MembersObj->Count ? q{} : q{ unset-field}%>">
<td class="labeltop"><&|/l&>AdminCc</&>:</td>
<td class="value"><& ShowGroupMembers, Group => $Ticket->AdminCc, Ticket => $Ticket &></td>
</tr>
@@ -188,3 +202,82 @@
/* textareas get to be bigger when we're in a table */
tr.edit-custom-field.cftype-Text textarea,
+diff --git a/t/web/ticket_display_unset_fields.t b/t/web/ticket_display_unset_fields.t
+--- a/t/web/ticket_display_unset_fields.t
++++ b/t/web/ticket_display_unset_fields.t
+@@
+
+ use RT::Test tests => undef, config => 'Set( $HideUnsetFieldsOnDisplay, 1 );';
+
+-my @link_labels = (
+- 'Depends on',
+- 'Depended on by',
+- 'Parents',
+- 'Children',
+- 'Refers to',
+- 'Referred to by',
++my @link_classes = qw(
++ DependsOn
++ DependedOnBy
++ MemberOf
++ Members
++ RefersTo
++ ReferredToBy
+ );
+
+ my $foo = RT::Test->create_ticket(
+@@
+ $m->login;
+ $m->goto_ticket( $foo->id );
+
+- for my $label (qw/Starts Started Closed Cc AdminCc/) {
+- $m->content_lacks( "$label:", "lacks $label as value is unset" );
++ my $dom = $m->dom;
++
++ for my $class (qw/starts started due resolved cc admincc/) {
++ is $dom->find(qq{tr.$class.unset-field})->size, 1, "found unset $class";
+ }
+
+- # there is one Due: in reminder
+- $m->content_unlike( qr/Due:.*Due:/s, "lacks Due as value is unset" );
++ is $dom->find(qq{tr.told:not(.unset-field)})->size, 1, "has Told as root can modify it";
+
+- $m->content_contains( "Last Contact", "has Told as root can set it" );
+- for my $label (@link_labels) {
+- $m->content_contains( "$label:", "has $label as root can create" );
++ for my $class (@link_classes) {
++ is $dom->find(qq{tr.$class:not(.unset-field)})->size, 1, "has $class as root can create";
+ }
+
+ $m->goto_ticket( $bar->id );
+- for my $label (qw/Starts Started Closed Cc AdminCc/) {
+- $m->content_contains( "$label:", "has $label as value is set" );
++ $dom = $m->dom;
++ for my $class (qw/starts started due resolved cc admincc/) {
++ is $dom->find(qq{tr.$class:not(.unset-field)})->size, 1, "has $class as value is set";
+ }
+- $m->content_like( qr/Due:.*Due:/s, "has Due as value is set" );
+ }
+
+ diag "test without ModifyTicket right";
+@@
+ RT::Test->set_rights( Principal => $user, Right => ['ShowTicket'] );
+ $m->login( 'foo', 'password', logout => 1 );
+ $m->goto_ticket( $foo->id );
+- $m->content_lacks( "Last Contact", "lacks Told as it is unset" );
+- for my $label ( @link_labels ) {
+- $m->content_lacks( "$label:", "lacks $label as it is unset" );
++ my $dom = $m->dom;
++ is $dom->find(qq{tr.told.unset-field})->size, 1, "lacks Told as it is unset and user has no modify right";
++ for my $class ( @link_classes ) {
++ is $dom->find(qq{tr.$class.unset-field})->size, 1, "lacks $class as it is unset and user has no modify right";
+ }
+
+ $m->goto_ticket( $bar->id );
+- $m->content_contains( "Depends on:", "has Depends on as it is set" );
++ $dom = $m->dom;
++ is $dom->find(qq{tr.DependsOn:not(.unset-field)})->size, 1, "has Depends on as it is set";
+ }
+
+ undef $m;
+
2: 76550c7 = 2: d701511 Allow user to toggle "hide unset fields" with a click
3: 4fe1164 = 3: 0c111cc Allow hide/show unset fields link to function without JS
4: e552469 = 4: 2f9d771 Use data-* attributes rather than JavaScript function parameters
More information about the rt-commit
mailing list