Pergunta

I'm implementing a function that allows user to switch between two different color schemes. However, it seems to me that the color scheme in Liferay is per system/portal, not per user. So if a user change it (I can give every user permission to do that), it'll change for all users. Am I understanding it correctly?

If that's the case, what's the best way to implement the function?

What I have in mind now is that, I could add a Custom Field for each user, to store one's selection of color scheme; but I'm not sure what to do next. Looks like that I could not change the color scheme system-wide such that ThemeDisplay can use it to render the pages, because that'll change it for all other users. Is it possible to apply the user-specific color scheme while rendering each page?


update: It seems that under theme/_diffs/templates/init.ftl, there's a way to achieve this by modifying the following line,

<#assign css_class = theme_display.getColorScheme().getCssClass() + " yui3-skin-sam" />

What we need is to retrieve the user-specific color scheme's Css class, and replace theme_display.getColorScheme().getCssClass() with that.

Will test the idea tomorrow.

Foi útil?

Solução

under theme/_diffs/templates/init.ftl, there's a way to achieve this by modifying the following line,

<#assign css_class = theme_display.getColorScheme().getCssClass() + " yui3-skin-sam" /> What we need is to retrieve the user-specific color scheme's Css class, and replace theme_display.getColorScheme().getCssClass() with that.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top