PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.4.3
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.4.3
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 / integration / index.js

index.js in weForms – Easy Drag & Drop Contact Form Builder For WordPress 1.4.3, at assets/components/integration/index.js

103 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 Vue.component('wpuf-integration', {
2 template: '#tmpl-wpuf-integration',
3
4 computed: {
5
6 integrations: function() {
7 return wpuf_form_builder.integrations;
8 },
9
10 hasIntegrations: function() {
11 return Object.keys(this.integrations).length;
12 },
13
14 store: function() {
15 return this.$store.state.integrations;
16 },
17
18 pro_link: function() {
19 return wpuf_form_builder.pro_link;
20 }
21 },
22
23 methods: {
24
25 getIntegration: function(id) {
26 return this.integrations[id];
27 },
28
29 getIntegrationSettings: function(id) {
30 // find settings in store, otherwise take from default integration settings
31 return this.store[id] || this.getIntegration(id).settings;
32 },
33
34 isActive: function(id) {
35 if ( !this.isAvailable(id) ) {
36 return false;
37 }
38
39 return this.getIntegrationSettings(id).enabled === true;
40 },
41
42 isAvailable: function(id) {
43 return ( this.integrations[id] && this.integrations[id].pro ) ? false : true;
44 },
45
46 toggleState: function(id, target) {
47 if ( ! this.isAvailable(id) ) {
48 this.alert_pro_feature( id );
49 return;
50 }
51
52 // toggle the enabled state
53 var settings = this.getIntegrationSettings(id);
54
55 settings.enabled = !this.isActive(id);
56
57 this.$store.commit('updateIntegration', {
58 index: id,
59 value: settings
60 });
61
62 $(target).toggleClass('checked');
63 },
64
65 alert_pro_feature: function (id) {
66 var title = this.getIntegration(id).title;
67
68 swal({
69 title: '<i class="fa fa-lock"></i> ' + title + ' <br>' + this.i18n.is_a_pro_feature,
70 text: this.i18n.pro_feature_msg,
71 type: '',
72 showCancelButton: true,
73 cancelButtonText: this.i18n.close,
74 confirmButtonColor: '#46b450',
75 confirmButtonText: this.i18n.upgrade_to_pro
76 }).then(function (is_confirm) {
77 if (is_confirm) {
78 window.open(wpuf_form_builder.pro_link, '_blank');
79 }
80
81 }, function() {});
82 },
83
84 showHide: function(target) {
85 $(target).closest('.wpuf-integration').toggleClass('collapsed');
86 },
87
88 openModal: function(target){
89 $(target).parents('.wpuf-integration').find('.wf-modal').addClass('wf-modal-open');
90 },
91
92 hideModal: function(target){
93 $(target).parents('.wf-modal').removeClass('wf-modal-open');
94 },
95
96 save_form_builder: function(target){
97 $('.weforms-save-form-builder').trigger('click');
98 this.hideModal(target);
99 }
100
101 }
102 });
103