Sha256: a65d84ab1f054921c54b5e7a4c8e6de671f62696c94de46f97d36a974474d542

Contents?: true

Size: 653 Bytes

Versions: 3

Compression:

Stored size: 653 Bytes

Contents

# code: 
# * George Moschovitis  <gm@navel.gr>
#
# (c) 2004 Navel, all rights reserved.
# $Id: tabs.rb 152 2004-11-13 20:02:35Z gmosx $

module N; module UI

	# Render a tabs bar
	#
	# Example:
	#
	# #{N::UI.tabs(request,
	#		["Page1", "Page2", "Page3"]
	#	}
	#
	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
	
end; end # module

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nitro-0.4.1 lib/nitro/ui/tabs.rb
nitro-0.5.0 lib/nitro/ui/tabs.rb
nitro-0.6.0 lib/nitro/ui/tabs.rb