Simplifying show_inactive_tickbox_path method

This commit is contained in:
Brenda Wallace
2018-04-28 22:11:02 +12:00
parent cd910e74bc
commit 1bbf0a3c18

View File

@@ -67,16 +67,12 @@ module ApplicationHelper
def show_inactive_tickbox_path(type, owner, show_all)
all = show_all ? '' : 1
if owner
if type == 'plantings'
plantings_by_owner_path(owner: owner.slug, all: all)
elsif type == 'gardens'
gardens_by_owner_path(owner: owner.slug, all: all)
end
elsif type == 'plantings'
plantings_path(all: all)
elsif type == 'gardens'
gardens_path(all: all)
return plantings_by_owner_path(owner: owner.slug, all: all) if type == 'plantings'
return gardens_by_owner_path(owner: owner.slug, all: all) if type == 'gardens'
end
return plantings_path(all: all) if type == 'plantings'
return gardens_path(all: all) if type == 'gardens'
end
def title(type, owner, crop, planting)