Fix #500 (when moving an action to an empy context , a wrong message is shown). Thanks, lrbalt!

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@530 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2007-04-15 23:04:16 +00:00
parent 2ff03c573e
commit fd5b871839
3 changed files with 24 additions and 12 deletions

View file

@ -12,20 +12,10 @@
<td class="label"><label for="todo_notes">Notes</label></td>
<td><%= text_area( "todo", "notes", "cols" => 20, "rows" => 5, "tabindex" => 9) %></td>
</tr>
<tr>
<td class="label"><label for="<%= dom_id(@todo, 'context_name') %>">Context</label></td>
<td><input id="<%= dom_id(@todo, 'context_name') %>" name="context_name" autocomplete="off" tabindex="10" size="25" type="text" value="<%= @todo.context.name %>" />
<div class="page_name_auto_complete" id="<%= dom_id(@todo, 'context_list') %>" style="display:none"></div></td>
<script type="text/javascript">
editFormContextAutoCompleter = new Autocompleter.Local('<%= dom_id(@todo, 'context_name') %>', '<%= dom_id(@todo, 'context_list') %>', <%= context_names_for_autocomplete %>, {choices:100,autoSelect:false});
Event.observe($('<%= dom_id(@todo, 'context_name') %>'), "focus", editFormContextAutoCompleter.activate.bind(editFormContextAutoCompleter));
Event.observe($('<%= dom_id(@todo, 'context_name') %>'), "click", editFormContextAutoCompleter.activate.bind(editFormContextAutoCompleter));
</script>
</tr>
<tr>
<td class="label"><label for="<%= dom_id(@todo, 'project_name') %>">Project</label></td>
<td>
<input id="<%= dom_id(@todo, 'project_name') %>" name="project_name" autocomplete="off" tabindex="11" size="25" type="text" value="<%= @todo.project.nil? ? 'None' : @todo.project.name %>" />
<input id="<%= dom_id(@todo, 'project_name') %>" name="project_name" autocomplete="off" tabindex="10" size="25" type="text" value="<%= @todo.project.nil? ? 'None' : @todo.project.name %>" />
<div class="page_name_auto_complete" id="<%= dom_id(@todo, 'project_list') %>" style="display:none"></div>
</td>
<script type="text/javascript">
@ -34,6 +24,16 @@
Event.observe($('<%= dom_id(@todo, 'project_name') %>'), "click", editFormProjectAutoCompleter.activate.bind(editFormProjectAutoCompleter));
</script>
</tr>
<tr>
<td class="label"><label for="<%= dom_id(@todo, 'context_name') %>">Context</label></td>
<td><input id="<%= dom_id(@todo, 'context_name') %>" name="context_name" autocomplete="off" tabindex="11" size="25" type="text" value="<%= @todo.context.name %>" />
<div class="page_name_auto_complete" id="<%= dom_id(@todo, 'context_list') %>" style="display:none"></div></td>
<script type="text/javascript">
editFormContextAutoCompleter = new Autocompleter.Local('<%= dom_id(@todo, 'context_name') %>', '<%= dom_id(@todo, 'context_list') %>', <%= context_names_for_autocomplete %>, {choices:100,autoSelect:false});
Event.observe($('<%= dom_id(@todo, 'context_name') %>'), "focus", editFormContextAutoCompleter.activate.bind(editFormContextAutoCompleter));
Event.observe($('<%= dom_id(@todo, 'context_name') %>'), "click", editFormContextAutoCompleter.activate.bind(editFormContextAutoCompleter));
</script>
</tr>
<tr>
<td class="label"><label for="<%= dom_id(@todo, 'tag_list') %>">Tags (separate with commas)</label></td>
<td><%= text_field_tag "tag_list", @todo.tags.collect{|t| t.name}.join(", "), :size => 40, :tabindex => 12 %></td>
@ -50,7 +50,7 @@
<input type="hidden" name="on_project_page" value="true" />
<% end -%>
<tr>
<td colspan="2"><input type="submit" value="Update" tabindex="14" />
<td colspan="2"><input id="<%= dom_id(@todo, 'submit') %>" type="submit" value="Update" tabindex="14" />
<a href="javascript:void(0);" onclick="Element.toggle('<%= dom_id(@todo, 'line') %>');Element.toggle('<%= dom_id(@todo, 'edit') %>');">Cancel</a></td>
</tr>
</table>

View file

@ -18,6 +18,7 @@ if @saved
if source_view_is(:todo) && @todo.active?
page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@todo.context_id}"
page.call "todoItems.expandNextActionListingByContext", "c#{@todo.context_id}items", true
page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil?
page.insert_html :bottom, "c#{@todo.context_id}items", :partial => 'todos/todo', :locals => { :parent_container_type => parent_container_type }
end
page.replace_html("badge_count", @remaining_undone_in_context) if source_view_is :context

View file

@ -0,0 +1,11 @@
setup :fixtures => :all
login :as => 'admin'
open "/"
click "edit_icon_todo_12"
wait_for_visible "context_name_todo_12"
type "context_name_todo_12", "errand"
click "submit_todo_12"
wait_for_element_not_present "css=#c1 #todo_12"
wait_for_visible "c4"
wait_for_visible "css=#c4 #todo_12"
assert_not_visible "c4empty-nd"