Последние авторы
| author | version | line-number | content |
|---|---|---|---|
| 1 | The Masonry macro integrates the [[JavaScript Masonry library>>https://masonry.desandro.com/]] into XWiki for easing the creationg of responsive images walls. It also uses the jQuery plugin [[waitForImages>>https://github.com/alexanderdickson/waitForImages]]. The code used is inspired from [[a codepen by Christopher Crostello>>https://codepen.io/christophercostello/pen/LyOPab]]. Other options could be considered to create such walls such as: | ||
| 2 | |||
| 3 | * https://css-tricks.com/piecing-together-approaches-for-a-css-masonry-layout/ | ||
| 4 | * https://tobiasahlin.com/blog/masonry-with-css/ | ||
| 5 | * https://codepen.io/chasebank/pen/KbrWdv | ||
| 6 | |||
| 7 | == Usage | ||
| 8 | |||
| 9 | {{velocity}} | ||
| 10 | #set ($parameters = $doc.getObjects('XWiki.WikiMacroParameterClass')) | ||
| 11 | #set ($tableHeaders = '|=Parameter name|=Description|=Mandatory|=Default') | ||
| 12 | #set ($tableBody = '') | ||
| 13 | #foreach ($parameter in $parameters) | ||
| 14 | #set ($isMandatory = ${parameter.getProperty('mandatory').value}) | ||
| 15 | #if ($isMandatory == 1) #set ($isMandatory = "Yes") #else #set ($isMandatory = "No") #end | ||
| 16 | #set ($tableBody = "$tableBody|${parameter.getProperty('name').value}|(((${parameter.getProperty('description').value})))|$isMandatory|$parameter.getProperty('defaultValue').value") | ||
| 17 | #end | ||
| 18 | ## This option is handy for generating the code to be pasted to the online extension.xwiki.org page for documenting the parameters statically. | ||
| 19 | #if ($request.debug) | ||
| 20 | {{code}} | ||
| 21 | $tableHeaders | ||
| 22 | $tableBody | ||
| 23 | {{/code}} | ||
| 24 | #end | ||
| 25 | |||
| 26 | $tableHeaders | ||
| 27 | $tableBody | ||
| 28 | {{/velocity}} | ||
| 29 | |||
| 30 | The macro can be used either without content - in that case the images attached to the current page are used - or with content, and with or without links. The image titles can be set using instances of ResourceMetadaClass attached to each target page. | ||
| 31 | |||
| 32 | {{code}} | ||
| 33 | {{masonry/}} | ||
| 34 | |||
| 35 | {{masonry}} | ||
| 36 | [[image:gallica-btv1b10052637j_5.jpg>>Sandbox.WebHome]] | ||
| 37 | [[image:gallica-btv1b10052637j_4.jpg>>Main.WebHome]] | ||
| 38 | [[image:gallica-btv1b10052637j_9.jpg>>XWiki.WebHome]] | ||
| 39 | {{/masonry}} | ||
| 40 | |||
| 41 | {{masonry}} | ||
| 42 | [[image:wiki.gargantua-francois-rabelais@gallica_bpt6k1040342n_23.jpg]] | ||
| 43 | [[image:wiki.heimatlosigkeit-et-chamanisme-pascal-quignard@nmoyart-2019-emstrang-2-02_3966-1.jpg]] | ||
| 44 | [[image:wiki.bestiaire-d-amour-jean-rostand@s-l1600.jpg]] | ||
| 45 | [[image:wiki.la-pataphysique-alfred-jarry@faustroll.jpg]] | ||
| 46 | [[image:wiki.testament-de-heiligenstadt-beethoven@Beethoven_Heiligenstaedter_Testament-1.jpg]] | ||
| 47 | [[image:wiki.lost-ego-francois-de-smet@1538617206_9782130788966_v100.jpg]] | ||
| 48 | {{/masonry}} | ||
| 49 | {{/code}} | ||
| 50 | |||
| 51 | == Example | ||
| 52 | |||
| 53 | (% style="background-color: #f6f6f6; padding: 1em; margin-bottom: 1em; text-align: center;" %)((( | ||
| 54 | The images displayed below come from [[Bibliothèque nationale de France - Gallica>>https://gallica.bnf.fr/ark:/12148/btv1b10052637j/f1.item.r=fleurs]]. | ||
| 55 | ))) | ||
| 56 | |||
| 57 | {{masonry/}} | ||
| 58 | |||
| 59 | {{masonry}} | ||
| 60 | [[image:gallica-btv1b10052637j_5.jpg>>Sandbox.WebHome]] | ||
| 61 | [[image:gallica-btv1b10052637j_4.jpg>>Main.WebHome]] | ||
| 62 | [[image:gallica-btv1b10052637j_9.jpg>>XWiki.WebHome]] | ||
| 63 | {{/masonry}} | ||
| 64 | |||
| 65 | |||
| 66 | {{masonry}} | ||
| 67 | [[image:wiki.gargantua-francois-rabelais@gallica_bpt6k1040342n_23.jpg]] | ||
| 68 | [[image:wiki.heimatlosigkeit-et-chamanisme-pascal-quignard@nmoyart-2019-emstrang-2-02_3966-1.jpg]] | ||
| 69 | [[image:wiki.bestiaire-d-amour-jean-rostand@s-l1600.jpg]] | ||
| 70 | [[image:wiki.la-pataphysique-alfred-jarry@faustroll.jpg]] | ||
| 71 | [[image:wiki.testament-de-heiligenstadt-beethoven@Beethoven_Heiligenstaedter_Testament-1.jpg]] | ||
| 72 | [[image:wiki.lost-ego-francois-de-smet@1538617206_9782130788966_v100.jpg]] | ||
| 73 | {{/masonry}} |