diff options
author | Georg Ehrke <developer@georgehrke.com> | 2014-05-31 17:50:39 +0200 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2014-05-31 17:50:39 +0200 |
commit | 020255b4e545413fd724fbd397662f6c4265caa3 (patch) | |
tree | b2b552307d14c571f2e800760c892e1ea3d17c53 /settings | |
parent | c8636ca4d9528faf42b1cd877bb73e56d26244cf (diff) | |
download | nextcloud-server-020255b4e545413fd724fbd397662f6c4265caa3.tar.gz nextcloud-server-020255b4e545413fd724fbd397662f6c4265caa3.zip |
add button for properly uninstalling apps
Diffstat (limited to 'settings')
-rw-r--r-- | settings/js/apps.js | 28 | ||||
-rw-r--r-- | settings/routes.php | 2 | ||||
-rw-r--r-- | settings/templates/apps.php | 1 |
3 files changed, 31 insertions, 0 deletions
diff --git a/settings/js/apps.js b/settings/js/apps.js index 05db4c9a048..5045992184c 100644 --- a/settings/js/apps.js +++ b/settings/js/apps.js @@ -69,6 +69,14 @@ OC.Settings.Apps = OC.Settings.Apps || { page.find('input.update').hide(); } + if (app.removable !== false) { + page.find('input.uninstall').show(); + page.find('input.uninstall').data('appid', app.id); + page.find('input.uninstall').attr('value', t('settings', 'Uninstall App')); + } else { + page.find('input.uninstall').hide(); + } + page.find('input.enable').show(); page.find('input.enable').val((app.active) ? t('settings', 'Disable') : t('settings', 'Enable')); page.find('input.enable').data('appid', app.id); @@ -158,6 +166,19 @@ OC.Settings.Apps = OC.Settings.Apps || { } },'json'); }, + uninstallApp:function(appid, element) { + console.log('uninstall app:', appid, element); + element.val(t('settings','Uninstalling ....')); + $.post(OC.filePath('settings','ajax','uninstallapp.php'),{appid:appid},function(result) { + if(!result || result.status !== 'success') { + OC.Settings.Apps.showErrorMessage(t('settings','Error while uninstalling app'),t('settings','Error')); + element.val(t('settings','Uninstall')); + } else { + OC.Settings.Apps.removeNavigation(appid); + appitem.removeClass('active'); + } + },'json'); + }, insertApp:function(appdata) { var applist = $('#app-navigation ul li'); @@ -280,6 +301,13 @@ $(document).ready(function(){ OC.Settings.Apps.updateApp(appid, element); } }); + $('#app-content input.uninstall').click(function(){ + var element = $(this); + var appid=$(this).data('appid'); + if(appid) { + OC.Settings.Apps.uninstallApp(appid, element); + } + }); if(appid) { var item = $('#app-navigation ul li[data-id="'+appid+'"]'); diff --git a/settings/routes.php b/settings/routes.php index 0e0f293b9be..433c5d5706e 100644 --- a/settings/routes.php +++ b/settings/routes.php @@ -67,6 +67,8 @@ $this->create('settings_ajax_disableapp', '/settings/ajax/disableapp.php') ->actionInclude('settings/ajax/disableapp.php'); $this->create('settings_ajax_updateapp', '/settings/ajax/updateapp.php') ->actionInclude('settings/ajax/updateapp.php'); +$this->create('settings_ajax_uninstallapp', '/settings/ajax/uninstallapp.php') + ->actionInclude('settings/ajax/uninstallapp.php'); $this->create('settings_ajax_navigationdetect', '/settings/ajax/navigationdetect.php') ->actionInclude('settings/ajax/navigationdetect.php'); $this->create('apps_custom', '/settings/js/apps-custom.js') diff --git a/settings/templates/apps.php b/settings/templates/apps.php index b7f3b6121ad..e2bc78b07fa 100644 --- a/settings/templates/apps.php +++ b/settings/templates/apps.php @@ -53,6 +53,7 @@ print_unescaped($l->t('<span class="licence"></span>-licensed by <span class="author"></span>'));?></p> <input class="enable hidden" type="submit" /> <input class="update hidden" type="submit" value="<?php p($l->t('Update')); ?>" /> + <input class="uninstall hidden" type="submit" value="<?php p($l->t('Uninstall')); ?>"/> <div class="warning hidden"></div> </div> </div> |