public
Description: Tracks is a GTD(TM) web application, built with Ruby on Rails
Homepage: http://www.rousette.org.uk/projects/
Clone URL: git://github.com/bsag/tracks.git
Click here to lend your support to: tracks and make a donation at www.pledgie.com !
fix moving todos from one context to another on tag view

also fix ordening on the collections on the tag view page
lrbalt (author)
Tue Aug 26 07:07:35 -0700 2008
commit  4d11e156f4228dcd405c7c87ffd52b07b3cc3be2
tree    309163f26970355b4ed7512a8140233a37a1e2e5
parent  4ac09ed3ae391672f4077c0991b0bb8fc6424756
...
106
107
108
 
109
110
111
...
212
213
214
215
 
216
217
218
...
336
337
338
 
339
340
341
...
344
345
346
347
348
349
 
 
 
 
350
351
352
 
 
 
 
 
 
 
 
 
 
 
 
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
 
369
370
371
...
106
107
108
109
110
111
112
...
213
214
215
 
216
217
218
219
...
337
338
339
340
341
342
343
...
346
347
348
 
349
 
350
351
352
353
354
355
 
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
 
 
 
 
 
 
 
372
373
374
 
 
375
376
377
378
0
@@ -106,6 +106,7 @@ class TodosController < ApplicationController
0
     @projects = current_user.projects.find(:all)
0
     @contexts = current_user.contexts.find(:all)
0
     @source_view = params['_source_view'] || 'todo'
0
+    @tag_name = params['_tag_name']
0
     respond_to do |format|
0
       format.js
0
     end
0
@@ -212,7 +213,7 @@ class TodosController < ApplicationController
0
       @todo.complete!
0
     end
0
     # strange. if checkbox is not checked, there is no 'done' in params.
0
-    # Therfore I've used the negation
0
+    # Therefore I've used the negation
0
     if !(params['done'] == '1') && @todo.completed?
0
       @todo.activate!
0
     end
0
@@ -336,6 +337,7 @@ class TodosController < ApplicationController
0
   
0
   # /todos/tag/[tag_name] shows all the actions tagged with tag_name
0
   def tag
0
+    @page_title = "TRACKS::Tagged with \'#{@tag_name}\'"
0
     @source_view = params['_source_view'] || 'tag'
0
     @tag_name = params[:name]
0
     
0
@@ -344,28 +346,33 @@ class TodosController < ApplicationController
0
     
0
     @tag = Tag.find_by_name(@tag_name)
0
     @tag = Tag.new(:name => @tag_name) if @tag.nil?
0
-    
0
     tag_collection = @tag.todos
0
-    @not_done_todos = tag_collection.find(:all, :conditions => ['taggings.user_id = ? and state = ?', current_user.id, 'active'])
0
+    
0
+    @not_done_todos = tag_collection.find(:all, 
0
+      :conditions => ['taggings.user_id = ? and state = ?', current_user.id, 'active'],
0
+      :order => 'todos.completed_at DESC, todos.created_at DESC')
0
     @hidden_todos = current_user.todos.find(:all, 
0
       :include => [:taggings, :tags, :context], 
0
-      :conditions => ['tags.name = ? AND (todos.state = ? OR (contexts.hide = ? AND todos.state = ?))', @tag_name, 'project_hidden', true, 'active'])
0
+      :conditions => ['tags.name = ? AND (todos.state = ? OR (contexts.hide = ? AND todos.state = ?))', @tag_name, 'project_hidden', true, 'active'],
0
+      :order => 'todos.completed_at DESC, todos.created_at DESC')
0
+    @deferred = tag_collection.find(:all, 
0
+      :conditions => ['taggings.user_id = ? and state = ?', current_user.id, 'deferred'],
0
+      :order => 'show_from ASC, todos.created_at DESC')
0
+    # If you've set no_completed to zero, the completed items box isn't shown on
0
+    # the tag page
0
+    max_completed = current_user.prefs.show_number_completed
0
+    @done = tag_collection.find(:all, 
0
+      :limit => max_completed, 
0
+      :conditions => ['taggings.user_id = ? and state = ?', current_user.id, 'completed'], 
0
+      :order => 'todos.completed_at DESC')
0
     
0
     @contexts = current_user.contexts.find(:all)
0
     @contexts_to_show = @contexts.reject {|x| x.hide? }
0
     
0
-    @deferred = tag_collection.find(:all, :conditions => ['taggings.user_id = ? and state = ?', current_user.id, 'deferred'])
0
-
0
-    @page_title = "TRACKS::Tagged with \'#{@tag_name}\'"
0
-    # If you've set no_completed to zero, the completed items box isn't shown on
0
-    # the home page
0
-    max_completed = current_user.prefs.show_number_completed
0
-    @done = tag_collection.find(:all, :limit => max_completed, :conditions => ['taggings.user_id = ? and state = ?', current_user.id, 'completed'])
0
     # Set count badge to number of items with this tag
0
     @not_done_todos.empty? ? @count = 0 : @count = @not_done_todos.size
0
     @down_count = @count 
0
-    # @default_project_context_name_map =
0
-    # build_default_project_context_name_map(@projects).to_json
0
+
0
     respond_to do |format|
0
       format.html {
0
         @default_project_context_name_map = build_default_project_context_name_map(@projects).to_json
...
1
2
3
4
 
 
 
5
6
7
...
1
2
 
 
3
4
5
6
7
8
0
@@ -1,7 +1,8 @@
0
 <div id="error_status"><%= error_messages_for("todo", :object_name => 'action') %></div>
0
 
0
-<%= hidden_field( "todo", "id" ) %>
0
-<%= source_view_tag( @source_view ) %>
0
+<%= hidden_field( "todo", "id" ) -%>
0
+<%= source_view_tag( @source_view ) -%>
0
+<%= "<INPUT TYPE=\"hidden\" name=\"_tag_name\" value=\""+ @tag_name+"\">" unless @tag_name.nil? -%>
0
 
0
 <label for="<%= dom_id(@todo, 'description') %>">Description</label>
0
 <%= text_field( "todo", "description", "size" => 30, "tabindex" => 8) %>
...
6
7
8
9
 
10
11
 
12
13
14
...
6
7
8
 
9
10
11
12
13
14
15
0
@@ -6,9 +6,10 @@ if @saved
0
   status_message = 'Added new context / ' + status_message if @new_context_created
0
   page.notify :notice, status_message, 5.0
0
   
0
-  # #update auto completer arrays for context and project
0
+  # update auto completer arrays for context and project
0
   page << "contextAutoCompleter.options.array = #{context_names_for_autocomplete}; contextAutoCompleter.changed = true" if @new_context_created
0
   page << "projectAutoCompleter.options.array = #{project_names_for_autocomplete}; projectAutoCompleter.changed = true" if @new_project_created
0
+  
0
   if source_view_is_one_of(:todo, :context, :tag)
0
     if @context_changed || @todo.deferred?
0
       page[@todo].remove 

Comments