Added permalink field to post view

This commit is contained in:
Marcin Kurczewski 2014-08-09 13:04:14 +02:00
parent f52e97e08a
commit 68c34a9f93
3 changed files with 37 additions and 1 deletions

View file

@ -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;

View file

@ -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();

View file

@ -190,6 +190,10 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
<?php endif ?>
</span>
</div>
<span class="permalink" title="Permalink">
<?= Core::getRouter()->linkTo(['PostController', 'genericView'], ['identifier' => $post->getId()]) ?>
</span>
</div>
<div class="unit hl-options">