Fix tpl from 1.11.x

pull/3064/head
Julio 5 years ago
parent 3990be24f2
commit 8bf44dbbbc
  1. 184
      public/main/template/default/forum/list.html.twig

@ -4,30 +4,30 @@
{% block content %}
{% autoescape false %}
{% if 'translate_html'|api_get_configuration_value %}
<script>
$(function () {
// default
$('.category-forum ').hide();
<script>
$(function () {
// default
$('.category-forum ').hide();
{% if default_user_language %}
$('.{{ default_user_language }}').show();
{% endif %}
{% if default_user_language %}
$('.{{ default_user_language }}').show();
{% endif %}
$('#extra_language').attr('data-width', '200px');
$('#extra_language option[value=""]').text('{{ 'Any' | get_lang | escape('js') }}');
$('#extra_language').on('change', function() {
var selectedLanguageArray = $(this).val();
$('.category-forum ').hide();
$.each(selectedLanguageArray, function(index, selectedLanguage) {
if (selectedLanguage == '') {
$('.category-forum ').show();
} else {
$('.'+ selectedLanguage).show();
}
});
$('#extra_language').attr('data-width', '200px');
$('#extra_language option[value=""]').text('{{ 'Any' | trans | escape('js') }}');
$('#extra_language').on('change', function() {
var selectedLanguageArray = $(this).val();
$('.category-forum ').hide();
$.each(selectedLanguageArray, function(index, selectedLanguage) {
if (selectedLanguage == '') {
$('.category-forum ').show();
} else {
$('.'+ selectedLanguage).show();
}
});
});
</script>
});
</script>
{% endif %}
{{ form_content }}
@ -35,44 +35,126 @@
{% set fold_forum_categories = 'forum_fold_categories'|api_get_configuration_value %}
{% if data is not empty %}
<div class="accordion forum" id="accordion-forum">
{% for item in data %}
{% set category_language_array = [] %}
{% set category_language = '' %}
{% for extra_field in item.extra_fields %}
{% if extra_field.variable == 'language' %}
{% set category_language_array = extra_field.value | split(';') %}
{% set category_language = extra_field.value | replace({';': ' ' }) %}
{% endif %}
{% endfor %}
{{ display.card_collapse('accordion-forum', item) }}
{% for item in data %}
{% set category_language_array = [] %}
{% set category_language = '' %}
{% for extra_field in item.extra_fields %}
{% if extra_field.variable == 'language' %}
{% set category_language_array = extra_field.value | split(';') %}
{% set category_language = extra_field.value | replace({';': ' ' }) %}
{% endif %}
{% endfor %}
</div>
{% else %}
<div class="alert alert-info">
{{ 'There is no forum in this category'|get_lang }}
</div>
{% if fold_forum_categories %}
{% set panel_icon %}
<a href="{{ item.url }}" title="{{ item.title }}">
<span class="open">{{ 'forum_blue.png'|img(32) }}</span>
</a>
{% endset %}
{% if is_allowed_to_edit %}
<div id="no-data-view" class="tool-view">
<h2>{{ "Forum"|trans }}</h2>
<img src="{{ "forum.png"|icon(64) }}" width="64" height="64">
<div class="controls">
<a href="{{ _p.web_self }}?{{ _p.web_cid_query ~ "&action=addglossary" }}" class="btn btn-outline-primary">
{{ "Add forum category"|trans }}
{% set panel_title %}
{{ item.title }}{{ item.icon_session }}
{% for category_language_item in category_language_array %}
<span class="flag-icon flag-icon-{{ languages[category_language_item | lower] }}"></span>
{% endfor %}
{% endset %}
{% else %}
{% set panel_title %}
<a href="{{ item.url }}" title="{{ item.title }}">
<span class="open">{{ 'forum_blue.png'|img(32) }}</span>
{{ item.title }}{{ item.icon_session }}
</a>
</div>
</div>
{% endif %}
{% for category_language_item in category_language_array %}
<span class="flag-icon flag-icon-{{ languages[category_language_item | lower] }}"></span>
{% endfor %}
<div class="pull-right">
{{ item.tools }}
</div>
{% endset %}
{% endif %}
{% endif %}
{% set panel_content %}
<div class="forum-description">
{{ item.description }}
</div>
{% for subitem in item.forums %}
<div class="forum_display">
<div class="panel panel-default forum">
<div class="panel-body">
<div class="row">
<div class="col-xs-4 col-md-3">
<div class="number-post">
<a href="{{ forum.url }}" title="{{forum.title}}">
{% if subitem.forum_image is not empty %}
<img src="{{ subitem.forum_image }}" width="48px">
{% else %}
{% if subitem.forum_of_group == 0 %}
{{ 'forum_group.png'|img(48) }}
{% else %}
{{ 'forum.png'|img(48) }}
{% endif %}
{% endif %}
</a>
<p>{{ 'Forum threads'| trans }}: {{ subitem.number_threads }} </p>
</div>
</div>
<div class="col-xs-8 col-md-9">
<div class="pull-right">
<div class="toolbar">
{{ subitem.tools }}
</div>
</div>
<h3 class="title">
{{ 'forum_yellow.png'|img(32) }}
<a href="{{ subitem.url }}" title="{{ subitem.title }}" class="{{ subitem.visibility != '1' ? 'text-muted': '' }}">{{ subitem.title }}</a>
{% if subitem.forum_of_group != 0 %}
<a class="forum-goto" href="../group/group_space.php?{{ _p.web_cid_query }}&gidReq={{ subitem.forum_of_group }}">
{{ "forum.png"|img(22) }} {{ "Go to"|trans }} {{ subitem.forum_group_title }}
</a>
{% endif %}
{{ subitem.icon_session }}
</h3>
{% if subitem.last_poster_id is not empty %}
<div class="forum-date">
<i class="fa fa-comments" aria-hidden="true"></i>
{{ subitem.last_poster_date }}
« {{ subitem.last_post_title }} »
{{ "By"|trans }}
{{ subitem.last_poster_user }}
</div>
{% endif %}
<div class="description">
{{ subitem.description }}
</div>
{{ subitem.last_post_text }}
{{ subitem.alert }}
{% if subitem.moderation is not empty %}
<span class="label label-warning">
{{ "Posts pending moderation"|trans }}: {{ subitem.moderation }}
</span>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endfor %}
{% endset %}
<div class="category-forum {{ category_language }}" id="category_{{ item.id }}">
{% if fold_forum_categories %}
{{ display.collapse('category_' ~ item.id, panel_title, panel_content, false, fold_forum_categories, item.tools, panel_icon ) }}
{% else %}
{{ display.panel(panel_title, panel_content) }}
{% endif %}
</div>
{% endfor %}
{% else %}
<div class="alert alert-warning">
{{ 'There are no forums in this category'|trans }}
</div>
{% endif %}
{% endautoescape %}
{% endblock %}

Loading…
Cancel
Save