diff --git a/src/js/yunohost/controllers/apps.js b/src/js/yunohost/controllers/apps.js index 870545d3..f7fc2edb 100644 --- a/src/js/yunohost/controllers/apps.js +++ b/src/js/yunohost/controllers/apps.js @@ -215,7 +215,36 @@ data.manifest.multi_instance = data.manifest.multi_instance ? y18n.t('yes') : y18n.t('no'); data.install_time = new Date(data.settings.install_time * 1000); - c.view('app/app_info', data); + c.view('app/app_info', data, function() { + + // Button to set the app as default + $('button[data-action="set-as-default"]').on("click", function() { + var app = $(this).data("app"); + c.confirm( + y18n.t('applications'), + y18n.t('confirm_app_default'), + function() { + c.api('PUT', '/apps/'+app+'/default', {}, function() { + c.redirect_to('#/apps/'+ app, {slide:false}); + }); + } + ); + }); + + // Button to uninstall the app + $('button[data-action="uninstall"]').on("click", function() { + var app = $(this).data("app"); + c.confirm( + y18n.t('applications'), + y18n.t('confirm_uninstall', [app]), + function() { + c.api('DELETE', '/apps/'+ app, {}, function() { + c.redirect_to('#/apps'); + }); + } + ); + }); + }); }); }); @@ -226,6 +255,10 @@ }); }); + // + // App actions + // + // Get app actions list app.get('#/apps/:app/actions', function (c) { c.api('GET', '/apps/'+c.params['app']+'/actions', {}, function(data) { @@ -269,6 +302,10 @@ }); }); + // + // App config panel + // + // Get app config panel app.get('#/apps/:app/config-panel', function (c) { c.api('GET', '/apps/'+c.params['app']+'/config-panel', {}, function(data) { @@ -593,19 +630,6 @@ ); }); - // Remove installed app - app.get('#/apps/:app/uninstall', function (c) { - c.confirm( - y18n.t('applications'), - y18n.t('confirm_uninstall', [c.params['app']]), - function() { - c.api('DELETE', '/apps/'+ c.params['app'], {}, function() { - c.redirect_to('#/apps'); - }); - } - ); - }); - // Manage app access app.get('#/apps/:app/access', function (c) { c.api('GET', '/apps/'+c.params['app']+'?raw', {}, function(data) { @@ -729,19 +753,6 @@ ); }); - // Make app default - app.get('#/apps/:app/default', function (c) { - c.confirm( - y18n.t('applications'), - y18n.t('confirm_app_default'), - function() { - c.api('PUT', '/apps/'+c.params['app']+'/default', {}, function() { - c.redirect_to('#/apps/'+ c.params['app'], {slide:false}); - }); - } - ); - }); - // Get app change label page app.get('#/apps/:app/changelabel', function (c) { c.api('GET', '/apps/'+c.params['app']+'?raw', {}, function(app_data) { diff --git a/src/views/app/app_info.ms b/src/views/app/app_info.ms index 4ccfa1dc..17a71c75 100644 --- a/src/views/app/app_info.ms +++ b/src/views/app/app_info.ms @@ -56,9 +56,9 @@

{{t 'app_info_default_desc' settings.domain}}

- +

@@ -78,9 +78,9 @@

{{t 'app_info_uninstall_desc'}}

- +