?
avatar rogercreagh
rogercreagh
12 Nov 2018

Steps to reproduce the issue

Feature request
It is good to have at least the first few dozen characters of the tag descriptions shown in the admin tags list so you can see which tags are missing one or might need updating.
You can't quite achieve this with a template override of /administrator/components/com_tags/views/tags/tmpl/default.php because the description is not included in the model.
Thus a simple addition is needed to /administrator/components/com_tags/models/tags.php
in protected function getListQuery() somewhere around line 140 amend

	$this->getState(
		'list.select',
		'a.id, a.title, a.alias, a.note, a.published, a.access' .
			', a.checked_out, a.checked_out_time, a.created_user_id' .
			', a.path, a.parent_id, a.level, a.lft, a.rgt' .
			', a.language, a.description'
	)

adding , a.description to the select

Expected result

A template override can add a column for description using $item->description; and implement any length limitation and display stuff required.

Actual result

It throws errors (quite correctly) if you try to access $item->description;

System information (as much as possible)

j 3.9
macosx10.13.6 serving through MAMP
chrome browser

Additional comments

Actually if doing this you might as well implement the column in the view default.php
Personally I either restrict the length displayed to 100 chars and strip tags, or if I have a very long description I will break it into two parts with an <hr> (would be better as a [readmore] but by default the readmore button is only available in article editing) and only display the text up to the <hr> in list views (front and back ends) and use the full description when displaying the tag on its own.
Thus in /administrator/components/com_tags/views/tags/tmpl/default.php I have inserted a <th>...</th> in the relevant place and use

<td class="hidden-phone"><span class="small">
	<?php $text = $item->description;
          $brkpos = strpos($text,'<hr />');
          if ($brkpos) {
              $text = substr($text,0, $brkpos);
              echo strip_tags($text).' [more]';
          } else {
              echo JHtml::_('string.truncate', strip_tags($text), 100); //100 is my choice - could be a param
          }
      ?>
</span></td>

to display the description preview.
In the front end I don't strip the tags, but that's another story.

avatar rogercreagh rogercreagh - open - 12 Nov 2018
avatar joomla-cms-bot joomla-cms-bot - labeled - 12 Nov 2018
avatar mbabker
mbabker - comment - 12 Nov 2018

If someone wants to submit a pull request adding the description to the query, that should get through without too much hassle.

But, I'd suggest that having descriptions on the list view is probably far too opinionated for core and better left to a template override.

avatar rogercreagh
rogercreagh - comment - 12 Nov 2018

I agree, all that is needed in the core is to add description to the query. Template overrides work fine for the view.

Being new to github I have no idea at all how this works or how to "submit a pull request". Been a lone wolf for too long, so will leave the suggestion for someone who knows how to do it. I'd be most grateful if someone could pick it up.
Thank you
RogerCO

avatar mbabker
mbabker - comment - 12 Nov 2018
avatar PhilETaylor
PhilETaylor - comment - 12 Nov 2018

Please see #23057

avatar Quy Quy - change - 12 Nov 2018
Status New Closed
Closed_Date 0000-00-00 00:00:00 2018-11-12 21:50:48
Closed_By Quy
avatar joomla-cms-bot joomla-cms-bot - change - 12 Nov 2018
Closed_By Quy joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 12 Nov 2018
avatar joomla-cms-bot
joomla-cms-bot - comment - 12 Nov 2018

Set to "closed" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/23056

Add a Comment

Login with GitHub to post a comment