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