2015-05-21 21:23:27 -04:00
#macro(lensNoQ)?#if($list.size($response.responseHeader.params.getAll("fq")) > 0)&#fqs($response.responseHeader.params.getAll("fq"))#end#sort($request.params.getParams('sort'))#end
## lens modified for example/files - to use fq from responseHeader rather than request, and #debug removed too as it is built into browse params now, also added type to lens
2015-06-02 16:56:04 -04:00
#macro(lens)#lensNoQ#q&type=#current_type#if("#current_locale"!="")&locale=#current_locale#end#end
2015-05-21 21:23:27 -04:00
# TODO: make this parameterized fully, no context sensitivity
#macro(field $f)
#if($response.response.highlighting.get($docId).get($f).get(0))
#set($pad = "")
#foreach($v in $response.response.highlighting.get($docId).get($f))
$pad$v## #TODO: $esc.html() or maybe make that optional?
#set($pad = " ... ")
#end
#else
#foreach($v in $doc.getFieldValues($f))$esc.html($v)
#end
#end
#end
#macro(link_to_previous_page)
#if($page.current_page_number > 1)
#set($prev_start = $page.start - $page.results_per_page)
<a class="prev-page" href="#url_for_start($prev_start)">$resource.previous</a>
#end
#end
#macro(link_to_next_page)
#if($page.current_page_number < $page.page_count)
#set($next_start = $page.start + $page.results_per_page)
<a class="next-page" href="#url_for_start($next_start)">$resource.next</a>
#end
#end
#macro(link_to_page $page_number $text)
#if($page_number == $page.current_page_number)
$text
#else
#if($page_number <= $page.page_count)
#set($page_start = $page_number * $page.results_per_page - $page.results_per_page)
<a class="page" href="#url_for_start($page_start)">$text</a>
#end
#end
#end
## Macros defined custom for the "files" example
2015-06-02 16:56:04 -04:00
#macro(url_for_type $type)#url_for_home#lensNoQ#q&type=$type#if("#current_locale"!="")&locale=#current_locale#end#end
2015-05-21 21:23:27 -04:00
#macro(current_type)#if($response.responseHeader.params.type)${response.responseHeader.params.type}#{else}all#end#end
2015-06-02 16:56:04 -04:00
#macro(url_for_locale $locale)#url_for_home#lensNoQ#q&type=#current_type#if($locale!="")&locale=$locale#end#end
#macro(current_locale)$!{response.responseHeader.params.locale}#end