Skip to content

Commit

Permalink
adding article related object image field template
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagocamposviana committed Dec 18, 2013
1 parent 685c00b commit e6270c9
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 26 deletions.
8 changes: 5 additions & 3 deletions Classes/Components/LineList.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ public function render(){

$contentTypeService = $this->controller->getRepository()->getContentTypeService();
$contentType = $contentTypeService->loadContentType($location->contentInfo->contentTypeId);

$classes = $this->controller->getContainer()->getParameter('project.list.' . $contentType->identifier);

if($this->controller->getContainer()->hasParameter('project.list.' . $contentType->identifier)){
$classes = $this->controller->getContainer()->getParameter('project.list.' . $contentType->identifier);
} else {
return $response->setContent('');
}
$query = new Query();

$query->criterion = new LogicalAnd(
Expand Down
2 changes: 0 additions & 2 deletions NOTES.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
TODO:
- Improve gallery template;
- Improve content generation on install;
- Improve pagination;
- Review and improve templates;
- Review and improve cache;
- Optimize code;
- Release version 2.0.

#########################
Expand Down
8 changes: 7 additions & 1 deletion Resources/config/ezpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,10 @@ system:
default:
template: "TuteiBaseBundle:content/default:block.html.twig"
match:
UrlAlias: "/"
UrlAlias: "/"
content_view:
line:
image:
template: "TuteiBaseBundle:content/image:content_line.html.twig"
match:
Identifier\ContentType: [image]
31 changes: 19 additions & 12 deletions Resources/views/content/article/full.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,37 @@
{% set language = (siteaccess[ezpublish.siteaccess.name].language) %}

<div class="content-view-full">
<div class="content-type-folder">
<div class="attribute-title">
<div class="content-type-article media">
<div class="attribute-title media-heading">
<h2>{{ ez_render_field( content, 'title', { lang: language } ) }}</h2>
</div>

{% if content.fields.image is defined %}
<div class="attribute-image">
{{ ez_render_field(content, 'image', {
parameters:{ alias:'small' },
attr:{ class:'block_item', custom_attribute:'value' }
}
)
}}
{% if not ez_is_field_empty( content, 'image', { lang: language } ) %}

<div class="attribute-image pull-left">

{{ render_hinclude(
controller(
"ez_content:viewContent",
{
"contentId": content.fields.image[language].destinationContentId,
"viewType": "line",
"params": { 'alias' : 'small' }
}
)
) }}
</div>

{% endif %}

{% if not ez_is_field_empty( content, "intro" ) %}
<div class="attribute-short">
<div class="attribute-short media-body">
{{ ez_render_field( content, 'intro', { lang: language } ) }}
</div>
{% endif %}

{% if not ez_is_field_empty( content, "body" ) %}
<div class="attribute-long">
<div class="attribute-long media-body">
{{ ez_render_field( content, 'body', { lang: language } ) }}
</div>
{% endif %}
Expand Down
23 changes: 15 additions & 8 deletions Resources/views/content/article/line.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,23 @@
</h2>
</div>

{% if content.fields.image is defined %}
{% if not ez_is_field_empty( content, 'image', { lang: language } ) %}

<div class="attribute-image pull-left">
<a href="{{ path( location ) }}" title="{{ location.contentInfo.name }}">
{{ ez_render_field(content, 'image', {
parameters:{ alias:'original' },
attr:{ class:'media-object image-small', custom_attribute:'value' }
}
)
}}</a>
<a href="{{ path( location ) }}" title="{{ location.contentInfo.name }}">

{{ render_hinclude(
controller(
"ez_content:viewContent",
{
"contentId": content.fields.image[language].destinationContentId,
"viewType": "line",
"params": { 'alias' : 'small' }
}
)
) }}</a>
</div>

{% endif %}

{% if not ez_is_field_empty( content, 'intro', { lang: language } ) %}
Expand Down
8 changes: 8 additions & 0 deletions Resources/views/content/image/content_line.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% set language = (siteaccess[ezpublish.siteaccess.name].language) %}
{% if content.fields.image[language].uri is defined %}
{% set image_alias = ez_image_alias( content.getField('image'), content.versionInfo, alias|default('original') ) %}

<img class="image-small" src="{{asset( image_alias.uri )}}" alt="{{content.versionInfo.names[language]}}" />

{% endif %}

1 change: 1 addition & 0 deletions Resources/views/pagelayout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
</div> <!-- /container -->

{% javascripts
'@eZDemoBundle/Resources/public/js/hinclude.js'
"bundles/tuteibase/js/bootstrap.min.js"
"bundles/tuteibase/js/lightbox-2.6.min.js"
"bundles/tuteibase/js/project.js"
Expand Down

0 comments on commit e6270c9

Please sign in to comment.