fixed the issue of failling to submit form when hitting the enter key

This commit is contained in:
huangjx
2021-10-28 16:18:28 +08:00
parent 11969a4b23
commit 91cda7a7e2
3 changed files with 44 additions and 16 deletions

View File

@@ -1,4 +0,0 @@
[ZoneTransfer]
ZoneId=3
ReferrerUrl=https://icons.getbootstrap.com/icons/trash/
HostUrl=https://icons.getbootstrap.com/assets/icons/trash.svg

View File

@@ -5,6 +5,7 @@ use OCA\NCDownloader\Search\torrentSearch;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest; use OCP\IRequest;
use OCA\NCDownloader\Tools\Helper;
class SearchController extends Controller class SearchController extends Controller
{ {

View File

@@ -1,15 +1,24 @@
<template> <template>
<form class="main-form" id="nc-vue-unified-form" :action="path"> <form class="main-form" id="nc-vue-unified-form" :action="path">
<div class="options-group"> <div class="options-group">
<button class="magnet-link http-link" @click.prevent="whichType('aria2')"> <div
class="magnet-link http-link option-buttons"
@click.prevent="whichType('aria2', $event)"
>
HTTP/MAGNET HTTP/MAGNET
</button> </div>
<button class="youtube-dl-link" @click.prevent="whichType('youtube-dl')"> <div
class="youtube-dl-link option-buttons"
@click.prevent="whichType('youtube-dl', $event)"
>
Youtube-dl Youtube-dl
</button> </div>
<button class="search-torrents" @click.prevent="whichType('search')"> <div
class="search-torrents option-buttons"
@click.prevent="whichType('search', $event)"
>
Search Torrents Search Torrents
</button> </div>
</div> </div>
<div class="action-group"> <div class="action-group">
<div class="download-input-container" v-if="inputType === 'download'"> <div class="download-input-container" v-if="inputType === 'download'">
@@ -57,11 +66,15 @@ export default {
searchInput, searchInput,
uploadFile, uploadFile,
}, },
computed: { computed: {},
},
methods: { methods: {
whichType(type) { whichType(type, event) {
let element = event.target;
let nodeList = document.querySelectorAll(".option-buttons");
nodeList.forEach((node) => {
node.classList.remove("active-button");
});
element.classList.toggle("active-button");
this.downloadType = type; this.downloadType = type;
if (type === "aria2") { if (type === "aria2") {
this.path = this.uris.aria2_url; this.path = this.uris.aria2_url;
@@ -85,8 +98,7 @@ export default {
this.$emit("uploadfile", event, vm); this.$emit("uploadfile", event, vm);
}, },
}, },
mounted() { mounted() {},
},
name: "mainForm", name: "mainForm",
props: { props: {
uris: Object, uris: Object,
@@ -111,6 +123,22 @@ export default {
height: 100%; height: 100%;
position: relative; position: relative;
} }
.options-group > .option-buttons {
margin: 0;
padding: 10px;
outline: 0;
font-weight: bold;
font-size: 13px;
font-family: inherit;
vertical-align: baseline;
cursor: pointer;
white-space: nowrap;
min-height: 34px;
width: auto;
}
.active-button {
border: 2px #9a5c8b solid;
}
.action-group { .action-group {
flex: 2; flex: 2;
@@ -158,6 +186,9 @@ export default {
.youtube-dl-link { .youtube-dl-link {
background-color: #c4c4d9; background-color: #c4c4d9;
} }
.search-torrents {
background-color: #b4b4c6;
}
.checkboxes { .checkboxes {
background-color: #c4c4d9; background-color: #c4c4d9;