Rename all the attributes for navigation in list with basket

This commit is contained in:
acognet
2023-08-11 16:05:31 +02:00
parent 49cf6f5fe2
commit 0e76db8c93
33 changed files with 2763 additions and 2462 deletions

View File

@@ -0,0 +1,30 @@
{# @copyright Copyright (C) 2010-2021 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
<div id='{{ oUIBlock.GetId() }}'
class='{{ oUIBlock.GetBlocksInheritanceCSSClassesAsString() }} {{ oUIBlock.GetAdditionalCSSClassesAsString() }} {{ oUIBlock.GetCSSColorClass() }} {% if oUIBlock.IsHidden() %}ibo-is-hidden{% endif %} ibo-is-opened' data-role='ibo-basket'>
{% block ibobasket %}
<form id='ibo-form-basket' class='ibo-basket-form' method='post'>
<input type='hidden' name='basket_list_basket' value='{{ oUIBlock.GetList() }}'/>
<input type='hidden' name='basket_class' value='{{ oUIBlock.GetClass() }}'/>
<input type='hidden' name='basket_filter' value='{{ oUIBlock.GetFilter() }}'/>
<input type='hidden' name='basket_back_posted_fields' value='{{ oUIBlock.GetPostedFields()|raw }}'/>
<input type='hidden' name='basket_back_url' value='{{ oUIBlock.GetBackUrl()|raw }}'/>
<div class='ibo-form-basket--nav fas fa-angle-up' id='{{ oUIBlock.GetId() }}-back' data-tooltip-content='{{ 'UI:Basket:Back'|dict_s }}'></div>
{% if oUIBlock.HasPrec() %}
<div class='ibo-form-basket--nav fas fa-angle-double-left' id='{{ oUIBlock.GetId() }}-first' data-tooltip-content='{{ 'UI:Basket:First'|dict_s }}'></div>
<div class='ibo-form-basket--nav fas fa-angle-left' id='{{ oUIBlock.GetId() }}-prev' data-tooltip-content='{{ 'UI:Basket:Previous'|dict_s }}'></div>
{% else %}
&#160;&#160;&#160;
{% endif %}
<div class='ibo-form-basket--total'>{{ oUIBlock.GetIdx() }} /
<span id='{{ oUIBlock.GetId() }}-total' class='ibo-form-basket--total--link' data-tooltip-content='{{ 'UI:Basket:Back'|dict_s }}'>{{ oUIBlock.GetCount() }}</span>
</div>
{% if oUIBlock.HasNext() %}
<div class='ibo-form-basket--nav fas fa-angle-right' id='{{ oUIBlock.GetId() }}-next' data-tooltip-content='{{ 'UI:Basket:Next'|dict_s }}'></div>
<div class='ibo-form-basket--nav fas fa-angle-double-right' id='{{ oUIBlock.GetId() }}-last' data-tooltip-content='{{ 'UI:Basket:Last'|dict_s }}'></div>
{% else %}
&#160;&#160;&#160;
{% endif %}
</form>
{% endblock %}
</div>

View File

@@ -0,0 +1,55 @@
{# @copyright Copyright (C) 2010-2021 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
function backToBasket() {
$('#ibo-form-basket').attr('action', '{{ oUIBlock.GetBackUrl() | raw }}');
$('#ibo-form-basket').attr('method', 'post');
$('#ibo-form-basket').find('[name=basket_filter]').val('');
if ('{{ oUIBlock.GetPostedFields() | raw }}' != '')
{
JSON.parse('{{ oUIBlock.GetPostedFields() | raw }}', (key, value) => {
$('#ibo-form-basket').append($('<input/>').attr({'type': 'hidden', 'name': key, 'value': value}));
});
}
$('#ibo-form-basket').submit();
}
$('#{{ oUIBlock.GetId() }}-back').on('click', function () {
backToBasket();
});
$('#{{ oUIBlock.GetId() }}-total').on('click', function () {
backToBasket();
});
$('#{{ oUIBlock.GetId() }}-first').on('click', function () {
$('#ibo-form-basket').attr('action', ' {{ oUIBlock.GetUrlFirst() | raw }} ');
$('#ibo-form-basket').submit();
});
$('#{{ oUIBlock.GetId() }}-prev').on('click', function () {
$('#ibo-form-basket').attr('action', ' {{ oUIBlock.GetUrlPrev()| raw }} ');
$('#ibo-form-basket').submit();
});
$('#{{ oUIBlock.GetId() }}-next').on('click', function () {
$('#ibo-form-basket').attr('action', ' {{ oUIBlock.GetUrlNext() | raw }} ');
$('#ibo-form-basket').submit();
});
$('#{{ oUIBlock.GetId() }}-last').on('click', function () {
$('#ibo-form-basket').attr('action', ' {{ oUIBlock.GetUrlLast() | raw }} ');
$('#ibo-form-basket').submit()
});
/*a first try but not the good solution to keep basket in edit mode */
$('.ibo-panel--toolbar a').each(function (idx, elt) {
var onclick = $(this).attr("onClick");
if (typeof onclick == 'undefined' && onclick == false)
{
$(this).on('click', function () {
$('#ibo-form-basket').attr('action', $this.attr('href'));
$('#ibo-form-basket').submit();
});
}
});

View File

@@ -2,6 +2,6 @@
{# @license http://opensource.org/licenses/AGPL-3.0 #}
$("form[id^='basket']").each(function () {
$(this).append($('<input/>')
.attr({'type': 'hidden', 'name': 'back_posted_fields', 'value': '{{ oUIBlock.GetPostedFieldsForBackUrl()|raw }}'})
.attr({'type': 'hidden', 'name': 'basket_back_posted_fields', 'value': '{{ oUIBlock.GetBasketPostedFieldsForBackUrl()|raw }}'})
);
});

View File

@@ -471,7 +471,7 @@ $('body').append($('<form/>')
.attr({'type': 'hidden', 'name': 'basket_class', 'value': "{{ oUIBlock.GetBasketClass()|raw }}"})
)
.append($('<input/>')
.attr({'type': 'hidden', 'name': 'back_url', 'value': window.location.href})
.attr({'type': 'hidden', 'name': 'basket_back_url', 'value': window.location.href})
)
);

View File

@@ -1,28 +0,0 @@
{# @copyright Copyright (C) 2010-2021 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
<div id='{{ oUIBlock.GetId() }}'
class='{{ oUIBlock.GetBlocksInheritanceCSSClassesAsString() }} {{ oUIBlock.GetAdditionalCSSClassesAsString() }} {{ oUIBlock.GetCSSColorClass() }} {% if oUIBlock.IsHidden() %}ibo-is-hidden{% endif %} ibo-is-opened' data-role='ibo-navigation'>
{% block iboNavigation %}
<form id='ibo-form-navigation' class='ibo-navigation-form' method='post'>
<input type='hidden' name='list_navigation' value='{{ oUIBlock.GetList() }}'/>
<input type='hidden' name='basket_class' value='{{ oUIBlock.GetBasketClass() }}'/>
<input type='hidden' name='basket_filter' value='{{ oUIBlock.GetBasketFilter() }}'/>
<input type='hidden' name='back_posted_fields' value='{{ oUIBlock.GetPostedFields()|raw }}'/>
<input type='hidden' name='back_url' value='{{ oUIBlock.GetBackUrl()|raw }}'/>
<div class='ibo-form-navigation--nav fas fa-angle-up' id='{{ oUIBlock.GetId() }}-back'></div>
{% if oUIBlock.HasPrec() %}
<div class='ibo-form-navigation--nav fas fa-angle-double-left' id='{{ oUIBlock.GetId() }}-first'></div>
<div class='ibo-form-navigation--nav fas fa-angle-left' id='{{ oUIBlock.GetId() }}-prev'></div>
{% else %}
&#160;&#160;&#160;
{% endif %}
<div class='ibo-form-navigation--total'>{{ oUIBlock.GetIdx() }} / {{ oUIBlock.GetCount() }}</div>
{% if oUIBlock.HasNext() %}
<div class='ibo-form-navigation--nav fas fa-angle-right' id='{{ oUIBlock.GetId() }}-next'></div>
<div class='ibo-form-navigation--nav fas fa-angle-double-right' id='{{ oUIBlock.GetId() }}-last'></div>
{% else %}
&#160;&#160;&#160;
{% endif %}
</form>
{% endblock %}
</div>

View File

@@ -1,37 +0,0 @@
{# @copyright Copyright (C) 2010-2021 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
$('#{{ oUIBlock.GetId() }}-back').on('click', function () {
$('#ibo-form-navigation').attr('action', '{{ oUIBlock.GetBackUrl() | raw }}');
$('#ibo-form-navigation').attr('method', 'post');
$('#ibo-form-navigation').find('[name=basket_filter]').val('');
if ('{{ oUIBlock.GetPostedFields() | raw }}' != '')
{
JSON.parse('{{ oUIBlock.GetPostedFields() | raw }}', (key, value) => {
$('#ibo-form-navigation').append($('<input/>').attr({'type': 'hidden', 'name': key, 'value': value}));
});
}
$('#ibo-form-navigation').submit();
});
$('#{{ oUIBlock.GetId() }}-first').on('click', function () {
$('#ibo-form-navigation').attr('action', ' {{ oUIBlock.GetUrlFirst() | raw }} ');
$('#ibo-form-navigation').submit();
});
$('#{{ oUIBlock.GetId() }}-prev').on('click', function () {
$('#ibo-form-navigation').attr('action', ' {{ oUIBlock.GetUrlPrev()| raw }} ');
$('#ibo-form-navigation').submit();
});
$('#{{ oUIBlock.GetId() }}-next').on('click', function() {
$('#ibo-form-navigation').attr('action', ' {{ oUIBlock.GetUrlNext() | raw}} ');
$('#ibo-form-navigation').submit();
});
$('#{{ oUIBlock.GetId() }}-last').on('click', function() {
$('#ibo-form-navigation').attr('action',' {{ oUIBlock.GetUrlLast() | raw}} ');
$('#ibo-form-navigation').submit()
});