[Rt-commit] rt branch, 4.4/attachments-list, created. rt-4.4.0-47-g9de4ca7

Shawn Moore shawn at bestpractical.com
Tue Feb 16 23:34:03 EST 2016


The branch, 4.4/attachments-list has been created
        at  9de4ca7675f8398d7ef78992d1817f91b8d050b1 (commit)

- Log -----------------------------------------------------------------
commit dd89c593aa4cc5f819c4ce13b9d014fd03d8c47a
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 04:11:54 2016 +0000

    Add a parameter to hide the titlebox in ShowAttachments

diff --git a/share/html/Ticket/Elements/ShowAttachments b/share/html/Ticket/Elements/ShowAttachments
index f32ac9c..bfa03d7 100644
--- a/share/html/Ticket/Elements/ShowAttachments
+++ b/share/html/Ticket/Elements/ShowAttachments
@@ -49,7 +49,8 @@
 <&| /Widgets/TitleBox, title => loc('Attachments'), 
         title_class=> 'inverse',  
         class => 'ticket-info-attachments',
-        color => "#336699" &>
+        color => "#336699",
+        hide_chrome => $HideTitleBox &>
 
 % foreach my $key (sort { lc($a) cmp lc($b) } keys %documents) {
 
@@ -95,5 +96,6 @@ while ( my $attach = $Attachments->Next() ) {
 $Ticket => undef
 $Attachments => undef
 $DisplayPath => $session{'CurrentUser'}->Privileged ? 'Ticket' : 'SelfService'
+$HideTitleBox => 0
 </%ARGS>
 
diff --git a/share/html/Widgets/TitleBox b/share/html/Widgets/TitleBox
index 822170c..7c65082 100644
--- a/share/html/Widgets/TitleBox
+++ b/share/html/Widgets/TitleBox
@@ -46,11 +46,16 @@
 %#
 %# END BPS TAGGED BLOCK }}}
 <div class="<% $class %>">
+% if ($hide_chrome) {
+  <% $content | n %>
+% } else {
   <& TitleBoxStart, %ARGS &><% $content | n %><& TitleBoxEnd &>
+% }
 </div>
 <%ARGS>
 $class => ''
 $hide_empty => 0
+$hide_chrome => 0
 </%ARGS>
 <%INIT>
 my $content = $m->content;

commit c4aed50cc67615ece9c0865afeb6687b9f77e10f
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 04:29:15 2016 +0000

    Use the existing template and stylings of attachment display for reuse
    
        The previous display was a bit harder to parse.
    
    Fixes: I#31709

diff --git a/share/html/Ticket/Elements/AddAttachments b/share/html/Ticket/Elements/AddAttachments
index 3a63c59..34798e2 100644
--- a/share/html/Ticket/Elements/AddAttachments
+++ b/share/html/Ticket/Elements/AddAttachments
@@ -163,25 +163,16 @@ jQuery( function() {
         </div>
     </td>
 </tr>
-% if (@quoted_attachments) {
+% if ($TicketObj && $TicketObj->id) {
 <tr>
   <td class="label" valign="top"><&|/l&>Include attachments</&>:</td>
   <td id="reuse-attachments">
-%     for my $attach (@quoted_attachments) {
-    <label>
-      <input type="checkbox" class="checkbox" name="AttachExisting" value="<% $attach->Id %>" \
-             <% (grep { $attach->Id == $_ } @AttachExisting) ? 'checked' : '' %> />
-      <% $attach->Filename %>
-      <% loc("[_1] ([_2]) by [_3]", $attach->CreatedAsString, $attach->FriendlyContentLength, $m->scomp('/Elements/ShowUser', User => $attach->CreatorObj)) |n %>
-    </label>
-<%perl>
-my $url = RT->System->ExternalStorageURLFor($attach) || sprintf '%s/Ticket/Attachment/%d/%d/%s',
-            RT->Config->Get('WebPath'), $attach->TransactionObj->Id, $attach->Id,
-            $m->interp->apply_escapes($attach->Filename, 'u');
-</%perl>
-      (<a href="<% $url %>" target="_blank"><&|/l&>View</&></a>)
-      <br />
-%     }
+    <& /Ticket/Elements/ShowAttachments,
+      Ticket       => $TicketObj,
+      Selectable   => 1,
+      HideTitleBox => 1,
+      Checked      => \@AttachExisting,
+    &>
   </td>
 </tr>
 % }
@@ -197,11 +188,4 @@ my $attachments;
 if ( exists $session{'Attachments'}{ $Token } && keys %{ $session{'Attachments'}{ $Token } } ) {
     $attachments = $session{'Attachments'}{ $Token };
 }
-
-my @quoted_attachments;
-if ($TicketObj and $TicketObj->id) {
-    @quoted_attachments = sort { lc($a->Filename) cmp lc($b->Filename) }
-                          grep { defined $_->Filename and length $_->Filename }
-                            @{$TicketObj->Attachments->ItemsArrayRef};
-}
 </%INIT>
diff --git a/share/html/Ticket/Elements/ShowAttachments b/share/html/Ticket/Elements/ShowAttachments
index bfa03d7..2a49c91 100644
--- a/share/html/Ticket/Elements/ShowAttachments
+++ b/share/html/Ticket/Elements/ShowAttachments
@@ -55,10 +55,17 @@
 % foreach my $key (sort { lc($a) cmp lc($b) } keys %documents) {
 
 <%$key%><br />
-<ul>
+<ul <% $Selectable ? 'class="selectable"' : '' |n %> >
 % foreach my $rev (@{$documents{$key}}) {
 % if ($rev->ContentLength) {
 <li><font size="-2">
+
+% if ($Selectable) {
+    <label>
+    <input type="checkbox" class="checkbox" name="AttachExisting" value="<% $rev->Id %>" \
+             <% $is_checked{$rev->Id} ? 'checked' : '' %> />
+% }
+
 % if (my $url = RT->System->ExternalStorageURLFor($rev)) {
 <a href="<%$url%>">
 % } else {
@@ -67,6 +74,11 @@
 % my $desc = loc("[_1] ([_2]) by [_3]", $rev->CreatedAsString, $rev->FriendlyContentLength, $m->scomp('/Elements/ShowUser', User => $rev->CreatorObj));
 <% $desc |n%>
 </a>
+
+% if ($Selectable) {
+    </label>
+% }
+
 </font></li>
 % }
 % }
@@ -91,11 +103,14 @@ while ( my $attach = $Attachments->Next() ) {
    unshift( @{ $documents{ $attach->Filename } }, $attach );
 }
 
+my %is_checked = map { $_ => 1 } @Checked;
 </%INIT>
 <%ARGS>
 $Ticket => undef
 $Attachments => undef
 $DisplayPath => $session{'CurrentUser'}->Privileged ? 'Ticket' : 'SelfService'
 $HideTitleBox => 0
+$Selectable => 0
+ at Checked => ()
 </%ARGS>
 
diff --git a/share/static/css/base/forms.css b/share/static/css/base/forms.css
index 9f57331..a03be9b 100644
--- a/share/static/css/base/forms.css
+++ b/share/static/css/base/forms.css
@@ -251,6 +251,19 @@ form div.submit div.buttons div.next {
     display: none;
 }
 
+ul.selectable {
+    list-style-type: none;
+}
+
+ul.selectable input[type=checkbox],
+ul.selectable a {
+    vertical-align: bottom;
+}
+
+#reuse-attachments {
+    padding-top: 0.25em;
+}
+
 /* query builder */
 
 #formatbuttons {

commit 9de4ca7675f8398d7ef78992d1817f91b8d050b1
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 04:33:32 2016 +0000

    Replace explicit <font> tag with CSS

diff --git a/share/html/Ticket/Elements/ShowAttachments b/share/html/Ticket/Elements/ShowAttachments
index 2a49c91..d9432b7 100644
--- a/share/html/Ticket/Elements/ShowAttachments
+++ b/share/html/Ticket/Elements/ShowAttachments
@@ -58,7 +58,7 @@
 <ul <% $Selectable ? 'class="selectable"' : '' |n %> >
 % foreach my $rev (@{$documents{$key}}) {
 % if ($rev->ContentLength) {
-<li><font size="-2">
+<li>
 
 % if ($Selectable) {
     <label>
@@ -79,7 +79,7 @@
     </label>
 % }
 
-</font></li>
+</li>
 % }
 % }
 </ul>
diff --git a/share/static/css/base/forms.css b/share/static/css/base/forms.css
index a03be9b..2584ee0 100644
--- a/share/static/css/base/forms.css
+++ b/share/static/css/base/forms.css
@@ -264,6 +264,10 @@ ul.selectable a {
     padding-top: 0.25em;
 }
 
+.ticket-info-attachments ul li {
+    font-size: .8em;
+}
+
 /* query builder */
 
 #formatbuttons {

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


More information about the rt-commit mailing list