Sha256: f57d0f0e63dfc6b36cf4c882596a7532cab38ab450eb0863e4d4f31ec5c9ebf8

Contents?: true

Size: 468 Bytes

Versions: 1

Compression:

Stored size: 468 Bytes

Contents

module ApplicationHelper
  def link_to_menu_item(menu_item)
    url = url_to_menu_item(menu_item)
    link_to(menu_item.label, url)
  end

  def url_to_menu_item(menu_item)
    if 'link' == menu_item.menu_item_type
      url = menu_item.link
    else
      if menu_item.page_id
        page = Cms::Page.find(menu_item.page_id)
        url = page.url
      else
        ComfyPress.logger.warn('Page is not selected for menu item.')
      end
    end

    url
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
comfypress-0.1.4 app/helpers/application_helper.rb