Skip to content

Commit

Permalink
[5.2] Admin Module Latest (#43216)
Browse files Browse the repository at this point in the history
* [5.2] Admin Module Latest

The admin module Articles - Latest displays a list of recently added content. This is really useful on the dashboards. (especially when used together with the author filter)

The list can be sorted by created or modified date but it will only ever display the created date.

This PR changes the date column to display created or modified depending on the sort param.

* blank
  • Loading branch information
brianteeman committed Apr 30, 2024
1 parent 775cae6 commit d8650b4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions administrator/language/en-GB/mod_latest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ MOD_LATEST_FIELD_VALUE_AUTHORS_BY_ME="Added or modified by me"
MOD_LATEST_FIELD_VALUE_AUTHORS_NOT_BY_ME="Not added or modified by me"
MOD_LATEST_FIELD_VALUE_ORDERING_ADDED="Recently Added First"
MOD_LATEST_FIELD_VALUE_ORDERING_MODIFIED="Recently Modified First"
MOD_LATEST_HEADING_DATE_CREATED="Date Created"
MOD_LATEST_HEADING_DATE_MODIFIED="Date Modified"
MOD_LATEST_LATEST_ITEMS="Latest Items"
MOD_LATEST_NO_MATCHING_RESULTS="No Matching Results"
MOD_LATEST_TITLE="Recently Created Articles"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static function getList(Registry $params, ArticlesModel $model)
$user = Factory::getUser();

// Set List SELECT
$model->setState('list.select', 'a.id, a.title, a.checked_out, a.checked_out_time, ' .
$model->setState('list.select', 'a.id, a.title, a.checked_out, a.checked_out_time, a.modified,' .
' a.access, a.created, a.created_by, a.created_by_alias, a.featured, a.state, a.publish_up, a.publish_down');

// Set Ordering filter
Expand Down
6 changes: 4 additions & 2 deletions administrator/modules/mod_latest/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
<th scope="col" class="w-20"><?php echo Text::_('JSTAGE'); ?></th>
<?php endif; ?>
<th scope="col" class="w-20"><?php echo Text::_('JAUTHOR'); ?></th>
<th scope="col" class="w-20"><?php echo Text::_('JDATE'); ?></th>
<th scope="col" class="w-20">
<?php echo ($params->get('ordering', 'c_dsc') == 'm_dsc') ? Text::_('MOD_LATEST_HEADING_DATE_MODIFIED') : Text::_('MOD_LATEST_HEADING_DATE_CREATED'); ?>
</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -53,7 +55,7 @@
<?php echo $item->author_name; ?>
</td>
<td>
<?php echo HTMLHelper::_('date', $item->created, Text::_('DATE_FORMAT_LC4')); ?>
<?php echo ($params->get('ordering', 'c_dsc') == 'm_dsc') ? HTMLHelper::_('date', $item->modified, Text::_('DATE_FORMAT_LC4')) : HTMLHelper::_('date', $item->created, Text::_('DATE_FORMAT_LC4')); ?>
</td>
</tr>
<?php endforeach; ?>
Expand Down

0 comments on commit d8650b4

Please sign in to comment.