spring-webflow icon indicating copy to clipboard operation
spring-webflow copied to clipboard

Simplify how links are decorated [SWF-1283]

Open spring-operator opened this issue 15 years ago • 0 comments

Rossen Stoyanchev opened SWF-1283 and commented

Currently links are decorated using code like this:

Spring.addDecoration(new Spring.AjaxEventDecoration({ elementId : "prevUrl", event : "onclick", params : { fragments : "main" }
}));

Spring.addDecoration(new Spring.AjaxEventDecoration({ elementId : "nextUrl", event : "onclick", params : { fragments : "main" }
}));

Spring.addDecoration(new Spring.AjaxEventDecoration({ elementId : "changeSearchUrl", event : "onclick", params : { fragments : "main" }
}));

This is quite verbose. Often the links can be grouped by the 'fragments' parameter and the rest of the information is boilerplate. The only other variation is whether popup true or false.

It would be nicer to point Spring JS to specific links with CSS classes and let it do the work.

Example HTML snippet: Next Previous Change Search

Example JavaScript snippet: Spring.addAjaxEventDecorations(params:{fragments : 'body'});

Note the use of two CSS classes for regular vs popup links.


Affects: 2.0.9

Issue Links:

  • #478 Allow DOM element in addition to elementId as input

  • #475 Simplify how form submit buttons are decorated

spring-operator avatar Mar 19 '09 12:03 spring-operator