Skip to content

Commit

Permalink
fixes #722, #723 by passing vocab to twig template and adding an init…
Browse files Browse the repository at this point in the history
…ializing ajax query on vocabulary concept error page
  • Loading branch information
kouralex committed Jul 14, 2020
1 parent 4ab7ba3 commit 583b950
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions controller/WebController.php
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ public function invokeGenericErrorPage($request, $message = null)
array(
'languages' => $this->languages,
'request' => $request,
'vocab' => $request->getVocab(),
'message' => $message,
'requested_page' => filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_STRING),
));
Expand Down
2 changes: 1 addition & 1 deletion resource/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ li.sub-group {
right: 0;
}

.page-alert > h3 {
.frontpage-alert > h3, .page-alert > h3 {
margin: 10px 0px;
}

Expand Down
4 changes: 2 additions & 2 deletions resource/js/docready.js
Original file line number Diff line number Diff line change
Expand Up @@ -1042,9 +1042,9 @@ $(function() { // DOCUMENT READY
}

/* makes an AJAX query for the alphabetical index contents when landing on
* the vocabulary home page.
* the vocabulary home page or on the vocabulary concept error page.
*/
if ($('#alpha').hasClass('active') && $('#vocab-info').length === 1 && $('.alphabetical-search-results').length === 0) {
if ($('#alpha').hasClass('active') && $('#vocab-info,.page-alert').length == 1 && $('.alphabetical-search-results').length == 0) {
// taking into account the possibility that the lang parameter has been changed by the WebController.
var urlLangCorrected = vocab + '/' + lang + '/index?limit=250&offset=0&clang=' + clang;
$('.sidebar-grey').empty().append('<div class="loading-spinner"><span class="spinner-text">'+ loading_text + '</span><span class="spinner" /></div>');
Expand Down
7 changes: 7 additions & 0 deletions view/error-page.twig
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
{% extends "light.twig" %}
{% block title %}: Error page{% endblock %}
{% block error %}
{% spaceless %}
{% set pageError = request.vocabid != '' and request.page == 'page' %}
{% if pageError %}
<div id="maincontent">
<div class="content">
{% endif %}
<div class="alert {% if request.vocabid != '' or request.page == 'feedback' or request.page == 'about' %}page-alert{% else %}frontpage-alert{% endif %}">
<h3>{% if not message %}{% trans %}404 Error: The page {{ requested_page }} cannot be found.{% endtrans %}{% else %}{{ message }}{% endif %}</h3>
</div>
{% if pageError %}
</div>
</div>
{% endif %}
{% endspaceless %}
{% endblock %}

0 comments on commit 583b950

Please sign in to comment.