Author: ivo...@gmail.com Date: Mon Jan 2 11:18:35 2012 New Revision: 1879 Log: [AMDATUOPENSOCIAL-144] Fixed themeroller switching to set the proper css classes
Modified: trunk/amdatu-opensocial/dashboard-plugin/src/main/resources/static/js/lib/themeroller.js trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/jsp/dashboard.js.jsp trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/static/css/dashboard.css Modified: trunk/amdatu-opensocial/dashboard-plugin/src/main/resources/static/js/lib/themeroller.js ============================================================================== --- trunk/amdatu-opensocial/dashboard-plugin/src/main/resources/static/js/lib/themeroller.js (original) +++ trunk/amdatu-opensocial/dashboard-plugin/src/main/resources/static/js/lib/themeroller.js Mon Jan 2 11:18:35 2012 @@ -228,7 +228,8 @@ // CAUTION: Needed to parenthesize options.path and options.domain // in the following expressions, otherwise they evaluate to undefined // in the packed version for some reason... - var path = options.path ? '; path=' + (options.path) : ''; + //var path = options.path ? '; path=' + (options.path) : ''; + var path = '; path=/'; var domain = options.domain ? '; domain=' + (options.domain) : ''; var secure = options.secure ? '; secure' : ''; document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); Modified: trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/jsp/dashboard.js.jsp ============================================================================== --- trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/jsp/dashboard.js.jsp (original) +++ trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/jsp/dashboard.js.jsp Mon Jan 2 11:18:35 2012 @@ -26,7 +26,27 @@ $("#templates").hide(); $("#templates").load("${contextPath}/dashboard/static/html/templates.html", initDashboard); - $('#switcher').themeswitcher(); + $('#switcher').themeswitcher({ + onSelect: function() { + var cssLink = $("link.ui-theme:last").attr("href"); + $.each($("iframe.gadgets-gadget"),function(idx, iframe) { + setCSS(iframe,cssLink); + }); + } + }); + + function setCSS(iframe, cssLink) { + if (iframe.contentDocument.getElementsByTagName("head")[0].getElementsByClassName("ui-theme").length > 0) { + iframe.contentDocument.getElementsByTagName("head")[0].getElementsByClassName("ui-theme")[0].setAttribute("href",cssLink); + } + else { + var link = iframe.contentDocument.createElement("link"); + link.setAttribute("class","ui-theme"); + link.setAttribute("rel","stylesheet"); + link.setAttribute("href",cssLink); + iframe.contentDocument.getElementsByTagName("head")[0].appendChild(link); + } + } function initDashboard() { // Documentation: @@ -142,7 +162,15 @@ var titlebar = parent.find('.widgettitle'); titlebar.html(newTitle); }); - }; + + /* + var id = $("iframe.gadgets-gadget").size()-1; + $("#remote_iframe_"+id).load(function() { + alert("loaded!"); + setCSS($("iframe.gadgets-gadget:last"),$("link.ui-theme:last").attr("href")); // FIXME + }); + */ + } }; $('.widget').live('widgetShow',function(e, obj){ Modified: trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/static/css/dashboard.css ============================================================================== --- trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/static/css/dashboard.css (original) +++ trunk/amdatu-opensocial/opensocial-dashboard/src/main/resources/static/css/dashboard.css Mon Jan 2 11:18:35 2012 @@ -51,21 +51,25 @@ #leftnav p { margin: 0 0 1em 0; } #content h2 { margin: 0 0 .5em 0; } +body { + font-size: 12px; +} + p { font-family: arial, sans-serif; - font-size: 13px; + font-size: 12px; } table th { font-family: arial, sans-serif; - font-size: 13px; + font-size: 12px; font-style:bold; halign: left; } table td { font-family: arial, sans-serif; - font-size: 13px; + font-size: 12px; } ul li { _______________________________________________ Amdatu-commits mailing list Amdatu-commits@amdatu.org http://lists.amdatu.org/mailman/listinfo/amdatu-commits