mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-23 17:26:11 +01:00
Tracks now looks at user-entered projects and sets the context if their is a default context for the project and if the context has not yet been edited. Closes #506.
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@546 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
f97af91cb2
commit
4650361c17
3 changed files with 8 additions and 1 deletions
|
|
@ -57,7 +57,7 @@ Event.observe($('todo_project_name'), "blur", selectDefaultContext.bind($('todo_
|
|||
|
||||
<script type="text/javascript">
|
||||
contextAutoCompleter = new Autocompleter.Local('todo_context_name', 'context_list', <%= context_names_for_autocomplete %>, {choices:100,autoSelect:false});
|
||||
$('todo_context_name').projectDefaultContextsMap = <%= @default_project_context_name_map %>;
|
||||
$('todo_context_name').projectDefaultContextsMap = eval('(' + <%= @default_project_context_name_map %> + ')');
|
||||
Event.observe($('todo_context_name'), "focus", function(){ $('todo_context_name').editedByTracksUser = true; });
|
||||
Event.observe($('todo_context_name'), "focus", contextAutoCompleter.activate.bind(contextAutoCompleter));
|
||||
Event.observe($('todo_context_name'), "click", contextAutoCompleter.activate.bind(contextAutoCompleter));
|
||||
|
|
|
|||
1
tracks/test/fixtures/projects.yml
vendored
1
tracks/test/fixtures/projects.yml
vendored
|
|
@ -14,6 +14,7 @@ timemachine:
|
|||
user_id: 1
|
||||
created_at: <%= today %>
|
||||
updated_at: <%= today %>
|
||||
default_context_id: 5
|
||||
|
||||
moremoney:
|
||||
id: 2
|
||||
|
|
|
|||
|
|
@ -281,4 +281,10 @@ class TodosControllerTest < Test::Rails::TestCase
|
|||
assert_equal Date.new(2007,1,2).to_s, t.due.to_s
|
||||
end
|
||||
|
||||
def test_index_html_assigns_default_project_name_map
|
||||
@request.session['user_id'] = users(:admin_user).id
|
||||
get :index, {"format"=>"html"}
|
||||
assert_equal '"{\\"Build a working time machine\\": \\"lab\\"}"', assigns(:default_project_context_name_map)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue