From 34c76c735a07c3644c50e5b9e0017b8d8c3fdb46 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Tue, 17 Dec 2019 10:08:52 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B0330=20Attachments=20display=20as=20table?= =?UTF-8?q?=20:=20portal.=20Various=20improvements=20*=20update=20CSS=20fo?= =?UTF-8?q?r=20table=20layout=20(vertical=20align,=20change=20text-align)?= =?UTF-8?q?=20*=20tooltip=20:=20fix=20max=20size=20was=20not=20used=20anym?= =?UTF-8?q?ore=20(tooltip=20was=20removing=20the=20style=20attributes)=20*?= =?UTF-8?q?=20tooltip=20:=20fix=20tooltip=20always=20available=20*=20delet?= =?UTF-8?q?e=20button=20background=20color=20set=20to=20same=20as=20valida?= =?UTF-8?q?te=20button=20*=20remove=20"type"=20column=20*=20reduce=20attac?= =?UTF-8?q?hment=20line=20height?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../portal/public/css/portal.css | 17 +++++++++++--- .../portal/public/css/portal.scss | 22 ++++++++++++++---- .../bsfileuploadfieldrenderer.class.inc.php | 23 +++++++------------ 3 files changed, 40 insertions(+), 22 deletions(-) diff --git a/datamodels/2.x/itop-portal-base/portal/public/css/portal.css b/datamodels/2.x/itop-portal-base/portal/public/css/portal.css index e53e325ae..c70e744c6 100644 --- a/datamodels/2.x/itop-portal-base/portal/public/css/portal.css +++ b/datamodels/2.x/itop-portal-base/portal/public/css/portal.css @@ -1115,11 +1115,14 @@ table .group-actions { text-align: center; } .attachments_container .attachmentsList tbody > tr > td { + text-align: left; + vertical-align: middle; +} +.attachments_container .attachmentsList tbody > tr > td:first-child { text-align: center; } .attachments_container .attachment { - height: 95px; - overflow-x: hidden; + height: 4em; } .attachments_container .attachment .attachment_name { overflow-x: hidden; @@ -1129,9 +1132,17 @@ table .group-actions { .attachments_container .attachment .btn { margin-top: 3px; } -.attachments_container .attachmenthover { +.attachments_container .attachment:hover { background-color: #e0e0e0; } +.attachment-tooltip { + width: 350px; + height: 300px; +} +.attachment-tooltip img { + max-width: 100%; + max-height: 100%; +} .upload_container input { display: inline; } diff --git a/datamodels/2.x/itop-portal-base/portal/public/css/portal.scss b/datamodels/2.x/itop-portal-base/portal/public/css/portal.scss index 2df2907ec..96cedd656 100644 --- a/datamodels/2.x/itop-portal-base/portal/public/css/portal.scss +++ b/datamodels/2.x/itop-portal-base/portal/public/css/portal.scss @@ -1201,13 +1201,17 @@ table .group-actions .item-action-wrapper .panel-body > p:last-child{ } & tbody > tr > td { - text-align: center; + text-align: left; + vertical-align: middle; + + &:first-child { + text-align: center; + } } } .attachment { - height: 95px; - overflow-x: hidden; + height: 4em; .attachment_name { overflow-x: hidden; @@ -1219,11 +1223,21 @@ table .group-actions .item-action-wrapper .panel-body > p:last-child{ margin-top: 3px; } - &hover { + &:hover { background-color: #e0e0e0; } } } +.attachment-tooltip { + width: 350px; + height: 300px; + + img { + max-width: 100%; + max-height: 100%; + } +} + .upload_container input{ display: inline; } diff --git a/sources/renderer/bootstrap/fieldrenderer/bsfileuploadfieldrenderer.class.inc.php b/sources/renderer/bootstrap/fieldrenderer/bsfileuploadfieldrenderer.class.inc.php index c8c55bd39..a33f9231c 100644 --- a/sources/renderer/bootstrap/fieldrenderer/bsfileuploadfieldrenderer.class.inc.php +++ b/sources/renderer/bootstrap/fieldrenderer/bsfileuploadfieldrenderer.class.inc.php @@ -105,7 +105,6 @@ class BsFileUploadFieldRenderer extends BsFieldRenderer '{{sFileSize}}', '{{sAttachmentDate}}', '{{sAttachmentCreator}}', - '{{sFileType}}', $bIsDeleteAllowed )); $oOutput->AddJs( @@ -131,7 +130,7 @@ class BsFileUploadFieldRenderer extends BsFieldRenderer { var iAttId = data.result.att_id, sDownloadLink = '{$this->oField->GetDownloadEndpoint()}'.replace(/-sAttachmentId-/, iAttId), - sIconClass = (data.result.preview == 'true') ? ' preview' : '', + sIconClass = (data.result.preview == 'true') ? 'trigger-preview' : '', sAttachmentMeta = ''; var replaces = [ @@ -145,7 +144,6 @@ class BsFileUploadFieldRenderer extends BsFieldRenderer {search: "{{sFileSize}}", replace:data.result.file_size }, {search: "{{sAttachmentDate}}", replace:data.result.creation_date }, {search: "{{sAttachmentCreator}}", replace:data.result.contact_id_friendlyname }, - {search: "{{sFileType}}", replace:data.result.file_type } ]; var sAttachmentRow = attachmentRowTemplate; $.each(replaces, function(indexInArray, value ) { @@ -160,7 +158,7 @@ class BsFileUploadFieldRenderer extends BsFieldRenderer container: 'body', html: true, title: function(){ - return '
'; + return '
'; } }); } @@ -209,7 +207,7 @@ class BsFileUploadFieldRenderer extends BsFieldRenderer $(oElem).parent().tooltip({ container: 'body', html: true, - title: function(){ return '
'; } + title: function(){ return '
'; } }); }); // Remove button handler @@ -307,7 +305,6 @@ JS $sTitleFileSize $sTitleFileDate $sTitleFileCreator - $sTitleFileType @@ -333,7 +330,7 @@ HTML $sIconClass = ''; if ($oDoc->IsPreviewAvailable()) { - $sIconClass = ' preview'; + $sIconClass = 'trigger-preview'; if ($oDoc->GetSize() <= AbstractAttachmentsRenderer::MAX_SIZE_FOR_PREVIEW) { $sAttachmentThumbUrl = $sDocDownloadUrl; @@ -341,7 +338,6 @@ HTML } $sFileSize = $oDoc->GetFormattedSize(); - $sFileType = $oDoc->GetMimeType(); $bIsTempAttachment = ($oAttachment->Get('item_id') === 0); $sAttachmentDate = ''; @@ -363,7 +359,6 @@ HTML $sFileSize, $sAttachmentDate, $sAttachmentCreator, - $sFileType, $bIsDeleteAllowed )); } @@ -387,30 +382,28 @@ HTML * @param $sFileSize * @param $sAttachmentDate * @param $sAttachmentCreator - * @param $sFileType * @param $bIsDeleteAllowed * * @return string */ protected static function GetAttachmentTableRow( $iAttId, $sLineStyle, $sDocDownloadUrl, $sIconClass, $sAttachmentThumbUrl, $sFileName, $sAttachmentMeta, $sFileSize, - $sAttachmentDate, $sAttachmentCreator, $sFileType, $bIsDeleteAllowed + $sAttachmentDate, $sAttachmentCreator, $bIsDeleteAllowed ) { $sDeleteButton = ''; if ($bIsDeleteAllowed) { $sDeleteBtnLabel = Dict::S('Portal:Button:Delete'); - $sDeleteButton = ''; + $sDeleteButton = ''; } return << - - $sFileName$sAttachmentMeta + + $sFileName$sAttachmentMeta $sFileSize $sAttachmentDate $sAttachmentCreator - $sFileType $sDeleteButton HTML;