mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-24 03:00:12 +01:00
Remove project_specified_by_name from TodoController
Use TodoCreateParamsHelper instead here and remove the duplication
This commit is contained in:
parent
445a0c7602
commit
d5dc723ef0
1 changed files with 2 additions and 8 deletions
|
|
@ -174,7 +174,8 @@ class TodosController < ApplicationController
|
|||
end
|
||||
|
||||
def create_multiple
|
||||
if project_specified_by_name(params[:project_name])
|
||||
p = TodoCreateParamsHelper.new(params, prefs)
|
||||
if p.project_specified_by_name?
|
||||
project = current_user.projects.where(:name => params[:project_name]).first_or_create
|
||||
@new_project_created = project.new_record_before_save?
|
||||
@project_id = project.id
|
||||
|
|
@ -1350,13 +1351,6 @@ class TodosController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def project_specified_by_name(project_name)
|
||||
return false unless params['project_id'].blank?
|
||||
return false if project_name.blank?
|
||||
return false if project_name == 'None'
|
||||
true
|
||||
end
|
||||
|
||||
def context_specified_by_name(context_name)
|
||||
return false unless params['context_id'].blank?
|
||||
return false if context_name.blank?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue