Skip to content

Commit

Permalink
refs #546 ask for confirmation before uninstalling a plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
tsteur committed Sep 30, 2013
1 parent 8b8d680 commit cc2d24c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lang/en.json
Expand Up @@ -717,7 +717,8 @@
"MenuPlatform": "Platform",
"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. "
"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?"
},
"CoreUpdater": {
"PluginDescription": "Piwik updating mechanism",
Expand Down
1 change: 1 addition & 0 deletions plugins/CorePluginsAdmin/CorePluginsAdmin.php
Expand Up @@ -89,6 +89,7 @@ public function getJsFiles(&$jsFiles)
{
$jsFiles[] = "plugins/CoreHome/javascripts/popover.js";
$jsFiles[] = "plugins/CorePluginsAdmin/javascripts/pluginDetail.js";
$jsFiles[] = "plugins/CorePluginsAdmin/javascripts/pluginOverview.js";
}

}
26 changes: 26 additions & 0 deletions plugins/CorePluginsAdmin/javascripts/pluginOverview.js
@@ -0,0 +1,26 @@
/*!
* Piwik - Web Analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/

$(document).ready(function () {

$('#plugins .uninstall').click(function (event) {
event.preventDefault();

var link = $(this).attr('href');

if (!link) {
return;
}

piwikHelper.modalConfirm('#confirmUninstallPlugin', {
yes: function () {
window.location = link;
}
});
});

});
10 changes: 9 additions & 1 deletion plugins/CorePluginsAdmin/templates/macros.twig
Expand Up @@ -43,6 +43,14 @@

{% macro tablePlugins(pluginsInfo, activateNonce, deactivateNonce, uninstallNonce, isTheme) %}

<div id="confirmUninstallPlugin" class="ui-confirm">

<h2 id="uninstallPluginConfirm">{{ 'CorePluginsAdmin_UninstallConfirm'|translate }}</h2>
<input role="yes" type="button" value="{{ 'General_Yes'|translate }}"/>
<input role="no" type="button" value="{{ 'General_No'|translate }}"/>

</div>

<div class='entityContainer'>
<table class="dataTable entityTable">
<thead>
Expand Down Expand Up @@ -84,7 +92,7 @@
{{ 'CorePluginsAdmin_Active'|translate }}
{% else %}
{{ 'CorePluginsAdmin_Inactive'|translate }} <br/>
- {% if plugin.uninstallable %}<a href='index.php?module=CorePluginsAdmin&action=uninstall&pluginName={{ name }}&nonce={{
- {% if plugin.uninstallable %}<a class="uninstall" href='index.php?module=CorePluginsAdmin&action=uninstall&pluginName={{ name }}&nonce={{
uninstallNonce }}'>uninstall</a>{% endif %}
{% endif %}
</td>
Expand Down

0 comments on commit cc2d24c

Please sign in to comment.