On Thu, Aug 27, 2015 at 1:13 AM, [IDIS Technical Secretariat] Ricardo
Rodríguez <ricardo.rodriguez(a)idisantiago.es> wrote:
Thanks! Please, read below...
On Wed, Aug 26, 2015 at 2:45 PM, Thomas Mortagne <thomas.mortagne(a)xwiki.com>
wrote:
On Wed, Aug 26, 2015 at 1:37 PM, [IDIS Technical
Secretariat] Ricardo
Rodríguez <ricardo.rodriguez(a)idisantiago.es> 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...
http://portal.idisantiago.es
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
Following these notes plus reading once again..
http://platform.xwiki.org/xwiki/bin/view/DevGuide/SkinExtensionsTutorial
I've done this..
1) Change to SSX extension to on demand only to be sure when and which
extension I'm calling.
2) Call the extension from the concerned page with this code...
{{velocity}}
#set($void = $xwiki.ssx.use($doc.fullName, {'sourceAction' :
$xcontext.action}))
{{/velocity}}
3) Modify the code of the SSX extension the way you proposed...
#if($request.sourceAction == 'view')
#mainContentArea {
margin-top: -35px;
padding: 0px 0px;
}
#else
#mainContentArea {
margin-top: 100px;
padding: 0px 0px;
}
#end
I've learnt a lot! Thank you very much! Unfortunately my programming
background, despite years of good intentions, remains still quite poor!
I'll keep trying.
Don't worry it's not general programming background issue, just XWiki
known how and I doubt you have years of this ;)
Help,
please!
Thanks,
Ricardo
On Wed, Aug 26, 2015 at 1:14 PM, Thomas Mortagne <
thomas.mortagne(a)xwiki.com>
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 <ricardo.rodriguez(a)idisantiago.es> 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 <
> thomas.mortagne(a)xwiki.com
> >> 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 <ricardo.rodriguez(a)idisantiago.es> 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
>> > users(a)xwiki.org
>> >
http://lists.xwiki.org/mailman/listinfo/users
>>
>>
>>
>> --
>> Thomas Mortagne
>> _______________________________________________
>> users mailing list
>> users(a)xwiki.org
>>
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
> users(a)xwiki.org
>
http://lists.xwiki.org/mailman/listinfo/users
--
Thomas Mortagne
_______________________________________________
users mailing list
users(a)xwiki.org
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
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
--
Thomas Mortagne
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
Cheers,
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
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users