Re: Styling question
Re: Styling question
- Subject: Re: Styling question
- From: Farrukh Ijaz <email@hidden>
- Date: Tue, 25 May 2010 13:58:47 +0300
Hi,
Design a framework "MyTheme" and put all the required images, css, js etc in the WebServerResources folder e.g.
/WebServerResources
/css
/js
/images
Define the complete UI of you application using a default set of CSS files.
E.g. default.css contains is something like this:
body {
margin: 5px;
border: 1px dotted silver;
background: #efefef;
font-family: Verdana, Tahoma, Arial, sans-serif;
}
Copy the default.css file and save it as template.css and store in /css folder along with default.css (for easy resource management) and modify the style as follows:
body {
margin: @@bodyMargin@@;
border: 1px dotted @@bodyBorderColor@@;
background: @@bodyBackground@@;
}
Define a Theme entity and define all the above mentioned @@ delimited properties.
Define a User entity which should store the user identifier and make association between Theme and User as toManyThemes etc.
Write a direct action which should do the following.
1. Load the template.css file from the WebServerResources folder into a String.
2. Based on session and logged in user should read the Theme entity.
3. Use ERXSimpleTemplateParser class to replace all the @@ delimited in the loaded template with the property values defined in the Theme object.
return the file parsed template as response.
In your component (PageWrapper probably the best place), define something as follows;
<wo:ERXStylesheet framework="MyTheme" filename="css/default.css"/>
<wo:ERXStylesheet src="/path/to/directaction/which/renders/the/template"/>
I hope this will give a very rough (not suitable to use as is) idea, how to do the theme for the application.
Farrukh
On 2010-05-25, at 11:34 AM, Gustavo Pizano wrote:
> Hello all.
>
> We are analyzing one project we might develop... within the reqs there is one that allows the user to set up its own "color-theme". So the idea is that the app will contain some Custom WOcomponetns which are just boxes with a title, rounded corners and that title has a color background, a width and a height, so the styles that the user specify for each box( the idea is) that they will be saved in the db, and when the user log's in it will see his/hers styled session.
> So we want to do as generic as we can, making generals WOCompoents that we can reuse given what the user want.
>
> So few questions:
> - Is it possible to set the style of these WoCompoents from within the Java code?, if so, can somebody give me a light where to read about it?
> -What would be the best approach, doing our own framework? or do our application and simply reuse components when needing them... I guess framework its better, but I guess the work its harder and time its longer.
>
>
> Thanks.
>
>
> Gustavo
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden