Fix TwigCS issues

This commit is contained in:
Yassine Guedidi 2022-05-03 23:28:20 +02:00
parent 4742b890da
commit fc85cfd52e
60 changed files with 290 additions and 298 deletions

View file

@ -48,4 +48,4 @@ jobs:
run: "php bin/phpstan analyse --no-progress --error-format=checkstyle | cs2pr"
- name: "Run TwigCS"
run: "php bin/twigcs --severity=error --display=blocking --reporter checkstyle src/ | cs2pr"
run: "php bin/twigcs --severity=error --display=blocking --reporter checkstyle app/ src/ | cs2pr"

View file

@ -5,8 +5,8 @@
<div class="row">
{{ form_widget(form._token) }}
{% for flashMessage in app.session.flashbag.get('notice') %}
<span class="black-text"><p>{{ flashMessage }}</p></span>
{% for flash_message in app.session.flashbag.get('notice') %}
<span class="black-text"><p>{{ flash_message }}</p></span>
{% endfor %}
<div class="input-field col s12">

View file

@ -5,8 +5,8 @@
<div class="row">
<p>{{ 'security.resetting.description'|trans({}, "messages") }}</p>
{% for flashMessage in app.session.flashbag.get('notice') %}
<span class="black-text"><p>{{ flashMessage }}</p></span>
{% for flash_message in app.session.flashbag.get('notice') %}
<span class="black-text"><p>{{ flash_message }}</p></span>
{% endfor %}
{% if invalid_username is defined %}

View file

@ -8,8 +8,8 @@
<script>Materialize.toast('{{ error.messageKey|trans(error.messageData, 'security') }}', 4000)</script>
{% endif %}
{% for flashMessage in app.session.flashbag.get('notice') %}
<script>Materialize.toast('{{ flashMessage }}')</script>
{% for flash_message in app.session.flashbag.get('notice') %}
<script>Materialize.toast('{{ flash_message }}')</script>
{% endfor %}
<div class="row">

View file

@ -25,9 +25,9 @@
<li>
<p>{{ 'config.otp.app.two_factor_code_description_4'|trans }}</p>
{% for flashMessage in app.session.flashbag.get("two_factor") %}
{% for flash_message in app.session.flashbag.get("two_factor") %}
<div class="card-panel red darken-1 black-text">
{{ flashMessage|trans }}
{{ flash_message|trans }}
</div>
{% endfor %}

View file

