mirror of
https://github.com/mollersuite/monofile.git
synced 2024-11-22 05:46:26 -08:00
tags ig
This commit is contained in:
parent
b82577e1a8
commit
92c48a52ef
|
@ -9,5 +9,9 @@
|
|||
"accounts": {
|
||||
"registrationEnabled": true,
|
||||
"requiredForUpload": false
|
||||
},
|
||||
|
||||
"webdrop": {
|
||||
"accountRequired": false
|
||||
}
|
||||
}
|
|
@ -73,6 +73,15 @@ fileApiRoutes.post("/manage", parser, (req,res) => {
|
|||
files.files[e].visibility = req.body.value;
|
||||
modified++;
|
||||
break;
|
||||
|
||||
case "setTag":
|
||||
if (!req.body.value) delete files.files[e].tag
|
||||
else {
|
||||
if (req.body.value.toString().length > 30) return
|
||||
files.files[e].tag = req.body.value.toString().lower()
|
||||
}
|
||||
modified++;
|
||||
break;
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -161,6 +161,46 @@ export function fileOptions(optPicker,file) {
|
|||
|
||||
})
|
||||
|
||||
break;
|
||||
|
||||
case "tag":
|
||||
|
||||
optPicker.picker("Enter a tag (max 30char)",[
|
||||
{
|
||||
name: "Tag name",
|
||||
icon: "/static/assets/icons/tag.svg",
|
||||
id: "tag",
|
||||
inputSettings: {}
|
||||
},
|
||||
{
|
||||
name: "OK",
|
||||
icon: "/static/assets/icons/update.svg",
|
||||
id: true
|
||||
}
|
||||
]).then((exp) => {
|
||||
|
||||
if (exp && exp.selected) {
|
||||
|
||||
fetch(`/files/manage`, {method: "POST", body: JSON.stringify({
|
||||
target: [ file.id ],
|
||||
action: "setTag",
|
||||
|
||||
value: exp.selected || null
|
||||
})}).then((response) => {
|
||||
|
||||
if (response.status != 200) {
|
||||
optPicker.picker(`${response.status} ${response.statusText}`,[])
|
||||
}
|
||||
|
||||
fetchFilePointers();
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
break
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,6 +37,11 @@
|
|||
<p class="detail">
|
||||
<img src="/static/assets/icons/{file.visibility || "public"}.svg" alt={file.visibility||"public"} />
|
||||
<span class="number">{file.id}</span> — <span class="number">{file.mime.split(";")[0]}</span>
|
||||
{#if file.tag}
|
||||
<br />
|
||||
<img src="/static/assets/icons/tag.svg" alt="tag"/>
|
||||
<span class="number">{file.tag}</span>
|
||||
{/if}
|
||||
</p>
|
||||
</div>
|
||||
<button class="more" on:click={fileOptions(picker, file)}>
|
||||
|
|
Loading…
Reference in a new issue