Patternslib/Patterns

pat-inject: method to modify the inserted snippet

Opened this issue · 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?

thet commented

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.