From aca5b6c6362c415df501f76ef170794e77522242 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 17 Jun 2016 00:06:33 +0200 Subject: file/history: Add support to display preview of entries on hover Signed-off-by: Florian Pritz --- application/controllers/file.php | 5 +++++ application/views/file/upload_history.php | 2 +- public_html/data/css/style.css | 11 +++++++++++ public_html/data/js/application.js | 11 +++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/application/controllers/file.php b/application/controllers/file.php index 79d5395ae..1f07ae4ec 100644 --- a/application/controllers/file.php +++ b/application/controllers/file.php @@ -764,6 +764,11 @@ class File extends MY_Controller { foreach($history["items"] as $key => $item) { $history["items"][$key]["filesize"] = format_bytes($item["filesize"]); + + if (isset($item['preview_text'])) { + $history["items"][$key]["preview_text"] = htmlentities($item['preview_text']); + } + if (is_cli_client()) { // Keep track of longest string to pad plaintext output correctly foreach($fields as $length_key => $value) { diff --git a/application/views/file/upload_history.php b/application/views/file/upload_history.php index 1e7ecfa62..7d46efe3a 100644 --- a/application/views/file/upload_history.php +++ b/application/views/file/upload_history.php @@ -16,7 +16,7 @@ $item): ?> ]" value="" class="delete-history"> - /"> + /" data-content=""> "> diff --git a/public_html/data/css/style.css b/public_html/data/css/style.css index f2c0542c9..4273ff896 100644 --- a/public_html/data/css/style.css +++ b/public_html/data/css/style.css @@ -296,6 +296,17 @@ body { max-width: 400px; } +#upload_history .popover { + max-width: 100%; +} + +#upload_history .popover pre { + background-color: transparent; + border: 0; + margin: 0; + line-height: 1.4; +} + .upload_thumbnails { margin: 0 auto; width: 152px; diff --git a/public_html/data/js/application.js b/public_html/data/js/application.js index 71aac8328..51b2c0c6d 100644 --- a/public_html/data/js/application.js +++ b/public_html/data/js/application.js @@ -47,6 +47,7 @@ define( Uploader.initialize(); TableSorter.initialize(); this.configureTooltips(); + this.setupHistoryPopovers(); this.setupToggleSelectAllEvent(); this.setupLineWrapToggle(); this.setupLazyLoadingImages(); @@ -68,6 +69,16 @@ define( }); }, + setupHistoryPopovers: function () { + $('#upload_history a').popover({ + trigger: 'hover', + placement: 'bottom', + html: true, + viewport: '#upload_history', + template: '' + }); + }, + setupToggleSelectAllEvent: function () { $('#history-all').on('click', function(event) { // Suppress click event on table heading -- cgit v1.2.3-24-g4f1b