Enhance LoRA and Recipe templates by adding request context to template rendering. Update JavaScript to initialize search managers with context-specific options and improve header navigation with dynamic search placeholders. Refactor header component for better context awareness in search functionality.

This commit is contained in:
Will Miao
2025-03-17 10:11:50 +08:00
parent b0a8b0cc6f
commit 1034282161
8 changed files with 631 additions and 37 deletions

View File

@@ -5,6 +5,7 @@ import { initializeCommonComponents } from './common.js';
import { ImportManager } from './managers/ImportManager.js';
import { RecipeCard } from './components/RecipeCard.js';
import { RecipeModal } from './components/RecipeModal.js';
import { SearchManager } from './managers/SearchManager.js';
class RecipeManager {
constructor() {
@@ -28,6 +29,21 @@ class RecipeManager {
// Load initial set of recipes
this.loadRecipes();
// Initialize search manager with Recipe-specific options
const recipeSearchManager = new SearchManager({
searchCallback: (query, options, recursive) => {
// Recipe-specific search implementation
fetchRecipes({
search: query,
search_options: options,
recursive: recursive
});
}
});
// Set the current page for proper context
document.body.dataset.page = 'recipes';
}
initEventListeners() {