From 5b818c825838e589575056c6b22e7291fc7d4df2 Mon Sep 17 00:00:00 2001 From: Benjamin Gamard Date: Tue, 5 Feb 2019 14:14:06 +0100 Subject: [PATCH] Closes #277: display files in list --- .../document/DocumentViewContent.js | 9 ++ docs-web/src/main/webapp/src/locale/en.json | 4 +- .../partial/docs/document.view.content.html | 97 ++++++++++++++++++- docs-web/src/main/webapp/src/style/main.less | 24 +++++ 4 files changed, 132 insertions(+), 2 deletions(-) diff --git a/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentViewContent.js b/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentViewContent.js index 0caa29fa..dd8efe7c 100644 --- a/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentViewContent.js +++ b/docs-web/src/main/webapp/src/app/docs/controller/document/DocumentViewContent.js @@ -4,6 +4,15 @@ * Document view content controller. */ angular.module('docs').controller('DocumentViewContent', function ($scope, $rootScope, $stateParams, Restangular, $dialog, $state, Upload, $translate, $uibModal) { + $scope.displayMode = _.isUndefined(localStorage.fileDisplayMode) ? 'grid' : localStorage.fileDisplayMode; + + /** + * Watch for display mode change. + */ + $scope.$watch('displayMode', function (next) { + localStorage.fileDisplayMode = next; + }); + /** * Configuration for file sorting. */ diff --git a/docs-web/src/main/webapp/src/locale/en.json b/docs-web/src/main/webapp/src/locale/en.json index e9df206a..05be0817 100644 --- a/docs-web/src/main/webapp/src/locale/en.json +++ b/docs-web/src/main/webapp/src/locale/en.json @@ -120,7 +120,9 @@ "file_processing_indicator": "This file is being processed. Searching will not be available before it is complete.", "reprocess_file": "Reprocess this file", "upload_new_version": "Upload a new version", - "open_versions": "Show version history" + "open_versions": "Show version history", + "display_mode_list": "Display files in list", + "display_mode_grid": "Display files in grid" }, "workflow": { "workflow": "Workflow", diff --git a/docs-web/src/main/webapp/src/partial/docs/document.view.content.html b/docs-web/src/main/webapp/src/partial/docs/document.view.content.html index b136dc5c..d91e5795 100644 --- a/docs-web/src/main/webapp/src/partial/docs/document.view.content.html +++ b/docs-web/src/main/webapp/src/partial/docs/document.view.content.html @@ -37,12 +37,32 @@ + +
+ + + + + + +
+ +
+ +
-
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
FilenameTypeSizeVersion
+
+ +
+
+ {{ file.name }} + + {{ file.mimetype }}{{ file.size | filesize }}v{{ file.version + 1 }}.0 + +
+

{{ 'document.view.content.drop_zone' | translate }} diff --git a/docs-web/src/main/webapp/src/style/main.less b/docs-web/src/main/webapp/src/style/main.less index a9c13ce5..1949e685 100644 --- a/docs-web/src/main/webapp/src/style/main.less +++ b/docs-web/src/main/webapp/src/style/main.less @@ -239,6 +239,30 @@ ul.tag-tree { } } +// File list +.table-files { + td { + vertical-align: middle !important; + } + + .thumbnail-list { + display: inline-block; + position: relative; + width: 32px; + height: 32px; + overflow: hidden; + + img { + position: absolute; + left: 50%; + top: 50%; + height: 100%; + width: auto; + transform: translate(-50%,-50%); + } + } +} + // Permissions table .table-permissions { .label-acl {