[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Relation field: Make only specified portion clickable
"luci \(@luciash\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6a96d7ee13af_3818e7a0399aa@gitlab-sidekiq-low-urgency-cpu-bound-v2-58d48c47b5-mflqg.mail> |
luci pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
2ba7f061 by Moïse Nturubika at 2026-09-01T13:32:29+00:00
[FIX] Relation field: Make only specified portion clickable
---
* [FIX] Relation field: Make only specified portion clickable
See merge request tikiwiki/tiki!8915
- - - - -
3 changed files:
- lib/smarty_tiki/FunctionHandler/ObjectLink.php
- templates/trackeroutput/relation.tpl
- themes/base_files/scss/_tiki-trackers.scss
Changes:
=====================================
lib/smarty_tiki/FunctionHandler/ObjectLink.php
=====================================
@@ -119,7 +119,8 @@ class ObjectLink extends Base implements TikiSmartyExtensionInterface
global $base_url;
if (empty($title)) {
- $title = \TikiLib::lib('object')->get_title($type, $object, empty($params['format']) ? null : $params['format'], $params['metaItemId'] ?? null);
+ $displayFormat = $params['display_format'] ?? $params['format'] ?? null;
+ $title = \TikiLib::lib('object')->get_title($type, $object, $displayFormat, $params['metaItemId'] ?? null);
}
if (empty($title) && ! empty($params['backuptitle'])) {
@@ -138,7 +139,9 @@ class ObjectLink extends Base implements TikiSmartyExtensionInterface
$text = \TikiLib::lib('wiki')->get_without_namespace($title);
}
- $escapedText = \SmartyTiki\Modifier\Escape::apply($text ? $text : tra('No title specified'), 'html', 'UTF-8', false);
+ $escapedText = ! empty($params['rawHtml'])
+ ? ($text !== '' ? $text : tra('No title specified'))
+ : \SmartyTiki\Modifier\Escape::apply($text ? $text : tra('No title specified'), 'html', 'UTF-8', false);
if ($url) {
$escapedHref = \SmartyTiki\Modifier\Escape::apply(\TikiLib::tikiUrlOpt($url));
@@ -256,10 +259,39 @@ class ObjectLink extends Base implements TikiSmartyExtensionInterface
\TikiLib::lib('access')->is_serializable_request()
)
) {
+ $format = $params['format'] ?? null;
+ if ($format && $format !== '{title}') {
+ $fullTitle = (string) \TikiLib::lib('object')->get_title($type, $object, $format, $params['metaItemId'] ?? null);
+ $linkTitle = (string) \TikiLib::lib('object')->get_title($type, $object, '{title}', $params['metaItemId'] ?? null);
+
+ if ($linkTitle !== '' && ($pos = mb_strpos($fullTitle, $linkTitle)) !== false) {
+ // Keep the whole line as a single clickable link, with the title
+ // portion bolded inside it for visual distinction (rather than the
+ // rest of the line being plain, non-clickable text).
+ $before = mb_substr($fullTitle, 0, $pos);
+ $after = mb_substr($fullTitle, $pos + mb_strlen($linkTitle));
+ $innerHtml = \SmartyTiki\Modifier\Escape::apply($before)
+ . '<strong>' . \SmartyTiki\Modifier\Escape::apply($linkTitle) . '</strong>'
+ . \SmartyTiki\Modifier\Escape::apply($after);
+ return $pre . $this->smartyFunctionObjectLinkDefault($template, $object, $innerHtml, $type, $url, $params + ['rawHtml' => true]);
+ } elseif ($fullTitle !== '') {
+ // No distinct title to bold (ex: item's main field is blank) but there's
+ // still other formatted content to show — link the whole thing plain,
+ // same as an item that never had a custom format.
+ return $pre . $this->smartyFunctionObjectLinkDefault($template, $object, $fullTitle, $type, $url, $params);
+ } else {
+ // Nothing at all resolved for this format (ex: item has no data yet).
+ // Same idea as the freetag case above: quietly show what we have (the
+ // status icon, if any) rather than a "No title specified" placeholder.
+ return rtrim($pre);
+ }
+ }
return $pre . $this->smartyFunctionObjectLinkDefault($template, $object, $title, $type, $url, $params);
} else {
+ // Handle display_format for non-viewable items
+ $displayFormat = $params['display_format'] ?? $params['format'] ?? null;
if (empty($title)) {
- $title = \TikiLib::lib('object')->get_title($type, $object, empty($params['format']) ? null : $params['format'], $params['metaItemId'] ?? null);
+ $title = \TikiLib::lib('object')->get_title($type, $object, $displayFormat, $params['metaItemId'] ?? null);
}
return $pre . \SmartyTiki\Modifier\Escape::apply($title);
=====================================
templates/trackeroutput/relation.tpl
=====================================
@@ -8,7 +8,7 @@
{/if}
<ul class="relation-list">
{foreach from=$data.relations item=rel}
- <li>{object_link identifier=[$rel.target.type,$rel.target.itemId]|join:':' format=$data.format metaItemId=$rel->getMetadataItemId() target='_blank'}</li>
+ <li>{object_link identifier=[$rel.target.type,$rel.target.itemId]|join:':' format=$data.format metaItemId=$rel->getMetadataItemId() target=$data.linkTarget}</li>
{/foreach}
</ul>
</div>
=====================================
themes/base_files/scss/_tiki-trackers.scss
=====================================
@@ -221,6 +221,7 @@
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
+ line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
max-width: 300px;
@@ -315,6 +316,51 @@
}
}
+/* Relation field list styling (MR !8915) */
+.relation-list {
+ padding-left: 1.25rem;
+ list-style-type: disc;
+ list-style-position: outside;
+ margin-top: 0.25rem;
+ margin-bottom: 0.5rem;
+
+ li {
+ /* Larger inter-item spacing vs. line-height — makes each item visually distinct */
+ margin-bottom: 0.65rem;
+ line-height: 1.45;
+ color: var(--bs-body-color);
+ padding-left: 0.1rem;
+
+ &::marker {
+ /* Faded bullet using opacity so themes can override via color variable */
+ color: var(--bs-secondary-color, #6c757d);
+ font-size: 0.7em;
+ opacity: 0.6;
+ }
+
+ a {
+ font-weight: 400;
+ color: var(--bs-link-color, var(--bs-primary));
+ text-decoration: none;
+
+ strong {
+ font-weight: 600;
+ }
+
+ &:hover {
+ text-decoration: underline;
+ }
+ }
+
+ /* Pure CSS: suppress bullet when a status icon already acts as a visual marker */
+ &:has(.tiki-status-icon, .icon, i[class*="status"]) {
+ list-style-type: none;
+ padding-left: 0;
+ margin-left: -1.15rem; /* Keep text aligned with items that have bullets */
+ }
+ }
+}
+
el-select {
--tiki-input-placeholder-color: var(--bs-secondary-color, #6c757d) !important;
--el-text-color-placeholder: var(--bs-secondary-color, #6c757d) !important;
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/2ba7f061256afbe06579d48660911200157b354c
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/2ba7f061256afbe06579d48660911200157b354c
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