Sha256: d8b77073839268a070e7ebe63eb7a8300fda0787158abf2de71b707c3421c01e

Contents?: true

Size: 1.4 KB

Versions: 12

Compression:

Stored size: 1.4 KB

Contents

# code: 
# * George Moschovitis  <gm@navel.gr>
#
# (c) 2004 Navel, all rights reserved.
# $Id: popup.rb 99 2004-10-22 09:50:28Z gmosx $

module N; module UI

# = Popup
#
# Display a popup window.
#
class Popup

	#  Emit the needed javascript.
	#  Alternatively use this code: <script src="/r/js/std.js">#{}</script>
	# 
	def self.script
%[
function newWin(url, name, w, h, scroll) {
	var pleft = (screen.width - w) / 2;
	var ptop = (screen.height - h) / 2;
	var settings = 'height=' + h + ',width=' + w + ',top=' + ptop + ',left=' + pleft + ',scrollbars=' + scroll + ',resizable';

	win = window.open(url, name, settings);

	return false;
}
]
	end

	# gmosx: keep the leading / to be IE friendly.
	#
	def self.onclick(uri, width, height, title = "Popup", type="PAGE", options = "scrollbars=yes,resizable", container = "/p/glue/popup.sx")
		%[javascript: var pwl = (screen.width - #{width}) / 2; var pwt = (screen.height - #{height}) / 2; window.open('#{container}?uri=#{uri};type=#{type}', '#{title}', 'width=#{width},height=#{height},top='+pwt+',left='+pwl+', #{options}'); return false"]		
	end	
	
	# gmosx: keep the leading / to be IE friendly.
	#
	def self.link(uri, width, height, link = "link", title = "Popup", type="PAGE", options = "scrollbars=yes,resizable", container = "/p/glue/popup.sx")
		%[<a href="#" onclick="#{self.onclick(uri, width, height, title, type, options, container)}">#{link}</a>]
	end
end

end; end # module

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
nitro-0.10.0 lib/nitro/ui/popup.rb
nitro-0.12.0 lib/nitro/ui/popup.rb
nitro-0.11.0 lib/nitro/ui/popup.rb
nitro-0.13.0 lib/nitro/ui/popup.rb
nitro-0.14.0 lib/nitro/ui/popup.rb
nitro-0.15.0 lib/nitro/ui/popup.rb
nitro-0.2.0 lib/n/ui/popup.rb
nitro-0.3.0 lib/n/ui/popup.rb
nitro-0.9.3 lib/nitro/ui/popup.rb
nitro-0.9.5 lib/nitro/ui/popup.rb
nitro-0.8.0 lib/nitro/ui/popup.rb
nitro-0.7.0 lib/nitro/ui/popup.rb