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; text-align: center;
} }
.done { .checkable:before {
content: '\2713';
margin-right: 0.2em;
font-style: italic; font-style: italic;
color: #999; color: #999;
text-decoration: line-through; visibility: hidden;
}
.checked {
font-style: italic;
color: #999;
}
.checked:before {
visibility: visible;
} }
.center { .center {

View file

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