Improve checked mark
Benjamin Renard

Benjamin Renard commited on 2017-09-17 21:37:44
Showing 2 changed files, with 19 additions and 8 deletions.

... ...
@@ -18,10 +18,21 @@ div.panel-heading, li.list-group-item, a {
18 18
   text-align: center;
19 19
 }
20 20
 
21
-.done {
21
+.checkable:before {
22
+  content: '\2713';
23
+  margin-right: 0.2em;
22 24
   font-style: italic;
23 25
   color: #999;
24
-	text-decoration: line-through;
26
+  visibility: hidden;
27
+}
28
+
29
+.checked {
30
+  font-style: italic;
31
+  color: #999;
32
+}
33
+
34
+.checked:before {
35
+  visibility: visible;
25 36
 }
26 37
 
27 38
 .center {
... ...
@@ -333,11 +333,11 @@ on_li_click=function(event) {
333 333
     return;
334 334
   }
335 335
   var li=$(this);
336
-  if (li.hasClass('done')) {
337
-    li.removeClass('done');
336
+  if (li.hasClass('checked')) {
337
+    li.removeClass('checked');
338 338
   }
339 339
   else {
340
-    li.addClass('done');
340
+    li.addClass('checked');
341 341
   }
342 342
   var ul=li.parent();
343 343
   var scase=scases.byName($('#cats').data('scase'));
... ...
@@ -346,7 +346,7 @@ on_li_click=function(event) {
346 346
     if (cat) {
347 347
       var thing=cat.byLabel(li.data('label'));
348 348
       if (thing) {
349
-        thing.setChecked(li.hasClass('done'));
349
+        thing.setChecked(li.hasClass('checked'));
350 350
         scases.save();
351 351
       }
352 352
       show_scase(scase,cat.name);
... ...
@@ -584,12 +584,12 @@ show_cat=function(cat,displayed) {
584 584
     if (cat.things[idx].removed) {
585 585
       continue;
586 586
     }
587
-    var li=$('<li class="list-group-item" data-label="'+cat.things[idx].label+'">'+cat.things[idx].label+'</li>');
587
+    var li=$('<li class="list-group-item checkable" data-label="'+cat.things[idx].label+'">'+cat.things[idx].label+'</li>');
588 588
     if (cat.things[idx].nb>1) {
589 589
       li.append(' <em>('+cat.things[idx].nb+')</em>');
590 590
     }
591 591
     if (cat.things[idx].checked) {
592
-      li.addClass('done');
592
+      li.addClass('checked');
593 593
     }
594 594
     li.bind('click',on_li_click);
595 595
 
596 596