+

Improve checked mark

Benjamin Renard [2017-09-17 21:37:44]
Improve checked mark
Filename
public_html/inc/main.css
public_html/inc/main.js
diff --git a/public_html/inc/main.css b/public_html/inc/main.css
index 21c519b..455fe34 100644
--- a/public_html/inc/main.css
+++ b/public_html/inc/main.css
@@ -18,10 +18,21 @@ div.panel-heading, li.list-group-item, a {
   text-align: center;
 }

-.done {
-	font-style: italic;
-	color: #999;
-	text-decoration: line-through;
+.checkable:before {
+  content: '\2713';
+  margin-right: 0.2em;
+  font-style: italic;
+  color: #999;
+  visibility: hidden;
+}
+
+.checked {
+  font-style: italic;
+  color: #999;
+}
+
+.checked:before {
+  visibility: visible;
 }

 .center {
diff --git a/public_html/inc/main.js b/public_html/inc/main.js
index 27c454c..31e7917 100644
--- a/public_html/inc/main.js
+++ b/public_html/inc/main.js
@@ -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);
ViewGit