[Notice] Announcing the End of Demo Server [Read me]
doortts doortts 2017-01-12
my-files: Show link of attachments belongs
@6fca5f0ac5447958683fac0ce16d627f105446e2
app/assets/stylesheets/less/_page.less
--- app/assets/stylesheets/less/_page.less
+++ app/assets/stylesheets/less/_page.less
@@ -6554,7 +6554,7 @@
             margin-left: auto;
             img {
                 border: 1px solid #333;
-                max-width: 140px;
+                max-width: 70px;
                 box-sizing: border-box;
             }
         }
@@ -6576,7 +6576,10 @@
         }
 
         .file-location {
-            text-align: center;
+            text-align: left;
+            overflow: hidden;
+            text-overflow: ellipsis;
+            white-space: nowrap;
         }
     }
     .hover {
app/assets/stylesheets/less/_reponsive.less
--- app/assets/stylesheets/less/_reponsive.less
+++ app/assets/stylesheets/less/_reponsive.less
@@ -398,6 +398,7 @@
 
 @media all and (max-width:1199px){
     .attachment-files {
+        font-size: 12px;
         .attachment-files-header {
             .header-file-name {
                 max-width: 200px;
@@ -414,6 +415,10 @@
             }
             .file-size {
                 max-width: 80px;
+                font-size: 12px;
+            }
+            .file-location {
+                font-size: 12px;
             }
         }
     }
app/utils/RouteUtil.java
--- app/utils/RouteUtil.java
+++ app/utils/RouteUtil.java
@@ -38,8 +38,10 @@
     public static final DiffRenderer$ diffRenderer = new DiffRenderer$();
 
     public static String getUrl(ResourceType resourceType, String resourceId) {
-        Long longId = Long.valueOf(resourceId);
+        return getUrl(resourceType, Long.valueOf(resourceId));
+    }
 
+    public static String getUrl(ResourceType resourceType, Long longId) {
         try {
             switch(resourceType) {
                 case ISSUE_POST:
app/views/user/userFiles.scala.html
--- app/views/user/userFiles.scala.html
+++ app/views/user/userFiles.scala.html
@@ -9,6 +9,7 @@
 
 @import utils.JodaDateUtil._
 @import utils.FileUtil._
+@import utils.RouteUtil._
 
 @preview(attachment: Attachment) = @{
     var previewFile = ""
@@ -16,6 +17,15 @@
         previewFile = "<img src='" + routes.AttachmentApp.getFile(attachment.id).toString + "'>";
     }
     Html(previewFile)
+}
+
+@link(attachment: Attachment) = @{
+    val url = getUrl(attachment.containerType, attachment.containerId)
+    if(url != null){
+        Html("<a href='" + url + "' target='_blank'>" + url + "</a>")
+    } else {
+        ""
+    }
 }
 
 @siteLayout(utils.Config.getSiteName, SITE_HOME) {
@@ -34,21 +44,21 @@
             </form>
             <div class="attachment-files">
                 <div class="attachment-files-header row">
-                    <div class="span2 header-preview">Preview</div>
+                    <div class="span1 header-preview">Preview</div>
                     <div class="span4 header-file-name">Filename</div>
                     <div class="span2 header-size">Size</div>
-                    <div class="span2">Download</div>
+                    <div class="span1">Download</div>
                     <div class="span2 file-date">Date</div>
-                    <div class="span1 header-location">Location</div>
+                    <div class="span4 header-location">Location</div>
                 </div>
                 @for(attachment <- currentPage.getList){
                     <div class="attachment-file-detail row">
-                        <div class="file-preview span2"><a href="@routes.AttachmentApp.getFile(attachment.id)" target="_blank">@preview(attachment)</a></div>
+                        <div class="file-preview span1"><a href="@routes.AttachmentApp.getFile(attachment.id)" target="_blank">@preview(attachment)</a></div>
                         <div class="span4 file-name"><a href="@routes.AttachmentApp.getFile(attachment.id)" target="_blank"><i class="icon text-icon"></i>@attachment.name</a></div>
                         <div class="span2 file-size">@humanReadableByteCount(attachment.size, true)</div>
-                        <div class="span2 file-download"><a href="@routes.AttachmentApp.getFile(attachment.id)?action=download"><button type="button" class="ybtn"><i class="yobicon-cloud-download"></i></button> </a></div>
+                        <div class="span1 file-download"><a href="@routes.AttachmentApp.getFile(attachment.id)?action=download"><button type="button" class="ybtn"><i class="yobicon-cloud-download"></i></button> </a></div>
                         <div class="span2 file-date">@socialDate(attachment.createdDate)</div>
-                        <div class="span1 file-location">location</div>
+                        <div class="span4 file-location">@link(attachment)</div>
                     </div>
                 }
             </div>
Add a comment
List