mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-26 12:08:47 +01:00
Provide data needed for partial views
The partials for context and project need to compute the context's/project's id, which is done based on @context/@project. Provide this data. Fixes #1836
This commit is contained in:
parent
e7495e32b7
commit
4ce7c6bcd4
1 changed files with 11 additions and 0 deletions
|
|
@ -425,6 +425,8 @@ class TodosController < ApplicationController
|
|||
|
||||
@saved = @todo.save
|
||||
|
||||
provide_project_or_context_for_view
|
||||
|
||||
# this is set after save and cleared after reload, so save it here
|
||||
@removed_predecessors = @todo.removed_predecessors
|
||||
|
||||
|
|
@ -457,6 +459,15 @@ class TodosController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def provide_project_or_context_for_view
|
||||
# see application_helper:source_view_key, used in shown partials
|
||||
if source_view_is :project
|
||||
@project = @todo.project
|
||||
elsif source_view_is :context
|
||||
@context = @todo.context
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@source_view = params['_source_view'] || 'todo'
|
||||
@todo = current_user.todos.find(params['id'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue