Skip to content

Instantly share code, notes, and snippets.

@epgarcia
Last active July 21, 2017 16:59
Show Gist options
  • Save epgarcia/a6f4ff94be3703fedd1914216b152bb6 to your computer and use it in GitHub Desktop.
Save epgarcia/a6f4ff94be3703fedd1914216b152bb6 to your computer and use it in GitHub Desktop.
<#if !entries?has_content>
<#if !themeDisplay.isSignedIn()>
${renderRequest.setAttribute("PORTLET_CONFIGURATOR_VISIBILITY", true)}
</#if>
<div class="alert alert-info">
<@liferay_ui["message"]
key="there-are-no-results"
/>
</div>
</#if>
<#list entries as entry>
<#assign entry = entry />
<#assign assetRenderer = entry.getAssetRenderer() />
<#assign entryTitle = htmlUtil.escape(assetRenderer.getTitle(locale)) />
<#assign viewURL = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, entry) />
<#if assetLinkBehavior != "showFullContent">
<#assign viewURL = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, entry, true) />
</#if>
<div class="asset-abstract">
<div class="pull-right">
<@getPrintIcon />
<@getFlagsIcon />
<@getEditIcon />
</div>
<h3 class="asset-title">
<a href="${viewURL}">
${entryTitle}
</a>
</h3>
<@getMetadataField fieldName="tags" />
<@getMetadataField fieldName="create-date" />
<@getMetadataField fieldName="view-count" />
<div class="asset-content">
<@getSocialBookmarks />
<@getRatings />
<@getRelatedAssets />
<@getDiscussion />
</div>
</div>
<#if entry.getClassName() == "com.liferay.journal.model.JournalArticle">
<#assign
assetRenderer = entry.getAssetRenderer()
journalArticle = assetRenderer.getAssetObject()
document = saxReaderUtil.read(journalArticle.getContentByLocale(localeUtil.toLanguageId(locale)))
xPathSelector = saxReaderUtil.createXPath("/root/dynamic-element[@name='text1']/dynamic-content")
text1 = xPathSelector.selectSingleNode(document).getStringValue()
/>
${text1}
</#if>
</#list>
<#macro getDiscussion>
<#if getterUtil.getBoolean(enableComments) && assetRenderer.isCommentable()>
<br />
<#assign discussionURL = renderResponse.createActionURL() />
${discussionURL.setParameter("javax.portlet.action", "invokeTaglibDiscussion")}
<@liferay_ui["discussion"]
className=entry.getClassName()
classPK=entry.getClassPK()
formAction=discussionURL?string
formName="fm" + entry.getClassPK()
ratingsEnabled=getterUtil.getBoolean(enableCommentRatings)
redirect=currentURL
userId=assetRenderer.getUserId()
/>
</#if>
</#macro>
<#macro getEditIcon>
<#if assetRenderer.hasEditPermission(themeDisplay.getPermissionChecker())>
<#assign redirectURL = renderResponse.createRenderURL() />
${redirectURL.setParameter("mvcPath", "/add_asset_redirect.jsp")}
${redirectURL.setWindowState("pop_up")}
<#assign editPortletURL = assetRenderer.getURLEdit(renderRequest, renderResponse, windowStateFactory.getWindowState("pop_up"), redirectURL)!"" />
<#if validator.isNotNull(editPortletURL)>
<#assign title = languageUtil.format(locale, "edit-x", entryTitle, false) />
<@liferay_ui["icon"]
cssClass="icon-monospaced visible-interaction"
icon="pencil"
markupView="lexicon"
message=title
url="javascript:Liferay.Util.openWindow({id:'" + renderResponse.getNamespace() + "editAsset', title: '" + title + "', uri:'" + htmlUtil.escapeURL(editPortletURL.toString()) + "'});"
/>
</#if>
</#if>
</#macro>
<#macro getFlagsIcon>
<#if getterUtil.getBoolean(enableFlags)>
<@liferay_flags["flags"]
className=entry.getClassName()
classPK=entry.getClassPK()
contentTitle=entry.getTitle(locale)
label=false
reportedUserId=entry.getUserId()
/>
</#if>
</#macro>
<#macro getMetadataField
fieldName
>
<#if stringUtil.split(metadataFields)?seq_contains(fieldName)>
<span class="metadata-entry metadata-${fieldName}">
<#assign dateFormat = "dd MMM yyyy - HH:mm:ss" />
<#if fieldName == "author">
<@liferay.language key="by" /> ${portalUtil.getUserName(assetRenderer.getUserId(), assetRenderer.getUserName())}
<#elseif fieldName == "categories">
<@liferay_ui["asset-categories-summary"]
className=entry.getClassName()
classPK=entry.getClassPK()
portletURL=renderResponse.createRenderURL()
/>
<#elseif fieldName == "create-date">
${dateUtil.getDate(entry.getCreateDate(), dateFormat, locale)}
<#elseif fieldName == "expiration-date">
${dateUtil.getDate(entry.getExpirationDate(), dateFormat, locale)}
<#elseif fieldName == "modified-date">
${dateUtil.getDate(entry.getModifiedDate(), dateFormat, locale)}
<#elseif fieldName == "priority">
${entry.getPriority()}
<#elseif fieldName == "publish-date">
${dateUtil.getDate(entry.getPublishDate(), dateFormat, locale)}
<#elseif fieldName == "tags">
<@liferay_ui["asset-tags-summary"]
className=entry.getClassName()
classPK=entry.getClassPK()
portletURL=renderResponse.createRenderURL()
/>
<#elseif fieldName == "view-count">
${entry.getViewCount()} <@liferay.language key="views" />
</#if>
</span>
</#if>
</#macro>
<#macro getPrintIcon>
<#if getterUtil.getBoolean(enablePrint)>
<#assign printURL = renderResponse.createRenderURL() />
${printURL.setParameter("mvcPath", "/view_content.jsp")}
${printURL.setParameter("assetEntryId", entry.getEntryId()?string)}
${printURL.setParameter("viewMode", "print")}
${printURL.setParameter("type", entry.getAssetRendererFactory().getType())}
<#if assetRenderer.getUrlTitle()?? && validator.isNotNull(assetRenderer.getUrlTitle())>
<#if assetRenderer.getGroupId() != themeDisplay.getScopeGroupId()>
${printURL.setParameter("groupId", assetRenderer.getGroupId()?string)}
</#if>
${printURL.setParameter("urlTitle", assetRenderer.getUrlTitle())}
</#if>
${printURL.setWindowState("pop_up")}
<@liferay_ui["icon"]
iconCssClass="icon-print"
message="print"
url="javascript:Liferay.Util.openWindow({id:'" + renderResponse.getNamespace() + "printAsset', title: '" + languageUtil.format(locale, "print-x-x", ["hide-accessible", entryTitle], false) + "', uri: '" + htmlUtil.escapeURL(printURL.toString()) + "'});"
/>
</#if>
</#macro>
<#macro getRatings>
<#if getterUtil.getBoolean(enableRatings) && assetRenderer.isRatable()>
<div class="asset-ratings">
<@liferay_ui["ratings"]
className=entry.getClassName()
classPK=entry.getClassPK()
/>
</div>
</#if>
</#macro>
<#macro getRelatedAssets>
<#if getterUtil.getBoolean(enableRelatedAssets)>
<@liferay_ui["asset-links"]
assetEntryId=entry.getEntryId()
/>
</#if>
</#macro>
<#macro getSocialBookmarks>
<#if getterUtil.getBoolean(enableSocialBookmarks)>
<@liferay_ui["social-bookmarks"]
displayStyle="${socialBookmarksDisplayStyle}"
target="_blank"
title=entry.getTitle(locale)
url=viewURL
/>
</#if>
</#macro>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment