Merge da17f11e1a
into 61b9f81e39
This commit is contained in:
commit
f497616fb7
3 changed files with 82 additions and 26 deletions
|
@ -15,10 +15,13 @@ $cancel-button-color = tomato
|
|||
&.inactive .skip-duplicates
|
||||
&.inactive .always-upload-similar
|
||||
&.inactive .pause-remain-on-error
|
||||
&.inactive .upload-all-anonymous
|
||||
&.inactive #common-tags,
|
||||
&.uploading input[type=submit],
|
||||
&.uploading .skip-duplicates,
|
||||
&.uploading .always-upload-similar
|
||||
&.uploading .pause-remain-on-error
|
||||
&.uploading .upload-all-anonymous
|
||||
&:not(.uploading) .cancel
|
||||
display: none
|
||||
|
||||
|
@ -30,6 +33,9 @@ $cancel-button-color = tomato
|
|||
small
|
||||
font-size: 60%
|
||||
|
||||
label[for=common-tags]
|
||||
display: none !important
|
||||
|
||||
input[type=submit]
|
||||
margin-top: 1em
|
||||
|
||||
|
@ -49,9 +55,21 @@ $cancel-button-color = tomato
|
|||
.pause-remain-on-error
|
||||
margin-left: 1em
|
||||
|
||||
.upload-all-anonymous
|
||||
margin-left: 1em
|
||||
|
||||
form>.messages
|
||||
margin-top: 1em
|
||||
|
||||
.control-strip
|
||||
display: flex
|
||||
flex-direction: column
|
||||
gap: 0.5em
|
||||
|
||||
.control-options
|
||||
display: flex
|
||||
flex-direction: column
|
||||
|
||||
.uploadables-container
|
||||
list-style-type: none
|
||||
margin: 0
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<div class='control-strip'>
|
||||
<input type='submit' value='Upload all' class='submit'/>
|
||||
|
||||
<div class='control-options'>
|
||||
<span class='skip-duplicates'>
|
||||
<%= ctx.makeCheckbox({
|
||||
text: 'Skip duplicate',
|
||||
|
@ -29,6 +30,17 @@
|
|||
}) %>
|
||||
</span>
|
||||
|
||||
<span class='upload-all-anonymous'>
|
||||
<%= ctx.makeCheckbox({
|
||||
text: 'Upload anonymously',
|
||||
name: 'upload-all-anonymous',
|
||||
checked: false,
|
||||
}) %>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<%= ctx.makeTextInput({placeholder: 'Common tags', id: 'common-tags', name: 'common-tags'}) %>
|
||||
|
||||
<input type='button' value='Cancel' class='cancel'/>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -8,6 +8,10 @@ const FileDropperControl = require("../controls/file_dropper_control.js");
|
|||
const template = views.getTemplate("post-upload");
|
||||
const rowTemplate = views.getTemplate("post-upload-row");
|
||||
|
||||
const misc = require('../util/misc.js');
|
||||
const TagAutoCompleteControl =
|
||||
require('../controls/tag_auto_complete_control.js');
|
||||
|
||||
function _mimeTypeToPostType(mimeType) {
|
||||
return (
|
||||
{
|
||||
|
@ -185,6 +189,16 @@ class PostUploadView extends events.EventTarget {
|
|||
this._evtFormSubmit(e)
|
||||
);
|
||||
this._formNode.classList.add("inactive");
|
||||
|
||||
if (this._commonTagsInputNode) {
|
||||
this._autoCompleteControl = new TagAutoCompleteControl(
|
||||
this._commonTagsInputNode,
|
||||
{
|
||||
confirm: tag =>
|
||||
this._autoCompleteControl.replaceSelectedText(
|
||||
misc.escapeSearchTerm(tag.names[0]), true),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
enableForm() {
|
||||
|
@ -299,14 +313,18 @@ class PostUploadView extends events.EventTarget {
|
|||
uploadable.safety = safetyNode.value;
|
||||
}
|
||||
|
||||
const anonymousNode = rowNode.querySelector(
|
||||
".anonymous input:checked"
|
||||
);
|
||||
if (anonymousNode) {
|
||||
uploadable.anonymous = true;
|
||||
let anonymous = this._uploadAllAnonymous.checked;
|
||||
if (!anonymous) {
|
||||
anonymous = rowNode.querySelector(".anonymous input:checked");
|
||||
}
|
||||
uploadable.anonymous = anonymous;
|
||||
|
||||
uploadable.tags = [];
|
||||
if (this._commonTagsInputNode) {
|
||||
var tags = this._commonTagsInputNode.value.split(' ');
|
||||
tags = tags.filter(t => t != "").map(t => t.replace('\\', ''));
|
||||
uploadable.tags = uploadable.tags.concat(tags);
|
||||
}
|
||||
uploadable.relations = [];
|
||||
for (let [i, lookalike] of uploadable.lookalikes.entries()) {
|
||||
let lookalikeNode = rowNode.querySelector(
|
||||
|
@ -441,6 +459,10 @@ class PostUploadView extends events.EventTarget {
|
|||
);
|
||||
}
|
||||
|
||||
get _uploadAllAnonymous() {
|
||||
return this._hostNode.querySelector("form [name=upload-all-anonymous]");
|
||||
}
|
||||
|
||||
get _submitButtonNode() {
|
||||
return this._hostNode.querySelector("form [type=submit]");
|
||||
}
|
||||
|
@ -452,6 +474,10 @@ class PostUploadView extends events.EventTarget {
|
|||
get _contentInputNode() {
|
||||
return this._formNode.querySelector(".dropper-container");
|
||||
}
|
||||
|
||||
get _commonTagsInputNode() {
|
||||
return this._formNode.querySelector('form [name=common-tags]');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = PostUploadView;
|
||||
|
|
Reference in a new issue