Skip to content

Commit

Permalink
Refactor helper method to fix duplicated issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sales committed Nov 25, 2016
1 parent 2ad1dea commit 481e90e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions helpers/custom_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ def is_page_active(page)
#
# = link_to 'Home', '/', class: ( 'is-active' if is_parent_page_active('/') )
#
def is_parent_page_active(page)
current_page.url.match(page)
def is_parent_page_active(url, title)
if current_page.data.parent.present?
current_page.data.parent == title
else
current_page.url.match(url)
end
end
end

0 comments on commit 481e90e

Please sign in to comment.