1<#assign journalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") />
2<#assign assetEntryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetEntryLocalService") />
3<#assign assetVocabularyLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetVocabularyLocalService") />
4
5<#-- Get current entry assets -->
6<#assign currentArticle = journalArticleLocalService.getArticle(groupId, .vars['reserved-article-id'].data) />
7<#assign currentArticleResourcePrimKey = currentArticle.getResourcePrimKey() />
8
9<#assign currentArticleAssetEntry = assetEntryLocalService.getEntry("com.liferay.journal.model.JournalArticle", currentArticleResourcePrimKey) />
10<#assign assetEntry = assetEntryLocalService.getEntry(currentArticleAssetEntry.getClassName(), currentArticleAssetEntry.getClassPK()) />
11<#assign entryCategories = assetEntry.getCategories() />
12
13<#-- Variáveis -->
14<#assign title = .vars['reserved-article-title'].data />
15<#assign currentUrl = themeDisplay.getPortalURL() + themeDisplay.getURLCurrent() />
16<#assign createdAt = dateUtil.parseDate("EEE, d MMM yyyy HH:mm:ss Z", .vars['reserved-article-create-date'].data, locale)?string("dd/MM/yyyy HH'h'mm") />
17<#assign updatedAt = dateUtil.parseDate("EEE, d MMM yyyy HH:mm:ss Z", .vars['reserved-article-modified-date'].data, locale)?string("dd/MM/yyyy HH'h'mm") />
18<#assign newsCategories = getNewsCategories(entryCategories) />
19
20<div class="news">
21 <#if newsCategories?has_content>
22 <div class="d-flex align-items-center mb-4">
23 <#list newsCategories as category>
24 <@getNewsBadge category/>
25 </#list>
26 </div>
27 </#if>
28
29 <h2 class="bold text-primary mb-3">
30 ${title}
31 </h2>
32
33 <#if (abstract.getData())??>
34 <p class="h4 text-gray">${abstract.getData()}</p>
35 </#if>
36
37 <div class="d-flex align-items-center justify-content-between c-my-32 border-top
38 border-bottom border-gray py-3">
39 <div class="d-flex align-items-center">
40 <span class="h5 text-gray pr-3">Publicado em ${createdAt}</span>
41 <span class="h5 text-gray border-left border-gray pl-3">Atualizado em ${updatedAt}</span>
42 </div>
43 <@getShare />
44 </div>
45
46 <#if (thumbnail.getData())?? && thumbnail.getData() != "">
47 <div class="d-flex justify-content-center align-items-center c-mb-32">
48 <img alt="${thumbnail.getAttribute('alt')}"data-fileentryid="${thumbnail.getAttribute('fileEntryId')}" src="${thumbnail.getData()}" />
49 </div>
50 </#if>
51
52 <div class="content">
53 ${content.getData()}
54 </div>
55
56 <#assign hasGaleryPhotos = imageGallery?? && imageGallery.getSiblings()?has_content && imageGallery.getSiblings()[0].getData()?? && imageGallery.getSiblings()[0].getData() != "" />
57
58 <#if hasGaleryPhotos>
59 <section class="d-flex flex-column justify-content-center align-items-center c-mt-32">
60 <h2 class="bold text-primary text-center mb-3">
61 Galeria de imagens
62 </h2>
63 <div
64 id="newsGaleryCarousel-${portletDisplay.getInstanceId()}"
65 class="slick-carousel slick-container carousel-galery"
66 >
67 <#list imageGallery.getSiblings() as curGaleryPhoto>
68 <#if (curGaleryPhoto.getData())?? && (curGaleryPhoto.getData()) != "">
69 <div
70 class="slick-slide-item"
71 data-photo-alt="${curGaleryPhoto.getAttribute('alt')}"
72 >
73 <div class="card align-items-center m-0">
74 <div class="card-img-wrapper position-relative">
75 <img alt="${curGaleryPhoto.getAttribute('alt')}" class="card-img" data-fileentryid="${curGaleryPhoto.getAttribute('fileEntryId')}" src="${curGaleryPhoto.getData()}" />
76 </div>
77 </div>
78 </div>
79 </#if>
80 </#list>
81 </div>
82 <div class="d-flex flex-column justify-content-center mt-3">
83 <h4 class="photo-alt text-gray text-center mb-2"></h4>
84 </div>
85 </section>
86
87 <script>
88 Liferay.on("allPortletsReady", function() {
89 function updateGaleryPhotoDetails() {
90 $('.photo-alt').text($(".slick-center").data("photo-alt"))
91 }
92
93 $("#newsGaleryCarousel-${portletDisplay.getInstanceId()}").on('init', function() {
94 updateGaleryPhotoDetails()
95 })
96
97 $("#newsGaleryCarousel-${portletDisplay.getInstanceId()}").on('afterChange', function() {
98 updateGaleryPhotoDetails()
99 })
100
101 $("#newsGaleryCarousel-${portletDisplay.getInstanceId()}").slick({
102 slidesToShow: 1,
103 slidesToScroll: 1,
104 speed: 500,
105 autoplay: true,
106 centerMode: true,
107 dots: false,
108 infinite: true,
109 variableWidth: true,
110 focusOnSelect: true,
111 touchMove: true,
112 useTransform: true,
113 arrows: true,
114 prevArrow: "<button type='button' class='slick-arrow slick-arrow-prev'><i class='las la-chevron-circle-left text-primary' aria-hidden='true'></i></button>",
115 nextArrow: "<button type='button' class='slick-arrow slick-arrow-next'><i class='las la-chevron-circle-right text-primary' aria-hidden='true'></i></button>",
116 responsive: [{
117 breakpoint: 768,
118 settings: {
119 slidesToShow: 1,
120 centerMode: true,
121 arrows: true
122 }
123 }]
124 });
125 })
126 </script>
127 </#if>
128
129 <#assign hasAttachments = attachments?? && attachments.getSiblings()?has_content &&
130 attachments.getSiblings()[0].getData()?? && attachments.getSiblings()[0].getData() != "" />
131
132 <#if hasAttachments>
133 <div class="attachments mt-4">
134 <h3 class="bold text-gray-dark mb-2">
135 Anexos
136 </h3>
137 <ul class="list-unstyled">
138 <#list attachments.getSiblings() as curAttachment>
139 <li class="mb-1">
140 <div class="d-inline-block">
141 <a
142 class="btn btn-link p-0"
143 href="${curAttachment.getData()}&download=true"
144 >
145 <i class="las la-file-download mr-2"></i>
146 <span>
147 ${curAttachment.getData()?string?split("/")[4]}
148 </span>
149 </a>
150 </div>
151 </li>
152 </#list>
153 </ul>
154 </div>
155 </#if>
156</div>
157
158<#macro getNewsBadge category>
159 <#assign newsCategoryId = category.getCategoryId() />
160 <#assign newsCategoryColorProperty = getCategoryProperty(newsCategoryId, 'color') />
161 <#assign newsCategoryColor = "#" + newsCategoryColorProperty?has_content?then(newsCategoryColorProperty.getValue(), "208bdc") />
162
163 <span
164 class="badge text-white mr-3"
165 style="background-color: ${newsCategoryColor}"
166 >
167 <span class="badge-item badge-item-expand">
168 ${category.getName()}
169 </span>
170 </span>
171</#macro>
172
173<#macro getShare>
174 <div class="share">
175 <ul class="nav align-items-center">
176 <li class="nav-item">
177 <button
178 class="btn nav-link nav-link-monospaced lfr-portal-tooltip"
179 href="${portletDisplay.getURLPrint()}"
180 title="Imprimir"
181 onclick="window.print();"
182 >
183 <i class="las la-print"></i>
184 </button>
185 </li>
186
187 <li class="nav-item border-left border-gray pl-3">
188 <span class="h5 text-gray">Compartilhe:</span>
189 </li>
190
191 <li class="nav-item">
192 <a
193 class="nav-link nav-link-monospaced lfr-portal-tooltip"
194 href="https://www.facebook.com/sharer.php?u=${currentUrl}"
195 title="Facebook"
196 target="_blank"
197 >
198 <i class="lab la-facebook-f"></i>
199 </a>
200 </li>
201
202 <li class="nav-item">
203 <a
204 class="nav-link nav-link-monospaced lfr-portal-tooltip"
205 href="https://www.instagram.com/?url=${currentUrl}"
206 title="Instagram"
207 target="_blank"
208 >
209 <i class="lab la-instagram"></i>
210 </a>
211 </li>
212
213 <li class="nav-item">
214 <a
215 class="nav-link nav-link-monospaced lfr-portal-tooltip"
216 href="https://www.linkedin.com/shareArticle?mini=true&url=${currentUrl}&title=${title}"
217 title="LinkedIn"
218 target="_blank"
219 >
220 <i class="lab la-linkedin-in"></i>
221 </a>
222 </li>
223
224 <li class="nav-item">
225 <a
226 class="nav-link nav-link-monospaced lfr-portal-tooltip"
227 href="http://twitter.com/intent/tweet?text=${title}%0AVeja%20mais%20em:&url=${currentUrl}"
228 title="Twitter"
229 target="_blank"
230 >
231 <i class="lab la-twitter"></i>
232 </a>
233 </li>
234 </ul>
235 </div>
236</#macro>
237
238<#function getNewsCategories categories>
239 <#local occupationCategories = [] />
240 <#local organizationCategories = [] />
241 <#local newsCategories = [] />
242 <#local categoryList = [] />
243
244 <#if categories?has_content>
245 <#list categories as category>
246 <#assign vocabulary = assetVocabularyLocalService.getVocabulary(category.vocabularyId) />
247
248 <#if (vocabulary.getName()?lower_case == "atuação")>
249 <#local occupationCategories = occupationCategories + [category] />
250 <#elseif (vocabulary.getName()?lower_case == "unidades")>
251 <#local organizationCategories = organizationCategories + [category] />
252 <#elseif (vocabulary.getName()?lower_case == "noticias")>
253 <#local newsCategories = newsCategories + [category] />
254 </#if>
255 </#list>
256 </#if>
257
258 <#if occupationCategories?has_content>
259 <#assign occupationCategory = occupationCategories?first />
260 <#local categoryList = categoryList + [occupationCategory] />
261 </#if>
262
263 <#if organizationCategories?has_content>
264 <#assign organizationCategory = organizationCategories?first />
265 <#local categoryList = categoryList + [organizationCategory] />
266 </#if>
267
268 <#if !categoryList?has_content && newsCategories?has_content>
269 <#assign newsCategory = newsCategories?first />
270 <#local categoryList = categoryList + [newsCategory] />
271 </#if>
272
273 <#return categoryList>
274</#function>
275
276<#function getCategoryProperty categoryId key>
277 <#local assetCategoryPropertyLocalService = serviceLocator.findService("com.liferay.asset.category.property.service.AssetCategoryPropertyLocalService") />
278 <#local assetCategoryProperties = assetCategoryPropertyLocalService.getCategoryProperties(categoryId)
279 />
280 <#local assetCategoryProperty = "" />
281
282 <#if assetCategoryProperties?has_content>
283 <#list assetCategoryProperties as curAssetCategoryProperty>
284 <#if curAssetCategoryProperty.getKey()?lower_case == key?lower_case>
285 <#local assetCategoryProperty = curAssetCategoryProperty>
286 </#if>
287 </#list>
288 </#if>
289
290 <#return assetCategoryProperty>
291</#function>