Add reset scase feature
This commit is contained in:
parent
4499c9c95c
commit
f591a94c40
4 changed files with 37 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
||||||
CACHE MANIFEST
|
CACHE MANIFEST
|
||||||
# Date : 2016/09/06 - Version : 6
|
# Date : 2016/09/07 - Version : 1
|
||||||
|
|
||||||
CACHE:
|
CACHE:
|
||||||
index.html
|
index.html
|
||||||
|
|
|
@ -133,6 +133,21 @@ on_close_copy_scase_modal=function () {
|
||||||
$('#copy_scase_modal form')[0].reset();
|
$('#copy_scase_modal form')[0].reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************
|
||||||
|
* Reset scase
|
||||||
|
**********************/
|
||||||
|
on_reset_scase_btn_click=function(event) {
|
||||||
|
navbar_collapse_hide();
|
||||||
|
var scase=scases.byName($('#cats').data('scase'));
|
||||||
|
if (scase) {
|
||||||
|
myconfirm('Voulez-vous vraiment réinitialiser la valise '+$('#cats').data('scase')+' ?',
|
||||||
|
function(data) {
|
||||||
|
scases.resetSCase(scase.name);
|
||||||
|
scases.save();
|
||||||
|
show_scase(scase);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
/***********************
|
/***********************
|
||||||
* Delete scase
|
* Delete scase
|
||||||
**********************/
|
**********************/
|
||||||
|
@ -603,6 +618,7 @@ $( document ).ready( function() {
|
||||||
$("#copy_scase_modal").on('hidden.bs.modal',on_close_copy_scase_modal);
|
$("#copy_scase_modal").on('hidden.bs.modal',on_close_copy_scase_modal);
|
||||||
$("#copy_scase_modal form").bind('submit',on_valid_copy_scase_modal);
|
$("#copy_scase_modal form").bind('submit',on_valid_copy_scase_modal);
|
||||||
|
|
||||||
|
$('#reset_scase_btn').bind('click',on_reset_scase_btn_click);
|
||||||
$('#delete_scase_btn').bind('click',on_delete_scase_btn_click);
|
$('#delete_scase_btn').bind('click',on_delete_scase_btn_click);
|
||||||
|
|
||||||
$('#add_cat_btn').bind('click',on_add_cat_btn_click);
|
$('#add_cat_btn').bind('click',on_add_cat_btn_click);
|
||||||
|
|
|
@ -181,6 +181,14 @@ function SCaseList() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.resetSCase=function(name) {
|
||||||
|
for (el in this) {
|
||||||
|
if (this.isSCase(this[el]) && this[el].name==name) {
|
||||||
|
return this[el].reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function SCase(name,data) {
|
function SCase(name,data) {
|
||||||
|
@ -211,6 +219,17 @@ function SCase(name,data) {
|
||||||
return this.cats.length;
|
return this.cats.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.reset=function() {
|
||||||
|
this.cats.each(function(idx,cat) {
|
||||||
|
for (idx in cat.things) {
|
||||||
|
if (cat.things[idx].checked) {
|
||||||
|
cat.things[idx].checked=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Contructor
|
* Contructor
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -62,6 +62,7 @@ div.panel-heading, li.list-group-item, a {
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<li><a href="#rename_scase" id="rename_scase_btn"><span class="glyphicon glyphicon-edit"></span> Renommer la valise</a></li>
|
<li><a href="#rename_scase" id="rename_scase_btn"><span class="glyphicon glyphicon-edit"></span> Renommer la valise</a></li>
|
||||||
<li><a href="#copy_scase" id="copy_scase_btn"><span class="glyphicon glyphicon-duplicate"></span> Copier la valise</a></li>
|
<li><a href="#copy_scase" id="copy_scase_btn"><span class="glyphicon glyphicon-duplicate"></span> Copier la valise</a></li>
|
||||||
|
<li><a href="#reset_scase" id="reset_scase_btn"><span class="glyphicon glyphicon-cog"></span> Réinitialiser la valise</a></li>
|
||||||
<li><a href="#delete_scase" id="delete_scase_btn"><span class="glyphicon glyphicon-trash"></span> Supprimer la valise</a></li>
|
<li><a href="#delete_scase" id="delete_scase_btn"><span class="glyphicon glyphicon-trash"></span> Supprimer la valise</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in a new issue