Fixes #439 (Can't toggle contexts on todo index page). Not sure I quite understand why this was broken, but we should be able to migrate a lot of code out of todo-items.js over time.

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@439 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2007-02-13 06:48:45 +00:00
parent 21cd0f04cf
commit 3dbc39113e
2 changed files with 17 additions and 3 deletions

View file

@ -3,6 +3,22 @@
<h2>
<% if collapsible -%>
<a href="#" class="container_toggle" id="toggle_c<%= context.id %>"><%= image_tag("collapse.png") %></a>
<% apply_behavior '.container_toggle:click', :prevent_default => true do |page|
page << "containerElem = this.up('.container')
toggleTarget = containerElem.down('.toggle_target')
if (Element.visible(toggleTarget))
{
todoItems.collapseNextActionListing(this, toggleTarget);
todoItems.contextCollapseCookieManager.setCookie(todoItems.buildCookieName(containerElem), true)
}
else
{
todoItems.expandNextActionListing(this, toggleTarget);
todoItems.contextCollapseCookieManager.clearCookie(todoItems.buildCookieName(containerElem))
}
"
end
%>
<% end -%>
<% if source_view_is :context %>
<%= in_place_editor_field :context, :name, {}, { :url => url_for(:controller => 'context', :action => 'update', :id => context.id, :field => 'name', :wants_render => false) } %>

View file

@ -30,10 +30,8 @@ ToDoItems.prototype = {
this.toggleContainerMap[toggleElem.id] = containerElem;
this.toggleItemsMap[toggleElem.id] = itemsElem;
this.containerItemsMap[containerElem.id] = itemsElem;
Event.observe(this.containerToggles[i], 'click', containerTogglesClick);
this.containerToggles[i].onclick = function() {return false;}; //workaround for Event.stop problem with Safari 2.0.3. See http://particletree.com/notebook/eventstop/
}
this.setNextActionListingTogglesToCookiedState();
this.setNextActionListingTogglesToCookiedState();
},
setNextActionListingTogglesToCookiedState: function()
{