add-source.js
1 month ago
builder.js
1 month ago
confirm-dialog.js
1 month ago
date_i18n.js
1 month ago
install-plugin-popup.js
1 month ago
jquery.tooltipster.min.js
1 month ago
oembed.js
1 month ago
owl.autoheight.js
1 month ago
ressources.js
1 month ago
tooltip-wizard.js
1 month ago
vue-color.min.js
1 month ago
install-plugin-popup.js
52 lines
| 1 | /** |
| 2 | * Install Plugin Popup Popup |
| 3 | * |
| 4 | * @since 4.0 |
| 5 | */ |
| 6 | Vue.component('install-plugin-popup', { |
| 7 | name: 'install-plugin-popup', |
| 8 | template: '#install-plugin-popup', |
| 9 | props: [ |
| 10 | 'genericText', |
| 11 | 'svgIcons', |
| 12 | 'viewsActive', |
| 13 | 'plugins' |
| 14 | ], |
| 15 | data: function() { |
| 16 | return{ |
| 17 | installerStatus: null |
| 18 | } |
| 19 | }, |
| 20 | methods : { |
| 21 | /** |
| 22 | * Install or Activate Plugin |
| 23 | * |
| 24 | * @since 4.0 |
| 25 | * |
| 26 | * @return void |
| 27 | */ |
| 28 | installOrActivatePlugin : function( plugin, pluginPath, action ){ |
| 29 | this.installerStatus = 'loading'; |
| 30 | let data = new FormData(); |
| 31 | data.append( 'action', action ); |
| 32 | data.append( 'nonce', cff_builder.nonce ); |
| 33 | data.append( 'plugin', pluginPath ); |
| 34 | data.append( 'type', 'plugin' ); |
| 35 | fetch(cff_builder.ajax_handler, { |
| 36 | method: "POST", |
| 37 | credentials: 'same-origin', |
| 38 | body: data |
| 39 | }) |
| 40 | .then(response => response.json()) |
| 41 | .then(data => { |
| 42 | if( data.success == true ) { |
| 43 | this.installerStatus = null; |
| 44 | plugin.installed = true; |
| 45 | plugin.activated = true; |
| 46 | } |
| 47 | return; |
| 48 | }); |
| 49 | }, |
| 50 | }, |
| 51 | }); |
| 52 |