|
34 | 34 |
|
35 | 35 | created: function created() { |
36 | 36 | var self = this, |
37 | | - humanpresence_field_id = 0, |
| 37 | + humanpresence_field_id = 0, |
38 | 38 | i = 0; |
39 | | - for(i = 0; i < self.$store.state.form_fields.length; i++) { |
| 39 | + for (i = 0; i < self.$store.state.form_fields.length; i++) { |
40 | 40 | if (self.$store.state.form_fields[i].template === 'humanpresence') { |
41 | 41 | humanpresence_field_id = self.$store.state.form_fields[i].id; |
42 | 42 | } |
43 | 43 | } |
44 | 44 |
|
45 | 45 | wpuf_form_builder.event_hub.$on('humanpresence-changed', this.humanpresence_changed); |
46 | 46 | wpuf_form_builder.event_hub.$on('humanpresence-disabled', this.delete_humanpresence_field); |
47 | | - |
48 | 47 | }, |
49 | 48 |
|
50 | 49 | mounted: function mounted() { |
|
177 | 176 |
|
178 | 177 | for (i = 0; i < this.form_fields.length; i++) { |
179 | 178 | if (parseInt(field_id) === parseInt(this.form_fields[i].id)) { |
180 | | - if(this.form_fields[i].template === 'humanpresence'){ |
| 179 | + if (this.form_fields[i].template === 'humanpresence') { |
181 | 180 | this.delete_field_no_confirm(i); |
182 | 181 | this.disable_humanpresence_setting(); |
183 | 182 | } else { |
|
189 | 188 |
|
190 | 189 | delete_humanpresence_field: function delete_humanpresence_field(data) { |
191 | 190 | var i = 0; |
192 | | - if(data.$store.state.form_fields.length) { |
193 | | - for(i = 0; i < data.$store.state.form_fields.length; i++) { |
194 | | - if(data.$store.state.form_fields[i].template === 'humanpresence') { |
| 191 | + if (data.$store.state.form_fields.length) { |
| 192 | + for (i = 0; i < data.$store.state.form_fields.length; i++) { |
| 193 | + if (data.$store.state.form_fields[i].template === 'humanpresence') { |
195 | 194 | this.delete_field_no_confirm(i); |
196 | 195 | this.disable_humanpresence_setting(); |
197 | 196 | } |
|
206 | 205 | }, |
207 | 206 |
|
208 | 207 | humanpresence_changed: function humanpresence_changed(e, data) { |
209 | | - if(data.$store.state.settings.humanpresence_enabled === 'true'){ |
| 208 | + if (data.$store.state.settings.humanpresence_enabled === 'true') { |
210 | 209 | wpuf_form_builder.event_hub.$emit('humanpresence-enabled', data); |
211 | 210 | } else { |
212 | 211 | wpuf_form_builder.event_hub.$emit('humanpresence-disabled', data); |
|
848 | 847 | handle: '.wpuf-column-field-control-buttons .move', |
849 | 848 | scroll: true, |
850 | 849 | stop: function stop(event, ui) { |
851 | | - var data_source = $( ui.item ).attr( 'data-source' ); |
| 850 | + var data_source = $(ui.item).attr('data-source'); |
852 | 851 |
|
853 | 852 | if ('panel' === data_source) { |
854 | 853 | var payload = { |
855 | 854 | toIndex: parseInt($(ui.item).index()), |
856 | | - field_template: $( ui.item ).attr( 'data-form-field' ), |
| 855 | + field_template: $(ui.item).attr('data-form-field'), |
857 | 856 | to_column: $(this).parent()[0].classList[0] |
858 | 857 | }; |
859 | 858 |
|
860 | 859 | self.add_column_inner_field(payload); |
861 | 860 |
|
862 | 861 | // remove button from stage |
863 | | - $(this).find( '.button.ui-draggable.ui-draggable-handle' ).remove(); |
| 862 | + $(this).find('.button.ui-draggable.ui-draggable-handle').remove(); |
864 | 863 | } |
865 | 864 | }, |
866 | 865 | update: function update(e, ui) { |
|
874 | 873 |
|
875 | 874 | if ('column-field-stage' === source) { |
876 | 875 | payload.field_id = self.field.id; |
877 | | - payload.fromIndex = parseInt($( item ).attr('column-field-index')); |
878 | | - payload.fromColumn = $( item ).attr('in-column'); |
879 | | - payload.toColumn = $( item ).parent().parent()[0].classList[0]; |
| 876 | + payload.fromIndex = parseInt($(item).attr('column-field-index')); |
| 877 | + payload.fromColumn = $(item).attr('in-column'); |
| 878 | + payload.toColumn = $(item).parent().parent()[0].classList[0]; |
880 | 879 |
|
881 | 880 | // when drag field one column to another column, sortable event trigger twice and try to swap field twice. |
882 | 881 | // So the following conditions are needed to check and run swap_column_field_elements commit only once |
|
1302 | 1301 | } |
1303 | 1302 | } |
1304 | 1303 |
|
1305 | | - if(field_template === 'humanpresence') { |
| 1304 | + if (field_template === 'humanpresence') { |
1306 | 1305 | var settings = this.$store.state.settings; |
1307 | 1306 | settings.humanpresence_enabled = true; |
1308 | 1307 | this.$store.commit('set_form_settings', settings); |
|
1315 | 1314 | }, |
1316 | 1315 |
|
1317 | 1316 | add_humanpresence_field: function add_humanpresence_field(data) { |
1318 | | - if(!this.containsField('humanpresence')) { |
| 1317 | + if (!this.containsField('humanpresence')) { |
1319 | 1318 | this.add_form_field('humanpresence'); |
1320 | 1319 | } |
1321 | 1320 | }, |
|
0 commit comments