Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions internal/web/public/js/weight.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ function setWeights(weights, wcolor, off, step) {
if (document.getElementById('weight-chart')) {
weightChart('weight-chart', dates, ws, wcolor, true);
}

// Grey out a paging button only when there's no further page that way:
// "Older" needs entries before the current window (start > 0); "Newer"
// needs a more-recent page (offset > 0).
var olderBtn = document.getElementById('weight-older-btn');
var newerBtn = document.getElementById('weight-newer-btn');
if (olderBtn) olderBtn.disabled = start <= 0;
if (newerBtn) newerBtn.disabled = offset <= 0;
}

// Render the log table for an already period-filtered weight set, resetting
Expand Down
8 changes: 4 additions & 4 deletions internal/web/templates/stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,12 @@
<tbody id="weightList"></tbody>
</table>
<div class="d-flex gap-2 px-3 pb-2 pt-2">
<button onclick='setWeights(filterWeightByPeriod(window._allWeight, currentPeriod), window._chartColor, 1, window._pageStep);'
class="btn btn-sm btn-outline-secondary rounded-3 flex-fill">
<button id="weight-older-btn" onclick='setWeights(filterWeightByPeriod(window._allWeight, currentPeriod), window._chartColor, 1, window._pageStep);'
class="btn btn-sm btn-outline-primary rounded-3 flex-fill">
<i class="bi bi-arrow-left"></i> Older
</button>
<button onclick='setWeights(filterWeightByPeriod(window._allWeight, currentPeriod), window._chartColor, -1, window._pageStep);'
class="btn btn-sm btn-outline-secondary rounded-3 flex-fill">
<button id="weight-newer-btn" onclick='setWeights(filterWeightByPeriod(window._allWeight, currentPeriod), window._chartColor, -1, window._pageStep);'
class="btn btn-sm btn-outline-primary rounded-3 flex-fill">
Newer <i class="bi bi-arrow-right"></i>
</button>
</div>
Expand Down
Loading