Sha256: 37ac76a0a5833ba57d9eaf141d61687f0cf48839ed1338f337bbfadad75d232b
Contents?: true
Size: 819 Bytes
Versions: 3
Compression:
Stored size: 819 Bytes
Contents
module Seiten module Helpers # Those helpers are convenience methods added to ApplicationController. module Current extend ActiveSupport::Concern included do if respond_to?(:helper_method) helper_method :current_navigation helper_method :current_page end end def current_navigation @current_navigation ||= set_current_navigation end def current_page @current_page ||= set_current_page end private def set_current_navigation Seiten::Navigation.find_by(name: params[:navigation_id] || 'application', locale: params[:locale] || I18n.locale.to_s) end def set_current_page current_navigation&.pages&.find_by(slug: params[:slug]) if params[:slug] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
seiten-1.0.2 | lib/seiten/helpers/current.rb |
seiten-1.0.1 | lib/seiten/helpers/current.rb |
seiten-1.0.0 | lib/seiten/helpers/current.rb |