Implement class-based template differentiation and fix collection item creation
- Add class-based template comparison to differentiate styling variants - Implement template deduplication based on structure + class signatures - Add GetCollectionTemplate method to repository interface and implementations - Fix collection item creation by replacing unimplemented CreateCollectionItemAtomic - Add template selection modal with auto-default selection in frontend - Generate meaningful template names from distinctive CSS classes - Fix unique constraint violations with timestamp-based collection item IDs - Add collection templates API endpoint for frontend template fetching - Update simple demo with featured/compact/dark testimonial variants for testing
This commit is contained in:
@@ -242,6 +242,29 @@ export class ApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get available templates for a collection
|
||||
* @param {string} collectionId - Collection ID
|
||||
* @returns {Promise<Array>} Array of collection templates
|
||||
*/
|
||||
async getCollectionTemplates(collectionId) {
|
||||
try {
|
||||
const collectionsUrl = this.getCollectionsUrl();
|
||||
const response = await fetch(`${collectionsUrl}/${collectionId}/templates?site_id=${this.siteId}`);
|
||||
|
||||
if (response.ok) {
|
||||
const result = await response.json();
|
||||
return result.templates || [];
|
||||
} else {
|
||||
console.warn(`⚠️ Failed to fetch collection templates (${response.status}): ${collectionId}`);
|
||||
return [];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch collection templates:', collectionId, error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reorder collection items in bulk
|
||||
* @param {string} collectionId - Collection ID
|
||||
|
||||
Reference in New Issue
Block a user