Sha256: 6b099a1aac5552021f13c20cf1312f3b3d6d9f6dcf5c6c3123a53d51ad1c0b06
Contents?: true
Size: 974 Bytes
Versions: 3
Compression:
Stored size: 974 Bytes
Contents
module DynamicMenu module InheritableMenus mattr_accessor :menu @@menu = Hash.new def get_current_menu path = Rails.root.join('app/menus') full_path = path + "#{params[:controller]}/#{params[:action]}.rb" if File.exists?(full_path) load full_path "#{params[:action]}Menu".classify.constantize.new(self) else #Depending on the action (for example edit) it should look for a relationship (:create=:new or :update=:edit) end end def dynamic_menu_file_loader controller, action path = Rails.root.join('app/menus') full_path += "#{controller}/#{action}.rb" try_again_des = try_again? action if !try_again_des.nil? dynamic_menu_file_loader controller, try_again_des end end def try_again? action if action == :create return :new elsif action == :update return :edit end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dynamic_menu-3.0.1 | lib/dynamic_menu/inheritable_menus.rb |
dynamic_menu-3.0.0 | lib/dynamic_menu/inheritable_menus.rb |
dynamic_menu-3.0.0.rc3 | lib/dynamic_menu/inheritable_menus.rb |