Merge pull request #206 from mmozuras/refactor_unless_blanks_into_presents

Refactor unless blanks into presents
This commit is contained in:
Reinier Balt 2013-09-13 06:08:16 -07:00
commit e2eb31cfcc
15 changed files with 25 additions and 25 deletions

View file

@ -73,7 +73,7 @@ class TodosController < ApplicationController
def create
@source_view = params['_source_view'] || 'todo'
@default_context = current_user.contexts.where(:name => params['default_context_name']).first
@default_project = current_user.projects.where(:name => params['default_project_name']).first unless params['default_project_name'].blank?
@default_project = current_user.projects.where(:name => params['default_project_name']).first if params['default_project_name'].present?
@tag_name = params['_tag_name']
@ -156,7 +156,7 @@ class TodosController < ApplicationController
# first build all todos and check if they would validate on save
params[:todo][:multiple_todos].split("\n").map do |line|
unless line.blank? #ignore blank lines
if line.present? #ignore blank lines
@todo = current_user.todos.build({:description => line, :context_id => p.context_id, :project_id => p.project_id})
validates &&= @todo.valid?
@ -202,7 +202,7 @@ class TodosController < ApplicationController
else
@multiple_error = @todos.size > 0 ? "" : t('todos.next_action_needed')
@saved = false
@default_tags = current_user.projects.where(:name => @initial_project_name).default_tags unless @initial_project_name.blank?
@default_tags = current_user.projects.where(:name => @initial_project_name).default_tags if @initial_project_name.present?
end
@status_message = @todos.size > 1 ? t('todos.added_new_next_action_plural') : t('todos.added_new_next_action_singular')