diff --git a/tracks/app/views/contexts/_context.rhtml b/tracks/app/views/contexts/_context.rhtml index 82a377e5..62014a76 100644 --- a/tracks/app/views/contexts/_context.rhtml +++ b/tracks/app/views/contexts/_context.rhtml @@ -3,6 +3,22 @@

<% if collapsible -%> <%= image_tag("collapse.png") %> + <% 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) } %> diff --git a/tracks/public/javascripts/todo-items.js b/tracks/public/javascripts/todo-items.js index 12e0d92f..09ee89f9 100644 --- a/tracks/public/javascripts/todo-items.js +++ b/tracks/public/javascripts/todo-items.js @@ -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() {