tracks/tracks/app/views/shared/_new_action_form.rhtml
lukemelia 1ee651f8bb DRY up code around Immediate and Deferred actions, including controller methods and views
Relocated todo_controller#deferred_update_action to be next to todo_controller#update_action 
Include all non-hidden contexts on the home page, but hide the empty ones. Ground work for supporting the automatic showing of a context with zero items when an item is moved to it.
Added a comment about todo_controller#update_element -- is it used?
Remove unused #list_of method from context, note & project models
Remove unused #list_all method from note model
Methods to lazy load done_todos and not_done_todos for project and context models

Fixes #322



git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@282 a4c988fc-2ded-0310-b66e-134b36920a42
2006-07-17 03:40:35 +00:00

67 lines
No EOL
2.4 KiB
Text

<% hide_link ||= false %>
<% unless hide_link -%>
<%= link_to_function(
"&nbsp;",
"onclick=new Lightbox.base('mybox', { closeOnOverlayClick : true });Form.focusFirstElement('todo-form-new-action-lightbox'); return false;",
{:title => "Add the next action", :accesskey => "q"}) %>
<% end -%>
<div id="mybox" style="display:none">
<div id="todo_new_action-lightbox" class="context_new">
<%= form_remote_tag(
:url => { :controller => controller.controller_name, :action => "add_item" },
:html=> { :id=>'todo-form-new-action-lightbox', :name=>'todo', :class => 'inline-form' }) %>
<h2>Add a new next action:</h2>
<div id="status">
</div>
<table>
<tr>
<td><label for="todo_description">Description</label></td>
<td><%= text_field( "todo", "description", "size" => 30, "tabindex" => 1) %></td>
</tr>
<tr>
<td><label for="todo_notes">Notes</label></td>
<td><%= text_area( "todo", "notes", "cols" => 25, "rows" => 10, "tabindex" => 2) %></td>
</tr>
<% unless controller.controller_name == "context" -%>
<tr>
<td><label for="todo_context_id">Context</label></td>
<td><%= collection_select( "todo", "context_id", @contexts, "id", "name",
{}, {"tabindex" => 3}) %></td>
</tr>
<% end -%>
<% unless controller.controller_name == "project" -%>
<tr>
<td><label for="todo_project_id">Project</label></td>
<td><%= collection_select( "todo", "project_id", @projects.reject{|p| p.done?}, "id", "name",
{ :include_blank => true }, {"tabindex" => 4}) %></td>
</tr>
<% end -%>
<tr>
<td><label for="todo_due">Due</label></td>
<td><%= text_field("todo", "due", "size" => 10, "class" => "Date", "onFocus" => "Calendar.setup", "tabindex" => 5, "autocomplete" => "off") %></td>
</tr>
<% if controller.controller_name == "project" -%>
<%= hidden_field( "todo", "project_id", "value" => "#{@project.id}") %>
<% elsif controller.controller_name == "context" -%>
<%= hidden_field( "todo", "context_id", "value" => "#{@context.id}") %>
<% end -%>
<% if @on_page == "tickler" -%>
<tr>
<td><label for="todo_show_from">Show from</label></td>
<td><%= date_select( "todo", "show_from", :start_year => Date.today.year, :order => [:year, :month, :day] ) %></td>
</tr>
<% end -%>
<tr>
<td></td>
<td><input type="submit" value="Add item" tabindex="6"></td>
</tr>
</table>
<%= end_form_tag %><!--[eoform:todo]-->
<%= calendar_setup( "todo_due" ) %>
</div><!-- [end:todo-new-action] -->
</div>