map color updates
This commit is contained in:
parent
bf8fa3ca5f
commit
c820a07a4d
6 changed files with 19 additions and 9 deletions
|
|
@ -103,7 +103,7 @@ def create_notepad():
|
||||||
return jsonify({'error': 'Unauthorized'}), 401
|
return jsonify({'error': 'Unauthorized'}), 401
|
||||||
|
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
new_pad = Notepad(name=data['name'], is_public=data.get('is_public', False), user_id=user_id)
|
new_pad = Notepad(name=data['name'], is_public=data.get('is_public', False), user_id=user_id, color=data.get('color', '#3388ff'))
|
||||||
db.session.add(new_pad)
|
db.session.add(new_pad)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return jsonify(new_pad.to_dict()), 201
|
return jsonify(new_pad.to_dict()), 201
|
||||||
|
|
|
||||||
|
|
@ -18,5 +18,6 @@ class Notepad(db.Model):
|
||||||
'name': self.name,
|
'name': self.name,
|
||||||
'is_public': self.is_public,
|
'is_public': self.is_public,
|
||||||
'owner_id': self.user_id,
|
'owner_id': self.user_id,
|
||||||
|
'color': self.color,
|
||||||
'note_count': self.notes.filter_by(is_hidden=False).count()
|
'note_count': self.notes.filter_by(is_hidden=False).count()
|
||||||
}
|
}
|
||||||
|
|
@ -97,3 +97,8 @@
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.custom-div-icon {
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
@ -116,9 +116,7 @@ window.openEditNoteModal = function(id, currentTitle, currentContent) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helper to open note modal (called from index.js)
|
// Helper to open note modal (called from index.js)
|
||||||
function openCreateNoteModal(notepadId) {
|
window.openCreateNoteModal = function(notepadId) {
|
||||||
activeNotepadId = notepadId;
|
activeNotepadId = notepadId;
|
||||||
document.getElementById('modal-create-note').classList.remove('hidden');
|
document.getElementById('modal-create-note').classList.remove('hidden');
|
||||||
}
|
};
|
||||||
en');
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -132,12 +132,14 @@ window.SpotNotes.renderMapMarkers = function() {
|
||||||
});
|
});
|
||||||
marker = L.marker([note.lat, note.lng], { icon: icon });
|
marker = L.marker([note.lat, note.lng], { icon: icon });
|
||||||
} else {
|
} else {
|
||||||
|
const teardropSvg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 36" width="24" height="36"><path fill="${padColor}" d="M12 0C5.373 0 0 5.373 0 12c0 8.442 12 24 12 24s12-15.558 12-24c0-6.627-5.373-12-12-12zm0 17c-2.761 0-5-2.239-5-5s2.239-5 5-5 5 2.239 5 5-2.239 5-5 5z" stroke="white" stroke-width="1.5"/></svg>`;
|
||||||
|
|
||||||
const svgIcon = L.divIcon({
|
const svgIcon = L.divIcon({
|
||||||
className: 'custom-div-icon',
|
className: 'custom-div-icon',
|
||||||
html: `<div style="background-color: ${padColor}; width: 16px; height: 16px; border-radius: 50%; border: 2px solid white; box-shadow: 0 0 4px rgba(0,0,0,0.5);"></div>`,
|
html: teardropSvg,
|
||||||
iconSize: [20, 20],
|
iconSize: [24, 36],
|
||||||
iconAnchor: [10, 10],
|
iconAnchor: [12, 36],
|
||||||
popupAnchor: [0, -10]
|
popupAnchor: [0, -36]
|
||||||
});
|
});
|
||||||
marker = L.marker([note.lat, note.lng], { icon: svgIcon });
|
marker = L.marker([note.lat, note.lng], { icon: svgIcon });
|
||||||
marker.bindPopup(`<b>${window.SpotNotes.escapeHtml(note.title)}</b><br><div style="white-space: pre-wrap;">${window.SpotNotes.escapeHtml(note.content)}</div><span style="font-size:0.7rem; color:#888;">${dateStr}</span><br>${directionsBtn} ${shareBtn} ${actionBtns}`);
|
marker.bindPopup(`<b>${window.SpotNotes.escapeHtml(note.title)}</b><br><div style="white-space: pre-wrap;">${window.SpotNotes.escapeHtml(note.content)}</div><span style="font-size:0.7rem; color:#888;">${dateStr}</span><br>${directionsBtn} ${shareBtn} ${actionBtns}`);
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,10 @@
|
||||||
<input type="checkbox" id="pad-public" style="width:auto;"> Make Public
|
<input type="checkbox" id="pad-public" style="width:auto;"> Make Public
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Marker Color</label>
|
||||||
|
<input type="color" id="pad-color" value="#3388ff">
|
||||||
|
</div>
|
||||||
<button type="submit" class="btn btn-primary">Create</button>
|
<button type="submit" class="btn btn-primary">Create</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue