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() />
<#macro translate key >
${languageUtil.get(pageContext, key)}
</#macro>
<#-- 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)>
<#assign addtoCartUrl = oneshopHelper.getAddToCartUrl(currentURL,renderResponse)>
<div class="span6">
<a name="thumbnail" class="thumbnail">
<img src="${imageUrl}" class="picture"/>
</a>
<div class="thumbnails-list clearfix">
<#list relatedUrls as relatedUrl>
<div class="span3">
<a href='#thumbnail'>
<img src="${relatedUrl}" class="picture thumbnail-small"/>
</a>
</div>
</#list>
</div>
</div>
<div class="span6">
<h1>
${htmlUtil.escape(item.getTitle(locale))}
</h1>
<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>
<hr/>
<@aui.form action="${addtoCartUrl}" name="fm${item.itemId}" method="post">
<div class="input-append">
<input type="hidden" name="${namespace}itemId" value="${item.itemId}" />
<span class="label label-success span4">
<p class="lead">
&euro; ${item.getPriceUnit(locale)!"--"}
</p>
</span>
<select name="${namespace}quantity" class="offset1 input-small">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
<button class="btn" type="submit">
<i class="icon-plus-sign"></i>
<span class="">
<@translate key="add-to-cart" />
</span>
</button>
</div>
</@>
</div>
</div>
</article>
<@aui.script use="aui-base">
<#-- <script> -->
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