Skip to content

Commit 4943817

Browse files
committed
Debugging
1 parent bf7480d commit 4943817

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

app/views/papers/_vote_summary.html.erb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,36 @@
3131

3232
<script>
3333
document.addEventListener('DOMContentLoaded', function() {
34+
console.log('DOM Content Loaded - Initializing vote comment storage');
35+
3436
const commentField = document.getElementById('vote-comment');
37+
console.log('Comment field found:', commentField);
38+
3539
const paperId = commentField.dataset.paperId;
40+
console.log('Paper ID:', paperId);
41+
3642
const storageKey = `vote_comment_${paperId}`;
43+
console.log('Storage key:', storageKey);
3744

3845
// Load saved comment if it exists
3946
const savedComment = localStorage.getItem(storageKey);
47+
console.log('Saved comment from storage:', savedComment);
48+
4049
if (savedComment) {
4150
commentField.value = savedComment;
51+
console.log('Restored comment from storage');
4252
}
4353

4454
// Save comment on input
4555
commentField.addEventListener('input', function() {
56+
console.log('Input detected, saving comment:', this.value);
4657
localStorage.setItem(storageKey, this.value);
4758
});
4859

4960
// Clear storage when form is submitted
5061
const form = commentField.closest('form');
5162
form.addEventListener('submit', function() {
63+
console.log('Form submitted, clearing storage');
5264
localStorage.removeItem(storageKey);
5365
});
5466
});

0 commit comments

Comments
 (0)