diff --git a/public_html/media/css/post-view.css b/public_html/media/css/post-view.css index b449efe0..bd25ce7c 100644 --- a/public_html/media/css/post-view.css +++ b/public_html/media/css/post-view.css @@ -165,9 +165,28 @@ i.icon-fav { margin: 2px; } +#inner-content { + position: relative; +} .unit.edit-post { + position: absolute; + margin-top: 0; + padding: 1em; + background: rgba(255, 255, 255, 0.8); + box-shadow: 0 0 1em 1em rgba(255, 255, 255, 0.8); + z-index: 99; + top: 0; + left: 0; + right: 0; display: none; } +.unit.edit-post ul.tagit, +.unit.edit-post input:not([type=file]) { + background: rgba(255, 255, 255, 0.75); +} +.unit.edit-post ul.tagit input { + background: transparent; +} ul.tagit { display: block; vertical-align: middle; diff --git a/public_html/media/js/post-view.js b/public_html/media/js/post-view.js index f6c9ce3d..4ce03465 100644 --- a/public_html/media/js/post-view.js +++ b/public_html/media/js/post-view.js @@ -12,7 +12,6 @@ $(function() aDom.addClass('inactive'); var formDom = $('form.edit-post'); - formDom.data('original-data', formDom.serialize()); if (formDom.find('.tagit').length == 0) { $.getJSON('/tags?json', {filter: 'order:popularity,desc'}, function(data) @@ -36,16 +35,41 @@ $(function() else aDom.removeClass('inactive'); + var editUnit = formDom.parents('.unit'); + var postUnit = $('.post-wrapper'); if (!$(formDom).is(':visible')) { - formDom.parents('.unit') - .show().css('height', formDom.height()).hide() - .slideDown(function() + formDom.data('original-data', formDom.serialize()); + + editUnit.show(); + var editUnitHeight = formDom.height(); + editUnit.css('height', editUnitHeight); + editUnit.hide(); + + if (postUnit.height() < editUnitHeight) + postUnit.animate({height: editUnitHeight + 'px'}, 'fast'); + + editUnit.slideDown('fast', function() { $(this).css('height', 'auto'); }); } - $('html, body').animate({ scrollTop: $(formDom).offset().top + 'px' }, 'fast'); + else + { + editUnit.slideUp('fast'); + + var postUnitOldHeight = postUnit.height(); + postUnit.height('auto'); + var postUnitHeight = postUnit.height(); + postUnit.height(postUnitOldHeight); + if (postUnitHeight != postUnitOldHeight) + postUnit.animate({height: postUnitHeight + 'px'}); + + if ($('.post-wrapper').height() < editUnitHeight) + $('.post-wrapper').animate({height: editUnitHeight + 'px'}); + return; + } + formDom.find('input[type=text]:visible:eq(0)').focus(); }); diff --git a/src/Views/post-view.phtml b/src/Views/post-view.phtml index d3348248..86de76c3 100644 --- a/src/Views/post-view.phtml +++ b/src/Views/post-view.phtml @@ -309,16 +309,16 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0;
-
- renderFile('post-file-render') ?> -
-
renderFile('post-edit') ?>
+
+ renderFile('post-file-render') ?> +
+