add checkbox fallback + DL script
This commit is contained in:
parent
60ac00f5fb
commit
7828c0225a
|
@ -1929,10 +1929,6 @@ h6 {
|
|||
fill: #fff;
|
||||
}
|
||||
|
||||
.fill-sky-500 {
|
||||
fill: #0ea5e9;
|
||||
}
|
||||
|
||||
.fill-yellow-500 {
|
||||
fill: #fbb140;
|
||||
}
|
||||
|
@ -1953,24 +1949,8 @@ h6 {
|
|||
fill: #f53939;
|
||||
}
|
||||
|
||||
.fill-blue-400 {
|
||||
fill: #60a5fa;
|
||||
}
|
||||
|
||||
.fill-orange-500 {
|
||||
fill: #fb6340;
|
||||
}
|
||||
|
||||
.fill-blue-500 {
|
||||
fill: #5e72e4;
|
||||
}
|
||||
|
||||
.fill-pink-600 {
|
||||
fill: #db2777;
|
||||
}
|
||||
|
||||
.fill-emerald-600 {
|
||||
fill: #059669;
|
||||
.fill-sky-500 {
|
||||
fill: #0ea5e9;
|
||||
}
|
||||
|
||||
.fill-amber-500 {
|
||||
|
@ -1981,6 +1961,14 @@ h6 {
|
|||
fill: #3a416f;
|
||||
}
|
||||
|
||||
.fill-blue-500 {
|
||||
fill: #5e72e4;
|
||||
}
|
||||
|
||||
.stroke-gray-100 {
|
||||
stroke: #ebeff4;
|
||||
}
|
||||
|
||||
.stroke-green-700 {
|
||||
stroke: #15803d;
|
||||
}
|
||||
|
@ -1989,34 +1977,14 @@ h6 {
|
|||
stroke: #fb6340;
|
||||
}
|
||||
|
||||
.stroke-red-500 {
|
||||
stroke: #f53939;
|
||||
}
|
||||
|
||||
.stroke-gray-300 {
|
||||
stroke: #d2d6da;
|
||||
}
|
||||
|
||||
.stroke-gray-500 {
|
||||
stroke: #adb5bd;
|
||||
}
|
||||
|
||||
.stroke-white {
|
||||
stroke: #fff;
|
||||
}
|
||||
|
||||
.stroke-gray-50 {
|
||||
stroke: #f8f9fa;
|
||||
}
|
||||
|
||||
.stroke-gray-100 {
|
||||
stroke: #ebeff4;
|
||||
}
|
||||
|
||||
.stroke-sky-500 {
|
||||
stroke: #0ea5e9;
|
||||
}
|
||||
|
||||
.stroke-red-500 {
|
||||
stroke: #f53939;
|
||||
}
|
||||
|
||||
.stroke-blue-400 {
|
||||
stroke: #60a5fa;
|
||||
}
|
||||
|
@ -3477,14 +3445,6 @@ h6 {
|
|||
display: none;
|
||||
}
|
||||
|
||||
.xl\:h-6 {
|
||||
height: 1.5rem;
|
||||
}
|
||||
|
||||
.xl\:w-6 {
|
||||
width: 1.5rem;
|
||||
}
|
||||
|
||||
.xl\:translate-x-0 {
|
||||
--tw-translate-x: 0px;
|
||||
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
||||
|
|
|
@ -5,7 +5,38 @@ import {
|
|||
FolderDropdown,
|
||||
} from "./utils/file.manager.js";
|
||||
|
||||
class Download {
|
||||
constructor(prefix = "cache") {
|
||||
this.prefix = prefix;
|
||||
this.listContainer = document.querySelector(`[cache-container]`);
|
||||
this.init();
|
||||
}
|
||||
|
||||
init() {
|
||||
this.listContainer.addEventListener("click", (e) => {
|
||||
try {
|
||||
if (
|
||||
e.target.closest("button").hasAttribute(`${this.prefix}-download`)
|
||||
) {
|
||||
const btnEl = e.target.closest("button");
|
||||
const jobName = btnEl.getAttribute("cache-download");
|
||||
const fileName = btnEl.getAttribute("cache-file");
|
||||
this.sendFileToDL(jobName, fileName);
|
||||
}
|
||||
} catch (err) {}
|
||||
});
|
||||
}
|
||||
|
||||
async sendFileToDL(jobName, fileName) {
|
||||
window.open(
|
||||
`${location.href}/download?job_name=${jobName}&file_name=${fileName}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const setModal = new FolderModal("cache");
|
||||
const setEditor = new FolderEditor();
|
||||
const setFolderNav = new FolderNav("cache");
|
||||
const setDropdown = new FolderDropdown("cache");
|
||||
const setDownload = new Download();
|
||||
|
|
|
@ -294,14 +294,17 @@ url_for(request.endpoint)[1:].split("/")[-1].strip().replace('_', '-') %}
|
|||
|
||||
<!-- download button -->
|
||||
{% if child['type'] == "file" and child['can_download'] == True %}
|
||||
{% if current_endpoint == "cache" %}
|
||||
<button
|
||||
type="button"
|
||||
value="download"
|
||||
{{current_endpoint}}-action-dropdown-btn="{{child['name']}}"
|
||||
{{current_endpoint}}-download="{{child['name'].split('/')[0]}}"
|
||||
{{current_endpoint}}-file="{{child['name'].split('/')[1] or child['name'].split('/')[0]}}"
|
||||
{{current_endpoint}}-setting-select-dropdown-btn="{{child['name'].split('/')[0]}}"
|
||||
class="duration-300 border-gray-300 hover:brightness-90 bg-white text-white my-0 relative px-6 py-2 text-center align-middle transition-all rounded-none cursor-pointer leading-normal text-sm ease-in tracking-tight-rem dark:border-slate-600 dark:bg-slate-700 dark:text-gray-300 w-full border-b border-l border-r hover:bg-gray-100"
|
||||
>
|
||||
<div class="flex justify-start items-center">
|
||||
<svg class="h-6 w-6 fill-sky-500"
|
||||
<svg class="h-6 w-6 stroke-sky-500"
|
||||
xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75l3 3m0 0l3-3m-3 3v-7.5M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
|
@ -313,6 +316,27 @@ url_for(request.endpoint)[1:].split("/")[-1].strip().replace('_', '-') %}
|
|||
>
|
||||
</div>
|
||||
</button>
|
||||
{%else%}
|
||||
<button
|
||||
type="button"
|
||||
value="download"
|
||||
{{current_endpoint}}-action-dropdown-btn="{{child['name']}}"
|
||||
class="duration-300 border-gray-300 hover:brightness-90 bg-white text-white my-0 relative px-6 py-2 text-center align-middle transition-all rounded-none cursor-pointer leading-normal text-sm ease-in tracking-tight-rem dark:border-slate-600 dark:bg-slate-700 dark:text-gray-300 w-full border-b border-l border-r hover:bg-gray-100"
|
||||
>
|
||||
<div class="flex justify-start items-center">
|
||||
<svg class="h-6 w-6 stroke-sky-500"
|
||||
xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75l3 3m0 0l3-3m-3 3v-7.5M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
|
||||
|
||||
<span
|
||||
class="transition duration-300 ease-in-out text-gray-700 dark:text-gray-300 dark:opacity-80 ml-4 font-bold uppercase"
|
||||
>download</span
|
||||
>
|
||||
</div>
|
||||
</button>
|
||||
{%endif %}
|
||||
{% endif %}
|
||||
<!-- end download button -->
|
||||
|
||||
|
|
|
@ -164,6 +164,8 @@
|
|||
<!-- checkbox -->
|
||||
{% if value["type"] == "check" %}
|
||||
<div checkbox-handler="{{value['id']}}" class="relative mb-7 md:mb-0">
|
||||
<input type="hidden" name="{{setting}}" value="no" default-value="no" default-method="default" />
|
||||
|
||||
<input id="{{setting}}" name="{{setting}}" default-method="{{global_config[setting]['method']}}" default-value="{{value['default']}}" {% if global_config[setting]['method'] != 'ui' or global_config[setting]['method'] != 'default' %} disabled {% endif %} {% if global_config[setting]['value'] and global_config[setting]['value'] == 'yes' or not global_config[setting]['value'] and value['default'] == 'yes' %} checked {% endif %} id="checkbox-{{value['id']}}"
|
||||
class="relative {% if global_config[setting]['method'] != 'ui' and global_config[setting]['method'] != 'default' %} pointer-events-none {% else %} cursor-pointer {% endif %} dark:border-slate-600 dark:bg-slate-700 z-10 checked:z-0 w-5 h-5 ease text-base rounded-1.4 checked:bg-primary checked:border-primary dark:checked:bg-primary dark:checked:border-primary duration-250 float-left mt-1 appearance-none border border-gray-300 bg-white bg-contain bg-center bg-no-repeat align-top transition-all disabled:bg-gray-400 disabled:border-gray-400 dark:disabled:bg-gray-800 dark:disabled:border-gray-800 disabled:text-gray-700 dark:disabled:text-gray-300"
|
||||
type="checkbox"
|
||||
|
|
|
@ -190,6 +190,7 @@
|
|||
<!-- checkbox -->
|
||||
{% if value["type"] == "check" %}
|
||||
<div checkbox-handler="{{value['id']}}" class="relative mb-7 md:mb-0">
|
||||
<input type="hidden" name="{{setting}}" value="no" default-value="no" default-method="default" />
|
||||
<input id="{{setting}}" name="{{setting}}"
|
||||
default-method="{{global_config[setting]['method']}}"
|
||||
default-value="{{global_config[setting]['value']}}" {% if
|
||||
|
@ -411,6 +412,8 @@
|
|||
<!-- checkbox -->
|
||||
{% if value["type"] == "check" %}
|
||||
<div checkbox-handler="{{value['id']}}" class="relative mb-7 md:mb-0">
|
||||
<input type="hidden" name="{{setting}}_SCHEMA" value="no" default-value="no" default-method="default" />
|
||||
|
||||
<input id="{{setting}}_SCHEMA" name="{{setting}}_SCHEMA"
|
||||
default-method="{{global_config[setting]['method']}}"
|
||||
default-value="{{global_config[setting]['value']}}" {% if
|
||||
|
|
Loading…
Reference in New Issue