All News
Close
Recent searches
Quick Links
An error occurred while processing the template.
The following has evaluated to null or missing: ==> structuredContentCategoriesIds?filter(c -> newsTopicsCategoriesId?seq_contains(c))?first [in template "44549#44620#98661" at line 23, column 18] ---- Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: categoryId = structuredContentCategor... [in template "44549#44620#98661" in function "getNewsTopicsFilterEndpoint" at line 23, column 5] ----
1<#assign
2 structuredContentResource = resourceLocator.locate("/headless-delivery/v1.0", "StructuredContent")
3/>
4<#attempt>
5<#assign
6 categories = restClient.get("/headless-admin-taxonomy/v1.0/taxonomy-vocabularies/" + 64872 + "/taxonomy-categories?fields=id&restricFields=actions,availableLanguages,taxonomyCategoryUsageCount&page=1&pageSize=30").items
7/>
8
9<#recover>
10 <#assign categories = [0] />
11</#attempt>
12
13<#function getVocabularyCategoriesIds>
14 <#return categories?map(category -> category.id?number)/>
15</#function>
16
17<#function getNewsTopicsFilterEndpoint structuredContent>
18 <#local
19 structuredContentCategoriesIds = structuredContent.getTaxonomyCategoryBriefs()
20 ?map(taxonomyCategoryBrief -> taxonomyCategoryBrief.getTaxonomyCategoryId())
21
22 newsTopicsCategoriesId = getVocabularyCategoriesIds()
23 categoryId = structuredContentCategoriesIds?filter(c -> newsTopicsCategoriesId?seq_contains(c))?first
24 />
25 <#return "/-/categories/" + categoryId/>
26</#function>
27
28<#function getCustomDisplayPageUrl structuredContent>
29 <#local
30 structuredContentFields = structuredContent.getContentFields()
31 customDisplayPageField = structuredContentFields?filter(f -> f.getName() == "customDisplayPage")?first
32 />
33 <#return customDisplayPageField.getContentFieldValue().getLink()/>
34</#function>
35
36<#function getNewsViewUrl structuredContent>
37 <#local
38 friendlyUrl = "/w/" + structuredContent.getFriendlyUrlPath()
39
40 categoryFilterEndpoint = getNewsTopicsFilterEndpoint(structuredContent)
41 customDisplayPageUrl = getCustomDisplayPageUrl(structuredContent)!""
42 />
43 <#return customDisplayPageUrl?has_content?then(customDisplayPageUrl, friendlyUrl) + categoryFilterEndpoint/>
44</#function>
45
46<#assign images_path = "/documents/d/guest/" />
47<#assign total = searchContainer.getTotal() />
48<#assign start = searchContainer.getStart() />
49<#assign delta = searchContainer.getDelta() />
50<#assign totalPages = (total/delta)?ceiling />
51<#assign currentPage = ((start+1)/delta)?ceiling />
52<#assign isFirstPage = currentPage == 1 />
53<#assign isLastPage = currentPage == totalPages />
54<#assign iteratorURL = searchContainer.getIteratorURL().toString() />
55<#assign iteratorURL += iteratorURL?contains("?")?then("", "?") />
56<#assign firstPageURL = iteratorURL + '&start=1'/>
57<#assign lastPageURL = iteratorURL + '&start=' + totalPages?string/>
58<#assign previousURL = iteratorURL + '&start=' + (currentPage - 1)?string />
59<#assign nextURL = iteratorURL + '&start=' + (currentPage + 1)?string />
60
61<#assign startPage = (currentPage < 3)?then(1, currentPage - 1) />
62<#assign endPage = 2 + startPage />
63<#assign endPage = (totalPages < endPage)?then(totalPages, endPage) />
64<#assign diff = startPage - endPage + 2 />
65<#assign startPage -= (startPage - diff > 0)?then(diff, 0) />
66
67<div class="vale-widget-resultados-busca-noticia">
68 <div class="d-sm-flex justify-content-between flex-wrap">
69 <#if entries?has_content>
70 <#list entries as entry>
71 <#if entry.getTitle()?has_content>
72 <#assign structuredContent = structuredContentResource.getStructuredContent(entry.getClassPK()) />
73 <#assign url = getNewsViewUrl(structuredContent) />
74 <#list structuredContent.getContentFields() as field>
75 <#if field.getName() == "data">
76 <#assign data = field.getContentFieldValue().getData()?datetime.iso />
77 <#assign date_localized = dateUtil.formatDate("yyyyMMdd", data?string("yyyyMMdd"), locale) />
78 </#if>
79 <#if field.getName() == "imagemDeCapa">
80 <#assign imageUrl = field.getContentFieldValue().getImage().getContentUrl() />
81 <#assign imageAlt = field.getContentFieldValue().getImage().getDescription() />
82 </#if>
83 </#list>
84
85 <a class="box text-decoration-none" href="${url}">
86 <div class="font-weight-light mb-5">
87 <div class="mb-4 position-relative">
88 <img
89 alt="${imageAlt}"
90 class="imagem-capa"
91 src="${imageUrl}"
92 />
93 <img
94 class="onda position-absolute"
95 src="${images_path}onda_branca"
96 />
97 </div>
98 <p class="text-cinza-escuro texto-sm mb-2">
99 ${date_localized}
100 </p>
101
102 <h5 class="title mb-0 text-verde-vale">
103 ${entry.getHighlightedTitle()}
104 </h5>
105 </div>
106 </a>
107 </#if>
108 </#list>
109 </#if>
110 </div>
111 <div class="line-divider"></div>
112 <div class="pagination d-flex justify-content-center my-5">
113 <a
114 class="pagination-option text-decoration-none mr-sm-5 ${isFirstPage?then('disabled', '')}"
115 href="${previousURL}"
116 disabled="${isFirstPage?string}"
117 >
118 <img
119 class="btn btn-primary border-amarelo-vale bg-amarelo-vale mr-2 p-1 rounded-circle"
120 src="${images_path}seta-2-esq_bra"
121 alt="button-prev"
122 />
123 <span class="btn btn-link text-amarelo-vale p-0 d-none d-sm-inline">
124 <@liferay.language key="previous" />
125 </span>
126 </a>
127
128 <#if (startPage > 1)>
129 <a
130 class="mr-2"
131 href="${firstPageURL}"
132 >
133 <span
134 class="pagination-item btn btn-primary p-1 rounded-circle"
135 alt="first-page-button"
136 >1
137 </span>
138 </a>
139 <#if currentPage != 3>
140 <span class="elipsis h-100 mt-auto mr-2">...</span>
141 </#if>
142 </#if>
143
144 <#list startPage..endPage as i>
145 <a
146 class="mr-2 ${(i == currentPage)?then('disabled', '')}"
147 href="${iteratorURL + '&start=' + i?string}"
148 >
149 <span
150 class="pagination-item ${(currentPage == i)?then('is-active', '')} btn btn-primary p-1 rounded-circle"
151 alt="first-page-button"
152 >${i}
153 </span>
154 </a>
155 </#list>
156
157 <#if (endPage < totalPages)>
158 <#if currentPage != totalPages - 2>
159 <span class="elipsis h-100 mt-auto mr-2">...</span>
160 </#if>
161 <a
162 class="mr-2"
163 href="${lastPageURL}"
164 >
165 <span
166 class="pagination-item btn btn-primary p-1 rounded-circle"
167 alt="last-page-button"
168 >${totalPages}
169 </span>
170 </a>
171 </#if>
172
173 <a
174 class="pagination-option text-decoration-none ml-sm-5 ${isLastPage?then('disabled', '')}"
175 href="${nextURL}"
176 disabled="${isLastPage?string}"
177 >
178 <span class="btn btn-link text-amarelo-vale mr-2 p-0 d-none d-sm-inline">
179 <@liferay.language key="next" />
180 </span>
181 <img
182 class="btn btn-primary border-amarelo-vale bg-amarelo-vale p-1 rounded-circle"
183 src="${images_path}seta-2-dir_bra"
184 alt="button-next"
185 />
186 </a>
187 </div>
188</div>
189
190
191<style>
192 .vale-widget-resultados-busca-noticia .pagination img {
193 width: 2.03125rem;
194 }
195
196 .vale-widget-resultados-busca-noticia .pagination-item {
197 color: var(--cinza-escuro);
198 background-color: var(--branco);
199 border: 2px solid var(--cinza-escuro);
200 line-height: 1.30625rem;
201 opacity: 0.6;
202 width: 2.03125rem;
203 height: 2.03125rem;
204 }
205
206 .vale-widget-resultados-busca-noticia .pagination-item:hover {
207 box-shadow: 0px 0px 6px #55555594;
208 }
209
210 .vale-widget-resultados-busca-noticia .pagination-item.is-active {
211 color: var(--branco);
212 background-color: var(--amarelo-vale);
213 border-color: var(--amarelo-vale);
214 opacity: 1;
215 }
216
217 .vale-widget-resultados-busca-noticia .pagination-item.is-active:hover {
218 box-shadow: 0px 0px 6px #ecb11f94;
219 }
220
221 .vale-widget-resultados-busca-noticia .elipsis {
222 opacity: 0.6;
223 }
224
225 .vale-widget-resultados-busca-noticia ~ form .pagination-bar {
226 display: none;
227 }
228
229 .vale-widget-resultados-busca-noticia .pagination .disabled {
230 pointer-events: none;
231 }
232
233 .vale-widget-resultados-busca-noticia .pagination-option.disabled {
234 opacity: 0.5;
235 }
236
237 .line-divider {
238 background-color: var(--cinza-escuro);
239 color: var(--cinza-escuro);
240 height: 1px;
241 width: 100%;
242 opacity: 0.2;
243 }
244
245 .vale-widget-resultados-busca-noticia .onda {
246 bottom: -0.125rem;
247 right: -0.125rem;
248 }
249
250 .vale-widget-resultados-busca-noticia .box {
251 width: 31%
252 }
253
254 .vale-widget-resultados-busca-noticia .imagem-capa {
255 border-left: 20px solid var(--amarelo-vale);
256 height: 13.75rem;
257 width: 100%;
258 object-fit: cover;
259 }
260
261 .vale-widget-resultados-busca-noticia .title {
262 height: 5.125rem;
263 display: -webkit-box;
264 overflow: hidden;
265 -webkit-line-clamp: 3;
266 -webkit-box-orient: vertical;
267 }
268
269 @media screen and (max-width: 992px) {
270 .vale-widget-resultados-busca-noticia .box {
271 width: 47%
272 }
273 }
274
275 @media screen and (max-width: 768px) {
276 .vale-widget-resultados-busca-noticia .imagem-capa {
277 border-left: 10px solid var(--amarelo-vale);
278 }
279
280 .vale-widget-resultados-busca-noticia .onda {
281 bottom: -0.125rem;
282 right: -0.125rem;
283 width: 75%
284 }
285 }
286
287</style>