Adding buttons to select all/no tickboxes in backup views.

This commit is contained in:
chateau 2019-01-12 17:07:16 +01:00
parent 4df9852a50
commit 445e1cdf29
6 changed files with 49 additions and 11 deletions

View file

@ -55,7 +55,7 @@
data['apps'] = {}; data['apps'] = {};
c.api('/apps?with_backup', function(apps_list) { c.api('/apps?with_backup', function(apps_list) {
data['apps'] = apps_list.apps; 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.system_parts = c.groupHooks(Object.keys(data['system']));
data.items = (data['hooks']!={} || data['apps']!=[]); data.items = (data['hooks']!={} || data['apps']!=[]);
data.locale = y18n.locale data.locale = y18n.locale
c.view('backup/backup_info', data); c.view('backup/backup_info', data, c.selectAllOrNone);
}); });
}); });

View file

@ -313,6 +313,19 @@
return box.modal('show'); 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) { arraySortById: function(arr) {
arr.sort(function(a, b){ arr.sort(function(a, b){
if (a.id > b.id) { if (a.id > b.id) {

View file

@ -283,6 +283,8 @@
"save": "Save", "save": "Save",
"search_for_apps": "Search for apps...", "search_for_apps": "Search for apps...",
"select_user": "Select user", "select_user": "Select user",
"select_all": "Select all",
"select_none": "Select none",
"service_description": "Description:", "service_description": "Description:",
"service_log": "%s log", "service_log": "%s log",
"service_start_on_boot": "Start on boot: ", "service_start_on_boot": "Start on boot: ",

View file

@ -221,6 +221,8 @@
"running": "En cours d'execution", "running": "En cours d'execution",
"save": "Sauvegarder", "save": "Sauvegarder",
"select_user": "Choisissez un utilisateur", "select_user": "Choisissez un utilisateur",
"select_all": "Tout sélectionner",
"select_none": "Tout déselectionner",
"service_log": "Journal de %s", "service_log": "Journal de %s",
"service_start_on_boot": "Lancer au démarrage : ", "service_start_on_boot": "Lancer au démarrage : ",
"service_status": "Statut : ", "service_status": "Statut : ",

View file

@ -10,7 +10,14 @@
<form action="#/backup/{{storage.id}}" method="POST" class="form-horizontal"> <form action="#/backup/{{storage.id}}" method="POST" class="form-horizontal">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title"><span class="fa-fw fa-cube"></span> {{t 'system'}}</h2> <h2 class="panel-title">
<span class="fa-fw fa-cube"></span>
{{t 'system'}}
<span class="select_all-none pull-right">
<input type="button" role="select_all" class="btn btn-default slide back select_all" value="{{t 'select_all'}}" />
<input type="button" role="select_none" class="btn btn-default slide back select_none" value="{{t 'select_none'}}" />
</span>
</h2>
</div> </div>
<div class="list-group"> <div class="list-group">
{{#each hooks}} {{#each hooks}}
@ -26,7 +33,14 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title"><span class="fa-fw fa-cubes"></span> {{t 'applications'}}</h2> <h2 class="panel-title">
<span class="fa-fw fa-cubes"></span>
{{t 'applications'}}
<span class="select_all-none pull-right">
<input type="button" role="select_all" class="btn btn-default slide back select_all" value="{{t 'select_all'}}" />
<input type="button" role="select_none" class="btn btn-default slide back select_none" value="{{t 'select_none'}}" />
</span>
</h2>
</div> </div>
<div class="list-group"> <div class="list-group">
{{#each apps}} {{#each apps}}

View file

@ -25,7 +25,14 @@
<form action="#/backup/{{storage.id}}/{{name}}/restore" method="POST" class="form-horizontal"> <form action="#/backup/{{storage.id}}/{{name}}/restore" method="POST" class="form-horizontal">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title"><span class="fa-fw fa-archive"></span> {{t 'backup_content'}}</h2> <h2 class="panel-title">
<span class="fa-fw fa-archive"></span>
{{t 'backup_content'}}
<span class="select_all-none pull-right">
<input type="button" role="select_all" class="btn btn-default slide back select_all" value="{{t 'select_all'}}" />
<input type="button" role="select_none" class="btn btn-default slide back select_none" value="{{t 'select_none'}}" />
</span>
</h2>
</div> </div>
{{#if items}} {{#if items}}
<div class="list-group"> <div class="list-group">