mirror of
https://github.com/knadh/listmonk.git
synced 2025-10-10 07:16:16 +08:00
Add on-hover one-click Copy
button to subscribers and campaigns tables UI.
This commit is contained in:
parent
a85e467cd9
commit
5a0980e55e
3 changed files with 14 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<a href="#" class="copy-text" ref="text" @click.prevent="onClick">
|
<a href="#" class="copy-text" ref="text" @click.prevent="onClick">
|
||||||
{{ $props.text }}
|
<template v-if="!hideText">{{ $props.text }}</template>
|
||||||
<b-icon icon="file-multiple-outline" size="is-small" />
|
<b-icon icon="file-multiple-outline" size="is-small" />
|
||||||
</a>
|
</a>
|
||||||
</template>
|
</template>
|
||||||
|
@ -11,10 +11,14 @@ export default {
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
text: { type: String, default: '' },
|
text: { type: String, default: '' },
|
||||||
|
hideText: { type: Boolean, default: false },
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onClick() {
|
onClick(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
|
||||||
const input = document.createElement('input');
|
const input = document.createElement('input');
|
||||||
input.setAttribute('type', 'text');
|
input.setAttribute('type', 'text');
|
||||||
input.style.opacity = '0';
|
input.style.opacity = '0';
|
||||||
|
|
|
@ -72,10 +72,11 @@
|
||||||
</b-tag>
|
</b-tag>
|
||||||
<router-link :to="{ name: 'campaign', params: { id: props.row.id } }">
|
<router-link :to="{ name: 'campaign', params: { id: props.row.id } }">
|
||||||
{{ props.row.name }}
|
{{ props.row.name }}
|
||||||
|
<copy-text :text="props.row.name" hide-text />
|
||||||
</router-link>
|
</router-link>
|
||||||
</p>
|
</p>
|
||||||
<p class="is-size-7 has-text-grey">
|
<p class="is-size-7 has-text-grey">
|
||||||
{{ props.row.subject }}
|
<copy-text :text="props.row.subject" />
|
||||||
</p>
|
</p>
|
||||||
<b-taglist>
|
<b-taglist>
|
||||||
<b-tag class="is-small" v-for="t in props.row.tags" :key="t">
|
<b-tag class="is-small" v-for="t in props.row.tags" :key="t">
|
||||||
|
@ -265,11 +266,13 @@ import Vue from 'vue';
|
||||||
import { mapState } from 'vuex';
|
import { mapState } from 'vuex';
|
||||||
import CampaignPreview from '../components/CampaignPreview.vue';
|
import CampaignPreview from '../components/CampaignPreview.vue';
|
||||||
import EmptyPlaceholder from '../components/EmptyPlaceholder.vue';
|
import EmptyPlaceholder from '../components/EmptyPlaceholder.vue';
|
||||||
|
import CopyText from '../components/CopyText.vue';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
components: {
|
components: {
|
||||||
CampaignPreview,
|
CampaignPreview,
|
||||||
EmptyPlaceholder,
|
EmptyPlaceholder,
|
||||||
|
CopyText,
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
|
|
|
@ -108,6 +108,7 @@
|
||||||
<a :href="`/subscribers/${props.row.id}`" @click.prevent="showEditForm(props.row)"
|
<a :href="`/subscribers/${props.row.id}`" @click.prevent="showEditForm(props.row)"
|
||||||
:class="{ 'blocklisted': props.row.status === 'blocklisted' }">
|
:class="{ 'blocklisted': props.row.status === 'blocklisted' }">
|
||||||
{{ props.row.email }}
|
{{ props.row.email }}
|
||||||
|
<copy-text :text="`${props.row.email}`" hide-text />
|
||||||
</a>
|
</a>
|
||||||
<b-tag v-if="props.row.status !== 'enabled'" :class="props.row.status" data-cy="blocklisted">
|
<b-tag v-if="props.row.status !== 'enabled'" :class="props.row.status" data-cy="blocklisted">
|
||||||
{{ $t(`subscribers.status.${props.row.status}`) }}
|
{{ $t(`subscribers.status.${props.row.status}`) }}
|
||||||
|
@ -130,6 +131,7 @@
|
||||||
<a :href="`/subscribers/${props.row.id}`" @click.prevent="showEditForm(props.row)"
|
<a :href="`/subscribers/${props.row.id}`" @click.prevent="showEditForm(props.row)"
|
||||||
:class="{ 'blocklisted': props.row.status === 'blocklisted' }">
|
:class="{ 'blocklisted': props.row.status === 'blocklisted' }">
|
||||||
{{ props.row.name }}
|
{{ props.row.name }}
|
||||||
|
<copy-text :text="`${props.row.name}`" hide-text />
|
||||||
</a>
|
</a>
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
|
|
||||||
|
@ -194,11 +196,13 @@ import EmptyPlaceholder from '../components/EmptyPlaceholder.vue';
|
||||||
import { uris } from '../constants';
|
import { uris } from '../constants';
|
||||||
import SubscriberBulkList from './SubscriberBulkList.vue';
|
import SubscriberBulkList from './SubscriberBulkList.vue';
|
||||||
import SubscriberForm from './SubscriberForm.vue';
|
import SubscriberForm from './SubscriberForm.vue';
|
||||||
|
import CopyText from '../components/CopyText.vue';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
components: {
|
components: {
|
||||||
SubscriberForm,
|
SubscriberForm,
|
||||||
SubscriberBulkList,
|
SubscriberBulkList,
|
||||||
|
CopyText,
|
||||||
EmptyPlaceholder,
|
EmptyPlaceholder,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue