From 67dc6e60f3e49ce1780b4bfccd57e62ccdc3902f Mon Sep 17 00:00:00 2001 From: Asaad Mahmood Date: Fri, 14 Aug 2015 19:36:58 +0500 Subject: mm-1858 - Truncating and adding tooltips to file names in thumbnail details --- web/react/components/file_attachment.jsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'web/react') diff --git a/web/react/components/file_attachment.jsx b/web/react/components/file_attachment.jsx index b7ea5734f..de9e2a04b 100644 --- a/web/react/components/file_attachment.jsx +++ b/web/react/components/file_attachment.jsx @@ -113,6 +113,14 @@ module.exports = React.createClass({ fileSizeString = utils.fileSizeToString(this.state.fileSize); } + var filenameString = decodeURIComponent(utils.getFileName(filename)); + if(filenameString.length > 35){ + trimmedFilename = filenameString.substring(0, Math.min(35,filenameString.length)) + "..."; + } + else { + trimmedFilename = decodeURIComponent(utils.getFileName(filename));; + } + return (
-
{decodeURIComponent(utils.getFileName(filename))}
+
{trimmedFilename}
{fileInfo.ext.toUpperCase()} {fileSizeString} -- cgit v1.2.3-1-g7c22 From 9a4a1c5f96c95cb79cfd4ba6f88e47404e8d9b5d Mon Sep 17 00:00:00 2001 From: Asaad Mahmood Date: Fri, 14 Aug 2015 19:38:01 +0500 Subject: Initialising trimmedFilename variable --- web/react/components/file_attachment.jsx | 1 + 1 file changed, 1 insertion(+) (limited to 'web/react') diff --git a/web/react/components/file_attachment.jsx b/web/react/components/file_attachment.jsx index de9e2a04b..5eba3a14e 100644 --- a/web/react/components/file_attachment.jsx +++ b/web/react/components/file_attachment.jsx @@ -114,6 +114,7 @@ module.exports = React.createClass({ } var filenameString = decodeURIComponent(utils.getFileName(filename)); + var trimmedFilename; if(filenameString.length > 35){ trimmedFilename = filenameString.substring(0, Math.min(35,filenameString.length)) + "..."; } -- cgit v1.2.3-1-g7c22 From 8f9f4810a51785dd9d5b4c30fcec8407072fe8ea Mon Sep 17 00:00:00 2001 From: Asaad Mahmood Date: Sat, 15 Aug 2015 01:17:26 +0500 Subject: Using variables efficiently --- web/react/components/file_attachment.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'web/react') diff --git a/web/react/components/file_attachment.jsx b/web/react/components/file_attachment.jsx index 5eba3a14e..a7da5218a 100644 --- a/web/react/components/file_attachment.jsx +++ b/web/react/components/file_attachment.jsx @@ -115,11 +115,11 @@ module.exports = React.createClass({ var filenameString = decodeURIComponent(utils.getFileName(filename)); var trimmedFilename; - if(filenameString.length > 35){ + if (filenameString.length > 35) { trimmedFilename = filenameString.substring(0, Math.min(35,filenameString.length)) + "..."; } else { - trimmedFilename = decodeURIComponent(utils.getFileName(filename));; + trimmedFilename = filenameString; } return ( @@ -129,7 +129,7 @@ module.exports = React.createClass({ {thumbnail}
-
{trimmedFilename}
+
{trimmedFilename}
{fileInfo.ext.toUpperCase()} {fileSizeString} -- cgit v1.2.3-1-g7c22 From 5f068109a7581fb069a446b9a2680fb1c24513a9 Mon Sep 17 00:00:00 2001 From: Asaad Mahmood Date: Sat, 15 Aug 2015 01:30:20 +0500 Subject: Fixing style guide issues --- web/react/components/file_attachment.jsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'web/react') diff --git a/web/react/components/file_attachment.jsx b/web/react/components/file_attachment.jsx index a7da5218a..c36c908d2 100644 --- a/web/react/components/file_attachment.jsx +++ b/web/react/components/file_attachment.jsx @@ -116,9 +116,8 @@ module.exports = React.createClass({ var filenameString = decodeURIComponent(utils.getFileName(filename)); var trimmedFilename; if (filenameString.length > 35) { - trimmedFilename = filenameString.substring(0, Math.min(35,filenameString.length)) + "..."; - } - else { + trimmedFilename = filenameString.substring(0, Math.min(35, filenameString.length)) + "..."; + } else { trimmedFilename = filenameString; } -- cgit v1.2.3-1-g7c22