Default upload tags
This commit is contained in:
parent
f90c190baf
commit
881cfe026c
3 changed files with 29 additions and 0 deletions
|
@ -15,6 +15,7 @@ $cancel-button-color = tomato
|
|||
&.inactive .skip-duplicates
|
||||
&.inactive .always-upload-similar
|
||||
&.inactive .pause-remain-on-error
|
||||
&.inactive #common-tags,
|
||||
&.uploading input[type=submit],
|
||||
&.uploading .skip-duplicates,
|
||||
&.uploading .always-upload-similar
|
||||
|
@ -30,6 +31,9 @@ $cancel-button-color = tomato
|
|||
small
|
||||
font-size: 60%
|
||||
|
||||
label[for=common-tags]
|
||||
display: none !important
|
||||
|
||||
input[type=submit]
|
||||
margin-top: 1em
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
}) %>
|
||||
</span>
|
||||
|
||||
<%= ctx.makeTextInput({placeholder: 'Common tags', id: 'common-tags', name: 'common-tags', style: 'margin-top:1em;'}) %>
|
||||
|
||||
<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() {
|
||||
|
@ -307,6 +321,11 @@ class PostUploadView extends events.EventTarget {
|
|||
}
|
||||
|
||||
uploadable.tags = [];
|
||||
if (this._commonTagsInputNode) {
|
||||
var tags = this._commonTagsInputNode.value.split(' ');
|
||||
tags = tags.filter(t => t != "");
|
||||
uploadable.tags = uploadable.tags.concat(tags);
|
||||
}
|
||||
uploadable.relations = [];
|
||||
for (let [i, lookalike] of uploadable.lookalikes.entries()) {
|
||||
let lookalikeNode = rowNode.querySelector(
|
||||
|
@ -452,6 +471,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;
|
||||
|
|
Loading…
Reference in a new issue