tracks/tracks/app/views/todo/_edit_form.rhtml
bsag 36fcfe5c59 Support for tagging of actions!
Made a start on tagging support. You can add tags via the action forms (just single word tags, separated by a space so far), update tags via the edit form (same limitations), and also search for all actions with a particular tag:

/todo/tag/[tag_name]

Tests for tagging are a bit rudimentary at the moment, and you can't as yet use tags consisting of multiple words, or search for conjunctions of tags (e.g. foo+bar), but I'm hoping to add these. Also no validation, so don't try anything funny!

I'm also planning on letting the user create custom links to /todo/tag pages, so that you can use a tag for inbox, someday/maybe, today, a meta-project, priority, or whatever you like.

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@400 a4c988fc-2ded-0310-b66e-134b36920a42
2007-01-14 19:29:01 +00:00

59 lines
3.6 KiB
Text

<div id="error_status"><%= error_messages_for("item") %></div>
<%= hidden_field( "item", "id" ) %>
<%= source_view_tag( @source_view ) %>
<table>
<tr>
<td class="label"><label for="item_description">Next action</label></td>
<td><%= text_field( "item", "description", "tabindex" => 8) %></td>
</tr>
<tr>
<td class="label"><label for="item_notes">Notes</label></td>
<td><%= text_area( "item", "notes", "cols" => 20, "rows" => 5, "tabindex" => 9) %></td>
</tr>
<tr>
<td class="label"><label for="<%= dom_id(@item, 'context_name') %>">Context</label></td>
<td><input id="<%= dom_id(@item, 'context_name') %>" name="context_name" autocomplete="off" tabindex="10" size="25" type="text" value="<%= @item.context.name %>" />
<div class="page_name_auto_complete" id="<%= dom_id(@item, 'context_list') %>" style="display:none"></div></td>
<script type="text/javascript">
editFormContextAutoCompleter = new Autocompleter.Local('<%= dom_id(@item, 'context_name') %>', '<%= dom_id(@item, 'context_list') %>', <%= context_names_for_autocomplete %>, {choices:100,autoSelect:true});
Event.observe($('<%= dom_id(@item, 'context_name') %>'), "focus", editFormContextAutoCompleter.activate.bind(editFormContextAutoCompleter));
Event.observe($('<%= dom_id(@item, 'context_name') %>'), "click", editFormContextAutoCompleter.activate.bind(editFormContextAutoCompleter));
</script>
</tr>
<tr>
<td class="label"><label for="<%= dom_id(@item, 'project_name') %>">Project</label></td>
<td>
<input id="<%= dom_id(@item, 'project_name') %>" name="project_name" autocomplete="off" tabindex="11" size="25" type="text" value="<%= @item.project.nil? ? 'None' : @item.project.name %>" />
<div class="page_name_auto_complete" id="<%= dom_id(@item, 'project_list') %>" style="display:none"></div>
</td>
<script type="text/javascript">
editFormProjectAutoCompleter = new Autocompleter.Local('<%= dom_id(@item, 'project_name') %>', '<%= dom_id(@item, 'project_list') %>', <%= project_names_for_autocomplete %>, {choices:100,autoSelect:true});
Event.observe($('<%= dom_id(@item, 'project_name') %>'), "focus", editFormProjectAutoCompleter.activate.bind(editFormProjectAutoCompleter));
Event.observe($('<%= dom_id(@item, 'project_name') %>'), "click", editFormProjectAutoCompleter.activate.bind(editFormProjectAutoCompleter));
</script>
</tr>
<tr>
<td class="label"><label for="<%= dom_id(@item, 'tag_list') %>">Tags</label></td>
<td><%= text_field_tag "tag_list", @item.tags.collect{|t| t.name}.join(" "), :size => 40 %></td>
</tr>
<tr>
<td class="label"><label for="<%= dom_id(@item, 'due') %>">Due</td>
<td><input name="item[due]" id="<%= dom_id(@item, 'due') %>" type="text" value="<%= format_date(@item.due) %>" tabindex="12" size="10" onfocus="Calendar.setup" autocomplete="off" class="Date" /></td>
</tr>
<tr>
<td class="label"><label for="<%= dom_id(@item, 'show_from') %>">Show from</td>
<td><input name="item[show_from]" id="<%= dom_id(@item, 'show_from') %>" type="text" value="<%= format_date(@item.show_from) %>" tabindex="13" size="10" onfocus="Calendar.setup" autocomplete="off" class="Date" /></td>
</tr>
<% if controller.controller_name == "project" || @item.deferred? -%>
<input type="hidden" name="on_project_page" value="true" />
<% end -%>
<tr>
<td colspan="2"><input type="submit" value="Update" tabindex="14" />
<a href="javascript:void(0);" onclick="Element.toggle('<%= dom_id(@item, 'line') %>');Element.toggle('<%= dom_id(@item, 'edit') %>');">Cancel</a></td>
</tr>
</table>
<%= calendar_setup( dom_id(@item, 'due') ) %>
<%= calendar_setup( dom_id(@item, 'show_from') ) %>