Class: NavGate::Builder

Inherits:
Base
  • Object
show all
Defined in:
lib/navgate/builder.rb

Instance Attribute Summary

Attributes inherited from Base

#by_id, #controller, #css_class, #css_selected, #default, #prefix, #selection

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from NavGate::Base

Instance Method Details

#render_it_with(options, selected) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/navgate/builder.rb', line 4

def render_it_with(options,selected)
  options_to_render = ""
  if self.css_class
    if options && options[:class]
      options[:class] = self.css_class
    else
      options = { class: self.css_class}
    end
  end
  if options
    options.each do |key,value|
      options_to_render += ("#{key}='#{value}'" + " ") unless ignoring key
    end
  end
  style = styling(options)
  @text_to_render = ""
  selected.gsub!('/',"")
  if !self.by_id
    self.selection.each do |select|
      @text_to_render += select_text_for(select,selected,options[:wrap],options_to_render,style)
    end
  else
    self.selection.each_with_index do |select,i|
      @text_to_render += select_text_for(select,selected,options[:wrap],options_to_render,style,i)
    end
  end
  @text_to_render
end