fix(frontend): 讓價格圖表按鈕直接開啟歷史走勢
All checks were successful
CD Pipeline / deploy (push) Successful in 1m44s

This commit is contained in:
OoO
2026-05-01 00:38:32 +08:00
parent 4945aeed3b
commit 22b27d19df
2 changed files with 10 additions and 1 deletions

View File

@@ -689,7 +689,15 @@
</div>
</td>
<td class="text-end">
<button class="dashboard-history-button" type="button" data-history-trigger aria-label="查看 {{ product.name|e }} 的歷史價格圖表">
<button
class="dashboard-history-button"
type="button"
data-history-trigger
data-product-id="{{ product.id }}"
data-product-name="{{ product.name|e }}"
onclick="event.stopPropagation(); showHistory(this.dataset.productId, this.dataset.productName);"
aria-label="查看 {{ product.name|e }} 的歷史價格圖表"
>
<span class="dashboard-price momo-mono">${{ item.record.price | int | number_format }}</span>
<i class="fas fa-chart-line" aria-hidden="true"></i>
</button>

View File

@@ -67,6 +67,7 @@ def test_dashboard_v2_restores_real_price_history_chart():
assert 'id="priceChart"' in dashboard
assert "data-product-id=\"{{ product.id }}\"" in dashboard
assert "data-history-trigger" in dashboard
assert "onclick=\"event.stopPropagation(); showHistory(this.dataset.productId, this.dataset.productName);\"" in dashboard
assert "fetch(`/api/history/${productId}`)" in dashboard
assert "priceChartInstance = new Chart" in dashboard
assert "目前沒有可顯示的歷史價格紀錄" in dashboard