From b79c18f59eb6ba5ec30a195a71bb8c67bbd5aeb5 Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Mon, 30 Sep 2013 20:56:30 +0000 Subject: [PATCH] refs #546 display the name of the plugin in the confirm message --- lang/en.json | 2 +- .../javascripts/pluginOverview.js | 15 +++++++++++++-- plugins/CorePluginsAdmin/templates/macros.twig | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lang/en.json b/lang/en.json index e0bdeed492d..6aefd3199d8 100644 --- a/lang/en.json +++ b/lang/en.json @@ -718,7 +718,7 @@ "MenuExtend": "Extend", "PluginNotCompatibleWith": "%1$s plugin is not compatible with %2$s.", "PluginAskDevToUpdate": "If you enjoyed this plugin, maybe you can ask the developers to update it to work on the latest Piwik. ", - "UninstallConfirm": "You are about to uninstall a plugin. The plugin will be completely removed from your platform and it won't be recoverable. Are you sure you want to do this?" + "UninstallConfirm": "You are about to uninstall a plugin %s. The plugin will be completely removed from your platform and it won't be recoverable. Are you sure you want to do this?" }, "CoreUpdater": { "PluginDescription": "Piwik updating mechanism", diff --git a/plugins/CorePluginsAdmin/javascripts/pluginOverview.js b/plugins/CorePluginsAdmin/javascripts/pluginOverview.js index 28b4915dd73..8160ddf1efe 100644 --- a/plugins/CorePluginsAdmin/javascripts/pluginOverview.js +++ b/plugins/CorePluginsAdmin/javascripts/pluginOverview.js @@ -7,15 +7,26 @@ $(document).ready(function () { + var uninstallConfirmMessage = ''; + $('#plugins .uninstall').click(function (event) { event.preventDefault(); var link = $(this).attr('href'); - - if (!link) { + var pluginName = $(this).attr('data-pluginName'); + + if (!link || !pluginName) { return; } + if (!uninstallConfirmMessage) { + uninstallConfirmMessage = $('#uninstallPluginConfirm').text(); + } + + var messageToDisplay = uninstallConfirmMessage.replace('%s', pluginName); + + $('#uninstallPluginConfirm').text(messageToDisplay); + piwikHelper.modalConfirm('#confirmUninstallPlugin', { yes: function () { window.location = link; diff --git a/plugins/CorePluginsAdmin/templates/macros.twig b/plugins/CorePluginsAdmin/templates/macros.twig index be90e4e20ce..8f44cca8727 100644 --- a/plugins/CorePluginsAdmin/templates/macros.twig +++ b/plugins/CorePluginsAdmin/templates/macros.twig @@ -92,7 +92,7 @@ {{ 'CorePluginsAdmin_Active'|translate }} {% else %} {{ 'CorePluginsAdmin_Inactive'|translate }}
- - {% if plugin.uninstallable %}uninstall{% endif %} {% endif %}