Skip to content

Instantly share code, notes, and snippets.

@baxtheman
Last active December 22, 2015 11:09

Revisions

  1. baxtheman revised this gist Sep 6, 2013. 1 changed file with 53 additions and 17 deletions.
    70 changes: 53 additions & 17 deletions item full
    Original file line number Diff line number Diff line change
    @@ -5,58 +5,94 @@

    <#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">
    <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">
    <div class="thumbnail">
    <a name="thumbnail" class="thumbnail">
    <img src="${imageUrl}" class="picture"/>
    </div>

    <div class="thumbnails-list">
    </a>
    <div class="thumbnails-list clearfix">
    <#list relatedUrls as relatedUrl>
    <div class="span3">
    <img src="${relatedUrl}" class="picture thumbnail-small"/>
    <a href='#thumbnail'>
    <img src="${relatedUrl}" class="picture thumbnail-small"/>
    </a>
    </div>
    </#list>
    </div>
    </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>

    <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>

    <script>
    //<@aui["script"] use="aui-base">
    <@aui.script use="aui-base">
    <#-- <script> -->

    var bigThumbnail = A.one('#${namespace}${item.itemId} .thumbnail img');

    @@ -69,12 +105,12 @@

    event.currentTarget.setAttribute('src', oldSrc);
    bigThumbnail.setAttribute('src', newSrc);

    },
    '.thumbnail-small'
    );

    //</@>
    </script>
    <#-- </script> -->
    </@>



  2. baxtheman created this gist Sep 6, 2013.
    80 changes: 80 additions & 0 deletions item full
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,80 @@
    <#-- 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>


    50 changes: 50 additions & 0 deletions item list
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,50 @@
    <#-- 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>