Permalink
Browse files

todo line is checked after page reload, if necessary

  • Loading branch information...
1 parent a05eb5e commit 4b2becdb1863c42e8c7c767e6bfae5adbe5b7653 @cedricss cedricss committed Mar 7, 2012
Showing with 11 additions and 3 deletions.
  1. +2 −0 resources/style.css
  2. +9 −3 src/todo.opa
View
@@ -150,6 +150,8 @@ ul#todo_list .display:hover .icon.icon-remove {display:inline-block;}
.todo_content {padding:0 3px;font-size:18px; line-height:22px;color:#6C6B66;}
+.done .todo_content{text-decoration: line-through;}
+
/* Edit input */
#todo_list .editing .display, #todo_list .edit {display: none;}
#todo_list .editing .edit {display: block;}
View
@@ -79,12 +79,18 @@ module Todo {
}
function add_todo_to_page(string id, string value, bool is_done) {
+ done = if (is_done) "done" else ""
+ checkbox = if (is_done) {
+ <input checked="yes" class="check" type="checkbox" onclick={function(_){make_done(id)}}/>
+ }else{
+ <input class="check" type="checkbox" onclick={function(_){make_done(id)}}/>
+ }
line =
- <li><div class="todo {if (is_done) "done" else ""}" id={ id }>
+ <li><div class="todo {done}" id={ id }>
<div class="display">
<span id={id^"_destroy"} class="todo_destroy icon icon-remove" onclick={function(_){remove_item(id)}}></span>
- <input class="check" type="checkbox" onclick={function(_){make_done(id)}}/>
- <div id={id^"_todo"} class="todo_content" onclick={function(_){make_editable(id, value)}}>{ value }</div>
+ {checkbox}
+ <div id={id^"_todo"} class="todo_content" onclick={function(_){ if (is_done) { }else{ make_editable(id, value) }}}>{ value }</div>
</div>
</div></li>
Dom.transform([#todo_list =+ line]);

0 comments on commit 4b2becd

Please sign in to comment.