-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
150 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
<template> | ||
<q-dialog v-model="dialog"> | ||
<q-card> | ||
<q-card-section> | ||
<div class="text-h6">{{ getLocale('NewBookmark') }}</div> | ||
</q-card-section> | ||
|
||
<q-card-section class="q-pt-none"> | ||
<div class="row"> | ||
<div class="col q-pa-md q-gutter-sm"> | ||
<q-input | ||
tabindex="1" | ||
clearable | ||
@keyup.enter="storeBookmark" | ||
v-model="editedBookmark.name" | ||
autofocus | ||
:label="getLocale('LinkName')" | ||
> | ||
<template v-slot:prepend> | ||
<q-icon name="bookmark" /> | ||
</template> | ||
</q-input> | ||
</div> | ||
<div class="col q-pa-md q-gutter-sm"> | ||
<q-input | ||
tabindex="3" | ||
clearable | ||
@keyup.enter="storeBookmark" | ||
v-model="editedBookmark.description" | ||
:label="getLocale('Description')" | ||
> | ||
<template v-slot:prepend> | ||
<q-icon name="description" /> | ||
</template> | ||
</q-input> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col q-pa-md q-gutter-sm"> | ||
<q-input | ||
tabindex="2" | ||
clearable | ||
type="url" | ||
@keyup.enter="storeBookmark" | ||
v-model="editedBookmark.url" | ||
:label="getLocale('URL')" | ||
> | ||
<template v-slot:prepend> | ||
<q-icon name="http" /> | ||
</template> | ||
</q-input> | ||
</div> | ||
</div> | ||
</q-card-section> | ||
|
||
<q-card-actions align="right"> | ||
<q-btn flat label="Cancel" tabindex="5" v-close-popup @click="$emit('cancel')" /> | ||
<q-btn flat label="OK" color="primary" tabindex="4" @click="storeBookmark" /> | ||
</q-card-actions> | ||
</q-card> | ||
</q-dialog> | ||
</template> | ||
|
||
<script> | ||
import {getLocale} from "src/helpers/utils"; | ||
import {defineComponent, reactive, ref} from "vue"; | ||
import {QWebSocket} from "src/services/qwebsocket"; | ||
export default defineComponent({ | ||
name: "AddBookmarkDialog", | ||
methods: {getLocale}, | ||
props: { | ||
model: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
bookmark: { | ||
type: Object, | ||
default: () => ({ name: '', description: '', url: '' }), | ||
required: true | ||
}, | ||
webSocket: { | ||
type: QWebSocket, | ||
required: true | ||
} | ||
}, | ||
setup(props, { emit }) { | ||
const dialog = ref(props.model); | ||
const editedBookmark = reactive(props.bookmark); | ||
const storeBookmark = (event) => { | ||
// // Prevent that pressing Enter to save bookmark triggers a 2nd dialog | ||
// if (event) { | ||
// event.preventDefault(); | ||
// } | ||
const data = {type: "newBookmarks", data: [editedBookmark]}; | ||
props.webSocket.send(data, function () { | ||
console.log("Stored bookmark:" + data); | ||
emit('bookmarkStored'); | ||
}); | ||
}; | ||
return { | ||
dialog, | ||
editedBookmark, | ||
storeBookmark | ||
}; | ||
}, | ||
emits: ['cancel', 'bookmarkStored'] | ||
}) | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
// app global css in SCSS form | ||
|
||
// This fixes the issue that the popup is getting tiny when a dialog is opened | ||
body.bex.q-body--prevent-scroll { | ||
position: inherit !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters