mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-18 00:00:12 +01:00
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:
parent
cd1984ad22
commit
5b34c57c81
13 changed files with 19 additions and 12 deletions
|
|
@ -14,7 +14,7 @@ class TodoController < ApplicationController
|
||||||
@page_title = "List tasks"
|
@page_title = "List tasks"
|
||||||
@projects = Project.find_all
|
@projects = Project.find_all
|
||||||
@places = Context.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 )
|
@hidden_places = Context.find_all_by_hide( 1 )
|
||||||
@done = Todo.find_all_by_done( 1, "completed DESC", 5 )
|
@done = Todo.find_all_by_done( 1, "completed DESC", 5 )
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,5 @@ class Context < ActiveRecord::Base
|
||||||
# and must be less than 255 bytes
|
# and must be less than 255 bytes
|
||||||
validates_presence_of :name, :message => "context must have a name"
|
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_length_of :name, :maximum => 255, :message => "context name must be less than %d"
|
||||||
|
validates_uniqueness_of :name, :message => "already exists"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,5 @@ class Project < ActiveRecord::Base
|
||||||
# and must be less than 255 bytes
|
# and must be less than 255 bytes
|
||||||
validates_presence_of :name, :message => "project must have a name"
|
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_length_of :name, :maximum => 255, :message => "project name must be less than %d"
|
||||||
|
validates_uniqueness_of :name, :message => "already exists"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
class Todo < ActiveRecord::Base
|
class Todo < ActiveRecord::Base
|
||||||
|
|
||||||
belongs_to :context
|
belongs_to :context, :order => 'name'
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
|
|
||||||
# Description field can't be empty, and must be < 100 bytes
|
# Description field can't be empty, and must be < 100 bytes
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
<div id="display_box">
|
<div id="display_box">
|
||||||
<h2>Edit context</h2>
|
<h2>Edit context</h2>
|
||||||
|
<%= error_messages_for 'context' %>
|
||||||
<form action="/context/update" method="post">
|
<form action="/context/update" method="post">
|
||||||
<%= render_partial "edit_context", "@context" %>
|
<%= render_partial "edit_context", "@context" %>
|
||||||
<input type="submit" value="Update" />
|
<input type="submit" value="Update" />
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
shown
|
shown
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</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>
|
</tr>
|
||||||
<% row += 1 %>
|
<% row += 1 %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<% @item = not_done %>
|
<% @item = not_done %>
|
||||||
<tr>
|
<tr>
|
||||||
<td valign="top"><%= check_box( "item", "done", "onclick" => "document.location.href='/todo/toggle_check/#{@item.id}'" ) %></td>
|
<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 ) %>
|
<td valign="top"><%= due_date( @item.due ) %>
|
||||||
<%= @item.description %>
|
<%= @item.description %>
|
||||||
<% if @item.project_id %>
|
<% if @item.project_id %>
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<td align="right" width="20"><%= @project.id.to_s %></td>
|
<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="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>
|
</tr>
|
||||||
<% row += 1 %>
|
<% row += 1 %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
</select>
|
</select>
|
||||||
<br />
|
<br />
|
||||||
<label for="new_item_project_id">Project</label><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 %>
|
<% if @belongs == nil %>
|
||||||
<option value="" selected="selected">None</option>
|
<option value="" selected="selected">None</option>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
<option value="<%= @project.id %>"><%= @project.name %></option>
|
<option value="<%= @project.id %>"><%= @project.name %></option>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</select>
|
</select>
|
||||||
<br />
|
<br />
|
||||||
<label for="item_due" tab>Due</label><br />
|
<label for="item_due" tab>Due</label><br />
|
||||||
<%= date_select( "item", "due", :include_blank => true, :start_year => 2005, "tabindex" => 5 ) %>
|
<%= date_select( "item", "due", :include_blank => true, :start_year => 2005, "tabindex" => 5 ) %>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
RAILS_ROOT = File.dirname(__FILE__) + "/../"
|
RAILS_ROOT = File.dirname(__FILE__) + "/../"
|
||||||
RAILS_ENV = ENV['RAILS_ENV'] || 'development'
|
RAILS_ENV = ENV['RAILS_ENV'] || 'production'
|
||||||
|
|
||||||
|
|
||||||
# Mocks first.
|
# Mocks first.
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,6 @@ Dependencies.mechanism = :load
|
||||||
ActionController::Base.consider_all_requests_local = true
|
ActionController::Base.consider_all_requests_local = true
|
||||||
ActionController::Base.perform_caching = false
|
ActionController::Base.perform_caching = false
|
||||||
BREAKPOINT_SERVER_PORT = 42531
|
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")
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
Dependencies.mechanism = :require
|
Dependencies.mechanism = :require
|
||||||
ActionController::Base.consider_all_requests_local = false
|
ActionController::Base.consider_all_requests_local = false
|
||||||
ActionController::Base.perform_caching = true
|
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")
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
formats:
|
formats:
|
||||||
date: %d/%m/%Y
|
date: %d/%m/%Y
|
||||||
path:
|
admin:
|
||||||
base: http://tracks
|
email: butshesagirl@rousette.org.uk
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue