1<#assign journalArticleService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService")>
2<#assign vocabularyLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetVocabularyLocalService")>
3<#if entries?has_content>
4 <ul class="row text-break three-columns-news u-hidden-mobile">
5 <#list entries as curEntry>
6 <#if curEntry.getAssetRenderer()?? && curEntry.getAssetRenderer().getClassName() == "com.liferay.journal.model.JournalArticle">
7
8 <#assign article = journalArticleService.getLatestArticle(getterUtil.getLong(curEntry.getClassPK())) />
9 <#assign rootElement = saxReaderUtil.read(article.getContentByLocale(locale)).getRootElement() />
10
11 <#assign selectorShortTitle = saxReaderUtil.createXPath("dynamic-element[@name='shortTitle']") />
12 <#assign title = "" />
13 <#if selectorShortTitle.selectSingleNode(rootElement)?has_content>
14 <#assign title = selectorShortTitle.selectSingleNode(rootElement).getStringValue() />
15 </#if>
16
17 <#if title?trim =="" >
18 <#assign title = article.getTitle(locale) />
19 </#if>
20 <#assign selectorImage = saxReaderUtil.createXPath("dynamic-element[@name='imgNoticia']") />
21 <#assign
22 image = ""
23 alt = ""
24 />
25
26 <#if selectorImage.selectSingleNode(rootElement)?has_content>
27 <#assign image = selectorImage.selectSingleNode(rootElement).getStringValue()?trim/>
28
29 <#if image != "">
30 <#attempt>
31 <#assign imageJSON = image?eval />
32 <#recover>
33 <#assign imageParsed = image?replace("\\u", "_u_") />
34 <#assign imageJSON = imageParsed?eval />
35 </#attempt>
36 <#assign image = "/documents/${imageJSON.groupId}/${imageJSON.uuid}" />
37 <#assign alt = imageJSON.alt />
38 </#if>
39 </#if>
40
41 <#if image == "">
42 <#assign image = "${themeDisplay.getPathThemeImages()}/images-default-contents.jpg" />
43 </#if>
44
45 <#assign viewURL = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, curEntry.getAssetRenderer(), curEntry, !stringUtil.equals(assetLinkBehavior, "showFullContent")) />
46
47 <li class="col-12 col-md-4 three-columns-news__item">
48 <a href="${viewURL}" class="three-columns-news__item__link">
49 <h3>${title}</h3>
50 </a>
51 <p class="three-columns-news__item__date">${article.getDisplayDate()?date?string['dd/MM/yyyy']}</p>
52 <#if _webContentsUtil??>
53 <#assign categories = _webContentsUtil.getCastelloCategoriesFromJournalArticleEntry(groupId, curEntry.getClassPK()) />
54 <div class="d-flex flex-wrap mb-sm-5">
55 <#list categories as category>
56 <a href="/noticias?category=${category.getCategoryId()}" class="three-columns-news__item__category">
57 <img alt="tag" src="${themeDisplay.getPathThemeImages()}/castellon/icons/svg/etiqueta.svg" />
58 <span>${category.getTitle(locale)}</span>
59 </a>
60 </#list>
61 </div>
62 </#if>
63 <div class="aspect-ratio aspect-ratio-16-to-9 three-columns-news__item__image">
64 <#if alt == "">
65 <#assign alt = article.getTitle(locale) />
66 </#if>
67 <img src="${image}" alt="${alt}" class="aspect-ratio-item-center-middle aspect-ratio-item-fluid" />
68 </div>
69 </li>
70 </#if>
71 </#list>
72 </ul>
73
74 <#-- carousel mobile -->
75 <ul class="row text-break three-columns-news u-hidden-desktop">
76 <div id="featured-carousel-indicators-news" class="featured-carousel carousel slide container" data-ride="carousel" >
77 <ul class="carousel-inner">
78 <#list entries as curEntry>
79 <#if curEntry.getAssetRenderer()?? && curEntry.getAssetRenderer().getClassName() == "com.liferay.journal.model.JournalArticle">
80
81 <#assign article = journalArticleService.getLatestArticle(getterUtil.getLong(curEntry.getClassPK())) />
82 <#assign rootElement = saxReaderUtil.read(article.getContentByLocale(locale)).getRootElement() />
83 <#assign selectorShortTitle = saxReaderUtil.createXPath("dynamic-element[@name='shortTitle']") />
84 <#if selectorShortTitle.selectSingleNode(rootElement)?has_content>
85 <#assign title = selectorShortTitle.selectSingleNode(rootElement).getStringValue() />
86 </#if>
87 <#if title=="">
88 <#assign title = article.getTitle(locale) />
89 </#if>
90 <#assign selectorImage = saxReaderUtil.createXPath("dynamic-element[@name='imgNoticia']") />
91 <#assign image = "" />
92 <#assign alt = "" />
93 <#if selectorImage.selectSingleNode(rootElement)?has_content>
94 <#assign image = selectorImage.selectSingleNode(rootElement).getStringValue()?trim />
95 <#if image?? && image?has_content && image?eval??>
96 <#attempt>
97 <#assign imageJSON = image?eval />
98 <#recover>
99 <#assign imageParsed = image?replace("\\u", "_u_") />
100 <#assign imageJSON = imageParsed?eval />
101 </#attempt>
102 <#assign image = "/documents/${imageJSON.groupId}/${imageJSON.uuid}" />
103 <#assign alt = imageJSON.alt />
104 </#if>
105 </#if>
106 <#if image == "">
107 <#assign image = "${themeDisplay.getPathThemeImages()}/images-default-contents.jpg" />
108 </#if>
109
110 <#assign viewURL = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, curEntry.getAssetRenderer(), curEntry, !stringUtil.equals(assetLinkBehavior, "showFullContent")) />
111 <#assign activeItem = "" />
112 <#if curEntry?is_first>
113 <#assign activeItem = "active" />
114 </#if>
115 <li class="col-12 three-columns-news__item carousel-item ${activeItem}">
116 <div class="aspect-ratio aspect-ratio-16-to-9 three-columns-news__item__image">
117 <#if alt == "">
118 <#assign alt = title />
119 </#if>
120 <img src="${image}" alt="${alt}" class="aspect-ratio-item-center-middle aspect-ratio-item-fluid" />
121 </div>
122 <a href="${viewURL}" class="three-columns-news__item__link">
123 <h3>${title}</h3>
124 </a>
125 <p class="three-columns-news__item__date">${article.getDisplayDate()?date?string['dd/MM/yyyy']}</p>
126 <#if _webContentsUtil??>
127 <#assign categories = _webContentsUtil.getCastelloCategoriesFromJournalArticleEntry(groupId, curEntry.getClassPK()) />
128 <div class="d-flex flex-wrap mb-sm-5">
129 <#list categories as category>
130 <a href="/noticias?category=${category.getCategoryId()}" class="three-columns-news__item__category">
131 <img alt="tag" src="${themeDisplay.getPathThemeImages()}/castellon/icons/svg/etiqueta.svg" />
132 <span>${category.getTitle(locale)}</span>
133 </a>
134 </#list>
135 </div>
136 </#if>
137 </li>
138 </#if>
139 </#list>
140 </ul>
141 <ol class="carousel-indicators">
142 <#list 1..entries?size as i>
143 <#assign activeIndicator = "" />
144 <#if i?is_first>
145 <#assign activeIndicator = "active" />
146 </#if>
147 <li data-target="#featured-carousel-indicators-news" data-slide-to="${i-1}" class="${activeIndicator}">
148 </li>
149 </#list>
150 </ol>
151 </div>
152 </ul>
153</#if>
154
155<script>
156 $('#featured-carousel-indicators-news').carousel({
157 interval:4000,
158 pause: "false"
159 });
160
161 $('#playButtonNews').click(function () {
162 $('#featured-carousel-indicators-news').carousel('cycle');
163 });
164 $('#pauseButtonNews').click(function () {
165 $('#featured-carousel-indicators-news').carousel('pause');
166 });
167</script>
168<style>
169 .three-columns-news__item.carousel-item.active {z-index:100 !important}
170</style>