Commit 1d1381cd authored by Boris Kocherov's avatar Boris Kocherov

erp5_xhtml_style: triggerMaximize(), triggerSubmit(), setFillStyle() add to erp5_gadgetfield.js

parent 2467360b
...@@ -1196,6 +1196,14 @@ span.search button .image {\n ...@@ -1196,6 +1196,14 @@ span.search button .image {\n
padding: 5px;\n padding: 5px;\n
}\n }\n
\n \n
/* Fullscreen content section */\n
.ui-content-fullscreen {\n
position: fixed;\n
top: 0; left: 0; right: 0; bottom: 0;\n
height: auto;\n
z-index: 2000;\n
}\n
\n
/* Search results list\n /* Search results list\n
------------------------------------------------*/\n ------------------------------------------------*/\n
\n \n
......
...@@ -27,6 +27,19 @@ ...@@ -27,6 +27,19 @@
return new RSVP.Promise(resolver, canceller); return new RSVP.Promise(resolver, canceller);
} }
function getMaxHeight(wrap_obj) {
var height;
if (wrap_obj) {
height = window.innerHeight - wrap_obj.offsetTop - 280;
} else {
height = window.innerHeight;
}
if (height < 400) {
height = 400;
}
return height + "px";
}
rJS(window) rJS(window)
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// ready // ready
...@@ -46,6 +59,53 @@ ...@@ -46,6 +59,53 @@
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// declared methods // declared methods
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.allowPublicAcquisition('setFillStyle', function () {
var gadget = this,
iframe = gadget.props.element.querySelector('iframe'),
height = getMaxHeight(iframe),
width = "100%";
iframe.setAttribute(
'style',
'width: ' + width + '; border: 0 none; height: ' + height
);
return {height: height, width: width};
})
.allowPublicAcquisition('triggerMaximize', function () {
var gadget = this,
fullscreen_classname = "ui-content-fullscreen",
info,
wrap = gadget.props.element.querySelector('iframe'),
subiframe = wrap.contentDocument.querySelector('iframe');
if (wrap.className.search(" " + fullscreen_classname) === -1) {
gadget.props.fullScreenRestore = {
scrollTop: window.pageYOffset,
scrollLeft: window.pageXOffset,
width: wrap.width,
height: wrap.height
};
wrap.style.width = "100%";
wrap.style.height = getMaxHeight();
wrap.className += " " + fullscreen_classname;
document.documentElement.style.overflow = "hidden";
} else {
wrap.className = wrap.className
.replace(new RegExp("\\s*" + fullscreen_classname + "\\b"), "");
document.documentElement.style.overflow = "";
info = gadget.props.fullScreenRestore;
// wrap.style.width = info.width;
wrap.style.width = "100%";
wrap.style.height = getMaxHeight(wrap);
window.scrollTo(info.scrollLeft, info.scrollTop);
}
if (subiframe) {
subiframe.style.height = wrap.style.height;
}
})
.allowPublicAcquisition('triggerSubmit', function () {
return document.querySelector("button[name='Base_edit:method']").click();
})
.declareService(function () { .declareService(function () {
var g = this, var g = this,
i, i,
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts20545059.65</string> </value> <value> <string>ts57741245.74</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>7063</int> </value> <value> <int>9114</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment