Improve checked mark

This commit is contained in:
Benjamin Renard 2017-09-17 23:37:44 +02:00
parent e17152537c
commit 8f0d90a209
2 changed files with 21 additions and 10 deletions

View file

@ -18,10 +18,21 @@ div.panel-heading, li.list-group-item, a {
text-align: center;
}
.done {
.checkable:before {
content: '\2713';
margin-right: 0.2em;
font-style: italic;
color: #999;
text-decoration: line-through;
visibility: hidden;
}
.checked {
font-style: italic;
color: #999;
}
.checked:before {
visibility: visible;
}
.center {

View file

@ -333,11 +333,11 @@ on_li_click=function(event) {
return;
}
var li=$(this);
if (li.hasClass('done')) {
li.removeClass('done');
if (li.hasClass('checked')) {
li.removeClass('checked');
}
else {
li.addClass('done');
li.addClass('checked');
}
var ul=li.parent();
var scase=scases.byName($('#cats').data('scase'));
@ -346,7 +346,7 @@ on_li_click=function(event) {
if (cat) {
var thing=cat.byLabel(li.data('label'));
if (thing) {
thing.setChecked(li.hasClass('done'));
thing.setChecked(li.hasClass('checked'));
scases.save();
}
show_scase(scase,cat.name);
@ -584,12 +584,12 @@ show_cat=function(cat,displayed) {
if (cat.things[idx].removed) {
continue;
}
var li=$('<li class="list-group-item" data-label="'+cat.things[idx].label+'">'+cat.things[idx].label+'</li>');
var li=$('<li class="list-group-item checkable" data-label="'+cat.things[idx].label+'">'+cat.things[idx].label+'</li>');
if (cat.things[idx].nb>1) {
li.append(' <em>('+cat.things[idx].nb+')</em>');
}
if (cat.things[idx].checked) {
li.addClass('done');
li.addClass('checked');
}
li.bind('click',on_li_click);