Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-22002

Confluence renders attachments with long filenames with an ellipsis rather than a presenting the information to the browser and using css to limit the fieldwidth

    XMLWordPrintable

Details

    Description

      Changed from new feature to bug- Original text of description:

      We would like the ability to set attachment macro's column width. Currently "name" column is too short. It doesn't display medium-sized file names very well.
      It will be very helpful to provide a way to limit the "comment" column' width too.

      This presents a usability problem with larger filenames. We probably shorted filenames in this way in the past because of the absence of browser support for the css3 property: text-overflow.

      Most modern browsers now support this property.

      Fix

      There are 2 modules affected by this bug. The attachments macro and the view attachments page (Tools > Attachments).

      To fix the attachments macro, download the version 3.6.7 or newer from the Atlassian Marketplace.

      For most users, that fix should be sufficient and you can stop here. If, however, you also need to fix the view attachments page, you'll have to edit confluence/includes/css/attachments.css and add the following CSS code:

      #viewAttachmentsDiv table.attachments {
          border-bottom: 1px solid #ccc;
          table-layout: fixed;
      }
      
      table.attachments .filename-column {
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
      }
      
      @media screen and (min-width: 1600px) {
          table.attachments th.filesize-column {
              width: 80px;
          }
      
          table.attachments th.filedate-column {
              width: 180px;
          }
      
          table.attachments th.filecreator-column {
              width: 180px;
          }
      
          table.attachments th.comment,
          table.attachments th.labels {
              width: 200px;
          }
      
          table.attachments th.actions-column {
              width: 180px;
          }
      }
      

      You will need to delete confluence/includes/css/attachments-min.css for these changes to take effect.

      Then edit confluence/pages/includes/attachments-table.vm and change:

      <th>#sortLink("size", "${sortPathPrefixHtml}size" $action.getText('file.size'))</th>
      <th>$action.getText('creator.name')</th>
      <th>#sortLink("createddate" "${sortPathPrefixHtml}createddate" $action.getText('columnheading.creation.date'))</th>
      

      to this:

      <th class="filesize-column">#sortLink("size", "${sortPathPrefixHtml}size" $action.getText('file.size'))</th>
      <th class="filecreator-column">$action.getText('creator.name')</th>
      <th class="filedate-column">#sortLink("createddate" "${sortPathPrefixHtml}createddate" $action.getText('columnheading.creation.date'))</th>
      

      and this:

      #if ($showActions == "true")
          <th> </th>
      #end
      

      to this:

       #if ($showActions == "true")
          <th class="actions-column">&nbsp;</th>
      #end
      

      Finally (and most importantly), change this:

      $generalUtil.htmlEncode($generalUtil.shortenString($attachment.fileName, 35))
      

      to this:

      $generalUtil.htmlEncode($attachment.fileName)
      

      Attachments

        1. labels are hidden.png
          labels are hidden.png
          48 kB
        2. NotResolved.jpg
          NotResolved.jpg
          116 kB
        3. Partially_Solved.jpg
          Partially_Solved.jpg
          202 kB
        4. Partially_Solved.jpg
          Partially_Solved.jpg
          210 kB
        5. Unable to read documents....jpg
          Unable to read documents....jpg
          55 kB

        Issue Links

          Activity

            People

              nbhawnani Niraj Bhawnani
              e4a15a8c6b83 Aviaso
              Votes:
              46 Vote for this issue
              Watchers:
              44 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: