On Wed, Aug 26, 2015 at 1:37 PM, [IDIS Technical Secretariat] Ricardo Rodríguez <[email protected]> wrote:
Thanks! But there is still something I doing the wrong way. If I introduce the following lines in the XWiki.StyleSheetExtension object code...
#if($context.action == 'view') #mainContentArea { margin-top: -35px; padding: 0px 0px; } #else #mainContentArea { margin-top: 100px; padding: 0px 0px; } #end
I do get a 100px top margin when viewing the page...
I'm afraid I'm wrongly using $context.action, but I don't understand why!
The problem with this specific use case is that your code is not executed in the context of the document view but as an asynchronous ssx resource with an URL looking like http://mydomain/xwiki/bin/ssx/Space/Page and the action being "ssx" I think (not view in any case). If you are the one calling $xwiki.ssx.use("Spac.Page") you could do something like $xwiki.ssx.use('Space.Page', {'sourceAction' : $xcontext.action}) and then modify your ssx to be something like #if($request.sourceAction == 'view') #mainContentArea { margin-top: -35px; padding: 0px 0px; } #else #mainContentArea { margin-top: 100px; padding: 0px 0px; } #end
Help, please!
Thanks,
Ricardo
On Wed, Aug 26, 2015 at 1:14 PM, Thomas Mortagne <[email protected]> wrote:
"{{velocity}}" is wiki syntax to indicate that you want to insert some Velocity. When you enable "parsing" the whole content become Velocity already.
On Wed, Aug 26, 2015 at 1:04 PM, [IDIS Technical Secretariat] Ricardo Rodríguez <[email protected]> wrote:
Thanks! So simple, so nice...
Still, I'm not able to get it working yet... Here what I'm trying to get...
{{velocity}} #if($context.action == 'view') #mainContentArea { margin-top: -35px; padding: 0px 0px; } #end {{/velocity}}
I didn't get this code read while within the Velocity IF structure. In the log, I'm getting this...
2015-08-26 13:00:13,926 [ http://localhost:8080/xwiki/bin/ssx/Home/WebHome?language=en] WARN o.x.v.i.DefaultVelocityEngine - Deprecated usage of getter [com.xpn.xwiki.api.DeprecatedContext.getAction] in 360:xwiki:Home.WebHome@6 ,14
Please, what am I doing wrong? Thanks!
Ricardo
On Wed, Aug 26, 2015 at 10:52 AM, Thomas Mortagne < [email protected]
wrote:
You can enable Velocity in StyleSheetExtension content (the "Parse content" property).
The problem is that it means you need to disable caching as otherwise the browser will stick with the first version it downloaded.
On Wed, Aug 26, 2015 at 10:32 AM, [IDIS Technical Secretariat] Ricardo Rodríguez <[email protected]> wrote:
Hi!
Please, is it possible to customise a XWiki.StyleSheetExtension object to apply different properties to different actions in the same page?
For instance, I would like to use different #mainContentArea { margin-top: ; } values when viewing, or editing a page, i.e. Home.WebHome, or creating new pages in that Home space.
Thanks for your help!
Ricardo
-- Ricardo Rodríguez Research Management and Promotion Technician Technical Secretariat Health Research Institute of Santiago de Compostela (IDIS) http://www.idisantiago.es _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Ricardo Rodríguez Research Management and Promotion Technician Technical Secretariat Health Research Institute of Santiago de Compostela (IDIS) http://www.idisantiago.es _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Ricardo Rodríguez Research Management and Promotion Technician Technical Secretariat Health Research Institute of Santiago de Compostela (IDIS) http://www.idisantiago.es _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne