[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX][UX] Admin: Hide empty fieldset when experimental prefs are filtered out...
"luci \(@luciash\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6a1a1128c22d7_38193b88968f5@gitlab-sidekiq-low-urgency-cpu-bound-v2-985c55b68-j2zs4.mail> |
luci pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
d5c0147f by Landry Bitege at 2026-05-29T22:02:13+00:00
[FIX][UX] Admin: Hide empty fieldset when experimental prefs are filtered out...
---
* [FIX][UX] Admin: Hide empty fieldset when experimental prefs are filtered out and fix tag badges toggle
See merge request tikiwiki/tiki!10395
- - - - -
4 changed files:
- lib/jquery_tiki/tiki-admin.js
- lib/prefs/markdown.php
- lib/smarty_tiki/FunctionHandler/Preference.php
- templates/prefs/shared.tpl
Changes:
=====================================
lib/jquery_tiki/tiki-admin.js
=====================================
@@ -439,17 +439,41 @@
prefs.parents("fieldset:not(.tabcontent)").hide();
prefs.closest("fieldset.tabcontent").removeClass("filled");
$(".preffilter").each(function () {
- var targets = $(".adminoptionbox.preference." + $(this).val() + ",.admbox." + $(this).val());
if ($(this).is(":checked")) {
filters.push($(this).val());
- show(targets);
- } else if ($(this).is(".negative:not(:checked)")) {
- hide(targets);
+ show($(".adminoptionbox.preference." + $(this).val() + ",.admbox." + $(this).val()));
}
});
show($(".adminoptionbox.preference.modified"));
+ $(".preffilter").each(function () {
+ if ($(this).is(".negative:not(:checked)")) {
+ hide($(".adminoptionbox.preference." + $(this).val() + ":not(.always),.admbox." + $(this).val() + ":not(.always)"));
+ }
+ });
+
+ // Hide fieldsets that became empty after negative filters were applied
+ $(".tiki-admin fieldset:not(.tabcontent):visible").each(function () {
+ if ($(this).find(".adminoptionbox.preference:visible, .admbox:visible").length === 0) {
+ $(this).hide();
+ }
+ });
+
+ // Hide tag badges (advanced/experimental) when their filter is actively selected
+ $(".preffilter").each(function () {
+ const tag = $(this).val();
+ if (tag !== "advanced" && tag !== "experimental") {
+ return;
+ }
+ const badges = $(".pref-tag-" + tag);
+ if ($(this).is(":checked")) {
+ badges.hide();
+ } else {
+ badges.show();
+ }
+ });
+
$('input[name="filters"]').val(filters.join(" "));
$(".tabset .tabmark a").each(function () {
const selector = "fieldset.tabcontent." + $(this).attr("href").substring(1);
=====================================
lib/prefs/markdown.php
=====================================
@@ -21,6 +21,7 @@ function prefs_markdown_list()
'description' => tra('Enable Github-flavored markdown.'),
'type' => 'flag',
'default' => 'y',
+ 'tags' => ['advanced', 'experimental'],
'dependencies' => [
'markdown_enabled',
],
@@ -34,6 +35,7 @@ function prefs_markdown_list()
'markdown' => tra('Markdown'),
],
'default' => 'tiki',
+ 'tags' => ['advanced', 'experimental'],
'dependencies' => [
'markdown_enabled',
],
@@ -45,6 +47,7 @@ function prefs_markdown_list()
'size' => 5,
'filter' => 'imgsize',
'default' => '300px',
+ 'tags' => ['advanced', 'experimental'],
'dependencies' => [
'markdown_enabled',
'feature_wysiwyg',
@@ -59,6 +62,7 @@ function prefs_markdown_list()
'tab' => tra('Tab'),
],
'default' => 'tab',
+ 'tags' => ['advanced', 'experimental'],
'dependencies' => [
'markdown_enabled',
'feature_wysiwyg',
@@ -73,6 +77,7 @@ function prefs_markdown_list()
'markdown' => tra('Markdown'),
],
'default' => 'wysiwyg',
+ 'tags' => ['advanced', 'experimental'],
'dependencies' => [
'markdown_enabled',
'feature_wysiwyg',
@@ -83,6 +88,7 @@ function prefs_markdown_list()
'description' => tra('Send hostname to Toast UI.'),
'type' => 'flag',
'default' => 'n',
+ 'tags' => ['advanced', 'experimental'],
'dependencies' => [
'markdown_enabled',
'feature_wysiwyg',
=====================================
lib/smarty_tiki/FunctionHandler/Preference.php
=====================================
@@ -55,6 +55,8 @@ class Preference extends Base
$info['params'] .= ' autocomplete="new-password" '; // by default preferences of type password should not be autocomplete
}
+ $template_visible_always = isset($params['visible']) && $params['visible'] == 'always';
+
if ($info['default'] !== $info['value']) {
$info['modified'] = true;
$params['visible'] = 'always';
@@ -64,6 +66,10 @@ class Preference extends Base
// Modified preferences are never hidden, so pretend it's modified when forcing display
$info['tags'][] = 'modified';
$info['tagstring'] .= ' modified';
+ if ($template_visible_always) {
+ // Template-forced always-visible: immune to negative filters (experimental, deprecated, etc.)
+ $info['tagstring'] .= ' always';
+ }
}
$pages_string = '';
=====================================
templates/prefs/shared.tpl
=====================================
@@ -25,13 +25,13 @@
{$p.pages}
-{if isset($pref_filters) and not $pref_filters.advanced.selected and in_array('advanced', $p.tags)}
- <span class="badge bg-warning tips" title=":{tr}Change your preference filter settings in order to view advanced preferences by default{/tr}">
+{if isset($pref_filters) and in_array('advanced', $p.tags)}
+ <span class="badge bg-warning tips pref-tag-badge pref-tag-advanced" title=":{tr}Change your preference filter settings in order to view advanced preferences by default{/tr}"{if $pref_filters.advanced.selected} style="display:none"{/if}>
{tr}advanced{/tr}
</span>
{/if}
-{if isset($pref_filters) and not $pref_filters.experimental.selected and in_array('experimental', $p.tags)}
- <span class="badge bg-danger tips" title=":{tr}Change your preference filter settings in order to view experimental preferences by default{/tr}">
+{if isset($pref_filters) and in_array('experimental', $p.tags)}
+ <span class="badge bg-danger tips pref-tag-badge pref-tag-experimental" title=":{tr}Change your preference filter settings in order to view experimental preferences by default{/tr}"{if $pref_filters.experimental.selected} style="display:none"{/if}>
{tr}experimental{/tr}
</span>
{/if}
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/d5c0147fdb051fcf8d259fa66fc3ce0cba9dd13f
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/d5c0147fdb051fcf8d259fa66fc3ce0cba9dd13f
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