Deleted projects and contexts now properly disappear in the Ajax 'fade' style when the delete button is clicked.

References to context.reset and project.reset are replaced by the correct Form.reset. Also replaced all instances of Form.focus_first with the correct Form.focusFirstElement.

Tidied up the edit forms on the projects and contexts pages. There's a weird visual bug in Safari (doesn't happen in Firefox), where the selected input box appears to be empty and unselected. However, if you type, your input will replace the previous text, and if you tab immediately to another field, you'll see that the input field was '''not''' actually empty.


git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@150 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
bsag 2005-10-12 12:51:14 +00:00
parent 5e4f0f9fe8
commit cc001264fc
9 changed files with 42 additions and 43 deletions

View file

@ -2,13 +2,12 @@
@context = context_form
%>
<%= error_messages_for 'context' %>
<div class="position">
<%= @context.position %>
</div>
<div class="data">
<label for="context_name">Name</label>
<%= text_field 'context', 'name', :class => 'context-name' %>
<label for="context_hide">Hidden?</label>
<%= check_box 'context', 'hide', :class => 'context-hide' %>
</div>
<tr>
<td width="150"><label for="context_name">Name</label></td>
<td width="300"><%= text_field 'context', 'name', :class => 'context-name' %></td>
</tr>
<tr>
<td width="150"><label for="context_hide">Hidden?</label></td>
<td width="300"><%= check_box 'context', 'hide', :class => 'context-hide' %></td>
</tr>
<% @context = nil %>

View file

@ -19,10 +19,10 @@
<%= link_to_remote( image_tag("blank", :title =>"Delete context", :class=>"delete_item"),
:update => "container_#{context.id}",
:loading => visual_effect(:fade, 'container_#{context.id}'),
:loading => visual_effect(:fade, "container_#{context.id}"),
:url => { :controller => "context", :action => "destroy", :id => context.id },
:confirm => "Are you sure that you want to delete the context \'#{context.name}\'?" ) + " " +
link_to_function( image_tag( "blank", :title => "Edit context", :class=>"edit_item"), "Element.toggle('context-#{context.id}','context-#{context.id}-edit-form'); new Effect.Appear('context-#{context.id}-edit-form'); Form.focus_first('form-context-#{context.id}');" ) %>
link_to_function( image_tag( "blank", :title => "Edit context", :class=>"edit_item"), "Element.toggle('context-#{context.id}','context-#{context.id}-edit-form'); new Effect.Appear('context-#{context.id}-edit-form'); Form.focusFirstElement('form-context-#{context.id}');" ) %>
</div>
</div><!-- [end:context-context.id] -->
@ -31,14 +31,16 @@
:html => { :id => "form-context-#{context.id}", :class => "inline-form" },
:update => "container_#{context.id}",
:complete => visual_effect(:appear, 'container_#{context.id}') %>
<table style="table-layout: fixed;" width="450">
<%= render_partial 'context_form', context %>
<div class="buttons">
<input type="submit" value="Update" />
<a href="javascript:void(0);" onclick="Element.toggle('context-<%= context.id %>','context-<%= context.id %>-edit-form');Form.reset('form-context-<%= context.id %>');">Cancel</a>
</div>
<tr>
<td width="150">&nbsp;</td>
<td width="300"><input type="submit" value="Update" />&nbsp;<a href="javascript:void(0);" onclick="Element.toggle('context-<%= context.id %>','context-<%= context.id %>-edit-form');Form.reset('form-context-<%= context.id %>');">Cancel</a></td>
</tr>
</table>
<%= end_form_tag %>
</div><!-- [end:context-context.id-edit-form] -->
</div><!-- [end:context-context.id-container] -->
</div><!-- [end:context_context.id] -->
<% if controller.action_name == 'new_context' %>
<script>
new Effect.Appear('context-<%= context.id %>');

View file

@ -19,7 +19,7 @@
<%= form_remote_tag :url => { :action => "new_context" },
:update=> "list-contexts",
:position=> "bottom",
:loading => "context.reset()",
:loading => "Form.reset('context-form')",
:complete => "Form.focusFirstElement('context-form');",
:html=> { :id=>'context-form', :name=>'context', :class => 'inline-form' } %>
<%= hidden_field( "context", "id" ) %>

View file

@ -39,7 +39,7 @@
<%= form_remote_tag :url => { :controller => "todo", :action => "add_item" },
:update=> "next_actions",
:position=> "bottom",
:loading => "context.reset()",
:loading => "Form.reset('context-form-new-action')",
:complete => "Form.focusFirstElement('context-form-new-action'); new Effect.Highlight('next_actions');",
:html=> { :id=>'context-form-new-action', :name=>'context', :class => 'inline-form' } %>
<%= hidden_field( "new_item", "context_id", "value" => "#{@context.id}") %>

View file

@ -2,21 +2,16 @@
@project = project_form
%>
<%= error_messages_for 'project' %>
<div class="position">
<%= @project.position %>
</div>
<div class="data">
<p>
<label for="project_done">Project done?</label>
<%= check_box 'project', 'done', :class => 'project-done' %>
</p>
<p>
<label for="project_name">Name:</label><br>
<%= text_field 'project', 'name', :class => 'project-name' %>
</p>
<p>
<label for="project_description">Description (optional):</label><br>
<%= text_area 'project', 'description', "cols" => 30, "rows" => 4, :class => 'project-description' %>
</p>
</div>
<tr>
<td width="150"><label for="project_name">Name:</label></td>
<td width="300"><%= text_field 'project', 'name', :class => 'project-name' %></td>
</tr>
<tr>
<td width="150"><label for="project_description">Description (optional):</label></td>
<td width="300"><%= text_area 'project', 'description', "cols" => 30, "rows" => 4, :class => 'project-description' %></td>
</tr>
<tr>
<td width="150"><label for="project_done">Project done?</label></td>
<td width="300"><%= check_box 'project', 'done', :class => 'project-done' %></td>
</tr>
<% @project = nil %>

View file

@ -17,10 +17,10 @@
<%= link_to_remote( image_tag("blank", :title =>"Delete project", :class=>"delete_item"),
:update => "container_#{project.id}",
:loading => visual_effect(:fade, 'container_#{project.id}'),
:loading => visual_effect(:fade, "container_#{project.id}"),
:url => { :controller => "project", :action => "destroy", :id => project.id },
:confirm => "Are you sure that you want to delete the project \'#{project.name}\'?" ) + " " +
link_to_function(image_tag( "blank", :title => "Edit item", :class=>"edit_item"), "Element.toggle('project-#{project.id}','project-#{project.id}-edit-form'); new Effect.Appear('project-#{project.id}-edit-form'); Form.focus_first('form-project-#{project.id}');" ) %>
link_to_function(image_tag( "blank", :title => "Edit item", :class=>"edit_item"), "Element.toggle('project-#{project.id}','project-#{project.id}-edit-form'); new Effect.Appear('project-#{project.id}-edit-form'); Form.focusFirstElement('form-project-#{project.id}');" ) %>
</div>
</div><!-- [end:project-project.id] -->
@ -29,11 +29,13 @@
:html => { :id => "form-project-#{project.id}", :class => "form" },
:update => "container_#{project.id}",
:complete => visual_effect(:appear, 'container_#{project.id}') %>
<table style="table-layout: fixed;" width="450">
<%= render_partial 'project_form', project %>
<div class="buttons">
<input type="submit" value="Update" />
<a href="javascript:void(0);" onclick="Element.toggle('project-<%= project.id %>','project-<%= project.id %>-edit-form');Form.reset('form-project-<%= project.id %>');">Cancel</a>
</div>
<tr>
<td width="150">&nbsp;</td>
<td width="300"><input type="submit" value="Update" />&nbsp;<a href="javascript:void(0);" onclick="Element.toggle('project-<%= project.id %>','project-<%= project.id %>-edit-form');Form.reset('form-project-<%= project.id %>');">Cancel</a></td>
</tr>
</table>
<%= end_form_tag %>
</div><!-- [end:project-project.id-edit-form] -->
</div><!-- [end:container_project.id] -->

View file

@ -19,7 +19,7 @@
<%= form_remote_tag :url => { :action => "new_project" },
:update=> "list-projects",
:position=> "bottom",
:loading => "project.reset()",
:loading => "Form.reset('project-form')",
:complete => "Form.focusFirstElement('project-form');",
:html=> { :id=>'project-form', :name=>'project', :class => 'inline-form' } %>
<label for="project_name">Name:</label><br />

View file

@ -71,7 +71,7 @@
<%= form_remote_tag :url => { :controller => "todo", :action => "add_item" },
:update=> "next_actions",
:position=> "bottom",
:loading => "project.reset()",
:loading => "Form.reset('project-form-new-action')",
:complete => "Form.focusFirstElement('project-form-new-action'); new Effect.Highlight('next_actions');",
:html=> { :id=>'project-form-new-action', :name=>'project', :class => 'inline-form' } %>
<%= hidden_field( "new_item", "project_id", "value" => "#{@project.id}") %>

View file

@ -30,6 +30,7 @@ Wiki (deprecated - please use Trac): http://www.rousette.org.uk/projects/wiki/
ruby -i.bak -pe 'gsub!("#!/usr/bin/env ruby", "#!c:/ruby/bin/ruby")' public/dispatch.* script/*
13. The TXT view is now sorted by position, just as the home page is.
14. <b>Contributed by lolindrath</b>: Items that are overdue are coloured red, and have the text 'Overdue by X days' in the badge. Other due dates are given as days from now (up to a week away in orange, more than a week away in green), and the tool tip shows the actual date.
15. Projects and Contexts in [tracks_url]/projects and [tracks_url]/contexts can now be rearranged in order by dragging and dropping. Just pick the item up by the 'DRAG' label and drop it where you want.
== Version 1.03