Module: NavigatorRails::Config
- Included in:
- NavigatorRails
- Defined in:
- lib/navigator_rails/config.rb
Instance Method Summary collapse
- #brand(params = {}) ⇒ Object
- #cancan? ⇒ Boolean
- #config(&block) ⇒ Object
- #constraint(constraint) ⇒ Object
- #devise? ⇒ Boolean
- #rails? ⇒ Boolean
- #rolify? ⇒ Boolean
- #use(*params) ⇒ Object
Instance Method Details
#brand(params = {}) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/navigator_rails/config.rb', line 23 def brand params={} params[:path] and path = "/#{params[:path].to_s}/brand" params[:content] and content = params[:content] path ||= '/head' content ||= '<span class="ion-cube">Project Name</span>' @config[:build_brand] = {path: path, content: content} end |
#cancan? ⇒ Boolean
47 48 49 |
# File 'lib/navigator_rails/config.rb', line 47 def cancan? defined?(CanCan) and true end |
#config(&block) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/navigator_rails/config.rb', line 3 def config &block if block_given? @config ||= { default_constraint: true, use_cancan: false, use_devise: false, use_rolify: false, search_at: %w{ app/controllers }, controllers: [], decorators: [ :navigator, :navbar, :submenu, :link ], } class_eval(&block) Decorator.instance Store.instance Store.collect Store.process_config_builders else @config end end |
#constraint(constraint) ⇒ Object
44 45 46 |
# File 'lib/navigator_rails/config.rb', line 44 def constraint constraint @config[:default_constraint] = constraint end |
#devise? ⇒ Boolean
50 51 52 |
# File 'lib/navigator_rails/config.rb', line 50 def devise? defined?(Devise) and true end |
#rails? ⇒ Boolean
56 57 58 |
# File 'lib/navigator_rails/config.rb', line 56 def rails? defined?(Rails) and true end |
#rolify? ⇒ Boolean
53 54 55 |
# File 'lib/navigator_rails/config.rb', line 53 def rolify? defined?(Rolify) and true end |
#use(*params) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/navigator_rails/config.rb', line 31 def use *params if params.count == 1 and params.first.class == Hash features = params.first.keys params.first.each do |builder,path| @config["build_#{builder}_at".to_sym] = path end else features = params end features.each do |feature| @config["use_#{feature}".to_sym] = true end end |