Class: Odania::MenuController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Odania::MenuController
- Defined in:
- app/controllers/odania/menu_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'app/controllers/odania/menu_controller.rb', line 5 def index accepted_langs = current_site..map { |o| o.language.iso_639_1 } locale = http_accept_language.preferred_language_from(accepted_langs) language = Odania::Language.where(iso_639_1: locale).first if locale.nil? language = current_site.default_language if language.nil? = current_site..where(language_id: language.id).first return render_not_found if .nil? redirect_to .get_target_path end |
#menu_index ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/odania/menu_controller.rb', line 16 def = . unless ..nil? = ..where(parent_id: nil).first if .nil? return render_error(t('No content defined')) if .nil? return redirect_to .target_data['url'] if 'URL'.eql? .target_type redirect_to .get_target_path end |
#show_page ⇒ Object
26 27 28 29 30 |
# File 'app/controllers/odania/menu_controller.rb', line 26 def show_page # Try to find the correct menu_item = ..where(full_path: params[:path]).first () end |