[TikiWiki-commits] [Git][tikiwiki/tiki][master] [ENH][UX] Search results: Make dynamic report links shareable, bookmarkable, etc.
"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6a0f160a70a05_39192670897f4@gitlab-sidekiq-low-urgency-cpu-bound-v2-686687cdf6-2gsrc.mail> |
Victor Emanouilov pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
96db9379 by Marcellin Wabo at 2026-05-21T14:07:39+00:00
[ENH][UX] Search results: Make dynamic report links shareable, bookmarkable, etc.
---
* [FIX] Make filter reset preserving contextual GET params
* [ENH][UX] Remove unrelated changes in bookmarkable reports features
* [ENH][UX] Use GET method to make tracker and search filters reports url bookmarkable
* Revert "[ENH][UX] Make dynamic report links shareable, bookmarkable, etc."
This reverts commit ad0ffbcf84472dba906b06185f0102b72626a11b.
* Revert "[ENH][UX] Bookmarkable, shareable report links: Avoid multiple submits"
This reverts commit 06246ae0e66695b3e67164df470ecd47bb03bb68.
* Bookmarkable, shareable report links: Avoid multiple submits
* [ENH][UX] Make dynamic report links shareable, bookmarkable, etc.
See merge request tikiwiki/tiki!8713
- - - - -
2 changed files:
- lib/core/Search/Formatter.php
- templates/search/list/filter.tpl
Changes:
=====================================
lib/core/Search/Formatter.php
=====================================
@@ -229,19 +229,19 @@ class Search_Formatter
}
$url = parse_url($_SERVER["REQUEST_URI"] ?? '', PHP_URL_PATH);
- $filters = [];
- foreach ($_GET as $key => $val) {
- if (! str_starts_with($key, 'tf_')) {
- $filters[$key] = $val;
+ $hiddenParams = [];
+ foreach ($_REQUEST as $key => $val) {
+ if (! str_starts_with($key, 'tf_') && $key !== 'filter' && $key !== 'reset_filter') {
+ $hiddenParams[$key] = $val;
}
}
- $url .= '?' . http_build_query($filters);
if ($fields) {
$smarty = TikiLib::lib('smarty');
$smarty->assign('filterFields', $fields);
$smarty->assign('filterCounter', $this->counter);
$smarty->assign('filterUrl', $url);
+ $smarty->assign('filterHiddenParams', $hiddenParams);
return '~np~' . $smarty->fetch('templates/search/list/filter.tpl') . '~/np~';
}
=====================================
templates/search/list/filter.tpl
=====================================
@@ -1,6 +1,15 @@
<a name="list_filter{$filterCounter}"></a>
<div class="list_filter" id="list_filter{$filterCounter}">
- <form action="{$filterUrl}#list_filter{$filterCounter}" method="post">
+ <form action="{$filterUrl}#list_filter{$filterCounter}" method="get" id="list_filter{$filterCounter}_form">
+ {foreach from=$filterHiddenParams key=k item=v}
+ {if is_array($v)}
+ {foreach from=$v key=vk item=vv}
+ <input type="hidden" name="{$k|escape}[{$vk|escape}]" value="{$vv|escape}">
+ {/foreach}
+ {else}
+ <input type="hidden" name="{$k|escape}" value="{$v|escape}">
+ {/if}
+ {/foreach}
<div class="row">
{foreach from=$filterFields item=field}
<div class="col-lg-6 col-12 mb-3">
@@ -27,14 +36,24 @@
<div class="row mb-3 justify-content-center">
<div class="col-auto">
<input class="button submit btn btn-primary" type="submit" name="filter" value="{tr}Filter{/tr}">
- <input class="button submit btn btn-primary" type="reset" name="reset_filter" value="{tr}Reset{/tr}">
+ <input class="button submit btn btn-secondary" type="button" name="reset_filter" value="{tr}Reset{/tr}" id="list_filter{$filterCounter}_reset">
</div>
</div>
</form>
</div>
{jq}
-$('#list_filter{{$filterCounter}} input[name=reset_filter]').off('click').on('click', function() {
- window.location.href = $(this).closest('form').attr('action').replace('#list_filter{{$filterCounter}}', '');
+$('#list_filter{{$filterCounter}}_reset').off('click').on('click', function() {
+ const $form = $('#list_filter{{$filterCounter}}_form');
+ $form.find(':input')
+ .not(':hidden, :submit, :button, :reset')
+ .each(function() {
+ if ($(this).is(':checkbox, :radio')) {
+ this.checked = false;
+ } else {
+ $(this).val('');
+ }
+ });
+ $form[0].submit();
});
{/jq}
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/96db937929bf4d809bf8f74b358ef33912cf8e59
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/96db937929bf4d809bf8f74b358ef33912cf8e59
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs