{% if discussions is defined %}
<div class="discussion-table-widget-main-container">
{% set shownRoutes = ['section_slug', 'property_type_slug', 'location_slug', 'search', 'property_type_search'] %}
<div class="row">
<div class="col-xs-12">
{% if app.request.attributes.get('_route') not in shownRoutes %}
<div class="page-header">
{% set discussionLocationTitle = listing.location is defined ? listing.location.title : '' %}
{% if discussionLocationTitle == '' %}
<h2 class="custom-header">{{ "neighborhoods.discussion.explore_title"|trans() }}</h2>
{% else %}
<h2 class="custom-header">{{ "neighborhoods.discussion.explore_title_in"|trans({'%location%': discussionLocationTitle} ) }}</h2>
{% endif %}
</div>
{% endif %}
<div class="discussions-table-container">
<div class="discussions-sample-table">
{% for discussion in discussions %}
<div class="media">
<div class="media-body">
<h4 class="media-heading">
<a id="title-link" target="_blank"
href="{{ path('neighborhood_discussion_comments' , {'utm_source': 'system', 'utm_medium': 'search', 'utm_campaign': 'view_question','discussion': discussion.id }) }}"
class="">
{{ discussion.content|slice(0, 87)|raw }}
</a>
</h4>
<div class="row">
{% if app.request.attributes.get('_route') not in shownRoutes %}
<div class="col-xs-8 pull-left flip">
<p id="discussion-p">
{% if discussion.category %}
<a id="content-link" target="_blank"
href="{{ path('neighborhood_discussion_list' , {'category': discussion.category.id }) }}"
class="">
{{ discussion.category.title }}
</a>
{% endif %}
{% if discussion.location %}
<span id="discussion-location-category-parser">{{ 'layout.in'|trans }}</span>
<a id="content-link" target="_blank"
href="{{ path('neighborhood_discussion_list' , {'location':discussion.location.id }) }}"
class="">
{{ discussion.location.title }}
</a>
{% endif %}
</p>
</div>
{% endif %}
<div class="col-xs-12 pull-right flip">
<small id="discussions_comment_label" class="">
<label><a target="_blank"
href="{{ path('neighborhood_discussion_comments' , {'discussion': discussion.id }) }}"
class="">
<i class="fa fa-comment-o"
aria-hidden="true"></i>
{{ discussion.comments|length }}
{{ "neighborhoods.discussion.comments"|trans }}
</a>
</label>
</small>
</div>
</div>
</div>
</div>
{% if not loop.last %}
<hr/>
{% endif %}
{% endfor %}
</div>
</div>
{% if app.request.attributes.get('_route') not in shownRoutes %}
<div class="explore-more-container">
{% set discussionLocation = app.request.get('location') ? app.request.get('location').id : '' %}
<a class="explore-more btn btn-block btn-primary" href="{{ path('neighborhood_discussion_list', { 'location': discussionLocation}) }}">{{ "neighborhoods.discussion.explore_more"|trans }}</a>
</div>
{% endif %}
</div>
</div>
</div>
{% endif %}