Patterns icon indicating copy to clipboard operation
Patterns copied to clipboard

pat-inject: method to modify the inserted snippet

Open agitator opened this issue 3 years ago • 1 comments

For a load more functionality, I'd like to keep the original batch next link in the template and only add'?ajax_load=1' to the target element.

Something like this append_to_selector_in_target [.next-link, '?ajax_load=1']

Or is there a way for this already?

agitator avatar Apr 05 '22 14:04 agitator

something like: <a href="./@@batch?start-at=10&batch_size=10" class="pat-inject" data-pat-inject="source: ...; target: ...; url: ./@@batch?start-at=10&batch_size=10&ajax_load=1">load more...</a> ?

You place the "load more..." button at the end of the document and replace itself with the results from the server - which itself again includes the new "load more" button, which will again placed at the end of the document.

thet avatar Apr 06 '22 15:04 thet