Class: N::UI::Popup
- Inherits:
-
Object
- Object
- N::UI::Popup
- Defined in:
- lib/n/ui/popup.rb
Overview
Popup
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.
39 40 41 |
# File 'lib/n/ui/popup.rb', line 39 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.
33 34 35 |
# File 'lib/n/ui/popup.rb', line 33 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>
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/n/ui/popup.rb', line 17 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 |