From b4db90bcdc37ccc53be9168a2cc7b379bb18df79 Mon Sep 17 00:00:00 2001 From: rr- Date: Sun, 19 Jul 2015 19:31:19 +0200 Subject: [PATCH] Hidden most edit controls by default This reduces form size in half, which should improve editing experience. --- public_html/css/post.css | 3 +++ .../js/Presenters/PostEditPresenter.js | 21 ++++++++++++++++++- public_html/templates/post-edit.tpl | 17 ++++++++++----- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/public_html/css/post.css b/public_html/css/post.css index a7743940..17fb8779 100644 --- a/public_html/css/post.css +++ b/public_html/css/post.css @@ -166,6 +166,9 @@ z-index: -1; } +#post-edit-target .advanced-trigger .form-input { + overflow: auto; /* fix browser's outline around the link being cut due to overflow: hidden; */ +} #post-edit-target .file-handler { margin: 0.5em 0; } diff --git a/public_html/js/Presenters/PostEditPresenter.js b/public_html/js/Presenters/PostEditPresenter.js index 92b73624..7acf32c5 100644 --- a/public_html/js/Presenters/PostEditPresenter.js +++ b/public_html/js/Presenters/PostEditPresenter.js @@ -47,7 +47,20 @@ App.Presenters.PostEditPresenter = function( } function render() { - $target.html(templates.postEdit({post: post, privileges: privileges})); + var $template = jQuery(templates.postEdit({post: post, privileges: privileges})); + + var $advanced = $template.find('.advanced'); + var $advancedTrigger = $template.find('.advanced-trigger'); + $advanced.hide(); + if (!$advanced.length) { + $advancedTrigger.hide(); + } else { + $advancedTrigger.find('a').click(function(e) { + advancedTriggerClicked(e, $advanced, $advancedTrigger); + }); + } + + $target.html($template); postContentFileDropper = new App.Controls.FileDropper($target.find('form [name=content]')); postContentFileDropper.onChange = postContentChanged; @@ -64,6 +77,12 @@ App.Presenters.PostEditPresenter = function( $target.find('form').submit(editFormSubmitted); } + function advancedTriggerClicked(e, $advanced, $advancedTrigger) { + $advancedTrigger.hide(); + $advanced.show(); + e.preventDefault(); + } + function focus() { if (tagInput) { tagInput.focus(); diff --git a/public_html/templates/post-edit.tpl b/public_html/templates/post-edit.tpl index 79bac1a5..6e3ad4c7 100644 --- a/public_html/templates/post-edit.tpl +++ b/public_html/templates/post-edit.tpl @@ -30,8 +30,15 @@ <% } %> +
+ + +
+ <% if (privileges.canChangeSource) { %> -
+
@@ -40,7 +47,7 @@ <% } %> <% if (privileges.canChangeRelations) { %> -
+
@@ -49,7 +56,7 @@ <% } %> <% if (privileges.canChangeFlags && post.contentType === 'video') { %> -
+
/> @@ -61,7 +68,7 @@ <% } %> <% if (privileges.canChangeContent) { %> -
+
@@ -70,7 +77,7 @@ <% } %> <% if (privileges.canChangeThumbnail) { %> -
+