Skip to content

Commit

Permalink
Modifs #4869 (problèmes affichage organisations)
Browse files Browse the repository at this point in the history
  • Loading branch information
Barbara ROMEO committed Mar 16, 2018
1 parent 9bea580 commit 21e47eb
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 12 deletions.
12 changes: 12 additions & 0 deletions ckanext/idgotheme/fanstatic/css/idgo_theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -6581,6 +6581,18 @@ li.media-item {
border-color: #afafaf;
}

/* Error messages */
.error_message .fa-chevron-right {
color: #02297f;
}
.error_message h1 {
color: #02297f;
}
.error_message span {
font-size: 16px;
}



/******************************************************************************************************
>>> FOOTER
Expand Down
52 changes: 43 additions & 9 deletions ckanext/idgotheme/fanstatic/js/sort_data.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,45 @@
$('.primary').on('click', '#affich-mode button', function () {
var selected_value = $(this).attr('data-affich');
$('.media-grid').removeClass('affich-grille affich-liste');
if (selected_value === 'grille') {
$('.media-grid').addClass('affich-grille');
} else if (selected_value === 'liste') {
$('.media-grid').addClass('affich-liste');
var var_display;

function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
$('#affich-mode button').removeClass('active');
$(this).addClass('active');
};

$(document).ready(function() {
var_display = getUrlParameter('view_mode');
if (var_display) {
$('.media-grid').removeClass('affich-grille affich-liste');
if (var_display === 'grid') {
$('.media-grid').addClass('affich-grille');
} else if (var_display === 'list') {
$('.media-grid').addClass('affich-liste');
}
$('#affich-mode button').removeClass('active');
$('#affich-mode button[data-affich='+var_display+']').addClass('active');
}
});

$('.primary').on('click', '#affich-mode button', function () {
var selected_value = $(this).attr('data-affich');
var newUrl;
// Update URL
if (var_display) {
newUrl = location.href.replace("view_mode="+var_display, "view_mode="+selected_value);
} else {
if (window.location.search) {
newUrl = window.location.href + '&view_mode=' + selected_value;
} else {
newUrl = window.location.href + '?view_mode=' + selected_value;
}
}
// Reload page with new URL
window.location.href = newUrl;
});
40 changes: 40 additions & 0 deletions ckanext/idgotheme/templates/error_document_template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{% extends "page.html" %}

{% block subtitle %}{{ gettext('Error %(error_code)s', error_code=c.code[0]) }}{% endblock %}

{% block primary %}
<article class="module">
<div class="module-content">
{% set error_code = c.code[0] %}
<div class="error_message">
<h1>
Erreur {{ error_code }} <i class="fa fa-exclamation" aria-hidden="true"></i>
</h1>
<i class="fa fa-chevron-right" aria-hidden="true"></i>
<span>
{% if error_code == '400' %}
La syntaxe de la requête est incorrecte.
{% elif error_code == '401' or error_code == '403' %}
Vous n'êtes pas autorisé à acceder à cette page.
{% elif error_code == '404' %}
La ressource demandée est introuvable.
{% elif error_code == '500' %}
Une erreur interne est survenue.
{% else %}
Une erreur s'est produite.
{% endif %}
</span>
<div>
</div>
</article>
{% endblock %}

{% block breadcrumb %}
{% endblock %}

{% block flash %}
{# eat the flash messages caused by the 404 #}
{% set flash_messages = h.flash.pop_messages() %}
{% endblock %}

{% block secondary %}{% endblock %}
6 changes: 3 additions & 3 deletions ckanext/idgotheme/templates/organization/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ <h1 class="hide-heading">{% block page_heading %}{{ _('Organizations') }}{% endb
{% block organizations_search_form %}
{% snippet 'snippets/search_form.html', form_id='organization-search-form', type='organization', query=c.q, sorting_selected=c.sort_by_selected, count=c.page.item_count, placeholder=_('Search organizations...'), show_empty=request.params, no_bottom_border=true if c.page.items, sorting = [(_('Name Ascending'), 'title asc'), (_('Name Descending'), 'title desc')] %}
<div id="affich-mode">
<button data-affich="grille" class="active"><i class="fa fa-th" aria-hidden="true"></i></button>
<button data-affich="liste"><i class="fa fa-bars" aria-hidden="true"></i></button>
<button data-affich="grid" class="active"><i class="fa fa-th" aria-hidden="true"></i></button>
<button data-affich="list"><i class="fa fa-bars" aria-hidden="true"></i></button>
</div>
{% endblock %}
{% block organizations_list %}
Expand All @@ -35,7 +35,7 @@ <h1 class="hide-heading">{% block page_heading %}{{ _('Organizations') }}{% endb
{% endif %}
{% endblock %}
{% block page_pagination %}
{{ c.page.pager(q=c.q or '', sort=c.sort_by_selected or '') }}
{{ c.page.pager(q=c.q or '', sort=c.sort_by_selected or '', view_mode=c.view_mode or 'grid') }}
{% endblock %}
{% endblock %}
</div>
Expand Down

0 comments on commit 21e47eb

Please sign in to comment.