<% # start of div which has a class 'description', and possibly 'stale_11', 'stale_12', 'stale_13' etc %>
<% if item.done? -%>
<%= format_date( item.completed ) %>
@@ -22,12 +21,10 @@
<%= toggle_show_notes( item ) %>
<% end -%>
- <%= end_form_tag %>
<%= form_remote_tag_edit_todo( item ) -%>
<% #note: edit form will load here remotely -%>
<%= end_form_tag -%>
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/tracks/app/views/todo/add_item.rjs b/tracks/app/views/todo/add_item.rjs
index 83caeb65..79a86559 100644
--- a/tracks/app/views/todo/add_item.rjs
+++ b/tracks/app/views/todo/add_item.rjs
@@ -1,11 +1,11 @@
if @saved
- page.insert_html :bottom, "c#{@item.context_id}", :partial => 'todo/item'
page.hide "status"
page.replace_html "status", content_tag("div", "Added new next action", "class" => "confirmation")
page.visual_effect :appear, 'status', :duration => 0.5
page.replace_html "badge_count", @up_count
page.visual_effect :highlight, "item-#{@item.id}-container", :duration => 3
page.send :record, "Form.reset('todo-form-new-action');Form.focusFirstElement('todo-form-new-action')"
+ page.insert_html :bottom, "c#{@item.context_id}", :partial => 'todo/item'
else
page.hide "status"
page.replace_html "status", content_tag("div", content_tag("h2", "#{pluralize(@item.errors.count, "error")} prohibited this record from being saved") + content_tag("p", "There were problems with the following fields:") + content_tag("ul", @item.errors.each_full { |msg| content_tag("li", msg) }), "id" => "ErrorExplanation", "class" => "ErrorExplanation")
diff --git a/tracks/app/views/todo/toggle_check.rjs b/tracks/app/views/todo/toggle_check.rjs
new file mode 100644
index 00000000..c26069b6
--- /dev/null
+++ b/tracks/app/views/todo/toggle_check.rjs
@@ -0,0 +1,15 @@
+if @saved
+ page.call "fadeAndRemoveItem", "item-#{@item.id}-container"
+ if @item.done?
+ page.insert_html :top, "completed", :partial => 'todo/item'
+ page.visual_effect :highlight, "item-#{@item.id}", {'startcolor' => "'#99ff99'"}
+ else
+ page.call "ensureVisibleWithEffectAppear", "c#{@item.context_id}"
+ page.insert_html :bottom, "c#{@item.context_id}", :partial => 'todo/item'
+ page.visual_effect :highlight, "item-#{@item.id}", {'startcolor' => "'#99ff99'"}
+ end
+ page.hide "status"
+ page.replace_html "badge_count", @down_count
+else
+ page.replace_html "status", content_tag("div", content_tag("h2", "#{pluralize(@item.errors.count, "error")} prohibited this record from being saved") + content_tag("p", "There were problems with the following fields:") + content_tag("ul", @item.errors.each_full { |msg| content_tag("li", msg) }), "id" => "ErrorExplanation", "class" => "ErrorExplanation")
+end
\ No newline at end of file
diff --git a/tracks/public/javascripts/todo-items.js b/tracks/public/javascripts/todo-items.js
index 4a0865f2..9cc0970b 100644
--- a/tracks/public/javascripts/todo-items.js
+++ b/tracks/public/javascripts/todo-items.js
@@ -8,7 +8,6 @@
*/
addEvent(window, "load", addNextActionListingToggles);
-addEvent(window, "load", addAjaxToDoItemCheckmarkHandling);
function addNextActionListingToggles()
{
@@ -19,25 +18,6 @@ function addNextActionListingToggles()
}
}
-function addAjaxToDoItemCheckmarkHandling()
-{
- var itemCheckboxes = document.getElementsByClassName('item-checkbox');
- for(var i = 0; i < itemCheckboxes.length; i++)
- {
- addEvent(itemCheckboxes[i], "click", toggleTodoItemChecked);
- }
-}
-
-function addOneAjaxToDoItemCheckmarkHandling(elem)
-{
- addEvent(document.getElementsByClassName('item-checkbox',elem)[0], "click", toggleTodoItemChecked);
-}
-
-function getMarkUndoneTargetElem()
-{
- return document.getElementsByClassName('container')[0];
-}
-
function ensureVisibleWithEffectAppear(elemId)
{
if ($(elemId).style.display == 'none')
@@ -46,28 +26,6 @@ function ensureVisibleWithEffectAppear(elemId)
}
}
-function toggleTodoItemChecked()
-{
- var itemContainerElem = findNearestParentByClassName(this, 'item-container');
- var itemContainerElemId = itemContainerElem.getAttribute('id');
- var checkboxForm = this.form;
- var markingAsDone = this.checked;
- var targetElemId = markingAsDone ? 'completed' : getMarkUndoneTargetElem().getAttribute('id');
- new Ajax.Updater(
- targetElemId,
- checkboxForm.action,
- {
- asynchronous:true,
- evalScripts:true,
- insertion:markingAsDone ? Insertion.Top : Insertion.Bottom,
- onLoading:function(request){ Form.disable(checkboxForm); removeFlashNotice(); ensureVisibleWithEffectAppear(targetElemId); },
- onSuccess:function(request){ fadeAndRemoveItem(itemContainerElemId); },
- onComplete:function(request){ new Effect.Highlight(itemContainerElemId,{}); addOneAjaxToDoItemCheckmarkHandling($(itemContainerElemId)); },
- parameters:Form.serialize(checkboxForm)
- });
- return false;
-}
-
function fadeAndRemoveItem(itemContainerElemId)
{
var fadingElemId = itemContainerElemId + '-fading';
@@ -76,15 +34,6 @@ function fadeAndRemoveItem(itemContainerElemId)
new Effect.Fade(fadingElemId,{afterFinish:function(effect) { Element.remove(fadingElemId); }, duration:0.4});
}
-function removeFlashNotice()
-{
- var flashNotice = document.getElementById("notice");
- if (flashNotice)
- {
- new Effect.Fade("notice",{afterFinish:function(effect) { Element.remove("notice"); }, duration:0.4});
- }
-}
-
function toggleNextActionListing()
{
var itemsElem = findItemsElem(this);
diff --git a/tracks/public/stylesheets/standard.css b/tracks/public/stylesheets/standard.css
index ed1a627a..06714b7a 100644
--- a/tracks/public/stylesheets/standard.css
+++ b/tracks/public/stylesheets/standard.css
@@ -161,8 +161,12 @@ h2 a:hover {
width: 20px;
}
+.item-container {
+ padding:2px;
+ }
+
.container a.icon {
- float: left;
+ float: left;
vertical-align: middle;
background-color: transparent;
}
@@ -173,11 +177,6 @@ input.item-checkbox {
vertical-align: middle;
}
-.checkbox form {
- display: inline;
- margin: 0;
- }
-
.description {
margin-left: 70px;
margin-right: 10px;
@@ -461,7 +460,7 @@ form {
width: 313px;
}
-.inline-form, .item-checkmark-form {
+.inline-form {
border: none;
padding: 3px;
width: 100%;
@@ -527,7 +526,7 @@ div.message {
#ErrorExplanation {
width: 400px;
- border: 2px solid #red;
+ border: 2px solid red;
padding: 7px;
padding-bottom: 12px;
margin-bottom: 20px;