Class: N::UI::Popup
Overview
Popup
Display a popup window.
Class Method Summary collapse
-
.link(uri, width, height, link = "link", title = "Popup", type = "PAGE", options = "scrollbars=yes,resizable", container = "/p/glue/popup.sx") ⇒ Object
gmosx: keep the leading / to be IE friendly.
-
.onclick(uri, width, height, title = "Popup", type = "PAGE", options = "scrollbars=yes,resizable", container = "/p/glue/popup.sx") ⇒ Object
gmosx: keep the leading / to be IE friendly.
-
.script ⇒ Object
Emit the needed javascript.
Class Method Details
.link(uri, width, height, link = "link", title = "Popup", type = "PAGE", options = "scrollbars=yes,resizable", container = "/p/glue/popup.sx") ⇒ Object
gmosx: keep the leading / to be IE friendly.
40 41 42 |
# File 'lib/nitro/ui/popup.rb', line 40 def self.link(uri, width, height, link = "link", title = "Popup", type="PAGE", = "scrollbars=yes,resizable", container = "/p/glue/popup.sx") %[<a href="#" onclick="#{self.onclick(uri, width, height, title, type, , container)}">#{link}</a>] end |
.onclick(uri, width, height, title = "Popup", type = "PAGE", options = "scrollbars=yes,resizable", container = "/p/glue/popup.sx") ⇒ Object
gmosx: keep the leading / to be IE friendly.
34 35 36 |
# File 'lib/nitro/ui/popup.rb', line 34 def self.onclick(uri, width, height, title = "Popup", type="PAGE", = "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+', #{}'); return false"] end |
.script ⇒ Object
Emit the needed javascript.
Alternatively use this code: <script src="/r/js/std.js">#{}</script>
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/nitro/ui/popup.rb', line 18 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 |