mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-22 05:50:47 +02:00
Merge pull request #1875 from C-Otto/tracks-1836
(2.3) Provide data needed for partial views
This commit is contained in:
commit
ebec4f089d
5 changed files with 23 additions and 5 deletions
|
@ -434,6 +434,8 @@ class TodosController < ApplicationController
|
|||
end
|
||||
|
||||
|
||||
provide_project_or_context_for_view
|
||||
|
||||
# this is set after save and cleared after reload, so save it here
|
||||
@removed_predecessors = @todo.removed_predecessors
|
||||
|
||||
|
@ -466,6 +468,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