Module: N::UI

Defined in:
lib/n/ui/tabs.rb,
lib/n/ui/popup.rb,
lib/n/ui/select.rb

Defined Under Namespace

Classes: Popup, Select

Class Method Summary collapse

Class Method Details

.tabs(request, options, param) ⇒ Object

Render a tabs bar

Example:

#{N::UI.tabs(request, [“Page1”, “Page2”, “Page3”] }



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/n/ui/tabs.rb', line 18

def self.tabs(request, options, param)
	tabs = []

	selected = request.get(param, 0)
	
	options.each_with_index { |opt, idx|
		if idx == selected
			tabs << %|<strong>#{opt}</strong>|
		else
			tabs << %|<a href="#{request.expand_uri(param => idx)}">#{opt}</a>|
		end
	}
	
	return %|<div class="tabs">#{tabs.join('<span class="sep">|</span>')}</div>| 
end