From ed4481f3b6849e270a2a8ea9c3c945b19c66197f Mon Sep 17 00:00:00 2001 From: bsag Date: Sun, 23 Jan 2005 19:49:41 +0000 Subject: [PATCH] Added a new row to the context table: hide. This determines whether a context gets hidden from the front todo/list page (it can still be accessed directly or via the context/list page). If it's true (1), the context is hidden. By default, it's false, so you don't have to check the box for every context you add, only the ones you want to hide. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@14 a4c988fc-2ded-0310-b66e-134b36920a42 --- tracks/app/controllers/context_controller.rb | 2 +- tracks/app/controllers/todo_controller.rb | 2 +- tracks/app/views/context/_not_done.rhtml | 2 +- tracks/app/views/context/list.rhtml | 10 ++++++++++ tracks/doc/CHANGENOTES.txt | 1 + tracks/public/stylesheets/standard.css | 3 +-- 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tracks/app/controllers/context_controller.rb b/tracks/app/controllers/context_controller.rb index 778a0435..3e2c5ce7 100644 --- a/tracks/app/controllers/context_controller.rb +++ b/tracks/app/controllers/context_controller.rb @@ -24,7 +24,7 @@ class ContextController < ApplicationController # def add_context context = Context.new - context.name = @params["new_context"]["name"] + context.attributes = @params["new_context"] if context.save flash["confirmation"] = "Succesfully created context" diff --git a/tracks/app/controllers/todo_controller.rb b/tracks/app/controllers/todo_controller.rb index 7480127d..082a2e0d 100644 --- a/tracks/app/controllers/todo_controller.rb +++ b/tracks/app/controllers/todo_controller.rb @@ -13,7 +13,7 @@ class TodoController < ApplicationController def list @page_title = "List tasks" @projects = Project.find_all - @places = Context.find_all + @places = Context.find_all( "hide=0", "id ASC") @done = Todo.find_all( "done=1", "completed DESC", 5 ) @count = Todo.count( "done=0" ) end diff --git a/tracks/app/views/context/_not_done.rhtml b/tracks/app/views/context/_not_done.rhtml index a0a88ed8..4d9d8ff7 100644 --- a/tracks/app/views/context/_not_done.rhtml +++ b/tracks/app/views/context/_not_done.rhtml @@ -1,7 +1,7 @@ <% @item = not_done %> <%= 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, { :action => "destroy", :id => @item.id }, :title => "Delete item", :confirm => "Are you sure you want to delete this entry: #{@item.description}" ) + " " %> + <%= 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 %> diff --git a/tracks/app/views/context/list.rhtml b/tracks/app/views/context/list.rhtml index 5565cfa5..ecc6b0e4 100644 --- a/tracks/app/views/context/list.rhtml +++ b/tracks/app/views/context/list.rhtml @@ -10,6 +10,13 @@ <% end %> <%= @context.id.to_s %> <%= link_to( "#{@context.name.capitalize}", :action => "show", :id => @context.id ) %> + + <% if @context.hide == 1 %> + hidden + <% else %> + shown + <% end %> + <%= link_to($edit_img, { :action => "edit", :id => @context.id }, :title => "Edit item" ) + " " + link_to($delete_img, { :action => "destroy", :id => @context.id }, :title => "Delete item", :confirm => "Are you sure you want to delete this context: #{@context.name}. Any todos in this context will be deleted.") + " " %> <% row += 1 %> @@ -24,6 +31,9 @@
<%= text_field("new_context", "name") %>
+
+ <%= check_box( "new_context", "hide" ) %> +
diff --git a/tracks/doc/CHANGENOTES.txt b/tracks/doc/CHANGENOTES.txt index 021b40b9..2af10d3c 100644 --- a/tracks/doc/CHANGENOTES.txt +++ b/tracks/doc/CHANGENOTES.txt @@ -11,6 +11,7 @@ Project wiki: 2. Added validation for the entry fields. If you enter a bit of text that's too long or you omit the description (not much point in a blank next action!) you'll get an error message and the action won't be saved. 3. Added action caching. 4. Did a bit of refactoring to try to make page loading a bit more efficient. +5. Added a new row to the context table: 'hide'. This determines whether a particular context gets hidden on the main page. If the checkbox on the add new context form is checked, the context is hidden, and isn't listed on the front (todo/list) page. This is useful for contexts like 'wish list' or 'someday/maybe' that you don't want taking up your attention all the time. ## Version 1.01 diff --git a/tracks/public/stylesheets/standard.css b/tracks/public/stylesheets/standard.css index b796728b..88eb0f0d 100644 --- a/tracks/public/stylesheets/standard.css +++ b/tracks/public/stylesheets/standard.css @@ -254,6 +254,5 @@ table.list { .next_actions td { border: none; - padding-top: 3px; - padding-bottom: 3px; + padding-bottom: 5px; } \ No newline at end of file