Show chore description on chorecard (closes #1759)

This commit is contained in:
Bernd Bestel
2022-01-23 20:02:16 +01:00
parent cf52e5ec96
commit fa3e705673
3 changed files with 10 additions and 0 deletions

View File

@@ -202,3 +202,8 @@ function CleanFileName(fileName)
// Umlaute seem to cause problems on Linux...
return fileName.toLowerCase().replaceAll(/ä/g, 'ae').replaceAll(/ö/g, 'oe').replaceAll(/ü/g, 'ue').replaceAll(/ß/g, 'ss');
}
function nl2br(s)
{
return s.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, "$1<br>$2");
}

View File

@@ -6,6 +6,7 @@ Grocy.Components.ChoreCard.Refresh = function(choreId)
function(choreDetails)
{
$('#chorecard-chore-name').text(choreDetails.chore.name);
$('#chorecard-chore-description').html(nl2br(choreDetails.chore.description));
$('#chorecard-chore-last-tracked').text((choreDetails.last_tracked || __t('never')));
$('#chorecard-chore-last-tracked-timeago').attr("datetime", choreDetails.last_tracked || '');
$('#chorecard-chore-tracked-count').text((choreDetails.tracked_count || '0'));

View File

@@ -22,6 +22,10 @@
</div>
<div class="card-body">
<h3><span id="chorecard-chore-name"></span></h3>
<p id="chorecard-chore-description"
class="text-muted mt-0"></p>
<strong>{{ $__t('Tracked count') }}:</strong> <span id="chorecard-chore-tracked-count"
class="locale-number locale-number-generic"></span><br>
<strong>{{ $__t('Last tracked') }}:</strong> <span id="chorecard-chore-last-tracked"></span> <time id="chorecard-chore-last-tracked-timeago"