Forum OpenACS Development: Suggestion - xowiki includelets

Collapse
Posted by Richard Hamilton on
It would be useful to be able to specify an ID or class for the entire output of any includelet. This would facilitate finer grained control of styles through the use of user defined CSS selectors.

For example:

{{categories -cssclass myclass -cssid myID -cssstyle "property: value;"}}

I propose that when any of the -cssclass, -cssid, or -cssstyle includelet parameters is encountered, the includelet render method would encapsulate the entire includelet output in a div block, adding the specified class, ID and style as appropriate.

So as examples:

1.

{{available-includelets -cssclass myclass}}

renders as:

<div class="myclass">
  **rendered includelete content**
</div>

2.

{{available-includelets -cssID myID}}

renders as:

<div id="myID">
  **rendered includelete content**
</div>

3.

{{available-includelets -cssstyle "color: red;"}}

renders as:

<div style="color: red;">
  **rendered includelete content**
</div>

4.

{{available-includelets -cssclass myclass -cssid myID -cssstyle "color: red;"}}

renders as:

<div id="myID" class="myclass" style="color: red;">
  **rendered includelete content**
</div>

Regards
Richard

Collapse
Posted by Gustaf Neumann on
There was already a flag "-id" for the includelets, but it was not passed correctly (just fixed this). The handling of the css classes is more complicated, since the rendering of the includelts is governed by the "-decoration portlet|edit|pain|rightbox|none" flag.

xowiki sets already a CSS class for all includelet content depending on the class of the includelet. E.g. for the includelet "available-includelets", it uses the CSS class "available-includelets". If would be certainly possible to use multiple classes, but i have not had the need so far.

I am not sure about adding a "cssstyle", since it requires editing of the pages, when the styles are changed. It is better to use css classes....

Collapse
Posted by Richard Hamilton on
Gustaf,

I confess that I had missed the significance of the '-style plain' parameter. Since first working with CSS and xowiki, I had been using '-style none'.

{{available-includelets -id rhtest -decoration plain}}

provides:

<div id='rhtest' class='available-includelets'>

This means you could have multiple instances of an includelet on a single page and style them either consistently or uniquely.

That's really powerful. 😊

R.