forked from ezsystems/ezplatform-demo
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEMO-111: [Product] - Full view (ezsystems#74)
* DEMO-111: [Product] - Full view https://jira.ez.no/browse/DEMO-111
- Loading branch information
Showing
15 changed files
with
429 additions
and
0 deletions.
There are no files selected for viewing
135 changes: 135 additions & 0 deletions
135
app/Resources/views/themes/tastefulplanet/full/product.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
{% extends "@ezdesign/pagelayout.html.twig" %} | ||
|
||
{% block page_head %} | ||
{% set title = ez_content_name(content) ~ " - " ~ content.contentInfo.publishedDate|localizeddate('short', 'short', app.request.locale) %} | ||
{{ parent() }} | ||
{% endblock %} | ||
|
||
{% block content %} | ||
{% include '@ezdesign/parts/product_modal_dialog.html.twig' %} | ||
|
||
<section class="content-type-product full-view"> | ||
<div class="breadcrumb"> | ||
<div class="container"> | ||
<a href="{{ path( ezpublish.rootLocation() ) }}">{{ ez_content_name(ezpublish.rootLocation().contentInfo) }}</a> > | ||
<a href="{{ path('ez_urlalias', {locationId: location.parentLocationId}) }}">{{ ez_content_name(app_content_info_by_location_id(location.parentLocationId)) }}</a> > | ||
<a class="product" href="{{ path('ez_urlalias', {locationId: location.id}) }}">{{ ez_content_name(content) }}</a> | ||
</div> | ||
</div> | ||
<div class="container product-main"> | ||
<div class="row"> | ||
<div class="col-md-7 product-main-image"> | ||
{% if not ez_is_field_empty(content, 'image') %} | ||
{{ ez_render_field(content, 'image', { | ||
'parameters': { | ||
'alias': 'product_large', | ||
'class': 'img-responsive' | ||
} | ||
}) }} | ||
{% endif %} | ||
</div> | ||
<div class="col-md-5"> | ||
<div class="product-main-title"> | ||
<h2>{{ ez_content_name(content) }}</h2> | ||
</div> | ||
<div class="row product-main-details"> | ||
<div class="col-md-4 product-main-price">$ {{ ez_field_value(content, 'price').value|number_format(2, '.') }}</div> | ||
<div class="col-md-3 product-main-serving"> | ||
<div class="product-main-serving-icon"></div> | ||
<div class="serving-label"> | ||
{{ ez_render_field(content, 'serving') }} {{ 'servings'|trans }} | ||
</div> | ||
</div> | ||
<div class="col-md-5 product-main-spicy"> | ||
{% set spicy_level = ez_field_value(content, 'spicy').selection.0 %} | ||
<div class="spicy-label">{{ 'Spicy Level:'|trans }}</div> | ||
{% for level in 1..spicy_level %} | ||
<div class="product-main-spicy-pepper"></div> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
<div class="product-main-description"> | ||
{{ ez_render_field(content, 'description') }} | ||
</div> | ||
<div class="product-main-add"> | ||
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#addModal"> | ||
<i class="fa fa-shopping-basket fa-lg"></i> {{ 'Add to cart'|trans }} | ||
</button> | ||
</div> | ||
<div class="product-dietary-list"> | ||
<h3>{{ 'Dietary restrictions'|trans }}</h3> | ||
{% if ez_field_value(content, 'dairy').bool %} | ||
<div class="product-main-dietary"> | ||
<div class="product-main-dietary-icon product-main-dietary-dairy-icon"></div> {{ 'Dairy'|trans }} | ||
</div> | ||
{% endif %} | ||
|
||
{% if ez_field_value(content, 'egg').bool %} | ||
<div class="product-main-dietary"> | ||
<div class="product-main-dietary-icon product-main-dietary-egg-icon"></div> {{ 'Egg'|trans }} | ||
</div> | ||
{% endif %} | ||
|
||
{% if ez_field_value(content, 'nuts').bool %} | ||
<div class="product-main-dietary"> | ||
<div class="product-main-dietary-icon product-main-dietary-nuts-icon"></div> {{ 'Nuts'|trans }} | ||
</div> | ||
{% endif %} | ||
|
||
{% if ez_field_value(content, 'gluten').bool %} | ||
<div class="product-main-dietary"> | ||
<div class="product-main-dietary-icon product-main-dietary-gluten-icon"></div> {{ 'Gluten'|trans }} | ||
</div> | ||
{% endif %} | ||
|
||
{% if ez_field_value(content, 'seafood').bool %} | ||
<div class="product-main-dietary"> | ||
<div class="product-main-dietary-icon product-main-dietary-seafood-icon"></div> {{ 'Seafood'|trans }} | ||
</div> | ||
{% endif %} | ||
</div> | ||
</div> | ||
</div> | ||
<div class="col-md-12 product-main-info"> | ||
<ul class="nav nav-tabs nav-justified"> | ||
<li class="nav-item"> | ||
<a class="nav-link active" data-toggle="tab" href="#ingredients" role="tab">{{ 'Ingredients'|trans }}</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" data-toggle="tab" href="#instructions" role="tab">{{ 'Cooking instructions'|trans }}</a> | ||
</li> | ||
</ul> | ||
<div class="tab-content"> | ||
<div class="tab-pane fade in show active" id="ingredients" role="tabpanel"> | ||
<div class="product-main-ingredients"> | ||
{{ ez_render_field(content, 'ingredients') }} | ||
</div> | ||
</div> | ||
<div class="tab-pane fade" id="instructions" role="tabpanel"> | ||
<div class="product-main-instruction"> | ||
{{ ez_render_field(content, 'cooking_instructions') }} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-md-6 content-tags"> | ||
<span class="tags-label">Tags</span> | ||
<div class="tags-list"> | ||
{{ ez_render_field(content, 'tags') }} | ||
</div> | ||
</div> | ||
<div class="col-md-6 content-share"> | ||
<span class="share-buttons-label">Share</span> | ||
<div class="share-buttons-list"> | ||
{% set url = url(location) %} | ||
{% set title = ez_content_name(content)|url_encode %} | ||
<a href="https://twitter.com/intent/tweet?original_referer={{ url }}&atext={{ title }}&url={{ url }}&via=ezsystems" target="_blank">Twitter</a> | ||
<a href="https://www.facebook.com/sharer/sharer.php?s=100&p[url]={{ url }}&p[title]={{ title }}" target="_blank">Facebook</a> | ||
<a href="http://www.linkedin.com/shareArticle?mini=true&url={{ url }}&title={{ title }}" target="_blank">LinkedIn</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
{% endblock %} |
18 changes: 18 additions & 0 deletions
18
app/Resources/views/themes/tastefulplanet/parts/product_modal_dialog.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<div class="modal fade" tabindex="-1" role="dialog" id="addModal"> | ||
<div class="modal-dialog" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
<h4 class="modal-title">{{ 'Hungry?'|trans }}</h4> | ||
</div> | ||
<div class="modal-body"> | ||
<p>{{ 'This is a bittersweet moment. This is a demo site, but we are happy we made you feel hungry.' }}</p> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-default" data-dismiss="modal">{{ 'Close'|trans }}</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
namespace AppBundle\Twig; | ||
|
||
use eZ\Publish\API\Repository\Values\Content\ContentInfo; | ||
use Twig_Extension; | ||
use Twig_SimpleFunction; | ||
use eZ\Publish\API\Repository\LocationService as LocationServiceInterface; | ||
|
||
/** | ||
* Twig helper for fetching ContentInfo Based on Location Id. | ||
*/ | ||
class ContentInfoByLocationIdExtension extends Twig_Extension | ||
{ | ||
/** var \eZ\Publish\API\Repository\LocationService */ | ||
private $locationService; | ||
|
||
/** | ||
* @param \eZ\Publish\API\Repository\LocationService $locationService | ||
*/ | ||
public function __construct(LocationServiceInterface $locationService) | ||
{ | ||
$this->locationService = $locationService; | ||
} | ||
|
||
/** | ||
* Returns the name of the extension. | ||
* | ||
* @return string the extension name | ||
*/ | ||
public function getName() | ||
{ | ||
return 'app.content_info'; | ||
} | ||
|
||
/** | ||
* Returns a list of functions to add to the existing list. | ||
* | ||
* @return array | ||
*/ | ||
public function getFunctions() | ||
{ | ||
return [ | ||
new Twig_SimpleFunction('app_content_info_by_location_id', [$this, 'contentInfoByLocationId']), | ||
]; | ||
} | ||
|
||
/** | ||
* Return ContentInfo based on Location Id | ||
* | ||
* @param $locationId int | ||
* | ||
* @return ContentInfo | ||
*/ | ||
public function contentInfoByLocationId($locationId) | ||
{ | ||
return $this->locationService->loadLocation($locationId)->getContentInfo(); | ||
} | ||
} |
Oops, something went wrong.