Remove recipe/post toggle — auto-detect type from category selection
When user selects Reseptit category, recipe fields (time, servings, ingredients, steps) appear automatically. All other categories show the post body field instead. Removed the manual toggle buttons and cleaned up related CSS. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -399,9 +399,7 @@ function generateSubmitCaptcha() {
|
||||
function setSubmitType(type) {
|
||||
submitType = type;
|
||||
document.getElementById('sub-recipeFields').style.display = type === 'recipe' ? '' : 'none';
|
||||
document.getElementById('sub-postFields').style.display = type === 'post' ? '' : 'none';
|
||||
document.getElementById('sub-typeRecipeBtn').classList.toggle('active', type === 'recipe');
|
||||
document.getElementById('sub-typePostBtn').classList.toggle('active', type === 'post');
|
||||
document.getElementById('sub-postFields').style.display = type === 'post' ? '' : 'none';
|
||||
}
|
||||
|
||||
function updateSubcategoryPicker() {
|
||||
@@ -418,14 +416,15 @@ function updateSubcategoryPicker() {
|
||||
subs.map(s => `<option value="${s.id}">${s.fi}</option>`).join('');
|
||||
group.style.display = '';
|
||||
}
|
||||
// Näytä reseptikentät jos kategoria on Reseptit, muuten julkaisukentät
|
||||
setSubmitType(catId === 'recipes' ? 'recipe' : 'post');
|
||||
}
|
||||
|
||||
function openSubmitModal() {
|
||||
const cats = APP.categories;
|
||||
const sel = document.getElementById('sub-category');
|
||||
sel.innerHTML = cats.map(c => `<option value="${c.id}">${c.emoji || ''} ${c.fi}</option>`).join('');
|
||||
updateSubcategoryPicker();
|
||||
setSubmitType('recipe');
|
||||
updateSubcategoryPicker(); // asettaa myös oikean tyypin kategorian mukaan
|
||||
document.getElementById('submitOverlay').classList.add('open');
|
||||
document.body.style.overflow = 'hidden';
|
||||
generateSubmitCaptcha();
|
||||
|
||||
Reference in New Issue
Block a user