Rework on home page
This commit is contained in:
parent
f591a94c40
commit
93caf40a09
3 changed files with 38 additions and 4 deletions
|
@ -481,9 +481,19 @@ on_back_to_scases_btn_click=function(e) {
|
|||
* Show scases
|
||||
*******************/
|
||||
show_scases=function() {
|
||||
clear_page('<ul class="list-group" id="scases"></ul>');
|
||||
clear_page('<h3>Vos valises</h3><ul class="list-group" id="scases"></ul>');
|
||||
scases.each(function(idx,scase) {
|
||||
var li=$('<li class="list-group-item" data-name="'+scase.name+'">'+scase.name+'</li>');
|
||||
var stats=scase.stats();
|
||||
var tag='<span class="count-tag pull-right">';
|
||||
if (stats.things==stats.done) {
|
||||
tag+='<span class="label label-success"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span></span>';
|
||||
}
|
||||
else {
|
||||
tag+='<span class="badge">'+stats.done+' / '+stats.things+'</span>';
|
||||
}
|
||||
tag+='</span>';
|
||||
|
||||
var li=$('<li class="list-group-item" data-name="'+scase.name+'"><span class="scase-name"><span class="glyphicon glyphicon-briefcase" aria-hidden="true"></span> '+scase.name+'</span>'+tag+'</li>');
|
||||
li.bind('click',on_scase_click);
|
||||
$('#scases').append(li);
|
||||
});
|
||||
|
|
|
@ -215,8 +215,24 @@ function SCase(name,data) {
|
|||
return false;
|
||||
}
|
||||
|
||||
this.count=function() {
|
||||
return this.cats.length;
|
||||
this.stats=function() {
|
||||
var cats=0;
|
||||
var things=0;
|
||||
var things_done=0;
|
||||
this.cats.each(function(cidx,cat) {
|
||||
cats++;
|
||||
for (idx in cat.things) {
|
||||
things++;
|
||||
if (cat.things[idx].checked) {
|
||||
things_done++;
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
'cats': cats,
|
||||
'things': things,
|
||||
'done': things_done
|
||||
}
|
||||
}
|
||||
|
||||
this.reset=function() {
|
||||
|
|
|
@ -37,6 +37,14 @@ div.panel-heading, li.list-group-item, a {
|
|||
color: #999;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.scase-name {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body>
|
||||
|
|
Loading…
Reference in a new issue