From 68c34a9f93f257d0fc580814236299a879b0ee50 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Sat, 9 Aug 2014 13:04:14 +0200 Subject: [PATCH] Added permalink field to post view --- public_html/media/css/post-view.css | 14 +++++++++++++- public_html/media/js/post-view.js | 20 ++++++++++++++++++++ src/Views/post/post-view.phtml | 4 ++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/public_html/media/css/post-view.css b/public_html/media/css/post-view.css index 8e5649a4..adcb046a 100644 --- a/public_html/media/css/post-view.css +++ b/public_html/media/css/post-view.css @@ -102,7 +102,6 @@ embed { #sidebar .score .selected { font-weight: bold; } - #sidebar .score a:first-of-type:before { content: '['; color: black; @@ -112,6 +111,19 @@ embed { color: black; } +#sidebar .permalink { + display: inline-block; + margin: 1em 0 0 -1px; + width: 100%; + font-size: 85%; + line-height: 150%; + height: auto; + padding: 0.2em 0.5em; + cursor: text; + color: dimgray; + border: 1px solid #e0e0e0; +} + #sidebar .left a, #sidebar .right a { display: inline-block; diff --git a/public_html/media/js/post-view.js b/public_html/media/js/post-view.js index 47038816..e12a72a5 100644 --- a/public_html/media/js/post-view.js +++ b/public_html/media/js/post-view.js @@ -2,6 +2,26 @@ $(function() { function onDomUpdate() { + $('#sidebar .permalink').bindOnce('select-link', 'click', function(e) + { + e.preventDefault(); + var node = $(this)[0]; + if (document.body.createTextRange) + { + var range = document.body.createTextRange(); + range.moveToElementText(node); + range.select(); + } + else if (window.getSelection) + { + var selection = window.getSelection(); + var range = document.createRange(); + range.selectNodeContents(node); + selection.removeAllRanges(); + selection.addRange(range); + } + }); + $('#sidebar a.edit-post').bindOnce('edit-post', 'click', function(e) { e.preventDefault(); diff --git a/src/Views/post/post-view.phtml b/src/Views/post/post-view.phtml index 814d99f0..13902d03 100644 --- a/src/Views/post/post-view.phtml +++ b/src/Views/post/post-view.phtml @@ -190,6 +190,10 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0; + + + linkTo(['PostController', 'genericView'], ['identifier' => $post->getId()]) ?> +