@ -19,20 +19,20 @@
{% endblock %}
{% block content %}
{% set currentRoute = app.request.attributes.get('_route') %}
{% if currentRoute == 'homepage' %}
{% set currentRoute = 'unread' %}
{% set current_route = app.request.attributes.get('_route') %}
{% if current_route == 'homepage' %}
{% set current_route = 'unread' %}
{% endif %}
{% set listMode = app.user.config.listMode %}
{% set list_mode = app.user.config.listMode %}
<div class="results">
<div class="nb-results">{{ 'entry.list.number_on_the_page'|transchoice(entries.count) }}</div>
<div class="pagination">
<a href="{{ path('switch_view_mode') }}"><i class="listMode-btn material-icons md-24">{% if listMode == 0 %}list{% else %}view_module{% endif %}</i></a>
<a href="{{ path('switch_view_mode') }}"><i class="listMode-btn material-icons md-24">{% if list_mode == 0 %}list{% else %}view_module{% endif %}</i></a>
{% if app.user.config.feedToken %}
{% include "@WallabagCore/themes/common/Entry/_feed_link.html.twig" %}
{% endif %}
{% if currentRoute in ['unread', 'starred', 'archive', 'untagged', 'all'] %}
<a href="{{ path('random_entry', { 'type': currentRoute }) }}"><i class="btn-clickable material-icons md-24 js-random-action">casino</i></a>
{% if current_route in ['unread', 'starred', 'archive', 'untagged', 'all'] %}
<a href="{{ path('random_entry', {'type': current_route}) }}"><i class="btn-clickable material-icons md-24 js-random-action">casino</i></a>
{% endif %}
<i class="btn-clickable download-btn material-icons md-24 js-export-action">file_download</i>
<i class="btn-clickable filter-btn material-icons md-24 js-filters-action">filter_list</i>
@ -43,14 +43,14 @@
</div>
{% for entry in entries %}
<div id="entry-{{ entry.id|e }}" class="{% if listMode == 0 %}entry{% else %}listmode entry{% endif %}">
<div id="entry-{{ entry.id|e }}" class="{% if list_mode == 0 %}entry{% else %}listmode entry{% endif %}">
<h2><a href="{{ path('view', {'id': entry.id}) }}" title="{{ entry.title|e|raw }}">{{ entry.title|striptags|truncate(80, true, '…')|default('entry.default_title'|trans)|raw }}</a></h2>
{% set readingTime = entry.readingTime / app.user.config.readingSpeed * 200 %}
{% set reading_time = entry.readingTime / app.user.config.readingSpeed * 200 %}
<div class="estimatedTime">
<span class="tool reading-time">
{% if readingTime > 0 %}
{{ 'entry.list.reading_time_minutes'|trans({'%readingTime%': readingTime|round}) }}
{% if reading_time > 0 %}
{{ 'entry.list.reading_time_minutes'|trans({'%readingTime%': reading_time|round}) }}
{% else %}
{{ 'entry.list.reading_time_less_one_minute'|trans|raw }}
{% endif %}
@ -68,13 +68,13 @@
<li><a title="{{ 'entry.list.toogle_as_star'|trans }}" class="tool icon {% if entry.isStarred == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', {'id': entry.id}) }}"><i class="material-icons md-24 vertical-align-middle">star_rate</i><span>{{ 'entry.list.toogle_as_star'|trans }}</span></a></li>
<li><a title="{{ 'entry.list.delete'|trans }}" class="tool icon" onclick="return confirm('{{ 'entry.confirm.delete'|trans|escape('js') }}')" href="{{ path('delete_entry', {'id': entry.id}) }}"><i class="material-icons md-24 vertical-align-middle">delete</i><span>{{ 'entry.list.delete'|trans }}</span></a></li>
</ul>
{% if (entry.previewPicture is null or listMode == 1) %}
{% if (entry.previewPicture is null or list_mode == 1) %}
<ul class="card-entry-tags">
{% for tag in entry.tags %}
<li><a href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{ tag.label }}</a></li>
{% endfor %}
</ul>
<p {% if listMode == 1 %}class="hide"{% endif %}>{{ entry.content|striptags|slice(0, 300) }}&hellip;</p>
<p {% if list_mode == 1 %}class="hide"{% endif %}>{{ entry.content|striptags|slice(0, 300) }}&hellip;</p>
{% else %}
<ul class="card-entry-labels">
{% for tag in entry.tags|slice(0, 3) %}
@ -92,25 +92,25 @@
<!-- Export -->
<aside id="download-form">
{% set currentTag = null %}
{% set current_tag = null %}
{% if tag is defined %}
{% set currentTag = tag %}
{% set current_tag = tag %}
{% endif %}
{% set exportSearchTerm = null %}
{% set export_search_term = null %}
{% if searchTerm is defined %}
{% set exportSearchTerm = searchTerm %}
{% set export_search_term = searchTerm %}
{% endif %}
{% set previousRoute = app.request.attributes.get('currentRoute') %}
{% set previous_route = app.request.attributes.get('currentRoute') %}
<h2>{{ 'entry.list.export_title'|trans }}</h2>
<a href="javascript: void(null);" id="download-form-close" class="close-button--popup close-button">&times;</a>
<ul>
{% if craue_setting('export_epub') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'epub', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">EPUB</a></li>{% endif %}
{% if craue_setting('export_mobi') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'mobi', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">MOBI (deprecated)</a></li>{% endif %}
{% if craue_setting('export_pdf') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'pdf', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">PDF</a></li>{% endif %}
{% if craue_setting('export_json') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'json', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">JSON</a></li>{% endif %}
{% if craue_setting('export_csv') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'csv', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">CSV</a></li>{% endif %}
{% if craue_setting('export_txt') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'txt', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">TXT</a></li>{% endif %}
{% if craue_setting('export_xml') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'xml', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">XML</a></li>{% endif %}
{% if craue_setting('export_epub') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', {'category': current_route, 'format': 'epub', 'tag': current_tag, 'search_entry[term]': export_search_term, 'currentRoute': previous_route}) }}">EPUB</a></li>{% endif %}
{% if craue_setting('export_mobi') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', {'category': current_route, 'format': 'mobi', 'tag': current_tag, 'search_entry[term]': export_search_term, 'currentRoute': previous_route}) }}">MOBI (deprecated)</a></li>{% endif %}
{% if craue_setting('export_pdf') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', {'category': current_route, 'format': 'pdf', 'tag': current_tag, 'search_entry[term]': export_search_term, 'currentRoute': previous_route}) }}">PDF</a></li>{% endif %}
{% if craue_setting('export_json') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', {'category': current_route, 'format': 'json', 'tag': current_tag, 'search_entry[term]': export_search_term, 'currentRoute': previous_route}) }}">JSON</a></li>{% endif %}
{% if craue_setting('export_csv') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', {'category': current_route, 'format': 'csv', 'tag': current_tag, 'search_entry[term]': export_search_term, 'currentRoute': previous_route}) }}">CSV</a></li>{% endif %}
{% if craue_setting('export_txt') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', {'category': current_route, 'format': 'txt', 'tag': current_tag, 'search_entry[term]': export_search_term, 'currentRoute': previous_route}) }}">TXT</a></li>{% endif %}
{% if craue_setting('export_xml') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', {'category': current_route, 'format': 'xml', 'tag': current_tag, 'search_entry[term]': export_search_term, 'currentRoute': previous_route}) }}">XML</a></li>{% endif %}
</ul>
</aside>
@ -122,7 +122,7 @@
<a href="javascript: void(null);" id="filter-form-close" class="close-button--popup close-button">&times;</a>
<div id="filter-status" class="filter-group">
{% if currentRoute != 'untagged' and nbEntriesUntagged != 0 %}
{% if current_route != 'untagged' and nbEntriesUntagged != 0 %}
<div class="">
<a href="{{ path('untagged') }}">{{ 'tag.list.see_untagged_entries'|trans }} ({{ nbEntriesUntagged }})</a>
</div>

View file

@ -14,12 +14,12 @@
<li><a href="{{ entry.url|e }}" target="_blank" rel="noopener" title="{{ 'entry.view.original_article'|trans }} : {{ entry.title|e }}" class="tool link icon icon-link original"><span>{{ entry.domainName|removeWww }}</span></a></li>
<li><a title="{{ 'entry.view.left_menu.re_fetch_content'|trans }}" class="tool icon icon-reload" href="{{ path('reload_entry', {'id': entry.id}) }}"><span>{{ 'entry.view.left_menu.re_fetch_content'|trans }}</span></a></li>
{% set markAsReadLabel = 'entry.view.left_menu.set_as_unread' %}
{% set mark_as_read_label = 'entry.view.left_menu.set_as_unread' %}
{% if entry.isArchived == 0 %}
{% set markAsReadLabel = 'entry.view.left_menu.set_as_read' %}
{% set mark_as_read_label = 'entry.view.left_menu.set_as_read' %}
{% endif %}
<li><a title="{{ markAsReadLabel|trans }}" class="tool icon icon-check {% if entry.isArchived == 0 %}archive-off{% else %}archive{% endif %} markasread" href="{{ path('archive_entry', { 'id': entry.id }) }}"><span>{{ markAsReadLabel|trans }}</span></a></li>
<li><a title="{{ mark_as_read_label|trans }}" class="tool icon icon-check {% if entry.isArchived == 0 %}archive-off{% else %}archive{% endif %} markasread" href="{{ path('archive_entry', {'id': entry.id}) }}"><span>{{ mark_as_read_label|trans }}</span></a></li>
<li><a title="{{ 'entry.view.left_menu.set_as_starred'|trans }}" class="tool icon icon-star {% if entry.isStarred == 0 %}fav-off{% else %}fav{% endif %} favorite" href="{{ path('star_entry', {'id': entry.id}) }}"><span>{{ 'entry.view.left_menu.set_as_starred'|trans }}</span></a></li>
<li><a id="nav-btn-add-tag" class="tool icon icon-price-tags" title="{{ 'entry.view.left_menu.add_a_tag'|trans }}"><span>{{ 'entry.view.left_menu.add_a_tag'|trans }}</span></a></li>
<li><a title="{{ 'entry.view.left_menu.delete'|trans }}" onclick="return confirm('{{ 'entry.confirm.delete'|trans|escape('js') }}')" class="tool delete icon icon-trash" href="{{ path('delete_entry', {'id': entry.id}) }}"><span>{{ 'entry.view.left_menu.delete'|trans }}</span></a></li>
@ -62,9 +62,9 @@
{% endif %}
<i class="tool icon icon-time">
{% set readingTime = entry.readingTime / app.user.config.readingSpeed * 200 %}
{% if readingTime > 0 %}
{{ 'entry.list.reading_time_minutes_short'|trans({'%readingTime%': readingTime|round}) }}
{% set reading_time = entry.readingTime / app.user.config.readingSpeed * 200 %}
{% if reading_time > 0 %}
{{ 'entry.list.reading_time_minutes_short'|trans({'%readingTime%': reading_time|round}) }}
{% else %}
{{ 'entry.list.reading_time_less_one_minute_short'|trans|raw }}
{% endif %}

View file

@ -62,10 +62,10 @@
<p>It will be removed in the next version. You can use the Material theme by <a href="{{ path('config') }}">updating the theme config</a>.</p>
</div>
{% for flashMessage in app.session.flashbag.get('notice') %}
{% for flash_message in app.session.flashbag.get('notice') %}
<div class="messages success">
<a href="#" class="closeMessage">×</a>
<p>{{ flashMessage|trans }}</p>
<p>{{ flash_message|trans }}</p>
</div>
{% endfor %}
{% endblock %}

View file

@ -1,11 +1,11 @@
{% if tag is defined %}
<a rel="alternate" type="application/atom+xml" href="{{ path('tag_feed', {'username': app.user.username, 'token': app.user.config.feedToken, 'slug': tag.slug}) }}" class="right"><i class="material-icons md-24">rss_feed</i></a>
{% elseif currentRoute in ['homepage', 'unread', 'starred', 'archive', 'all'] %}
{% set feedRoute = currentRoute %}
{% if currentRoute == 'homepage' %}
{% set feedRoute = 'unread' %}
{% elseif current_route in ['homepage', 'unread', 'starred', 'archive', 'all'] %}
{% set feed_route = current_route %}
{% if current_route == 'homepage' %}
{% set feed_route = 'unread' %}
{% endif %}
{% set feedRoute = feedRoute ~ '_feed' %}
{% set feed_route = feed_route ~ '_feed' %}
<a rel="alternate" type="application/atom+xml" href="{{ path(feedRoute, {'username': app.user.username, 'token': app.user.config.feedToken}) }}" class="right"><i class="material-icons">rss_feed</i></a>
<a rel="alternate" type="application/atom+xml" href="{{ path(feed_route, {'username': app.user.username, 'token': app.user.config.feedToken}) }}" class="right"><i class="material-icons">rss_feed</i></a>
{% endif %}

View file

@ -1,20 +1,20 @@
{% set currentRoute = app.request.attributes.get('_route') %}
{% set current_route = app.request.attributes.get('_route') %}
{% if currentRoute == 'starred' %}
{% if current_route == 'starred' %}
{{ 'entry.page_titles.starred'|trans }}
{% elseif currentRoute == 'archive' %}
{% elseif current_route == 'archive' %}
{{ 'entry.page_titles.archived'|trans }}
{% elseif currentRoute == 'all' %}
{% elseif current_route == 'all' %}
{{ isFiltered ? 'entry.page_titles.filtered'|trans : 'entry.page_titles.all'|trans }}
{% elseif currentRoute == 'search' %}
{% elseif current_route == 'search' %}
{{ 'entry.page_titles.filtered_search'|trans }} {{ filter }}
{% elseif currentRoute == 'tag_entries' %}
{% elseif current_route == 'tag_entries' %}
{{ 'entry.page_titles.filtered_tags'|trans }} {{ filter }}
{% elseif currentRoute == 'untagged' %}
{% elseif current_route == 'untagged' %}
{{ 'entry.page_titles.untagged'|trans }}
{% elseif currentRoute == 'same_domain' %}
{% elseif current_route == 'same_domain' %}
{{ 'entry.page_titles.same_domain'|trans }}
{% elseif currentRoute == 'annotated' %}
{% elseif current_route == 'annotated' %}
{{ 'entry.page_titles.with_annotations'|trans }}
{% else %}
{{ 'entry.page_titles.unread'|trans }}

View file

@ -7,13 +7,13 @@
<meta property="og:title" content="{{ entry.title|e|raw }}" />
<meta property="og:type" content="article" />
<meta property="og:url" content="{{ app.request.uri }}" />
{% set picturePath = app.request.schemeAndHttpHost ~ asset('img/logo-wallabag.svg') %}
{% set picture_path = app.request.schemeAndHttpHost ~ asset('img/logo-wallabag.svg') %}
{% if entry.previewPicture is not null %}
{% set picturePath = entry.previewPicture %}
{% set picture_path = entry.previewPicture %}
{% endif %}
<meta property="og:image" content="{{ picturePath }}" />
<meta property="og:image" content="{{ picture_path }}" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:image" content="{{ picturePath }}" />
<meta name="twitter:image" content="{{ picture_path }}" />
<meta name="twitter:site" content="@wallabagapp" />
<meta name="twitter:title" content="{{ entry.title|e|raw }}" />
<meta name="twitter:description" content="{{ entry.content|striptags|slice(0, 300)|raw }}&hellip;" />

View file

@ -33,9 +33,9 @@
<li>
<p>{{ 'config.otp.app.two_factor_code_description_4'|trans }}</p>
{% for flashMessage in app.session.flashbag.get("two_factor") %}
{% for flash_message in app.session.flashbag.get("two_factor") %}
<div class="card-panel red darken-1 black-text">
{{ flashMessage|trans }}
{{ flash_message|trans }}
</div>
{% endfor %}

View file

@ -2,8 +2,8 @@
{% include "@WallabagCore/themes/material/Entry/Card/_mass_checkbox.html.twig" with {'entry': entry} only %}
<div class="card-preview">
<a href="{{ path('view', {'id': entry.id}) }}">
{% set previewClassModifier = entry.previewPicture ? '' : ' preview--default' %}
<span class="preview{{ previewClassModifier }}" style="background-image: url({{ entry.previewPicture | default(asset('img/logo-square.svg')) }})"></span>
{% set preview_class_modifier = entry.previewPicture ? '' : ' preview--default' %}
<span class="preview{{ preview_class_modifier }}" style="background-image: url({{ entry.previewPicture|default(asset('img/logo-square.svg')) }})"></span>
</a>
</div>
{% include "@WallabagCore/themes/material/Entry/Card/_content.html.twig" with {'entry': entry, 'withMetadata': true, 'subClass': 'metadata'} only %}

View file

@ -7,8 +7,8 @@
{% endfor %}
</ul>
<a href="{{ path('view', {'id': entry.id}) }}">
{% set previewClassModifier = entry.previewPicture ? '' : ' preview--default' %}
<span class="preview{{ previewClassModifier }}" style="background-image: url({{ entry.previewPicture | default(asset('img/logo-square.svg')) }})"></span>
{% set preview_class_modifier = entry.previewPicture ? '' : ' preview--default' %}
<span class="preview{{ preview_class_modifier }}" style="background-image: url({{ entry.previewPicture|default(asset('img/logo-square.svg')) }})"></span>
</a>
</div>
{% include "@WallabagCore/themes/material/Entry/Card/_content.html.twig" with {'entry': entry, 'withPreview': true} only %}

View file

@ -1,7 +1,7 @@
{% set readingTime = entry.readingTime / app.user.config.readingSpeed * 200 %}
{% set reading_time = entry.readingTime / app.user.config.readingSpeed * 200 %}
<i class="material-icons grey-text">timer</i>
{% if readingTime > 0 %}
<span>{{ 'entry.list.reading_time_minutes_short'|trans({'%readingTime%': readingTime|round}) }}</span>
{% if reading_time > 0 %}
<span>{{ 'entry.list.reading_time_minutes_short'|trans({'%readingTime%': reading_time|round}) }}</span>
{% else %}
<span>{{ 'entry.list.reading_time_less_one_minute_short'|trans|raw }}</span>
{% endif %}

View file

@ -19,30 +19,30 @@
{% endblock %}
{% block content %}
{% set listMode = app.user.config.listMode %}
{% set entriesWithArchivedClassRoutes = ['tag_entries', 'search', 'all'] %}
{% set currentRoute = app.request.attributes.get('_route') %}
{% if currentRoute == 'homepage' %}
{% set currentRoute = 'unread' %}
{% set list_mode = app.user.config.listMode %}
{% set entries_with_archived_class_routes = ['tag_entries', 'search', 'all'] %}
{% set current_route = app.request.attributes.get('_route') %}
{% if current_route == 'homepage' %}
{% set current_route = 'unread' %}
{% endif %}
<form name="form_mass_action" action="{{ path('mass_action') }}" method="post">
<div class="results">
<div class="nb-results">
{{ 'entry.list.number_on_the_page'|transchoice(entries.count) }}
<a href="{{ path('switch_view_mode') }}"><i class="material-icons">{% if listMode == 0 %}view_list{% else %}view_module{% endif %}</i></a>
<a href="{{ path('switch_view_mode') }}"><i class="material-icons">{% if list_mode == 0 %}view_list{% else %}view_module{% endif %}</i></a>
{% if app.user.config.feedToken %}
{% include "@WallabagCore/themes/common/Entry/_feed_link.html.twig" %}
{% endif %}
</div>
{% if currentRoute == 'search' %}<div><a href="{{ path('tag_this_search', {'filter': searchTerm, 'currentRoute': app.request.get('currentRoute') }) }}" title="{{ 'entry.list.assign_search_tag'|trans }}">{{ 'entry.list.assign_search_tag'|trans }}</a></div>{% endif %}
{% if current_route == 'search' %}<div><a href="{{ path('tag_this_search', {'filter': searchTerm, 'currentRoute': app.request.get('currentRoute')}) }}" title="{{ 'entry.list.assign_search_tag'|trans }}">{{ 'entry.list.assign_search_tag'|trans }}</a></div>{% endif %}
{% if entries.getNbPages > 1 %}
{{ pagerfanta(entries, 'twitter_bootstrap_translated', {'proximity': 1}) }}
{% endif %}
</div>
{% if listMode == 1 %}
{% if list_mode == 1 %}
<div class="mass-buttons">
{% if entries.count > 0 and listMode == 1 %}
{% if entries.count > 0 and list_mode == 1 %}
<span>
<input id="selectAll" type="checkbox" data-toggle="[data-js='entry-checkbox']" data-js="checkboxes-toggle" />&nbsp;
</span>
@ -61,16 +61,16 @@
</div>
{% endif %}
<ol class="entries {% if listMode == 1 %}collection{% else %}row entries-row data{% endif %}">
<ol class="entries {% if list_mode == 1 %}collection{% else %}row entries-row data{% endif %}">
{% for entry in entries %}
<li id="entry-{{ entry.id|e }}" class="{% if listMode != 0 %}col collection-item{% endif %} s12" data-entry-id="{{ entry.id|e }}" data-test="entry">
{% if listMode == 1 %}
{% include "@WallabagCore/themes/material/Entry/_card_list.html.twig" with {'entry': entry, 'currentRoute': currentRoute, 'routes': entriesWithArchivedClassRoutes} only %}
<li id="entry-{{ entry.id|e }}" class="{% if list_mode != 0 %}col collection-item{% endif %} s12" data-entry-id="{{ entry.id|e }}" data-test="entry">
{% if list_mode == 1 %}
{% include "@WallabagCore/themes/material/Entry/_card_list.html.twig" with {'entry': entry, 'currentRoute': current_route, 'routes': entries_with_archived_class_routes} only %}
{% elseif not entry.previewPicture is null and entry.mimetype starts with 'image/' %}
{% include "@WallabagCore/themes/material/Entry/_card_full_image.html.twig" with {'entry': entry, 'currentRoute': currentRoute, 'routes': entriesWithArchivedClassRoutes} only %}
{% include "@WallabagCore/themes/material/Entry/_card_full_image.html.twig" with {'entry': entry, 'currentRoute': current_route, 'routes': entries_with_archived_class_routes} only %}
{% else %}
{% include "@WallabagCore/themes/material/Entry/_card_preview.html.twig" with {'entry': entry, 'currentRoute': currentRoute, 'routes': entriesWithArchivedClassRoutes} only %}
{% include "@WallabagCore/themes/material/Entry/_card_preview.html.twig" with {'entry': entry, 'currentRoute': current_route, 'routes': entries_with_archived_class_routes} only %}
{% endif %}
</li>
{% endfor %}
@ -85,24 +85,24 @@
<!-- Export -->
<div id="export" class="side-nav right-aligned">
{% set currentTag = null %}
{% set current_tag = null %}
{% if tag is defined %}
{% set currentTag = tag.slug %}
{% set current_tag = tag.slug %}
{% endif %}
{% set exportSearchTerm = null %}
{% set export_search_term = null %}
{% if searchTerm is defined %}
{% set exportSearchTerm = searchTerm %}
{% set export_search_term = searchTerm %}
{% endif %}
{% set previousRoute = app.request.attributes.get('currentRoute') %}
{% set previous_route = app.request.attributes.get('currentRoute') %}
<h4 class="center">{{ 'entry.list.export_title'|trans }}</h4>
<ul>
{% if craue_setting('export_epub') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'epub', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">EPUB</a></li>{% endif %}
{% if craue_setting('export_mobi') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'mobi', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">MOBI (deprecated)</a></li>{% endif %}
{% if craue_setting('export_pdf') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'pdf', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">PDF</a></li>{% endif %}
{% if craue_setting('export_json') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'json', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">JSON</a></li>{% endif %}
{% if craue_setting('export_csv') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'csv', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">CSV</a></li>{% endif %}
{% if craue_setting('export_txt') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'txt', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">TXT</a></li>{% endif %}
{% if craue_setting('export_xml') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'xml', 'tag' : currentTag, 'search_entry[term]' : exportSearchTerm, 'currentRoute' : previousRoute }) }}">XML</a></li>{% endif %}
{% if craue_setting('export_epub') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', {'category': current_route, 'format': 'epub', 'tag': current_tag, 'search_entry[term]': export_search_term, 'currentRoute': previous_route}) }}">EPUB</a></li>{% endif %}
{% if craue_setting('export_mobi') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', {'category': current_route, 'format': 'mobi', 'tag': current_tag, 'search_entry[term]': export_search_term, 'currentRoute': previous_route}) }}">MOBI (deprecated)</a></li>{% endif %}
{% if craue_setting('export_pdf') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', {'category': current_route, 'format': 'pdf', 'tag': current_tag, 'search_entry[term]': export_search_term, 'currentRoute': previous_route}) }}">PDF</a></li>{% endif %}
{% if craue_setting('export_json') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', {'category': current_route, 'format': 'json', 'tag': current_tag, 'search_entry[term]': export_search_term, 'currentRoute': previous_route}) }}">JSON</a></li>{% endif %}
{% if craue_setting('export_csv') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', {'category': current_route, 'format': 'csv', 'tag': current_tag, 'search_entry[term]': export_search_term, 'currentRoute': previous_route}) }}">CSV</a></li>{% endif %}
{% if craue_setting('export_txt') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', {'category': current_route, 'format': 'txt', 'tag': current_tag, 'search_entry[term]': export_search_term, 'currentRoute': previous_route}) }}">TXT</a></li>{% endif %}
{% if craue_setting('export_xml') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', {'category': current_route, 'format': 'xml', 'tag': current_tag, 'search_entry[term]': export_search_term, 'currentRoute': previous_route}) }}">XML</a></li>{% endif %}
</ul>
</div>
@ -114,7 +114,7 @@
<h4 class="center">{{ 'entry.filters.title'|trans }}</h4>
<div class="row">
{% if currentRoute != 'untagged' and nbEntriesUntagged != 0 %}
{% if current_route != 'untagged' and nbEntriesUntagged != 0 %}
<div class="col s12 center-align">
<a href="{{ path('untagged') }}">{{ 'tag.list.see_untagged_entries'|trans }} ({{ nbEntriesUntagged }})</a>
</div>

View file

@ -61,15 +61,15 @@
<div class="collapsible-body"></div>
</li>
{% set markAsReadLabel = 'entry.view.left_menu.set_as_unread' %}
{% set mark_as_read_label = 'entry.view.left_menu.set_as_unread' %}
{% if entry.isArchived == 0 %}
{% set markAsReadLabel = 'entry.view.left_menu.set_as_read' %}
{% set mark_as_read_label = 'entry.view.left_menu.set_as_read' %}
{% endif %}
<li class="bold hide-on-med-and-down">
<a class="waves-effect collapsible-header markasread" title="{{ markAsReadLabel|trans }}" href="{{ path('archive_entry', { 'id': entry.id }) }}" id="markAsRead">
<a class="waves-effect collapsible-header markasread" title="{{ mark_as_read_label|trans }}" href="{{ path('archive_entry', {'id': entry.id}) }}" id="markAsRead">
<i class="material-icons small">{% if entry.isArchived == 0 %}done{% else %}unarchive{% endif %}</i>
<span>{{ markAsReadLabel|trans }}</span>
<span>{{ mark_as_read_label|trans }}</span>
</a>
<div class="collapsible-body"></div>
</li>
@ -123,15 +123,7 @@
</li>
</ul>
</li>
{% if craue_setting('share_public')
or craue_setting('share_twitter')
or craue_setting('share_shaarli')
or craue_setting('share_scuttle')
or craue_setting('share_diaspora')
or craue_setting('share_unmark')
or craue_setting('carrot')
or craue_setting('share_mail')
%}
{% if craue_setting('share_public') or craue_setting('share_twitter') or craue_setting('share_shaarli') or craue_setting('share_scuttle') or craue_setting('share_diaspora') or craue_setting('share_unmark') or craue_setting('carrot') or craue_setting('share_mail') %}
<li class="bold">
<a class="waves-effect collapsible-header">
<i class="material-icons small">share</i>

View file

@ -16,9 +16,9 @@
{% endblock %}
{% block messages %}
{% for flashMessage in app.session.flashbag.get('notice') %}
{% for flash_message in app.session.flashbag.get('notice') %}
<script>
Materialize.toast('{{ flashMessage|trans }}', 4000);
Materialize.toast('{{ flash_message|trans }}', 4000);
</script>
{% endfor %}
{% endblock %}
@ -34,40 +34,40 @@
</li>
{% endblock %}
{% set currentRoute = app.request.attributes.get('_route') %}
{% set currentRouteFromQueryParams = app.request.query.get('currentRoute') %}
{% set current_route = app.request.attributes.get('_route') %}
{% set current_route_from_query_params = app.request.query.get('currentRoute') %}
{% set activeRoute = null %}
{% if currentRoute == 'all' or currentRouteFromQueryParams == 'all' %}
{% set activeRoute = 'all' %}
{% elseif currentRoute == 'annotated' or currentRouteFromQueryParams == 'annotated' %}
{% set activeRoute = 'annotated' %}
{% elseif currentRoute == 'archive' or currentRouteFromQueryParams == 'archive' %}
{% set activeRoute = 'archive' %}
{% elseif currentRoute == 'starred' or currentRouteFromQueryParams == 'starred' %}
{% set activeRoute = 'starred' %}
{% elseif currentRoute == 'unread' or currentRoute == 'homepage' or currentRouteFromQueryParams == 'unread' %}
{% set activeRoute = 'unread' %}
{% elseif currentRoute == 'untagged' %}
{% set activeRoute = 'untagged' %}
{% set active_route = null %}
{% if current_route == 'all' or current_route_from_query_params == 'all' %}
{% set active_route = 'all' %}
{% elseif current_route == 'annotated' or current_route_from_query_params == 'annotated' %}
{% set active_route = 'annotated' %}
{% elseif current_route == 'archive' or current_route_from_query_params == 'archive' %}
{% set active_route = 'archive' %}
{% elseif current_route == 'starred' or current_route_from_query_params == 'starred' %}
{% set active_route = 'starred' %}
{% elseif current_route == 'unread' or current_route == 'homepage' or current_route_from_query_params == 'unread' %}
{% set active_route = 'unread' %}
{% elseif current_route == 'untagged' %}
{% set active_route = 'untagged' %}
{% endif %}
<li class="bold {% if activeRoute == 'unread' %}active{% endif %}">
<li class="bold {% if active_route == 'unread' %}active{% endif %}">
<a class="waves-effect" href="{{ path('unread') }}">{{ 'menu.left.unread'|trans }} <span class="numberItems grey-text">{{ count_entries('unread') }}</span></a>
</li>
<li class="bold {% if activeRoute == 'starred' %}active{% endif %}">
<li class="bold {% if active_route == 'starred' %}active{% endif %}">
<a class="waves-effect" href="{{ path('starred') }}">{{ 'menu.left.starred'|trans }} <span class="numberItems grey-text">{{ count_entries('starred') }}</span></a>
</li>
<li class="bold {% if activeRoute == 'archive' %}active{% endif %}">
<li class="bold {% if active_route == 'archive' %}active{% endif %}">
<a class="waves-effect" href="{{ path('archive') }}">{{ 'menu.left.archive'|trans }} <span class="numberItems grey-text">{{ count_entries('archive') }}</span></a>
</li>
<li class="bold {% if activeRoute == 'annotated' %}active{% endif %}">
<li class="bold {% if active_route == 'annotated' %}active{% endif %}">
<a class="waves-effect" href="{{ path('annotated') }}">{{ 'menu.left.with_annotations'|trans }} <span class="numberItems grey-text">{{ count_entries('annotated') }}</span></a>
</li>
<li class="bold {% if activeRoute == 'all' %}active{% endif %}">
<li class="bold {% if active_route == 'all' %}active{% endif %}">
<a class="waves-effect" href="{{ path('all') }}">{{ 'menu.left.all_articles'|trans }} <span class="numberItems grey-text">{{ count_entries('all') }}</span></a>
</li>
<li class="bold {% if currentRoute == 'tags' %}active{% endif %}">
<li class="bold {% if current_route == 'tags' %}active{% endif %}">
<a class="waves-effect" href="{{ path('tag') }}">{{ 'menu.left.tags'|trans }} <span class="numberItems grey-text">{{ count_tags() }}</span></a>
</li>
</ul>
@ -91,9 +91,9 @@
<i class="material-icons">search</i>
</a>
</li>
{% if activeRoute %}
{% if active_route %}
<li id="button_random">
<a class="waves-effect tooltipped js-random-action" data-position="bottom" data-delay="50" data-tooltip="{{ 'menu.top.random_entry'|trans }}" href="{{ path('random_entry', { 'type': activeRoute }) }}">
<a class="waves-effect tooltipped js-random-action" data-position="bottom" data-delay="50" data-tooltip="{{ 'menu.top.random_entry'|trans }}" href="{{ path('random_entry', {'type': active_route}) }}">
<i class="material-icons">casino</i>
</a>
</li>
@ -154,7 +154,7 @@
</ul>
</div>
{{ render(controller("WallabagCoreBundle:Entry:searchForm", {'currentRoute': currentRoute})) }}
{{ render(controller("WallabagCoreBundle:Entry:searchForm", {'currentRoute': current_route})) }}
{{ render(controller("WallabagCoreBundle:Entry:addEntryForm")) }}
</div>
</nav>

View file

@ -1,6 +1,6 @@
{% set redis = craue_setting('import_with_redis') %}
{% set rabbit = craue_setting('import_with_rabbitmq') %}
{% set downloadImages = craue_setting('download_images_enabled') %}
{% set download_images = craue_setting('download_images_enabled') %}
{% if redis or rabbit %}
<div class="card-panel yellow darken-1 black-text">
@ -8,7 +8,7 @@
</div>
{% endif %}
{% if not redis and not rabbit and downloadImages %}
{% if not redis and not rabbit and download_images %}
<div class="card-panel orange darken-1 black-text">
{{ 'import.worker.download_images_warning'|trans|raw }}
</div>

View file

@ -6,8 +6,8 @@
<div class="card-content">
<div class="row">
{% for flashMessage in app.session.flashbag.get("two_factor") %}
<p class="error">{{ flashMessage|trans }}</p>
{% for flash_message in app.session.flashbag.get("two_factor") %}
<p class="error">{{ flash_message|trans }}</p>
{% endfor %}
{# Authentication errors #}