From 6816d759339243f2c416483bf1684a980f1e0199 Mon Sep 17 00:00:00 2001 From: Will Miao Date: Fri, 19 Jun 2026 22:41:50 +0800 Subject: [PATCH] refactor(recipes): unify controls and breadcrumb UI with model pages - Replace inline controls+breadcrumb in recipes.html with shared includes - Add page_id conditionals in controls.html to adapt buttons per page type - Unify customFilterText selector to class-based in recipes.js - Add [data-action="find-duplicates"] event listener for unified button - Fix i18n keys to use recipes-specific translations on recipes page --- static/js/recipes.js | 10 +++- templates/components/controls.html | 34 ++++++++++-- templates/recipes.html | 88 +----------------------------- 3 files changed, 39 insertions(+), 93 deletions(-) diff --git a/static/js/recipes.js b/static/js/recipes.js index 67a5a43c..73accc93 100644 --- a/static/js/recipes.js +++ b/static/js/recipes.js @@ -149,9 +149,10 @@ class RecipeManager { _showCustomFilterIndicator() { const indicator = document.getElementById('customFilterIndicator'); - const textElement = document.getElementById('customFilterText'); + if (!indicator) return; + const textElement = indicator.querySelector('.customFilterText'); - if (!indicator || !textElement) return; + if (!textElement) return; // Update text based on filter type let filterText = ''; @@ -250,6 +251,11 @@ class RecipeManager { bulkButton.addEventListener('click', () => window.bulkManager?.toggleBulkMode()); } + const duplicatesButton = document.querySelector('[data-action="find-duplicates"]'); + if (duplicatesButton) { + duplicatesButton.addEventListener('click', () => this.findDuplicateRecipes()); + } + const favoriteFilterBtn = document.getElementById('favoriteFilterBtn'); if (favoriteFilterBtn) { favoriteFilterBtn.addEventListener('click', () => { diff --git a/templates/components/controls.html b/templates/components/controls.html index 8b9b98ca..fb22f016 100644 --- a/templates/components/controls.html +++ b/templates/components/controls.html @@ -1,4 +1,5 @@
+ {% if page_id != 'recipes' %}