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
This commit is contained in:
bsag 2005-01-23 19:49:41 +00:00
parent 9a649506a5
commit ed4481f3b6
6 changed files with 15 additions and 5 deletions

View file

@ -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"

View file

@ -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

View file

@ -1,7 +1,7 @@
<% @item = not_done %>
<tr>
<td valign="top"><%= check_box( "item", "done", "onclick" => "document.location.href='/todo/toggle_check/#{@item.id}'" ) %></td>
<td valign="top" width="30"><%= 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}" ) + " " %></td>
<td valign="top" width="30"><%= 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}" ) + " " %></td>
<td valign="top"><%= due_date( @item.due ) %>
<%= @item.description %>
<% if @item.project_id %>

View file

@ -10,6 +10,13 @@
<% end %>
<td align="right" width="20"><%= @context.id.to_s %></td>
<td width="390"><%= link_to( "#{@context.name.capitalize}", :action => "show", :id => @context.id ) %></td>
<td>
<% if @context.hide == 1 %>
hidden
<% else %>
shown
<% end %>
</td>
<td width="40"><%= 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.") + " " %></td>
</tr>
<% row += 1 %>
@ -24,6 +31,9 @@
<label for="new_context_name">New context</label><br />
<%= text_field("new_context", "name") %>
<br />
<label for="new_context_one_front">Hide from front page?</label><br />
<%= check_box( "new_context", "hide" ) %>
<br />
<input type="submit" value="Add context">
</form>
</div>

View file

@ -11,6 +11,7 @@ Project wiki: <http://www.rousette.org.uk/projects/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

View file

@ -254,6 +254,5 @@ table.list {
.next_actions td {
border: none;
padding-top: 3px;
padding-bottom: 3px;
padding-bottom: 5px;
}