PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.6.1
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.6.1
1.6.7 1.6.8 1.6.9 1.6.12 1.6.13 1.6.14 1.6.15 1.6.16 1.6.17 1.6.18 1.6.19 1.6.2 1.6.20 1.6.21 1.6.22 1.6.23 1.6.24 1.6.25 1.6.26 1.6.27 1.6.28 1.6.3 1.6.4 1.6.5 1.6.6 All 74 releases
weforms / assets / components / form-notification / index.js

index.js in weForms – Easy Drag & Drop Contact Form Builder For WordPress 1.6.1, at assets/components/form-notification/index.js

88 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 Vue.component('wpuf-cf-form-notification', {
2 template: '#tmpl-wpuf-form-notification',
3 mixins: [weForms.mixins.Loading],
4 data: function() {
5 return {
6 editing: false,
7 editingIndex: 0,
8 };
9 },
10
11 computed: {
12 is_pro: function() {
13 return 'true' === weForms.is_pro;
14 },
15 has_sms: function() {
16 return 'true' === weForms.has_sms;
17 },
18 pro_link: function() {
19 return wpuf_form_builder.pro_link;
20 },
21 notifications: function() {
22 return this.$store.state.notifications;
23 },
24
25 hasNotifications: function() {
26 return Object.keys( this.$store.state.notifications ).length;
27 }
28 },
29
30 methods: {
31 addNew: function() {
32 this.$store.commit('addNotification', wpuf_form_builder.defaultNotification);
33 },
34
35 editItem: function(index) {
36 this.editing = true;
37 this.editingIndex = index;
38 },
39
40 editDone: function() {
41 this.editing = false;
42
43 this.$store.commit('updateNotification', {
44 index: this.editingIndex,
45 value: this.notifications[this.editingIndex]
46 });
47
48 jQuery('.advanced-field-wrap').slideUp('fast');
49 },
50
51 deleteItem: function(index) {
52 if ( confirm( 'Are you sure' ) ) {
53 this.editing = false;
54 this.$store.commit( 'deleteNotification', index);
55 this.$emit('deleteNotification', index);
56 }
57 },
58
59 toggelNotification: function(index) {
60 this.$store.commit('updateNotificationProperty', {
61 index: index,
62 property: 'active',
63 value: !this.notifications[index].active
64 });
65 },
66
67 duplicate: function(index) {
68 this.$store.commit('cloneNotification', index);
69 },
70
71 toggleAdvanced: function() {
72 jQuery('.advanced-field-wrap').slideToggle('fast');
73 },
74
75 insertValue: function(type, field, property) {
76 var notification = this.notifications[this.editingIndex],
77 value = ( field !== undefined ) ? '{' + type + ':' + field + '}' : '{' + type + '}';
78
79 notification[property] = notification[property] + value;
80 },
81
82 insertValueEditor: function(type, field, property) {
83 var value = ( field !== undefined ) ? '{' + type + ':' + field + '}' : '{' + type + '}';
84 this.$emit('insertValueEditor', value);
85 },
86 }
87 });
88