From 0f62f70f7951af918a7a736bddc9389e0b556073 Mon Sep 17 00:00:00 2001 From: Lapo Luchini Date: Sat, 22 Nov 2014 21:04:02 +0100 Subject: [PATCH 1/2] Fix long descriptions from overflowing the area. --- pinry/static/css/pinry.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pinry/static/css/pinry.css b/pinry/static/css/pinry.css index 21d722c..8b4fae1 100644 --- a/pinry/static/css/pinry.css +++ b/pinry/static/css/pinry.css @@ -243,6 +243,8 @@ textarea { font-size: 12px; margin-bottom: 0; padding: 8px; + overflow: hidden; + text-overflow: ellipsis; } .pin strong { From 212dd7f8198ec6219c565fa74f6c3440b4a6cfec Mon Sep 17 00:00:00 2001 From: Lapo Luchini Date: Sat, 22 Nov 2014 22:15:33 +0100 Subject: [PATCH 2/2] Make links clickable and only show the domain in the text. --- pinry/static/js/helpers.js | 12 ++++++++++++ pinry/templates/includes/lightbox.html | 2 +- pinry/templates/includes/pins.html | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/pinry/static/js/helpers.js b/pinry/static/js/helpers.js index 33e95e8..9f22a4e 100644 --- a/pinry/static/js/helpers.js +++ b/pinry/static/js/helpers.js @@ -58,3 +58,15 @@ function postPinData(data) { function getUrlParameter(name) { return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null; } + +Handlebars.registerHelper('niceLinks', (function () { + var reNL = /\r?\n/g, + reURL = /https?:[/][/](?:www[.])?([^/]+)(?:[/]([.]?[^\s,.])+)?/g; + return function (text) { + var t = Handlebars.Utils.escapeExpression(text); + t = t.replace(reURL, '$1'); + t = t.replace(reNL, '
'); + return new Handlebars.SafeString(t); + }; +})()); + diff --git a/pinry/templates/includes/lightbox.html b/pinry/templates/includes/lightbox.html index 1c558c7..d903575 100644 --- a/pinry/templates/includes/lightbox.html +++ b/pinry/templates/includes/lightbox.html @@ -8,7 +8,7 @@