[IMP] attempt to fix height of widgets in home page
bzr revid: xmo@openerp.com-20110825144131-8xe3ukrdoph9p9v1
This commit is contained in:
@@ -1,11 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import openerpweb
|
||||
|
||||
WIDGET_CONTENT_PATTERN = """<!DOCTYPE html>
|
||||
<html>
|
||||
<head><title>[[Widget %(id)d]]</title></head>
|
||||
<body>
|
||||
%(content)s
|
||||
<script type="text/javascript">
|
||||
var load = window.onload;
|
||||
window.onload = function () {
|
||||
if (load) {
|
||||
load();
|
||||
}
|
||||
window.frameElement.style.height = document.height + 'px';
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
class Widgets(openerpweb.openerpweb.Controller):
|
||||
_cp_path = '/base_dashboard/widgets'
|
||||
|
||||
@openerpweb.httprequest
|
||||
def content(self, request, widget_id):
|
||||
return request.session.model('res.widget').read(
|
||||
return WIDGET_CONTENT_PATTERN % request.session.model('res.widget').read(
|
||||
[widget_id], ['content'], request.session.eval_context(request.context)
|
||||
)[0]['content']
|
||||
)[0]
|
||||
|
||||
Reference in New Issue
Block a user