Skip to content

Commit

Permalink
DEMO-150: Add eZ Tags view (ezsystems#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
SylvainGuittard authored and damianz5 committed Mar 21, 2018
1 parent 2f9e75e commit 0dea69d
Show file tree
Hide file tree
Showing 13 changed files with 283 additions and 26 deletions.
36 changes: 19 additions & 17 deletions app/Resources/NetgenTagsBundle/views/tag/view.html.twig
Expand Up @@ -9,32 +9,34 @@

{% block content %}
<section class="tags-content content-view-full">
<div class="row">
<div class="col-md-8 col-md-offset-2 col-sm-12">
<div class="attribute-header">
<h1>{{ 'Tags'|trans }} / <a href="{{ app.request.requestUri }}">{{ tag_keyword }}</a></h1>
</div>
<div class="container">
<div class="row">
<div class="col-md-8 offset-md-2 col-sm-12">
<div class="attribute-header">
<h1>{{ 'Tags'|trans }} / <a href="{{ app.request.requestUri }}">{{ tag_keyword }}</a></h1>
</div>

{% if related_content|length > 0 %}
<section class="content-view-children search-result-item">
{% for related_content_item in related_content %}
{{ render(controller(
{% if related_content|length > 0 %}
<section class="content-view-children search-result-item">
{% for related_content_item in related_content %}
{{ render(controller(
"ez_content:viewAction", {
"contentId": related_content_item.id,
"locationId": related_content_item.mainLocationId,
"viewType": "search_result_item",
"layout": false
}
)) }}
{% endfor %}
</section>
)) }}
{% endfor %}
</section>

{% if related_content.haveToPaginate() %}
<div class="pagination-centered">
{{ pagerfanta( related_content, 'twitter_bootstrap3_translated' ) }}
</div>
{% if related_content.haveToPaginate() %}
<div class="pagination-centered">
{{ pagerfanta( related_content, 'twitter_bootstrap3_translated' ) }}
</div>
{% endif %}
{% endif %}
{% endif %}
</div>
</div>
</div>
</section>
Expand Down
10 changes: 10 additions & 0 deletions app/Resources/views/themes/admin/fields/eztags_field.html.twig
@@ -0,0 +1,10 @@
{% extends "EzPublishCoreBundle::content_fields.html.twig" %}

{% block eztags_field %}
{% for tag in field.value.tags %}
<a href="{{ path('netgen_tags_admin_tag_show', {'tagId': tag.id}) }}">
{{ netgen_tags_tag_keyword(tag) }}
</a>
{% if not loop.last %}, {% endif %}
{% endfor %}
{% endblock %}
Expand Up @@ -2,9 +2,8 @@

{% block eztags_field %}
{% for tag in field.value.tags %}
<a href="{{ path('netgen_tags_admin_tag_show', {'tagId': tag.id}) }}">
<a href="{{ path( tag ) }}" class="badge badge-light">
{{ netgen_tags_tag_keyword(tag) }}
</a>
{% if not loop.last %}, {% endif %}
{% endfor %}
{% endblock %}
Expand Up @@ -34,6 +34,10 @@
<div class="field-body">
{{ ez_render_field(content, 'body') }}
</div>

<div class="field-tags">
{{ ez_render_field(content, 'tags') }}
</div>
</div>
</div>
</div>
Expand Down
Expand Up @@ -47,6 +47,10 @@
<div class="field-body">
{{ ez_render_field(content, 'body') }}
</div>

<div class="field-tags">
{{ ez_render_field(content, 'tags') }}
</div>
</div>
</div>
</div>
Expand Down
Expand Up @@ -38,12 +38,16 @@
<div class="field-description">
{{ ez_render_field(content, 'description') }}
</div>

<div class="field-tags">
{{ ez_render_field(content, 'tags') }}
</div>
</div>
</div>
</div>

<div class="field-location">
{{ ez_render_field(content, 'location', { parameters:{ mapType:'TERRAIN', showInfo:false, zoom: 6, width:'false', height:'400px' } }) }}
{{ ez_render_field(content, 'location', { parameters:{ mapType:'TERRAIN', showInfo:false, zoom: 6, width:'false', height:'400px', scrollWheel:false } }) }}
</div>

</section>
Expand Down
@@ -0,0 +1,43 @@
{% block content %}
{% set url = path(location) %}
{% set title = ez_content_name(content) %}

<section class="row item article">
<div class="col-md-9 item-info">
<div class="item-title">
<h2>
<a href="{{ url }}" title="{{ title }}">
{{ ez_render_field(content, 'title') }}
</a>
</h2>
</div>
<div class="d-none d-md-none d-sm-block d-xs-block item-image-sm">
{% if not ez_is_field_empty(content, 'image') %}
<a href="{{ url }}" title="{{ title }}">
{{ ez_render_field(content, 'image', {
'parameters': {
'alias': 'search_result_item_large',
'class': 'w-100'
}
}) }}
</a>
{% endif %}
</div>
<div class="item-intro">
{{ ez_render_field(content, 'intro') }}
</div>
</div>
<div class="col-md-3 d-none d-sm-none d-md-block d-lg-block item-image">
{% if not ez_is_field_empty(content, 'image') %}
<a href="{{ url }}" title="{{ title }}">
{{ ez_render_field(content, 'image', {
'parameters': {
'alias': 'search_result_item',
'class': 'w-100'
}
}) }}
</a>
{% endif %}
</div>
</section>
{% endblock %}
Expand Up @@ -2,7 +2,7 @@
{% set url = path(location) %}
{% set title = ez_content_name(content) %}

<section class="container item">
<section class="row item">
<div class="col-md-9 item-info">
<div class="item-title">
<h2>
Expand All @@ -11,12 +11,13 @@
</a>
</h2>
</div>
<div class="hidden-md visible-sm visible-xs item-image-sm">
<div class="d-none d-md-none d-sm-block d-xs-block item-image-sm">
{% if ez_field(content, 'image') and not ez_is_field_empty(content, 'image') %}
<a href="{{ url }}" title="{{ title }}">
{{ ez_render_field(content, 'image', {
'parameters': {
'alias': 'search_result_item_large'
'alias': 'search_result_item_large',
'class': 'w-100'
}
}) }}
</a>
Expand All @@ -29,12 +30,13 @@
</div>
{% endif %}
</div>
<div class="col-md-3 hidden-sm visible-md visible-lg item-image">
<div class="col-md-3 d-none d-sm-none d-md-block d-lg-block item-image">
{% if ez_field(content, 'image') and not ez_is_field_empty(content, 'image') %}
<a href="{{ url }}" title="{{ title }}">
{{ ez_render_field(content, 'image', {
'parameters': {
'alias': 'search_result_item'
'alias': 'search_result_item',
'class': 'w-100'
}
}) }}
</a>
Expand Down
@@ -0,0 +1,43 @@
{% block content %}
{% set url = path(location) %}
{% set name = ez_content_name(content) %}

<section class="row item place">
<div class="col-md-9 item-info">
<div class="item-name">
<h2>
<a href="{{ url }}" title="{{ name }}">
{{ ez_render_field(content, 'name') }}
</a>
</h2>
</div>
<div class="d-none d-md-none d-sm-block d-xs-block item-image-sm">
{% if not ez_is_field_empty(content, 'image') %}
<a href="{{ url }}" title="{{ name }}">
{{ ez_render_field(content, 'image', {
'parameters': {
'alias': 'search_result_item_large',
'class': 'w-100'
}
}) }}
</a>
{% endif %}
</div>
<div class="item-intro">
{{ ez_render_field(content, 'intro') }}
</div>
</div>
<div class="col-md-3 d-none d-sm-none d-md-block d-lg-block item-image">
{% if not ez_is_field_empty(content, 'image') %}
<a href="{{ url }}" title="{{ name }}">
{{ ez_render_field(content, 'image', {
'parameters': {
'alias': 'search_result_item',
'class': 'w-100'
}
}) }}
</a>
{% endif %}
</div>
</section>
{% endblock %}
@@ -0,0 +1,43 @@
{% block content %}
{% set url = path(location) %}
{% set title = ez_content_name(content) %}

<section class="row item product">
<div class="col-md-9 item-info">
<div class="item-title">
<h2>
<a href="{{ url }}" title="{{ title }}">
{{ ez_render_field(content, 'title') }}
</a>
</h2>
</div>
<div class="d-none d-md-none d-sm-block d-xs-block item-image-sm">
{% if not ez_is_field_empty(content, 'image') %}
<a href="{{ url }}" title="{{ title }}">
{{ ez_render_field(content, 'image', {
'parameters': {
'alias': 'search_result_item_large',
'class': 'w-100'
}
}) }}
</a>
{% endif %}
</div>
<div class="item-description">
{{ ez_render_field(content, 'description') }}
</div>
</div>
<div class="col-md-3 d-none d-sm-none d-md-block d-lg-block item-image">
{% if not ez_is_field_empty(content, 'image') %}
<a href="{{ url }}" title="{{ title }}">
{{ ez_render_field(content, 'image', {
'parameters': {
'alias': 'search_result_item',
'class': 'w-100'
}
}) }}
</a>
{% endif %}
</div>
</section>
{% endblock %}
4 changes: 3 additions & 1 deletion app/config/ezplatform.yml
Expand Up @@ -67,7 +67,7 @@ ezpublish:
default_ttl: '%httpcache_default_ttl%'
http_cache:
purge_servers: ['%purge_server%']
design: main
design: admin
site:
languages:
- eng-GB
Expand All @@ -90,6 +90,7 @@ ezpublish:
ezdesign:
design_list:
main: [tastefulplanet]
admin: [admin, tastefulplanet]

assetic:
assets:
Expand All @@ -107,3 +108,4 @@ assetic:
- 'assets/css/blog.css'
- 'assets/css/blog_post.css'
- 'assets/css/subscribe.css'
- 'assets/css/tags.css'
19 changes: 19 additions & 0 deletions app/config/views.yml
Expand Up @@ -3,6 +3,9 @@ ezpublish:
site_group:
pagelayout: "@ezdesign/pagelayout.html.twig"

field_templates:
- {template: "@ezdesign/fields/eztags_field.html.twig", priority: 20}

user:
layout: "@ezdesign/pagelayout.html.twig"
login_template: "@ezdesign/user/login.html.twig"
Expand Down Expand Up @@ -136,6 +139,22 @@ ezpublish:
Identifier\ContentType: [article]

search_result_item:
article:
template: "@ezdesign/search_result_item/article.html.twig"
match:
Identifier\ContentType: [article]
place:
template: "@ezdesign/search_result_item/place.html.twig"
match:
Identifier\ContentType: [place]
product:
template: "@ezdesign/search_result_item/product.html.twig"
match:
Identifier\ContentType: [product]
blog_post:
template: "@ezdesign/search_result_item/default.html.twig"
match:
Identifier\ContentType: [blog_post]
default:
template: "@ezdesign/search_result_item/default.html.twig"
match:
Expand Down

0 comments on commit 0dea69d

Please sign in to comment.