diff --git a/tracks/app/controllers/context_controller.rb b/tracks/app/controllers/context_controller.rb index 641b1cbe..778a0435 100644 --- a/tracks/app/controllers/context_controller.rb +++ b/tracks/app/controllers/context_controller.rb @@ -41,7 +41,6 @@ class ContextController < ApplicationController # def show @context = Context.find(@params["id"]) - @places = Context.find_all @projects = Project.find_all @page_title = "Context: #{@context.name.capitalize}" @not_done = Todo.find_all( "context_id=#{@context.id} AND done=0", "created ASC" ) diff --git a/tracks/app/controllers/project_controller.rb b/tracks/app/controllers/project_controller.rb index 3edffa12..dfbc9a75 100644 --- a/tracks/app/controllers/project_controller.rb +++ b/tracks/app/controllers/project_controller.rb @@ -87,23 +87,5 @@ class ProjectController < ApplicationController end end - - # Toggles the 'done' status of the action - def toggle_check - item = Todo.find( @params['id'] ) - - case item.done - when 0: item.done = 1; item.completed = Time.now() - when 1: item.done = 0; item.completed = nil - end - - if item.save - flash["confirmation"] = "Marked next action as completed" - redirect_to( :action => "list" ) - else - flash["warning"] = "Couldn't mark next action as completed" - redirect_to( :action => "list" ) - end - end end diff --git a/tracks/app/controllers/todo_controller.rb b/tracks/app/controllers/todo_controller.rb index 6fa630bd..7480127d 100644 --- a/tracks/app/controllers/todo_controller.rb +++ b/tracks/app/controllers/todo_controller.rb @@ -12,8 +12,8 @@ class TodoController < ApplicationController # def list @page_title = "List tasks" - @places = Context.find_all @projects = Project.find_all + @places = Context.find_all @done = Todo.find_all( "done=1", "completed DESC", 5 ) @count = Todo.count( "done=0" ) end diff --git a/tracks/app/helpers/application_helper.rb b/tracks/app/helpers/application_helper.rb index 09b7ec69..689810bd 100644 --- a/tracks/app/helpers/application_helper.rb +++ b/tracks/app/helpers/application_helper.rb @@ -49,5 +49,15 @@ module ApplicationHelper end end + def get_projects() + @projects = Project.find_all + return @@projects + end + + def get_contexts() + @places = Context.find_all + return @@places + end + end diff --git a/tracks/app/views/context/list.rhtml b/tracks/app/views/context/list.rhtml index d49bcf52..5565cfa5 100644 --- a/tracks/app/views/context/list.rhtml +++ b/tracks/app/views/context/list.rhtml @@ -1,6 +1,6 @@
| <%= check_box( "item", "done", "onclick" => "document.location.href='/todo/toggle_check/#{@item.id}'" ) %> | +<%= link_to( $edit_img, { :action => "edit", :id => @item.id }, :title => "Edit item" ) + " " + link_to($delete_img, { :controller => "todo", :action => "destroy", :id => @item.id }, :title => "Delete item", :confirm => "Are you sure you want to delete this entry: #{@item.description}" ) + " " %> | +<%= due_date( @item.due ) %>
+ <%= @item.description %>
+ <% if @item.project_id %>
+ <%= link_to( "[C]", { :controller => "context", :action => "show", :id => @item.context_id }, :title => "View context: #{@item.context['name'].capitalize}" ) %>
+ <% end %>
+ <% if @item.notes? %>
+ <%= "" + $notes_img + "" %>
+ <% m_notes = markdown( @item.notes ) %>
+ <%= " " + m_notes + " " %>
+ <% end %>
+ |
+