| 1 |
/* assets/js/utils/jquery-siaf-start.js */ |
| 2 |
;(function($) { |
| 3 |
'use strict'; |
| 4 |
|
| 5 |
/* ./assets/components/field-name/index.js */ |
| 6 |
Vue.component('field-name', { |
| 7 |
template: '#tmpl-wpuf-field-name', |
| 8 |
|
| 9 |
mixins: [ |
| 10 |
wpuf_mixins.option_field_mixin |
| 11 |
], |
| 12 |
|
| 13 |
computed: { |
| 14 |
value: { |
| 15 |
get: function () { |
| 16 |
return this.editing_form_field[this.option_field.name]; |
| 17 |
}, |
| 18 |
|
| 19 |
set: function (value) { |
| 20 |
this.update_value(this.option_field.name, value); |
| 21 |
} |
| 22 |
} |
| 23 |
}, |
| 24 |
|
| 25 |
methods: { |
| 26 |
on_focusout: function (e) { |
| 27 |
wpuf_form_builder.event_hub.$emit('field-text-focusout', e, this); |
| 28 |
}, |
| 29 |
on_keyup: function (e) { |
| 30 |
wpuf_form_builder.event_hub.$emit('field-text-keyup', e, this); |
| 31 |
} |
| 32 |
} |
| 33 |
}); |
| 34 |
|
| 35 |
/* ./assets/components/form-name_field/index.js */ |
| 36 |
/** |
| 37 |
* Field template: First Name |
| 38 |
*/ |
| 39 |
Vue.component('form-name_field', { |
| 40 |
template: '#tmpl-wpuf-form-name_field', |
| 41 |
|
| 42 |
mixins: [ |
| 43 |
wpuf_mixins.form_field_mixin |
| 44 |
] |
| 45 |
}); |
| 46 |
|
| 47 |
/* ./assets/components/integration-slack/index.js */ |
| 48 |
Vue.component('wpuf-integration-slack', { |
| 49 |
template: '#tmpl-wpuf-integration-slack', |
| 50 |
mixins: [wpuf_mixins.integration_mixin] |
| 51 |
}); |
| 52 |
/* ./assets/components/template-modal/index.js */ |
| 53 |
Vue.component('wpuf-template-modal', { |
| 54 |
template: '#tmpl-wpuf-template-modal', |
| 55 |
|
| 56 |
props: { |
| 57 |
show: Boolean, |
| 58 |
onClose: Function |
| 59 |
}, |
| 60 |
|
| 61 |
data: function() { |
| 62 |
return { |
| 63 |
loading: false |
| 64 |
}; |
| 65 |
}, |
| 66 |
|
| 67 |
methods: { |
| 68 |
|
| 69 |
blankForm: function(target) { |
| 70 |
this.createForm('blank_form', target); |
| 71 |
}, |
| 72 |
|
| 73 |
createForm: function(form, target) { |
| 74 |
var self = this, |
| 75 |
list = $(target).parents('li'); |
| 76 |
|
| 77 |
// already on a request? |
| 78 |
if ( self.loading ) { |
| 79 |
return; |
| 80 |
} |
| 81 |
|
| 82 |
self.loading = true; |
| 83 |
|
| 84 |
if ( list ) { |
| 85 |
list.addClass('on-progress'); |
| 86 |
} |
| 87 |
|
| 88 |
wp.ajax.send( 'weforms_contact_form_template', { |
| 89 |
data: { |
| 90 |
template: form, |
| 91 |
_wpnonce: weForms.nonce |
| 92 |
}, |
| 93 |
|
| 94 |
success: function(response) { |
| 95 |
self.$router.push({ |
| 96 |
name: 'edit', |
| 97 |
params: { id: response.id } |
| 98 |
}); |
| 99 |
}, |
| 100 |
|
| 101 |
error: function(error) { |
| 102 |
|
| 103 |
}, |
| 104 |
|
| 105 |
complete: function() { |
| 106 |
self.loading = false; |
| 107 |
|
| 108 |
if ( list ) { |
| 109 |
list.removeClass('on-progress'); |
| 110 |
} |
| 111 |
} |
| 112 |
}); |
| 113 |
} |
| 114 |
} |
| 115 |
}); |
| 116 |
|
| 117 |
/* assets/js/utils/jquery-siaf-end.js */ |
| 118 |
})(jQuery); |
| 119 |
|