Hidden most edit controls by default

This reduces form size in half, which should improve editing experience.
This commit is contained in:
rr- 2015-07-19 19:31:19 +02:00
parent c6a17d33af
commit b4db90bcdc
3 changed files with 35 additions and 6 deletions

View file

@ -166,6 +166,9 @@
z-index: -1; 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 { #post-edit-target .file-handler {
margin: 0.5em 0; margin: 0.5em 0;
} }

View file

@ -47,7 +47,20 @@ App.Presenters.PostEditPresenter = function(
} }
function render() { 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 = new App.Controls.FileDropper($target.find('form [name=content]'));
postContentFileDropper.onChange = postContentChanged; postContentFileDropper.onChange = postContentChanged;
@ -64,6 +77,12 @@ App.Presenters.PostEditPresenter = function(
$target.find('form').submit(editFormSubmitted); $target.find('form').submit(editFormSubmitted);
} }
function advancedTriggerClicked(e, $advanced, $advancedTrigger) {
$advancedTrigger.hide();
$advanced.show();
e.preventDefault();
}
function focus() { function focus() {
if (tagInput) { if (tagInput) {
tagInput.focus(); tagInput.focus();

View file

@ -30,8 +30,15 @@
</div> </div>
<% } %> <% } %>
<div class="form-row advanced-trigger">
<label></label>
<div class="form-input">
<a href="#">Advanced&hellip;</a>
</div>
</div>
<% if (privileges.canChangeSource) { %> <% if (privileges.canChangeSource) { %>
<div class="form-row"> <div class="form-row advanced">
<label class="form-label" for="post-source">Source:</label> <label class="form-label" for="post-source">Source:</label>
<div class="form-input"> <div class="form-input">
<input maxlength="200" type="text" name="source" id="post-source" placeholder="Where did you get this? (optional)" value="<%= post.source %>"/> <input maxlength="200" type="text" name="source" id="post-source" placeholder="Where did you get this? (optional)" value="<%= post.source %>"/>
@ -40,7 +47,7 @@
<% } %> <% } %>
<% if (privileges.canChangeRelations) { %> <% if (privileges.canChangeRelations) { %>
<div class="form-row"> <div class="form-row advanced">
<label class="form-label" for="post-relations">Relations:</label> <label class="form-label" for="post-relations">Relations:</label>
<div class="form-input"> <div class="form-input">
<input maxlength="200" type="text" name="relations" id="post-relations" placeholder="Post ids, separated with space" value="<%= _.pluck(post.relations, 'id').join(' ') %>"/> <input maxlength="200" type="text" name="relations" id="post-relations" placeholder="Post ids, separated with space" value="<%= _.pluck(post.relations, 'id').join(' ') %>"/>
@ -49,7 +56,7 @@
<% } %> <% } %>
<% if (privileges.canChangeFlags && post.contentType === 'video') { %> <% if (privileges.canChangeFlags && post.contentType === 'video') { %>
<div class="form-row"> <div class="form-row advanced">
<label class="form-label">Loop:</label> <label class="form-label">Loop:</label>
<div class="form-input"> <div class="form-input">
<input type="checkbox" id="post-loop" name="loop" value="loop" <%= post.flags.loop ? 'checked="checked"' : '' %>/> <input type="checkbox" id="post-loop" name="loop" value="loop" <%= post.flags.loop ? 'checked="checked"' : '' %>/>
@ -61,7 +68,7 @@
<% } %> <% } %>
<% if (privileges.canChangeContent) { %> <% if (privileges.canChangeContent) { %>
<div class="form-row"> <div class="form-row advanced">
<label class="form-label" for="post-content">Content:</label> <label class="form-label" for="post-content">Content:</label>
<div class="form-input"> <div class="form-input">
<input type="file" id="post-content" name="content"/> <input type="file" id="post-content" name="content"/>
@ -70,7 +77,7 @@
<% } %> <% } %>
<% if (privileges.canChangeThumbnail) { %> <% if (privileges.canChangeThumbnail) { %>
<div class="form-row"> <div class="form-row advanced">
<label class="form-label" for="post-thumbnail">Thumbnail:</label> <label class="form-label" for="post-thumbnail">Thumbnail:</label>
<div class="form-input"> <div class="form-input">
<input type="file" id="post-thumbnail" name="thumbnail"/> <input type="file" id="post-thumbnail" name="thumbnail"/>