diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2019-03-07 05:24:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-07 05:24:03 +0300 |
commit | e2b9414bf29c12bab57dc7c9630243738e90b458 (patch) | |
tree | bca6e3df5e745cfc0107dab61f1c318cdad51d83 /plugins/CorePluginsAdmin | |
parent | 0d5d0dfe40f771d437fa0bf36e8393daa3da07d3 (diff) |
Allow updating multiple plugins at once. (#14052)
* Allow updating multiple plugins at once.
* Disable checkbox if plugin is not downloadable.
* Fix translation typo.
* really fix typo
Diffstat (limited to 'plugins/CorePluginsAdmin')
-rw-r--r-- | plugins/CorePluginsAdmin/lang/en.json | 3 | ||||
-rw-r--r-- | plugins/CorePluginsAdmin/templates/macros.twig | 46 |
2 files changed, 48 insertions, 1 deletions
diff --git a/plugins/CorePluginsAdmin/lang/en.json b/plugins/CorePluginsAdmin/lang/en.json index 8ab8ca0948..b7ed466470 100644 --- a/plugins/CorePluginsAdmin/lang/en.json +++ b/plugins/CorePluginsAdmin/lang/en.json @@ -83,6 +83,7 @@ "Version": "Version", "ViewAllMarketplacePlugins": "View all Marketplace plugins", "WeCouldNotLoadThePluginAsItHasMissingDependencies": "The plugin %1$s could not be loaded as it has missing dependencies: %2$s", - "Websites": "Websites" + "Websites": "Websites", + "UpdateSelected": "Update Selected" } } diff --git a/plugins/CorePluginsAdmin/templates/macros.twig b/plugins/CorePluginsAdmin/templates/macros.twig index ad0f4bb2ac..13c7a41ec9 100644 --- a/plugins/CorePluginsAdmin/templates/macros.twig +++ b/plugins/CorePluginsAdmin/templates/macros.twig @@ -2,9 +2,18 @@ {% macro tablePluginUpdates(pluginsHavingUpdate, updateNonce, isMultiServerEnvironment) %} {% import '@Marketplace/macros.twig' as marketplaceMacro %} + <div> + <a id="update-selected-plugins" href="javascript:" class="btn">{{ 'CorePluginsAdmin_UpdateSelected'|translate }}</a> + </div> <table piwik-content-table> <thead> <tr> + <th> + <span class="checkbox-container"> + <input type="checkbox" id="select-plugin-all" /> + <label for="select-plugin-all"></label> + </span> + </th> <th>{{ 'General_Plugin'|translate }}</th> <th class="num">{{ 'CorePluginsAdmin_Version'|translate }}</th> <th>{{ 'General_Description'|translate }}</th> @@ -15,6 +24,12 @@ <tbody id="plugins"> {% for name,plugin in pluginsHavingUpdate %} <tr {% if plugin.isActivated|default(false) %}class="active-plugin"{% else %}class="inactive-plugin"{% endif %}> + <td class="select-cell"> + <span class="checkbox-container"> + <input type="checkbox" id="select-plugin-{{ plugin.name|e('html_attr') }}" {% if plugin.isDownloadable is defined and not plugin.isDownloadable %}disabled="disabled"{% endif %} /> + <label for="select-plugin-{{ plugin.name|e('html_attr') }}"></label> + </span> + </td> <td class="name"> <a href="javascript:void(0);" piwik-plugin-name="{{ plugin.name|e('html_attr') }}" class="plugin-details"> {{ plugin.name }} @@ -57,6 +72,37 @@ </tbody> </table> + <script> + $(function () { + $('#update-selected-plugins').on('click', function () { + var pluginsToUpdate = []; + $('tbody#plugins td.select-cell input').each(function () { + if (!this.checked) { + return; + } + + var pluginName = $(this).closest('tr').find('.name .plugin-details').attr('piwik-plugin-name'); + pluginsToUpdate.push(pluginName); + }); + + var url = '{{ linkTo({'module':'Marketplace','action':'updatePlugin','nonce':updateNonce})|raw }}&pluginName=' + encodeURIComponent(pluginsToUpdate.join(',')); + window.location.href = url; + + $(this).prop('disabled', true); + }); + + $('#select-plugin-all').on('change', function () { + var self = this; + $('tbody#plugins td.select-cell input[type=checkbox]').each(function () { + if ($(this).prop('disabled')) { + return; + } + $(this).prop('checked', self.checked); + }); + }); + }); + </script> + {% endmacro %} {% macro pluginActivateDeactivateAction(name, isActivated, missingRequirements, deactivateNonce, activateNonce) -%} |