boissier_app/app/controllers/public/menu_items_controller.rb
Nicolas Bally 6abf7679fd initial
2011-05-14 13:36:30 +02:00

36 lines
675 B
Ruby

# -*- encoding : utf-8 -*-
class Public::MenuItemsController < ApplicationController
layout "public"
def show
@menu_item = MenuItem.find_by_permalink(params[:url])
if @menu_item
if !@menu_item.enabled
redirect_to "/404.html"
elsif @menu_item.menu_content_type == "MenuAlias"
if @menu_item.menu_content.menu_item
redirect_to menu_item_path(:url => @menu_item.menu_content.menu_item_alias.permalink)
else
redirect_to "/404.html"
end
elsif @menu_item.menu_content_type == "Page"
@page = @menu_item.menu_content
@title = @page.title
end
else
redirect_to "/404.html"
end
end
end