mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-03 06:21:49 +01:00
Altered the shared/add_new_item_form to show the context and project drop downs on all the pages (including the show/[context_name] and show/[project_name] pages). On the latter pages, the drop down automatically selects the context or project of the current page.
To my great surprise, it also seems to fix the long-standing problem with Safari silently nullifying the fields after an item was added, and so causing two additions in a row to fail! Yay for unintended side effects! Fixes #331 git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@288 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
89802e7e19
commit
0401763a10
3 changed files with 15 additions and 17 deletions
|
|
@ -111,4 +111,5 @@ module ApplicationHelper
|
|||
"<span class=\"green\">" + format_date(due) + "</span>"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,10 +2,16 @@
|
|||
case controller.controller_name
|
||||
when "context"
|
||||
add_string = "Add a next action in this context »"
|
||||
@selected_context = @context.id
|
||||
@selected_project = nil
|
||||
when "project"
|
||||
add_string = "Add a next action in this project »"
|
||||
@selected_context = @contexts[0].id
|
||||
@selected_project = @project.id
|
||||
else
|
||||
add_string = "Add a next action »"
|
||||
@selected_context = @contexts[0].id
|
||||
@selected_project = nil
|
||||
end
|
||||
|
||||
if @on_page == "tickler"
|
||||
|
|
@ -41,27 +47,18 @@
|
|||
<label for="todo_notes">Notes</label><br />
|
||||
<%= text_area( "todo", "notes", "cols" => 25, "rows" => 10, "tabindex" => 2) %><br />
|
||||
|
||||
<% unless controller.controller_name == "context" -%>
|
||||
<label for="todo_context_id">Context</label><br />
|
||||
<%= collection_select( "todo", "context_id", @contexts, "id", "name",
|
||||
{}, {"tabindex" => 3}) %><br />
|
||||
<% end -%>
|
||||
<label for="todo_context_id">Context</label><br />
|
||||
<%= select("todo", "context_id", @contexts.collect {|c| [c.name, c.id] }, { :selected => @selected_context }, {"tabindex" => 3}) %>
|
||||
<br />
|
||||
|
||||
<% unless controller.controller_name == "project" -%>
|
||||
<label for="todo_project_id">Project</label><br />
|
||||
<%= collection_select( "todo", "project_id", @projects.reject{|p| p.done?}, "id", "name",
|
||||
{ :include_blank => true }, {"tabindex" => 4}) %><br />
|
||||
<% end -%>
|
||||
<label for="todo_project_id">Project</label><br />
|
||||
<%= select( "todo", "project_id", @projects.reject{|x| x.done? }.collect {|p| [p.name, p.id] },
|
||||
{ :selected => @selected_project, :include_blank => true }, {"tabindex" => 4}) %>
|
||||
<br />
|
||||
|
||||
<label for="todo_due">Due</label><br />
|
||||
<%= text_field("todo", "due", "size" => 10, "class" => "Date", "onFocus" => "Calendar.setup", "tabindex" => 5, "autocomplete" => "off") %>
|
||||
|
||||
<% 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" -%>
|
||||
<br /> <label for="todo_show_from">Show from</label><br />
|
||||
<%= text_field("todo", "show_from", "size" => 10, "class" => "Date", "onFocus" => "Calendar.setup", "tabindex" => 5, "autocomplete" => "off") %><br />
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ module ActionView
|
|||
"select", add_options(options_from_collection_for_select(collection, value_method, text_method, value), options, value), html_options
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
def to_country_select_tag(priority_countries, options, html_options)
|
||||
html_options = html_options.stringify_keys
|
||||
add_default_name_and_id(html_options)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue