Skip to content

Commit 5a0980e

Browse files
committed
Add on-hover one-click Copy button to subscribers and campaigns tables UI.
1 parent a85e467 commit 5a0980e

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

frontend/src/components/CopyText.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<a href="#" class="copy-text" ref="text" @click.prevent="onClick">
3-
{{ $props.text }}
3+
<template v-if="!hideText">{{ $props.text }}</template>
44
<b-icon icon="file-multiple-outline" size="is-small" />
55
</a>
66
</template>
@@ -11,10 +11,14 @@ export default {
1111
1212
props: {
1313
text: { type: String, default: '' },
14+
hideText: { type: Boolean, default: false },
1415
},
1516
1617
methods: {
17-
onClick() {
18+
onClick(e) {
19+
e.preventDefault();
20+
e.stopPropagation();
21+
1822
const input = document.createElement('input');
1923
input.setAttribute('type', 'text');
2024
input.style.opacity = '0';

frontend/src/views/Campaigns.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,11 @@
7272
</b-tag>
7373
<router-link :to="{ name: 'campaign', params: { id: props.row.id } }">
7474
{{ props.row.name }}
75+
<copy-text :text="props.row.name" hide-text />
7576
</router-link>
7677
</p>
7778
<p class="is-size-7 has-text-grey">
78-
{{ props.row.subject }}
79+
<copy-text :text="props.row.subject" />
7980
</p>
8081
<b-taglist>
8182
<b-tag class="is-small" v-for="t in props.row.tags" :key="t">
@@ -265,11 +266,13 @@ import Vue from 'vue';
265266
import { mapState } from 'vuex';
266267
import CampaignPreview from '../components/CampaignPreview.vue';
267268
import EmptyPlaceholder from '../components/EmptyPlaceholder.vue';
269+
import CopyText from '../components/CopyText.vue';
268270
269271
export default Vue.extend({
270272
components: {
271273
CampaignPreview,
272274
EmptyPlaceholder,
275+
CopyText,
273276
},
274277
275278
data() {

frontend/src/views/Subscribers.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
<a :href="`/subscribers/${props.row.id}`" @click.prevent="showEditForm(props.row)"
109109
:class="{ 'blocklisted': props.row.status === 'blocklisted' }">
110110
{{ props.row.email }}
111+
<copy-text :text="`${props.row.email}`" hide-text />
111112
</a>
112113
<b-tag v-if="props.row.status !== 'enabled'" :class="props.row.status" data-cy="blocklisted">
113114
{{ $t(`subscribers.status.${props.row.status}`) }}
@@ -130,6 +131,7 @@
130131
<a :href="`/subscribers/${props.row.id}`" @click.prevent="showEditForm(props.row)"
131132
:class="{ 'blocklisted': props.row.status === 'blocklisted' }">
132133
{{ props.row.name }}
134+
<copy-text :text="`${props.row.name}`" hide-text />
133135
</a>
134136
</b-table-column>
135137

@@ -194,11 +196,13 @@ import EmptyPlaceholder from '../components/EmptyPlaceholder.vue';
194196
import { uris } from '../constants';
195197
import SubscriberBulkList from './SubscriberBulkList.vue';
196198
import SubscriberForm from './SubscriberForm.vue';
199+
import CopyText from '../components/CopyText.vue';
197200
198201
export default Vue.extend({
199202
components: {
200203
SubscriberForm,
201204
SubscriberBulkList,
205+
CopyText,
202206
EmptyPlaceholder,
203207
},
204208

0 commit comments

Comments
 (0)