mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-06 21:00:20 +01:00
Updated for Rails 0.14.3
* Fixed unchecking of next actions on context and project pages, so that they now update visually, as well as changing the database. * For some reason, the completion field was not being saved, which was messing up the completed page. That's fixed now. * Deletion and editing of items was broken on context/show and project/show. That's fixed now, but if you uncheck a completed item, then attempt to delete or edit an item without a refresh it will fail. I'm not sure what I can do about this. * Next actions on project and context pages now show the appropriate link to contexts and projects respectively, even when first created by Ajax. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@162 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
a7c094b38d
commit
8a342036a1
20 changed files with 324 additions and 359 deletions
|
|
@ -24,12 +24,11 @@ class ContextController < ApplicationController
|
|||
# e.g. <home>/project/show/<project_name> shows just <project_name>.
|
||||
#
|
||||
def show
|
||||
self.init
|
||||
self.init_todos
|
||||
self.check_user_set_context
|
||||
init
|
||||
init_todos
|
||||
@page_title = "TRACKS::Context: #{@context.name}"
|
||||
end
|
||||
|
||||
|
||||
# Creates a new context via Ajax helpers
|
||||
#
|
||||
def new_context
|
||||
|
|
@ -58,6 +57,19 @@ class ContextController < ApplicationController
|
|||
render :text => ""
|
||||
end
|
||||
end
|
||||
|
||||
# Toggles the 'done' status of the action
|
||||
#
|
||||
def toggle_check
|
||||
self.init
|
||||
|
||||
item = check_user_return_item
|
||||
item.toggle!('done')
|
||||
item.completed = Time.now () # For some reason, the before_save in todo.rb stopped working
|
||||
if item.save
|
||||
render :partial => 'context/show_items', :object => item
|
||||
end
|
||||
end
|
||||
|
||||
# Fairly self-explanatory; deletes the context
|
||||
# If the context contains actions, you'll get a warning dialogue.
|
||||
|
|
@ -84,6 +96,16 @@ class ContextController < ApplicationController
|
|||
end
|
||||
|
||||
protected
|
||||
def check_user_return_item
|
||||
item = Todo.find( @params['id'] )
|
||||
if @session['user'] == item.user
|
||||
return item
|
||||
else
|
||||
flash["warning"] = "Item and session user mis-match: #{item.user.name} and #{@session['user'].name}!"
|
||||
render_text ""
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def check_user_set_context
|
||||
@user = @session['user']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue