Skip to content

Instantly share code, notes, and snippets.

@baxtheman
Last active December 22, 2015 11:09
Show Gist options
  • Save baxtheman/6464122 to your computer and use it in GitHub Desktop.
Save baxtheman/6464122 to your computer and use it in GitHub Desktop.
template x ADT oneshop
<#-- DECLARATIONS -->
<#assign liferay_ui = taglibLiferayHash["/WEB-INF/tld/liferay-ui.tld"] />
<#assign aui = taglibLiferayHash["/WEB-INF/tld/aui.tld"] />
<#assign namespace = renderResponse.getNamespace() />
<#-- BODY -->
<article class="container-fluid" id="${namespace}${item.itemId}">
<div class="row-fluid">
<#assign imageUrl = oneshopHelper.getIconURL(item,themeDisplay)!"holder.js/300x200/text:missing">
<#assign relatedUrls = oneshopHelper.getRelatedURLs(item,themeDisplay)>
<#assign attributes = oneshopHelper.getSimpleAttributes(item)>
<div class="span6">
<div class="thumbnail">
<img src="${imageUrl}" class="picture"/>
</div>
<div class="thumbnails-list">
<#list relatedUrls as relatedUrl>
<div class="span3">
<img src="${relatedUrl}" class="picture thumbnail-small"/>
</div>
</#list>
</div>
</div>
<div class="span6">
<h1>
${htmlUtil.escape(item.getTitle(locale))}
</h1>
<span class="lead badge badge-success">&euro; ${item.getPriceUnit(locale)!"--"}</span>
<p class="muted">
${htmlUtil.escape(item.getDescription(locale))}<br/>
</p>
<p>
<#if attributes.weight??>
<span>${attributes.weight.getTitle(locale)}</span>
<strong>${oneshopHelper.getAttributeValue(item,attributes.weight,locale)}</strong>
</#if>
</p>
</div>
</div>
</article>
<script>
//<@aui["script"] use="aui-base">
var bigThumbnail = A.one('#${namespace}${item.itemId} .thumbnail img');
A.one('#${namespace}${item.itemId} .thumbnails-list').delegate(
'click',
function (event) {
var newSrc = event.currentTarget.getAttribute('src');
var oldSrc = bigThumbnail.getAttribute('src');
event.currentTarget.setAttribute('src', oldSrc);
bigThumbnail.setAttribute('src', newSrc);
},
'.thumbnail-small'
);
//</@>
</script>
<#-- DECLARATIONS -->
<#assign liferay_ui = taglibLiferayHash["/WEB-INF/tld/liferay-ui.tld"] />
<#-- BODY -->
<ul class="thumbnails">
<#list entries as entry>
<#assign fullUrl = oneshopHelper.getItemFullViewUrl(entry, renderRequest, renderResponse)>
<#assign imageUrl = oneshopHelper.getIconURL(entry,themeDisplay)!"holder.js/300x200/text:missing">
<#assign attributes = oneshopHelper.getSimpleAttributes(entry)>
<li class="span4">
<div class="thumbnail">
<a href="${fullUrl}">
<img src="${imageUrl}" />
</a>
<h3>
${htmlUtil.escape(entry.getTitle(locale))}
</h3>
<span class="lead badge badge-success">&euro; ${entry.getPriceUnit(locale)!"--"}</span>
<p class="muted">
${htmlUtil.escape(entry.getDescription(locale))}<br/>
</p>
<p>
<#if attributes.weight??>
<span>${attributes.weight.getTitle(locale)}</span>
<#assign value = oneshopHelper.getAttributeValue(entry,attributes.weight,locale)>
<strong>${value}</strong>
</#if>
</p>
<a href="${fullUrl}">
<@liferay.language key="read-more" />
</a>
</div>
</li>
</#list>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment