mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-19 23:46:10 +01:00
Added first patch contributed by Jim Ray: adds a host of fixes and bits of cleaning up, including a position column for contexts and projects to allow custom sorting, and changes to the links for pages to make them more human-readable.
I also added a pop-up calendar to set the due date. This is entirely lifted from Michele's excellent tutorial on pxl8.com (<http://www.pxl8.com/calendar_date_picker.html>). It works well, but I need to make sure it doesn't break in postgresql or sqlite. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@49 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
f6eeb1d20d
commit
e0b9ba0182
20 changed files with 319 additions and 111 deletions
|
|
@ -11,9 +11,15 @@ class ContextController < ApplicationController
|
|||
# Main method for listing contexts
|
||||
# Set page title, and collect existing contexts in @contexts
|
||||
#
|
||||
|
||||
def index
|
||||
list
|
||||
render_action "list"
|
||||
end
|
||||
|
||||
def list
|
||||
@page_title = "List Contexts"
|
||||
@contexts = Context.find_all
|
||||
@contexts = Context.find_all( conditions = nil, "position ASC", limit = nil )
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -33,7 +39,20 @@ class ContextController < ApplicationController
|
|||
redirect_to( :action => "list" )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def new
|
||||
expire_action(:controller => "context", :action => "list")
|
||||
context = Context.new
|
||||
context.attributes = @params["new_context"]
|
||||
|
||||
if context.save
|
||||
flash["confirmation"] = "Succesfully created context \"#{context.name}\""
|
||||
redirect_to( :action => "list" )
|
||||
else
|
||||
flash["warning"] = "Couldn't add new context \"#{context.name}\""
|
||||
redirect_to( :action => "list" )
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
expire_action(:controller => "context", :action => "list")
|
||||
|
|
@ -56,10 +75,10 @@ class ContextController < ApplicationController
|
|||
|
||||
|
||||
# Filter the contexts to show just the one passed in the URL
|
||||
# e.g. <home>/context/show/<context_id> shows just <context_id>.
|
||||
# e.g. <home>/context/show/<context_name> shows just <context_name>.
|
||||
#
|
||||
def show
|
||||
@context = Context.find(@params["id"])
|
||||
@context = Context.find_by_name(@params["id"].humanize)
|
||||
@projects = Project.find_all
|
||||
@page_title = "Context: #{@context.name.capitalize}"
|
||||
@not_done = Todo.find_all( "context_id=#{@context.id} AND done=0", "created ASC" )
|
||||
|
|
@ -74,15 +93,16 @@ class ContextController < ApplicationController
|
|||
expire_action(:controller => "context", :action => "list")
|
||||
item = Todo.new
|
||||
item.attributes = @params["new_item"]
|
||||
where = Context.find_by_id(item.context_id)
|
||||
|
||||
back_to = item.context_id
|
||||
back_to = urlize(where.name)
|
||||
|
||||
if item.save
|
||||
flash["confirmation"] = "Succesfully added action \"#{item.description}\" to context"
|
||||
redirect_to( :controller => "context", :action => "show", :id => "#{back_to}" )
|
||||
redirect_to( :controller => "context", :action => "show", :name => "#{back_to}")
|
||||
else
|
||||
flash["warning"] = "Could not add action \"#{item.description}\" to context"
|
||||
redirect_to( :controller => "context", :action => "show", :id => "#{back_to}" )
|
||||
redirect_to( :controller => "context", :action => "show", :name => "#{back_to}" )
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue