1<#assign namespace = renderResponse.getNamespace()>
2<#assign journalService = serviceLocator.findService('com.liferay.journal.service.JournalArticleService')/>
3<#assign hits = searchResultsPortletDisplayContext.getDocuments()>
4
5<div class="search__results search--locresults" id="search__results-${namespace}">
6 <div class="explore__right">
7 <div class="explore__rightinner">
8 <h2 class="explore__heading">
9 <span>Global locations</span>
10 <span class="explore__filtericon"></span>
11 </h2>
12 <div class="explore__results">
13 <div class="accordion" id="accordion-${namespace}">
14 <#if entries?has_content>
15
16 <#assign locationDetails = [] />
17 <#assign renderingCountry = "--NULL--" />
18
19 <#list entries as entry>
20 <#if !entry.isTemporarilyUnavailable()>
21 <#assign hit = hits[entry?index] />
22 <#if hit?? && hit.articleId?? && hit.articleId?has_content>
23 <#assign
24 hit = hits[entry?index]
25 journalArticle = journalService.getArticle(getterUtil.getLong(hit.groupId), hit.articleId)
26 document = saxReaderUtil.read(journalArticle.getContentByLocale(locale.toString()))
27 rootElement = document.getRootElement()
28
29
30 xPathSelector = saxReaderUtil.createXPath("dynamic-element[@name='Country']")
31 country = xPathSelector.selectSingleNode(rootElement).getStringValue()?trim
32
33 xPathSelector = saxReaderUtil.createXPath("dynamic-element[@name='City']")
34 city = xPathSelector.selectSingleNode(rootElement).getStringValue()?trim
35
36 xPathSelector = saxReaderUtil.createXPath("dynamic-element[@name='Address']")
37 address = xPathSelector.selectSingleNode(rootElement).getStringValue()?trim?replace("\n", "<br/>")
38
39 xPathSelector = saxReaderUtil.createXPath("dynamic-element[@name='ContactDetails']")
40 contactDetails = xPathSelector.selectSingleNode(rootElement).getStringValue()?trim?replace("\n", "<br/>")
41
42 xPathSelector = saxReaderUtil.createXPath("dynamic-element[@name='MapLink_TitleFieldSet']//dynamic-element[@name='MapLink_External']")
43 mapLink = xPathSelector.selectSingleNode(rootElement).getStringValue()?trim
44
45 locationDetail = {'country': country, 'city': city, 'address': address, 'contactDetails': contactDetails, 'mapLink': mapLink}
46 />
47 </#if>
48 <#if country == renderingCountry || renderingCountry == '--NULL--' >
49 <#assign
50 renderingCountry = country
51 locationDetails = locationDetails + [locationDetail]
52 />
53 <#else>
54 <@renderCountryLocations countryName=renderingCountry locationDetails=locationDetails />
55 <#assign
56 renderingCountry = country
57 locationDetails = [locationDetail]
58 />
59 </#if>
60 <#if entry?is_last>
61 <@renderCountryLocations countryName=country locationDetails=locationDetails />
62 </#if>
63 </#if>
64 </#list>
65 </#if>
66 </div>
67 </div>
68 </div>
69 </div>
70</div>
71
72<#macro renderCountryLocations countryName locationDetails>
73 <#assign sectionId = random.nextInt() />
74 <div class="jmaccrdn__section">
75 <div class="jmaccrdn__title" role="button" tabindex="0" data-toggle="collapse" data-target="#section${namespace}${sectionId}"
76 aria-expanded="true" aria-controls="section${namespace}${sectionId}">
77 <p>
78 ${countryName}
79 <span class="jmaccrdn__arrow"></span>
80 </p>
81 </div>
82 <div id="section${namespace}${sectionId}" class="jmaccrdn__body collapse" data-parent="#accordion-${namespace}">
83 <div class="jmaccrdn__answer-sec">
84 <#list locationDetails as locationDetail>
85 <div class="row country-locations">
86 <div class="col-md-4">
87 <div class="jmcountry-title">City</div>
88 <div>${locationDetail.city}</div>
89 </div>
90 <div class="col-md-4">
91 <div class="jmcountry-title">Address</div>
92 <div>${locationDetail.address}</div>
93 </div>
94 <div class="col-md-4">
95 <div class="jmcountry-title">Contact Details</div>
96 <div>${locationDetail.contactDetails}</div>
97 <div class="map-link-cont">
98 <a class="map-link" href="${locationDetail.mapLink}" target="_blank">Map Link</a>
99 </div>
100 </div>
101 </div>
102 </#list>
103 </div>
104 </div>
105 </div>
106</#macro>
107
108<script>
109$(function() {
110 $("#search__results-${namespace}").parent().find(".pagination-bar").hide();
111 $('button.dropdown-toggle.page-link[role="combobox"]').attr('aria-label', 'Select number of entries per page');
112});
113</script>
114
115<style>
116
117@media (min-width: 320px) and (max-width: 650px) {
118 .search__results .explore__right {
119 margin-top: -16%;
120 }
121 .search--locresults .jmaccrdn__title p {
122 font-size: 20px !important;
123 }
124 .explore__heading{
125 padding-left: 14.2px !important;
126 padding-right: 14px !important;
127 }
128 .search--locresults .jmaccrdn__title p {
129 padding: 25px 25px 25px 18px;
130 }
131}
132</style>