mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-21 08:12:26 +02:00
Rename all the attributes for navigation in list with basket
This commit is contained in:
30
templates/base/components/basket/layout.html.twig
Normal file
30
templates/base/components/basket/layout.html.twig
Normal 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 %}
|
||||
   
|
||||
{% 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 %}
|
||||
   
|
||||
{% endif %}
|
||||
</form>
|
||||
{% endblock %}
|
||||
</div>
|
||||
55
templates/base/components/basket/layout.js.twig
Normal file
55
templates/base/components/basket/layout.js.twig
Normal 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();
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -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 }}'})
|
||||
);
|
||||
});
|
||||
@@ -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})
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -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 %}
|
||||
   
|
||||
{% 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 %}
|
||||
   
|
||||
{% endif %}
|
||||
</form>
|
||||
{% endblock %}
|
||||
</div>
|
||||
@@ -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()
|
||||
});
|
||||
Reference in New Issue
Block a user