diff --git a/src/js/yunohost/controllers/backup.js b/src/js/yunohost/controllers/backup.js index 5c234462..83cdc83c 100644 --- a/src/js/yunohost/controllers/backup.js +++ b/src/js/yunohost/controllers/backup.js @@ -55,7 +55,7 @@ data['apps'] = {}; c.api('/apps?with_backup', function(apps_list) { data['apps'] = apps_list.apps; - c.view('backup/backup_create', data); + c.view('backup/backup_create', data, c.selectAllOrNone); }); }); }); @@ -137,7 +137,7 @@ data.system_parts = c.groupHooks(Object.keys(data['system'])); data.items = (data['hooks']!={} || data['apps']!=[]); data.locale = y18n.locale - c.view('backup/backup_info', data); + c.view('backup/backup_info', data, c.selectAllOrNone); }); }); diff --git a/src/js/yunohost/helpers.js b/src/js/yunohost/helpers.js index c7aca7b3..101554f8 100644 --- a/src/js/yunohost/helpers.js +++ b/src/js/yunohost/helpers.js @@ -174,7 +174,7 @@ // Open a WebSocket connection to retrieve live messages from the moulinette var ws = new WebSocket('wss://'+ store.get('url') +'/messages'); // Flag to avoid to call twice the API - // We need to set that in ws object as we need to use it in ws.onopen + // We need to set that in ws object as we need to use it in ws.onopen // and several ws object could be running at the same time... ws.api_called = false; ws.onmessage = function(evt) { @@ -190,7 +190,7 @@ }; ws.onclose = function() { }; - + ws.onopen = function () { if (!ws.api_called) { ws.api_called = true; @@ -313,6 +313,19 @@ return box.modal('show'); }, + selectAllOrNone: function () { + // Remove active style from buttons + $(".select_all-none input").click(function(){ $(this).toggleClass("active"); }); + // Select all checkbox in this panel + $(".select_all").click(function(){ + $(this).parents(".panel").children(".list-group").find("input").prop("checked", true); + }); + // Deselect all checkbox in this panel + $(".select_none").click(function(){ + $(this).parents(".panel").children(".list-group").find("input").prop("checked", false); + }); + }, + arraySortById: function(arr) { arr.sort(function(a, b){ if (a.id > b.id) { @@ -367,15 +380,15 @@ description:(group_id==hook)?y18n.t('hook_'+hook+'_desc'):y18n.t('hook_'+hook) }; } - }); + }); return data; }, - + ungroupHooks: function(system_parts,apps) { var data = {}; data['apps'] = apps || []; data['system'] = system_parts || []; - + if (data['system'].constructor !== Array) { data['system'] = [data['system']]; } diff --git a/src/locales/en.json b/src/locales/en.json index a9af68b3..40c7c994 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -281,8 +281,10 @@ "run": "Run", "running": "Running", "save": "Save", - "search_for_apps": "Search for apps...", + "search_for_apps": "Search for apps...", "select_user": "Select user", + "select_all": "Select all", + "select_none": "Select none", "service_description": "Description:", "service_log": "%s log", "service_start_on_boot": "Start on boot: ", diff --git a/src/locales/fr.json b/src/locales/fr.json index a5791cd2..027479fa 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -221,6 +221,8 @@ "running": "En cours d'execution", "save": "Sauvegarder", "select_user": "Choisissez un utilisateur", + "select_all": "Tout sélectionner", + "select_none": "Tout déselectionner", "service_log": "Journal de %s", "service_start_on_boot": "Lancer au démarrage : ", "service_status": "Statut : ", diff --git a/src/views/backup/backup_create.ms b/src/views/backup/backup_create.ms index b2e527c6..e354e9e1 100644 --- a/src/views/backup/backup_create.ms +++ b/src/views/backup/backup_create.ms @@ -10,7 +10,14 @@
-

{{t 'system'}}

+

+ + {{t 'system'}} + + + + +

{{#each hooks}} @@ -26,7 +33,14 @@
-

{{t 'applications'}}

+

+ + {{t 'applications'}} + + + + +

{{#each apps}} diff --git a/src/views/backup/backup_info.ms b/src/views/backup/backup_info.ms index a891612f..b212ebde 100644 --- a/src/views/backup/backup_info.ms +++ b/src/views/backup/backup_info.ms @@ -25,7 +25,14 @@
-

{{t 'backup_content'}}

+

+ + {{t 'backup_content'}} + + + + +

{{#if items}}