[TikiWiki-commits] [Git][tikiwiki/tiki][master] [ENH][FIX] Tracker items list: make it optional to choose fields to display...
"Adrien Mbuya Maloba \(@adrienmaloba\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <68c582efdafa2_2cbe8a98821e0@gitlab-sidekiq-low-urgency-cpu-bound-v2-669574cd86-l2h4h.mail> |
Adrien Mbuya Maloba pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
5347bc3d by Marcellin Wabo at 2025-09-13T17:35:05+03:00
[ENH][FIX] Tracker items list: make it optional to choose fields to display and fix "using inexistant user pref for new trackers"
---
* Fix: avoid to apply non existing prefs
* [ENH] Tracker items list: make it optional to choose fields to display
See merge request tikiwiki/tiki!8365
- - - - -
3 changed files:
- lib/trackers/trackerlib.php
- templates/tiki-view_tracker.tpl
- templates/tracker/replace.tpl
Changes:
=====================================
lib/trackers/trackerlib.php
=====================================
@@ -7080,6 +7080,7 @@ class TrackerLib extends TikiLib
'notifyOn' => $input->notifyOn->word() ? $input->notifyOn->word() : 'both',
'relationshipBehaviour' => $input->relationshipBehaviour->text(),
'allowInlineEditing' => $input->allowInlineEditing->int() ? 'y' : 'n',
+ 'allowChooseFieldsToDisplay' => $input->allowChooseFieldsToDisplay->int() ? 'y' : 'n',
];
}
}
=====================================
templates/tiki-view_tracker.tpl
=====================================
@@ -148,32 +148,35 @@
{if $items|@count ge '1'}
{* ------- list toggleable fields --- *}
- {if $trk_items_col_pref neq ''}
- <textarea id="savedcolpref" class="d-none">{$trk_items_col_pref}</textarea>
- {/if}
- <form id="savecolprefsform" method="post" action="{service controller=user action=save_column_prefs}">
- {ticket}
- <div class="mb-3">
- <div class="toggle-col-warning d-none">
- {remarksbox type="danger" title="{tr}Warning{/tr}" close="y"}
- {tr}{"At least one column must remain visible."}{/tr}
- {/remarksbox}
+
+ {if $tracker_info.allowChooseFieldsToDisplay eq 'y'}
+ {if $trk_items_col_pref neq ''}
+ <textarea id="savedcolpref" class="d-none">{$trk_items_col_pref}</textarea>
+ {/if}
+ <form id="savecolprefsform" method="post" action="{service controller=user action=save_column_prefs}">
+ {ticket}
+ <div class="mb-3">
+ <div class="toggle-col-warning d-none">
+ {remarksbox type="danger" title="{tr}Warning{/tr}" close="y"}
+ {tr}{"At least one column must remain visible."}{/tr}
+ {/remarksbox}
+ </div>
+ {foreach from=$listfields key=ix item=field_value}
+ {if $field_value.isTblVisible eq 'y' and ( $field_value.type ne 'x' and $field_value.type ne 'h') and ($field_value.type ne 'p' or $field_value.options_array[0] ne 'password') and $field_value.visibleInViewMode eq 'y'}
+ <div class="form-check form-check-inline">
+ <input type="checkbox" class="form-check-input toggle-col" data-col-name="{$field_value.name}" checked>
+ <label class="form-check-label">{$field_value.name|tra|truncate:255:"..."|escape|default:" "}</label>
+ </div>
+ {/if}
+ {/foreach}
</div>
- {foreach from=$listfields key=ix item=field_value}
- {if $field_value.isTblVisible eq 'y' and ( $field_value.type ne 'x' and $field_value.type ne 'h') and ($field_value.type ne 'p' or $field_value.options_array[0] ne 'password') and $field_value.visibleInViewMode eq 'y'}
- <div class="form-check form-check-inline">
- <input type="checkbox" class="form-check-input toggle-col" data-col-name="{$field_value.name}" checked>
- <label class="form-check-label">{$field_value.name|tra|truncate:255:"..."|escape|default:" "}</label>
- </div>
- {/if}
- {/foreach}
- </div>
- <div class="mb-3">
- <textarea name="prefs" id="prefs" class="d-none"></textarea>
- <input name="trackerId" type="hidden" id="col_pref_trackerid" value="{$trackerId}">
- <input name="trackerName" type="hidden" value="{tr}{$tracker_info.name}{/tr}">
- </div>
- </form>
+ <div class="mb-3">
+ <textarea name="prefs" id="prefs" class="d-none"></textarea>
+ <input name="trackerId" type="hidden" id="col_pref_trackerid" value="{$trackerId}">
+ <input name="trackerName" type="hidden" value="{tr}{$tracker_info.name}{/tr}">
+ </div>
+ </form>
+ {/if}
{* ------- list headings --- *}
<form name="checkform" method="post">
{ticket}
@@ -407,6 +410,9 @@
if (savedPrefs) {
let prefs = JSON.parse(savedPrefs);
const actual_tracker_prefs = prefs[colprefkey];
+ if (! actual_tracker_prefs) {
+ return;
+ }
Object.keys(actual_tracker_prefs).forEach(function (columnName) {
const checkbox = $('.toggle-col[data-col-name="' + columnName +'"]');
checkbox.prop('checked', actual_tracker_prefs[columnName]);
=====================================
templates/tracker/replace.tpl
=====================================
@@ -242,6 +242,13 @@
<label for="showPopup">{tr}List detail popup{/tr}</label>
{object_selector_multi type=trackerfield tracker_id=$info.trackerId _simplevalue=$info.showPopup _separator="," _simplename="showPopup"}
</div>
+ <div class="form-check">
+ <input type="checkbox" class="form-check-input" name="allowChooseFieldsToDisplay" value="1"
+ {if $info.allowChooseFieldsToDisplay eq 'y'} checked="checked"{/if}>
+ <label class="form-check-label" for="allowChooseFieldsToDisplay">
+ {tr}Allow user to choose fields to display{/tr}
+ </label>
+ </div>
{/accordion_group}
{accordion_group title="{tr}Section Format{/tr}"}
<div class="mb-3 mx-0">
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5347bc3de886cf548daf2c04d33493f749748502
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5347bc3de886cf548daf2c04d33493f749748502
You're receiving this email because of your account on gitlab.com.
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs