You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by mf...@apache.org on 2013/08/15 19:31:15 UTC
svn commit: r1514389 -
/rave/trunk/rave-portal-resources/src/main/webapp/static/script/core/rave_opensocial.js
Author: mfranklin
Date: Thu Aug 15 17:31:14 2013
New Revision: 1514389
URL: http://svn.apache.org/r1514389
Log:
Fixed that open view was not respecting preferredHeight (RAVE-1038)
Modified:
rave/trunk/rave-portal-resources/src/main/webapp/static/script/core/rave_opensocial.js
Modified: rave/trunk/rave-portal-resources/src/main/webapp/static/script/core/rave_opensocial.js
URL: http://svn.apache.org/viewvc/rave/trunk/rave-portal-resources/src/main/webapp/static/script/core/rave_opensocial.js?rev=1514389&r1=1514388&r2=1514389&view=diff
==============================================================================
--- rave/trunk/rave-portal-resources/src/main/webapp/static/script/core/rave_opensocial.js (original)
+++ rave/trunk/rave-portal-resources/src/main/webapp/static/script/core/rave_opensocial.js Thu Aug 15 17:31:14 2013
@@ -82,8 +82,8 @@ define(['underscore', 'core/rave_view_ma
"securityToken": data.securityToken,
"metadata": opt_gadgetInfo
},
- height = gadget.metadata.modulePrefs.height || stateManager.getDefaultHeight(),
- width = gadget.metadata.modulePrefs.width || stateManager.getDefaultWidth();
+ height = getHeightFromParams(gadget.metadata.modulePrefs),
+ width = getWidthFromParams(gadget.metadata.modulePrefs);
preloadMetadata(gadget);
@@ -158,6 +158,34 @@ define(['underscore', 'core/rave_view_ma
}
}
+ function getHeightFromParams(opts) {
+ var height;
+ if(opts.height) {
+ height = opts.height;
+ }
+ else if(opts.preferredHeight) {
+ height = opts.preferredHeight;
+ }
+ else {
+ height = stateManager.getDefaultHeight();
+ }
+ return height;
+ }
+
+ function getWidthFromParams(opts) {
+ var width;
+ if(opts.width) {
+ width = opts.width;
+ }
+ else if(opts.preferredWidth) {
+ width = opts.preferredWidth;
+ }
+ else {
+ width = stateManager.getDefaultWidth();
+ }
+ return width;
+ }
+
exports.renderWidget = function (widget, el, opts) {
if (widget.error) {
widget.renderError(el, widget.error.message);
@@ -172,10 +200,10 @@ define(['underscore', 'core/rave_view_ma
renderParams[osapi.container.RenderParam.VIEW] = opts.view || stateManager.getDefaultView();
renderParams[osapi.container.RenderParam.ALLOW_DEFAULT_VIEW ] = opts.allowDefaultView;
renderParams[osapi.container.RenderParam.DEBUG ] = opts.debug;
- renderParams[osapi.container.RenderParam.HEIGHT ] = opts.height || stateManager.getDefaultHeight();
+ renderParams[osapi.container.RenderParam.HEIGHT ] = getHeightFromParams(opts);
renderParams[osapi.container.RenderParam.NO_CACHE ] = opts.noCache;
renderParams[osapi.container.RenderParam.TEST_MODE] = opts.testMode;
- renderParams[osapi.container.RenderParam.WIDTH ] = opts.width || stateManager.getDefaultWidth();
+ renderParams[osapi.container.RenderParam.WIDTH ] = getWidthFromParams(opts);
renderParams[osapi.container.RenderParam.USER_PREFS] = getCompleteUserPrefSet(widget.userPrefs, widget.metadata.userPrefs);
container.navigateGadget(site, widget.widgetUrl, opts.view_params, renderParams, opts.callback);
}