mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-09 03:04:54 -04:00
Feature/copy icon (#406)
* add copy tooltip * transparent scrollbar * add version to header * localize Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
parent
5a38589a60
commit
5f074fe5d9
@ -3,9 +3,9 @@
|
|||||||
<!-- Dummpy Comment -->
|
<!-- Dummpy Comment -->
|
||||||
<TheAppBar />
|
<TheAppBar />
|
||||||
<v-main>
|
<v-main>
|
||||||
<v-banner v-if="demo" sticky
|
<v-banner v-if="!demo" sticky>
|
||||||
><div class="text-center"><b> This is a Demo</b> | Username: changeme@email.com | Password: demo</div></v-banner
|
<div class="text-center"><b> This is a Demo of the v0.5.0 (BETA) </b> | Username: changeme@email.com | Password: demo</div>
|
||||||
>
|
</v-banner>
|
||||||
<GlobalSnackbar />
|
<GlobalSnackbar />
|
||||||
<router-view></router-view>
|
<router-view></router-view>
|
||||||
</v-main>
|
</v-main>
|
||||||
@ -73,15 +73,7 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
*::-webkit-scrollbar {
|
:root {
|
||||||
width: 0.25rem;
|
scrollbar-color: transparent transparent;
|
||||||
}
|
|
||||||
|
|
||||||
*::-webkit-scrollbar-track {
|
|
||||||
background: lightgray;
|
|
||||||
}
|
|
||||||
|
|
||||||
*::-webkit-scrollbar-thumb {
|
|
||||||
background: grey;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -129,7 +129,7 @@ export default {
|
|||||||
},
|
},
|
||||||
async downloadJson() {
|
async downloadJson() {
|
||||||
const recipe = await api.recipes.requestDetails(this.slug);
|
const recipe = await api.recipes.requestDetails(this.slug);
|
||||||
this.downloadString(JSON.stringify(recipe, "", 4), "text/json", recipe.slug+'.json');
|
this.downloadString(JSON.stringify(recipe, "", 4), "text/json", recipe.slug + ".json");
|
||||||
},
|
},
|
||||||
downloadString(text, fileType, fileName) {
|
downloadString(text, fileType, fileName) {
|
||||||
let blob = new Blob([text], { type: fileType });
|
let blob = new Blob([text], { type: fileType });
|
||||||
|
69
frontend/src/components/UI/Buttons/TheCopyButton.vue
Normal file
69
frontend/src/components/UI/Buttons/TheCopyButton.vue
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<template>
|
||||||
|
<v-tooltip
|
||||||
|
ref="copyToolTip"
|
||||||
|
v-model="show"
|
||||||
|
color="success lighten-1"
|
||||||
|
right
|
||||||
|
:open-on-hover="false"
|
||||||
|
:open-on-click="true"
|
||||||
|
close-delay="500"
|
||||||
|
transition="slide-y-transition"
|
||||||
|
>
|
||||||
|
<template v-slot:activator="{ on }">
|
||||||
|
<v-btn
|
||||||
|
icon
|
||||||
|
color="primary"
|
||||||
|
@click="
|
||||||
|
on.click;
|
||||||
|
textToClipboard();
|
||||||
|
"
|
||||||
|
@blur="on.blur"
|
||||||
|
retain-focus-on-click
|
||||||
|
>
|
||||||
|
<v-icon>mdi-content-copy</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
|
<span>
|
||||||
|
<v-icon left dark>
|
||||||
|
mdi-clipboard-check
|
||||||
|
</v-icon>
|
||||||
|
{{ $t('general.coppied')}}!
|
||||||
|
|
||||||
|
</span>
|
||||||
|
</v-tooltip>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
copyText: {
|
||||||
|
default: "Default Copy Text",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
show: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
toggleBlur() {
|
||||||
|
this.$refs.copyToolTip.deactivate();
|
||||||
|
},
|
||||||
|
textToClipboard() {
|
||||||
|
this.show = true;
|
||||||
|
const copyText = this.copyText;
|
||||||
|
navigator.clipboard.writeText(copyText).then(
|
||||||
|
() => console.log("Copied", copyText),
|
||||||
|
() => console.log("Copied Failed", copyText)
|
||||||
|
);
|
||||||
|
setTimeout(() => {
|
||||||
|
this.toggleBlur();
|
||||||
|
}, 500);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
</style>
|
@ -49,6 +49,7 @@
|
|||||||
"confirm": "Confirm",
|
"confirm": "Confirm",
|
||||||
"create": "Create",
|
"create": "Create",
|
||||||
"created": "Created",
|
"created": "Created",
|
||||||
|
"coppied": "Coppied",
|
||||||
"current-parenthesis": "(Current)",
|
"current-parenthesis": "(Current)",
|
||||||
"custom": "Custom",
|
"custom": "Custom",
|
||||||
"dashboard": "Dashboard",
|
"dashboard": "Dashboard",
|
||||||
|
@ -70,11 +70,7 @@
|
|||||||
<v-data-table :headers="headers" :items="links" sort-by="calories">
|
<v-data-table :headers="headers" :items="links" sort-by="calories">
|
||||||
<template v-slot:item.token="{ item }">
|
<template v-slot:item.token="{ item }">
|
||||||
{{ `${baseURL}/sign-up/${item.token}` }}
|
{{ `${baseURL}/sign-up/${item.token}` }}
|
||||||
<v-btn icon class="mr-1" small color="accent" @click="updateClipboard(`${baseURL}/sign-up/${item.token}`)">
|
<TheCopyButton :copy-text="`${baseURL}/sign-up/${item.token}`"/>
|
||||||
<v-icon>
|
|
||||||
mdi-content-copy
|
|
||||||
</v-icon>
|
|
||||||
</v-btn>
|
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:item.admin="{ item }">
|
<template v-slot:item.admin="{ item }">
|
||||||
<v-btn small :color="item.admin ? 'success' : 'error'" text>
|
<v-btn small :color="item.admin ? 'success' : 'error'" text>
|
||||||
@ -98,11 +94,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import TheCopyButton from "@/components/UI/Buttons/TheCopyButton";
|
||||||
import ConfirmationDialog from "@/components/UI/Dialogs/ConfirmationDialog";
|
import ConfirmationDialog from "@/components/UI/Dialogs/ConfirmationDialog";
|
||||||
import { api } from "@/api";
|
import { api } from "@/api";
|
||||||
import { validators } from "@/mixins/validators";
|
import { validators } from "@/mixins/validators";
|
||||||
export default {
|
export default {
|
||||||
components: { ConfirmationDialog },
|
components: { ConfirmationDialog, TheCopyButton },
|
||||||
mixins: [validators],
|
mixins: [validators],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user