mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 23:30:12 +01:00
Continued the separating out of the new item forms for all the controllers. So the new item form for todo/list, project/show/[name] and context/show/[name] all use shared/add_new_item_form.
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@157 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
9867ca01ad
commit
f39ebf6ec9
7 changed files with 28 additions and 68 deletions
|
|
@ -32,35 +32,7 @@
|
|||
|
||||
<div id="input_box">
|
||||
|
||||
<%= link_to_function( "Add the next action in this context »", "Element.toggle('context_new_action'); Form.focusFirstElement('context-form-new-action');", {:title => "Add the next action", :accesskey => "n"}) %>
|
||||
|
||||
<div id="context_new_action" class="context_new" style="display:none">
|
||||
<!--[form:context]-->
|
||||
<%= form_remote_tag :url => { :controller => "todo", :action => "add_item" },
|
||||
:update=> "next_actions",
|
||||
:position=> "bottom",
|
||||
: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}") %>
|
||||
<label for="new_item_description">Description</label><br />
|
||||
<%= text_field( "new_item", "description", "size" => 25, "tabindex" => 1) %><br />
|
||||
<label for="new_item_notes">Notes</label><br />
|
||||
<%= text_area( "new_item", "notes", "cols" => 25, "rows" => 10, "tabindex" => 2) %><br />
|
||||
<label for="new_item_project_id">Project</label><br />
|
||||
<select name="new_item[project_id]" id="item_project_id" tabindex="3">
|
||||
<option selected="selected"></option>
|
||||
<%= options_from_collection_for_select(@projects, "id", "name") %>
|
||||
</select><br />
|
||||
<label for="item_due">Due</label><br />
|
||||
<%= text_field("new_item", "due", "size" => 10, "class" => "Date", "onFocus" => "Calendar.setup", "tabindex" => 4) %>
|
||||
<br /><br />
|
||||
<input type="submit" value="Add item" tabindex="5">
|
||||
<%= end_form_tag %><!--[eoform:context]-->
|
||||
<%= calendar_setup( "new_item_due" ) %>
|
||||
|
||||
</div><!-- [end:context-new-action] -->
|
||||
|
||||
<%= render "shared/add_new_item_form" %>
|
||||
<%= render "shared/sidebar" %>
|
||||
</div><!-- End of input box -->
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@
|
|||
:update => "item-#{item.id}-container",
|
||||
:complete => "new Effect.Appear('item-#{item.id}-container', true);" %>
|
||||
<%= render_partial 'todo/action_edit_form', item %>
|
||||
<input type="hidden" name="project" value="true" />
|
||||
<%= end_form_tag %>
|
||||
</div><!-- [end:action-item.id-edit-form] -->
|
||||
|
||||
|
|
|
|||
|
|
@ -64,35 +64,7 @@
|
|||
|
||||
<div id="input_box">
|
||||
|
||||
<%= link_to_function( "Add the next action in this project »", "Element.toggle('project_new_action'); Form.focusFirstElement('project-form-new-action');", {:title => "Add the next action", :accesskey => "n"}) %>
|
||||
|
||||
<div id="project_new_action" class="project_new" style="display:none">
|
||||
<!--[form:project]-->
|
||||
<%= form_remote_tag :url => { :controller => "todo", :action => "add_item" },
|
||||
:update=> "next_actions",
|
||||
:position=> "bottom",
|
||||
: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}") %>
|
||||
<label for="new_item_description">Description</label><br />
|
||||
<%= text_field( "new_item", "description", "size" => 25, "tabindex" => 1 ) %><br />
|
||||
<label for="new_item_notes">Notes</label><br />
|
||||
<%= text_area( "new_item", "notes", "cols" => 25, "rows" => 10, "tabindex" => 2 ) %><br />
|
||||
<label for="new_item_context_id">Context</label><br />
|
||||
<select name="new_item[context_id]" id="new_item_context_id" tabindex="3">
|
||||
<%= options_from_collection_for_select(@contexts, "id", "name" ) %>
|
||||
</select><br />
|
||||
<label for="item_due">Due</label><br />
|
||||
<%= text_field("new_item", "due", "size" => 10, "class" => "Date", "onFocus" => "Calendar.setup", "tabindex" => 4) %>
|
||||
<br /><br />
|
||||
<input type="hidden" name="project" value="true" />
|
||||
<input type="submit" value="Add item" tabindex="5">
|
||||
<%= end_form_tag %><!--[eoform:project]-->
|
||||
<%= calendar_setup( "new_item_due" ) %>
|
||||
|
||||
</div><!-- [end:project-new-action] -->
|
||||
|
||||
<%= render "shared/add_new_item_form" %>
|
||||
<%= render "shared/sidebar" %>
|
||||
</div><!-- End of input box -->
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,13 @@
|
|||
case controller.controller_name
|
||||
when "context"
|
||||
add_string = "Add a next action in this context »"
|
||||
update_div = "next_actions"
|
||||
when "project"
|
||||
add_string = "Add a next action in this project »"
|
||||
update_div = "next_actions"
|
||||
else
|
||||
add_string = "Add a next action »"
|
||||
update_div = "new_actions"
|
||||
end
|
||||
%>
|
||||
|
||||
|
|
@ -18,7 +21,7 @@
|
|||
<!--[form:todo]-->
|
||||
<%= form_remote_tag(
|
||||
:url => { :controller => "todo", :action => "add_item" },
|
||||
:update => "new_actions",
|
||||
:update => update_div,
|
||||
:position=> "bottom",
|
||||
:complete => "Form.focusFirstElement('todo-form-new-action');Form.reset('todo-form-new-action');",
|
||||
:html=> { :id=>'todo-form-new-action', :name=>'todo', :class => 'inline-form' }) %>
|
||||
|
|
@ -29,16 +32,27 @@
|
|||
<label for="new_item_notes">Notes</label><br />
|
||||
<%= text_area( "new_item", "notes", "cols" => 25, "rows" => 10, "tabindex" => 2) %><br />
|
||||
|
||||
<label for="new_item_context_id">Context</label><br />
|
||||
<%= collection_select( "new_item", "context_id", @contexts, "id", "name",
|
||||
{}, {"tabindex" => 3}) %><br />
|
||||
<% unless controller.controller_name == "context" -%>
|
||||
<label for="new_item_context_id">Context</label><br />
|
||||
<%= collection_select( "new_item", "context_id", @contexts, "id", "name",
|
||||
{}, {"tabindex" => 3}) %><br />
|
||||
<% end -%>
|
||||
|
||||
<label for="new_item_project_id">Project</label><br />
|
||||
<%= collection_select( "new_item", "project_id", @projects, "id", "name",
|
||||
{ :include_blank => true }, {"tabindex" => 4}) %><br />
|
||||
<% unless controller.controller_name == "project" -%>
|
||||
<label for="new_item_project_id">Project</label><br />
|
||||
<%= collection_select( "new_item", "project_id", @projects, "id", "name",
|
||||
{ :include_blank => true }, {"tabindex" => 4}) %><br />
|
||||
<% end -%>
|
||||
|
||||
<label for="item_due">Due</label><br />
|
||||
<%= text_field("new_item", "due", "size" => 10, "class" => "Date", "onFocus" => "Calendar.setup", "tabindex" => 5) %>
|
||||
|
||||
<% if controller.controller_name == "project" -%>
|
||||
<%= hidden_field( "new_item", "project_id", "value" => "#{@project.id}") %>
|
||||
<input type="hidden" name="project" value="true" />
|
||||
<% elsif controller.controller_name == "context" -%>
|
||||
<%= hidden_field( "new_item", "context_id", "value" => "#{@context.id}") %>
|
||||
<% end -%>
|
||||
<br /><br />
|
||||
<input type="submit" value="Add item" tabindex="6">
|
||||
<%= end_form_tag %><!--[eoform:todo]-->
|
||||
|
|
|
|||
|
|
@ -48,6 +48,9 @@
|
|||
<td><input name="item[due]" id="due_<%= @item.id %>" type="text" value="<%= format_date(@item.due) %>" tabindex="5" size="10" onFocus="Calendar.setup" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<% if controller.controller_name == "project" %>
|
||||
<input type="hidden" name="project" value="true" />
|
||||
<% end -%>
|
||||
<td><input type="submit" value="Update" tabindex="6" />
|
||||
<a href="javascript:void(0);" onclick="Element.toggle('item-<%= @item.id %>','action-<%= @item.id %>-edit-form');Form.reset('form-action-<%= @item.id %>');">Cancel</a></td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<%= due_date( item.due ) %>
|
||||
<%= sanitize(item.description) %>
|
||||
|
||||
<% if @params["project"] == true %>
|
||||
<% if @params["project"] == "true" %>
|
||||
<%= link_to( "[C]", { :controller => "context", :action => "show", :name => urlize(item.context.name) }, :title => "View context: #{item.context.name}" ) %>
|
||||
<% else %>
|
||||
<% if item.project_id %>
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ Rails::Initializer.run do |config|
|
|||
|
||||
# Use Active Record's schema dumper instead of SQL when creating the test database
|
||||
# (enables use of different database adapters for development and test environments)
|
||||
# config.active_record.schema_format = :ruby
|
||||
config.active_record.schema_format = :ruby
|
||||
|
||||
# See Rails::Configuration for more options
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue