diff --git a/tracks/app/controllers/todo_controller.rb b/tracks/app/controllers/todo_controller.rb index f93af164..bcbd9326 100644 --- a/tracks/app/controllers/todo_controller.rb +++ b/tracks/app/controllers/todo_controller.rb @@ -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 ) diff --git a/tracks/app/models/context.rb b/tracks/app/models/context.rb index 44526134..cb7eec1f 100644 --- a/tracks/app/models/context.rb +++ b/tracks/app/models/context.rb @@ -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 diff --git a/tracks/app/models/project.rb b/tracks/app/models/project.rb index 96dc94aa..0d4588d9 100644 --- a/tracks/app/models/project.rb +++ b/tracks/app/models/project.rb @@ -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 diff --git a/tracks/app/models/todo.rb b/tracks/app/models/todo.rb index b9c1721b..07de183c 100644 --- a/tracks/app/models/todo.rb +++ b/tracks/app/models/todo.rb @@ -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 diff --git a/tracks/app/views/context/edit.rhtml b/tracks/app/views/context/edit.rhtml index 9d47fefb..37a97497 100644 --- a/tracks/app/views/context/edit.rhtml +++ b/tracks/app/views/context/edit.rhtml @@ -1,5 +1,6 @@

Edit context

+ <%= error_messages_for 'context' %>
<%= render_partial "edit_context", "@context" %> diff --git a/tracks/app/views/context/list.rhtml b/tracks/app/views/context/list.rhtml index a8f86a17..77cf3def 100644 --- a/tracks/app/views/context/list.rhtml +++ b/tracks/app/views/context/list.rhtml @@ -17,7 +17,7 @@ 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.") + " " %> + <%= 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.") + " " %> <% row += 1 %> <% end %> diff --git a/tracks/app/views/project/_not_done.rhtml b/tracks/app/views/project/_not_done.rhtml index e24caa63..f0cdb638 100644 --- a/tracks/app/views/project/_not_done.rhtml +++ b/tracks/app/views/project/_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, { :controller => "todo", :action => "destroy", :id => @item.id }, :title => "Delete item", :confirm => "Are you sure you want to delete this entry: #{@item.description}" ) + " " %> + <%= 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}" ) + " " %> <%= due_date( @item.due ) %> <%= @item.description %> <% if @item.project_id %> diff --git a/tracks/app/views/project/list.rhtml b/tracks/app/views/project/list.rhtml index 7d4d0453..a462065d 100644 --- a/tracks/app/views/project/list.rhtml +++ b/tracks/app/views/project/list.rhtml @@ -10,7 +10,7 @@ <% end %> <%= @project.id.to_s %> <%= link_to ( "#{@project.name}", :action => "show", :id => @project.id ) %> - <%= 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." ) + " " %> + <%= 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." ) + " " %> <% row += 1 %> <% end %> diff --git a/tracks/app/views/todo/_item.rhtml b/tracks/app/views/todo/_item.rhtml index 48d3c50b..bd833e56 100644 --- a/tracks/app/views/todo/_item.rhtml +++ b/tracks/app/views/todo/_item.rhtml @@ -21,7 +21,7 @@

- <% if @belongs == nil %> <% end %> @@ -33,7 +33,7 @@ <% end %> <% end %> - +

<%= date_select( "item", "due", :include_blank => true, :start_year => 2005, "tabindex" => 5 ) %> diff --git a/tracks/config/environment.rb b/tracks/config/environment.rb index 62a7c668..164b80be 100644 --- a/tracks/config/environment.rb +++ b/tracks/config/environment.rb @@ -1,5 +1,5 @@ RAILS_ROOT = File.dirname(__FILE__) + "/../" -RAILS_ENV = ENV['RAILS_ENV'] || 'development' +RAILS_ENV = ENV['RAILS_ENV'] || 'production' # Mocks first. diff --git a/tracks/config/environments/development.rb b/tracks/config/environments/development.rb index 3d2c0be3..fb8baacd 100644 --- a/tracks/config/environments/development.rb +++ b/tracks/config/environments/development.rb @@ -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 \ No newline at end of file +# 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") \ No newline at end of file diff --git a/tracks/config/environments/production.rb b/tracks/config/environments/production.rb index 8b673937..e97ed79f 100644 --- a/tracks/config/environments/production.rb +++ b/tracks/config/environments/production.rb @@ -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 \ No newline at end of file +# 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") diff --git a/tracks/config/settings.yml.tmpl b/tracks/config/settings.yml.tmpl index b6143fa3..e3b8d406 100644 --- a/tracks/config/settings.yml.tmpl +++ b/tracks/config/settings.yml.tmpl @@ -1,4 +1,4 @@ formats: date: %d/%m/%Y -path: - base: http://tracks +admin: + email: butshesagirl@rousette.org.uk