[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] TrackerItem: Preview tab for text area field on trackeritem should be optional
Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <69ab3d0445f3b_3b1892c835460@gitlab-sidekiq-low-urgency-cpu-bound-v2-66fc7bd6c7-dbpzc.mail> |
Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
a89a4c46 by Grace Nshokano at 2026-03-06T20:38:05+00:00
[FIX] TrackerItem: Preview tab for text area field on trackeritem should be optional
---
* [FIX] Make tracker textarea preview tabs configurable per field
* [FIX] make textarea Preview tab optional via admin sub-setting
See merge request tikiwiki/tiki!9301
- - - - -
5 changed files:
- lib/core/Tracker/Field/TextArea.php
- lib/core/Tracker/Field/Wiki.php
- lib/prefs/ajax.php
- templates/trackerinput/textarea.tpl
- templates/trackerinput/wiki.tpl
Changes:
=====================================
lib/core/Tracker/Field/TextArea.php
=====================================
@@ -97,6 +97,17 @@ class Tracker_Field_TextArea extends Tracker_Field_Text
],
'legacy_index' => 7,
],
+ 'previewtabs' => [
+ 'name' => tr('Preview Tabs'),
+ 'description' => tr('Enable edit and preview tabs for this field.'),
+ 'default' => 'n',
+ 'filter' => 'alpha',
+ 'options' => [
+ 'n' => tr('No'),
+ 'y' => tr('Yes'),
+ ],
+ 'legacy_index' => 9,
+ ],
],
],
=====================================
lib/core/Tracker/Field/Wiki.php
=====================================
@@ -129,6 +129,16 @@ class Tracker_Field_Wiki extends Tracker_Field_Text implements \Tracker\Field\Ex
'y' => tr('Yes'),
],
],
+ 'previewtabs' => [
+ 'name' => tr('Preview Tabs'),
+ 'description' => tr('Enable edit and preview tabs for this field.'),
+ 'default' => 'n',
+ 'filter' => 'alpha',
+ 'options' => [
+ 'n' => tr('No'),
+ 'y' => tr('Yes'),
+ ],
+ ],
'actions' => [
'name' => tr('Action Buttons'),
'description' => tr('Display wiki page buttons when editing the item.'),
=====================================
lib/prefs/ajax.php
=====================================
@@ -34,8 +34,8 @@ function prefs_ajax_list()
'dependencies' => ['ajax_inline_edit'],
],
'ajax_edit_previews' => [
- 'name' => tr('Preview Edits in Text Areas'),
- 'description' => tr('Add a preview tab to text areas.'),
+ 'name' => tr('Preview Edit Tabs in Text Areas'),
+ 'description' => tr('Enable edit and preview tabs in supported text areas.'),
'type' => 'flag',
'default' => 'n',
],
=====================================
templates/trackerinput/textarea.tpl
=====================================
@@ -1,4 +1,10 @@
{strip}
+ {if $prefs.ajax_edit_previews eq 'y' and $field.options_map.previewtabs eq 'y'}
+ {assign var='tracker_previews' value='y'}
+ {else}
+ {assign var='tracker_previews' value='n'}
+ {/if}
+
{capture assign='charCount'}
{if $field.options_map.max}
<div class="charCount form-text">
@@ -28,11 +34,11 @@
<input type="text" id="{$data.element_id|escape}" name="{$field.ins_id}"{if $field.options_map.width > 0} size="{$field.options_map.width}"{/if}{if $field.options_map.max gt 0} maxlength="{$field.options_map.max}"{/if} value="{$field.value|escape}" onkeyup={$data.keyup} />
{else}
{if $field.options_map.wysiwyg == 'y'}
- {textarea _class='form-control' id=$data.element_id name=$field.ins_id rows=$data.rows _toolbars=$data.toolbar onkeyup=$data.keyup _wysiwyg='y' section='trackers' switcheditor='n' _preview=$prefs.ajax_edit_previews}
+ {textarea _class='form-control' id=$data.element_id name=$field.ins_id rows=$data.rows _toolbars=$data.toolbar onkeyup=$data.keyup _wysiwyg='y' section='trackers' switcheditor='n' _preview=$tracker_previews}
{$field.value}
{/textarea}
{else}
- {textarea _class='form-control' id=$data.element_id name=$field.ins_id _toolbars=$data.toolbar rows=$data.rows onkeyup=$data.keyup _wysiwyg='n' section="trackers" switcheditor='n' _preview=$prefs.ajax_edit_previews}
+ {textarea _class='form-control' id=$data.element_id name=$field.ins_id _toolbars=$data.toolbar rows=$data.rows onkeyup=$data.keyup _wysiwyg='n' section="trackers" switcheditor='n' _preview=$tracker_previews}
{$field.value}
{/textarea}
{/if}
@@ -43,7 +49,7 @@
{foreach name=lg from=$field.lingualvalue item=ling}
<label for="{$data.element_id|escape}_{$ling.lang}">{$ling.lang|langname}</label>
{if $field.options_map.wysiwyg == 'y'}
- {textarea _class='form-control' id="{$data.element_id}_{$ling.lang}" name="{$field.ins_id}[{$ling.lang}]" rows=$data.rows onkeyup=$data.keyup _wysiwyg='y' cols="{if $field.options_map.width gt 1}{$field.options_map.width}{else}50{/if}" section="trackers" switcheditor='n' _preview=$prefs.ajax_edit_previews}
+ {textarea _class='form-control' id="{$data.element_id}_{$ling.lang}" name="{$field.ins_id}[{$ling.lang}]" rows=$data.rows onkeyup=$data.keyup _wysiwyg='y' cols="{if $field.options_map.width gt 1}{$field.options_map.width}{else}50{/if}" section="trackers" switcheditor='n' _preview=$tracker_previews}
{$ling.value}
{/textarea}
{else}
=====================================
templates/trackerinput/wiki.tpl
=====================================
@@ -1,10 +1,16 @@
{strip}
+ {if $prefs.ajax_edit_previews eq 'y' and $field.options_map.previewtabs eq 'y'}
+ {assign var='tracker_previews' value='y'}
+ {else}
+ {assign var='tracker_previews' value='n'}
+ {/if}
+
{if $field.options_map['wysiwyg'] eq 'y'}
- {textarea _class='form-control' id=$data.element_id name=$field.ins_id rows=$data.rows onkeyup=$data.keyup _wysiwyg='y' section="trackers" switcheditor='n' _preview=$prefs.ajax_edit_previews}
+ {textarea _class='form-control' id=$data.element_id name=$field.ins_id rows=$data.rows onkeyup=$data.keyup _wysiwyg='y' section="trackers" switcheditor='n' _preview=$tracker_previews}
{$field.page_data}
{/textarea}
{else}
- {textarea _class='form-control' id=$data.element_id name=$field.ins_id _toolbars=$data.toolbar _simple='y' rows=$data.rows onkeyup=$data.keyup _wysiwyg='n' section="trackers" switcheditor='n' _preview=$prefs.ajax_edit_previews}
+ {textarea _class='form-control' id=$data.element_id name=$field.ins_id _toolbars=$data.toolbar _simple='y' rows=$data.rows onkeyup=$data.keyup _wysiwyg='n' section="trackers" switcheditor='n' _preview=$tracker_previews}
{$field.page_data}
{/textarea}
{/if}
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/a89a4c466b1adbca53bc8acbb0e5f5958438860a
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/a89a4c466b1adbca53bc8acbb0e5f5958438860a
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