A handful of tweaks and adjustments:

* Added some more validation statements to make sure that context and project names aren't duplicated
* Sort contexts by name rather than id (a placeholder until I can get custom sort orders working
* Made the default environment production in environment.rb


git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@34 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
bsag 2005-03-02 16:09:49 +00:00
parent cd1984ad22
commit 5b34c57c81
13 changed files with 19 additions and 12 deletions

View file

@ -14,7 +14,7 @@ class TodoController < ApplicationController
@page_title = "List tasks"
@projects = Project.find_all
@places = Context.find_all
@shown_places = Context.find_all_by_hide( 0, "id ASC" )
@shown_places = Context.find_all_by_hide( 0, "name DESC")
@hidden_places = Context.find_all_by_hide( 1 )
@done = Todo.find_all_by_done( 1, "completed DESC", 5 )

View file

@ -5,4 +5,5 @@ class Context < ActiveRecord::Base
# and must be less than 255 bytes
validates_presence_of :name, :message => "context must have a name"
validates_length_of :name, :maximum => 255, :message => "context name must be less than %d"
validates_uniqueness_of :name, :message => "already exists"
end

View file

@ -5,4 +5,5 @@ class Project < ActiveRecord::Base
# and must be less than 255 bytes
validates_presence_of :name, :message => "project must have a name"
validates_length_of :name, :maximum => 255, :message => "project name must be less than %d"
validates_uniqueness_of :name, :message => "already exists"
end

View file

@ -1,6 +1,6 @@
class Todo < ActiveRecord::Base
belongs_to :context
belongs_to :context, :order => 'name'
belongs_to :project
# Description field can't be empty, and must be < 100 bytes

View file

@ -1,5 +1,6 @@
<div id="display_box">
<h2>Edit context</h2>
<%= error_messages_for 'context' %>
<form action="/context/update" method="post">
<%= render_partial "edit_context", "@context" %>
<input type="submit" value="Update" />

View file

@ -17,7 +17,7 @@
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>
<td width="40"><%= link_image_to("edit", { :action => "edit", :id => @context.id }, :title => "Edit item", :size => "10x10") + " " + link_image_to("delete", { :action => "destroy", :id => @context.id }, :title => "Delete item", :size => "10x10", :confirm => "Are you sure you want to delete this context: #{@context.name}. Any todos in this context will be deleted.") + " " %></td>
</tr>
<% row += 1 %>
<% 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, { :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" width="30"><%= link_image_to( "edit", { :action => "edit", :id => @item.id }, :title => "Edit item", :size => "10x10" ) + " " + link_image_to( "delete", { :controller => "todo", :action => "destroy", :id => @item.id }, :title => "Delete item", :size => "10x10", :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,7 +10,7 @@
<% end %>
<td align="right" width="20"><%= @project.id.to_s %></td>
<td width="390"><%= link_to ( "#{@project.name}", :action => "show", :id => @project.id ) %></td>
<td width="40"><%= link_to( $edit_img, { :action => "edit", :id => @project.id }, :title => "Edit item" ) + " " + link_to($delete_img, { :action => "destroy", :id => @project.id }, :title => "Delete item", :confirm => "Are you sure you want to delete the project: #{@project.name}. Any todos in this project will be deleted." ) + " " %></td>
<td width="40"><%= link_image_to( "edit", { :action => "edit", :id => @project.id }, :title => "Edit item", :size => "10x10" ) + " " + link_image_to( "delete", { :action => "destroy", :id => @project.id }, :title => "Delete item", :size => "10x10", :confirm => "Are you sure you want to delete the project: #{@project.name}. Any todos in this project will be deleted." ) + " " %></td>
</tr>
<% row += 1 %>
<% end %>

View file

@ -21,7 +21,7 @@
</select>
<br />
<label for="new_item_project_id">Project</label><br />
<select name="item[project_id]" id="item_project_id" tabindex="4">
<select name="item[project_id]" id="item_project_id" tabindex="4">
<% if @belongs == nil %>
<option value="" selected="selected">None</option>
<% end %>
@ -33,7 +33,7 @@
<option value="<%= @project.id %>"><%= @project.name %></option>
<% end %>
<% end %>
</select>
</select>
<br />
<label for="item_due" tab>Due</label><br />
<%= date_select( "item", "due", :include_blank => true, :start_year => 2005, "tabindex" => 5 ) %>

View file

@ -1,5 +1,5 @@
RAILS_ROOT = File.dirname(__FILE__) + "/../"
RAILS_ENV = ENV['RAILS_ENV'] || 'development'
RAILS_ENV = ENV['RAILS_ENV'] || 'production'
# Mocks first.

View file

@ -2,4 +2,6 @@ Dependencies.mechanism = :load
ActionController::Base.consider_all_requests_local = true
ActionController::Base.perform_caching = false
BREAKPOINT_SERVER_PORT = 42531
ActionController::Base.fragment_cache_store = ActionController::Caching::Fragments::MemoryStore.new
# Use Memory Store if you are using FCGI, otherwise use file store
ActionController::Base.fragment_cache_store = ActionController::Caching::Fragments::MemoryStore.new
#ActionController::Base.fragment_cache_store = ActionController::Caching::Fragments::FileStore.new("/path/to/cache/directory")

View file

@ -1,4 +1,6 @@
Dependencies.mechanism = :require
ActionController::Base.consider_all_requests_local = false
ActionController::Base.perform_caching = true
ActionController::Base.fragment_cache_store = ActionController::Caching::Fragments::MemoryStore.new
# Use Memory Store if you are using FCGI, otherwise use file store
ActionController::Base.fragment_cache_store = ActionController::Caching::Fragments::MemoryStore.new
#ActionController::Base.fragment_cache_store = ActionController::Caching::Fragments::FileStore.new("/path/to/cache/directory")

View file

@ -1,4 +1,4 @@
formats:
date: %d/%m/%Y
path:
base: http://tracks
admin:
email: butshesagirl@rousette.org.uk