Created
January 10, 2012 21:08
-
-
Save natecavanaugh/1591216 to your computer and use it in GitHub Desktop.
Liferay - set custom css class from theme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//replace LINK_ID | |
//Add this to your theme vm | |
<div id="LINK_ID"> | |
<a href="javascript:;" data-customCssClass="red">Red</a> | |
<a href="javascript:;" data-customCssClass="blue">Blue</a> | |
<a href="javascript:;" data-customCssClass="green">Green</a> | |
</div> | |
//Add this to your JS somewhere | |
A.one('#LINK_ID').delegate( | |
'click', | |
function(event){ | |
var cssClass = event.currentTarget.attr('data-customCssClass'); | |
if (cssClass) { | |
A.io.request( | |
themeDisplay.getPathMain() + '/portal/session_click', | |
{ | |
data: { | |
'theme_custom_css_class': cssClass | |
} | |
} | |
); | |
} | |
}, | |
'a' | |
); | |
// Add this to custom.vm | |
#set ($theme_custom_css_class = $getterUtil.getString($sessionClicks.get($request, "theme_custom_css_class", ""))) | |
#if ($panelsMinimized != "") | |
#set ($css_class = "${css_class} $theme_custom_css_class") | |
#end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment