Skip to content

Commit

Permalink
Refs #81 - changed noImage to noImageLarge and added noImageSmall.
Browse files Browse the repository at this point in the history
only needed for this branch.
  • Loading branch information
cbmarcum committed Nov 9, 2019
1 parent 49b4d31 commit ed9c2c4
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,13 @@ class ProductController {
def notices = noticeService.getCurrentNoticesByPage("Product")

// used for no-image if a product is missing one.
def noImage = Photo.findByName("no-image")?.photo?.getCloudFile("large")
def noImageLarge = Photo.findByName("no-image")?.photo?.getCloudFile("large")
def noImageSmall = Photo.findByName("no-image")?.photo?.getCloudFile("small")

// render(view:'index', model: [message: 'Hello world', result: result, fieldsList: indexedProperties.keySet()])

respond productList, model: [productCategory: productCategory, productCount: productCount, noticeList: notices, noImage: noImage]
respond productList, model: [productCategory: productCategory, productCount: productCount,
noticeList: notices, noImageLarge: noImageLarge, noImageSmall: noImageSmall]

}

Expand Down
131 changes: 68 additions & 63 deletions grails-app/views/product/index.gsp
Original file line number Diff line number Diff line change
@@ -1,71 +1,76 @@
<!doctype html>
<html>
<head>
<meta name="layout" content="main">
<g:set var="entityName" value="${message(code: 'product.label', default: 'Product')}"/>
<g:if test="${params.category}">
<g:set var="entityCategory" value="${params.category}"/>
</g:if>
<g:else>
<g:set var="entityCategory" value="All Products"/>
</g:else>
<head>
<meta name="layout" content="main">
<g:set var="entityName" value="${message(code: 'product.label', default: 'Product')}"/>
<g:if test="${params.category}">
<g:set var="entityCategory" value="${params.category}"/>
</g:if>
<g:else>
<g:set var="entityCategory" value="All Products"/>
</g:else>

<title><g:message code="default.list.label" args="[entityName]"/></title>
<title><g:message code="default.list.label" args="[entityName]"/></title>

</head>
</head>

<body>
<body>

<div class="container">
<div class="container">

<a href="#list-product" class="skip" tabindex="-1"><g:message code="default.link.skip.label"
default="Skip to content&hellip;"/></a>
<sec:access expression="hasRole('ROLE_ADMIN')">
<g:render template="/common/subnav-create"/>
</sec:access>
<a href="#list-product" class="skip" tabindex="-1"><g:message code="default.link.skip.label"
default="Skip to content&hellip;"/></a>
<sec:access expression="hasRole('ROLE_ADMIN')">
<g:render template="/common/subnav-create"/>
</sec:access>


<div id="list-product" class="row">
<div class="col-sm-6">
<h1><g:message code="default.list.label" args="[entityName]"/>&nbsp;<small>&nbsp;${entityCategory}</small>
</h1>
</div>
<div id="list-product" class="row">
<div class="col-sm-6">
<h1><g:message code="default.list.label" args="[entityName]"/>&nbsp;<small>&nbsp;${entityCategory}</small>
</h1>
</div>

<div class="col-sm-6">
<g:render template="/product/menubar-search"/>
</div>
<div class="col-sm-6">
<g:render template="/product/menubar-search"/>
</div>

</div> <%-- /.row --%>
</div> <%-- /.row --%>

<g:render template="/common/flash-message"/>
<g:render template="/common/flash-message"/>

<g:render template="/common/notice-message"/>
<g:render template="/common/notice-message"/>

<div>Hover over image to zoom</div>
<div>Hover over image to zoom</div>

<div class="table-responsive">
<table class="table">
<div class="table-responsive">
<table class="table">

<tbody>
<g:each in="${productList}" status="i" var="product">
<g:set var="large" value="${product.photos[0].photo.getCloudFile("large")}"/>
<g:set var="small" value="${product.photos[0].photo.getCloudFile("small")}"/>

<tr>
<td width="160px">
<tbody>
<g:each in="${productList}" status="i" var="product">
<g:if test="${product.photos[0]}">
<g:set var="large" value="${product.photos[0].photo.getCloudFile("large")}"/>
<g:set var="small" value="${product.photos[0].photo.getCloudFile("small")}"/>
</g:if>
<g:else>
<g:set var="large" value="${noImageLarge}"/>
<g:set var="large" value="${noImageSmall}"/>
</g:else>
<tr>
<td width="160px">
<cb:zoomImageByClass clazz="zoom_01" large="${large}" small="${small}"/>
</td>
<td>SKU:
</td>
<td>SKU:
<sec:access expression="hasRole('ROLE_ADMIN')">
<g:link action="show" id="${product.id}">${product.number}</g:link><br/>
</sec:access>
<sec:noAccess expression="hasRole('ROLE_ADMIN')">
</sec:access>
<sec:noAccess expression="hasRole('ROLE_ADMIN')">
<g:link action="detail" id="${product.id}">${product.number}</g:link><br/>
</sec:noAccess>
<b>${product?.name}</b><br/>
</sec:noAccess>
<b>${product?.name}</b><br/>
${product?.shortDescription}<br/>
List Price: <g:formatNumber number="${product.listPrice}" type="currency"
currencyCode="USD"/><br/>
currencyCode="USD"/><br/>

<g:if test="${product.variantGroupId}">
<g:link action="detail" id="${product.id}">Product details and variations</g:link><br/>
Expand All @@ -75,30 +80,30 @@
<g:link action="detail" id="${product.id}">Product details</g:link><br/>
</g:else>

</td>
</td>

</tr>
</g:each>
</tbody>
</table>
</div><!-- table-responsive -->
</tr>
</g:each>
</tbody>
</table>
</div><!-- table-responsive -->


<g:if test="${productCount > params.max}">
<div class="text-center">
<cb:bsPaginate total="${productCount}" params="${params}"/>
</div>
</g:if>
<g:if test="${productCount > params.max}">
<div class="text-center">
<cb:bsPaginate total="${productCount}" params="${params}"/>
</div>
</g:if>

</div> <!-- /.container -->
</div> <!-- /.container -->

<script type="text/javascript">
//initiate the plugin and pass the class of the div containing gallery images
$(".zoom_01").elevateZoom({
<script type="text/javascript">
//initiate the plugin and pass the class of the div containing gallery images
$(".zoom_01").elevateZoom({
zoomWindowWidth: 200,
zoomWindowHeight: 200
});
</script>
});
</script>

</body>
</html>

0 comments on commit ed9c2c4

Please sign in to comment.