mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-24 01:36:10 +01:00
Merge branch '2.3_branch'
This commit is contained in:
commit
8dd4970b0c
6 changed files with 36 additions and 10 deletions
|
|
@ -85,7 +85,7 @@ class TodosController < ApplicationController
|
|||
create_multiple
|
||||
else
|
||||
p = Todos::TodoCreateParamsHelper.new(params, current_user)
|
||||
p.parse_dates() unless mobile?
|
||||
p.parse_dates unless mobile?
|
||||
tag_list = p.tag_list
|
||||
|
||||
@todo = current_user.todos.build
|
||||
|
|
@ -423,7 +423,18 @@ class TodosController < ApplicationController
|
|||
update_dependencies
|
||||
update_attributes_of_todo
|
||||
|
||||
@saved = @todo.save
|
||||
begin
|
||||
@saved = @todo.save!
|
||||
rescue ActiveRecord::RecordInvalid => exception
|
||||
record = exception.record
|
||||
if record.is_a?(Dependency)
|
||||
record.errors.each { |key,value| @todo.errors[key] << value }
|
||||
end
|
||||
@saved = false
|
||||
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
|
||||
|
|
@ -457,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'])
|
||||
|
|
@ -1133,7 +1153,7 @@ end
|
|||
end
|
||||
|
||||
def update_project
|
||||
@project_changed = false;
|
||||
@project_changed = false
|
||||
if params['todo']['project_id'].blank? && !params['project_name'].nil?
|
||||
if params['project_name'].blank?
|
||||
project = Project.null_object
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue