Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions public/javascripts/items.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const descriptionEdited = event => {

const completedClicked = event => {
const element = $( event.target )
const id = element.data( 'id' )
const id = element.parent().data( 'id' )
const completed = ! element.data( 'completed' )

fetch( `/items/${id}`, params({ completed: completed } ) )
Expand All @@ -64,9 +64,8 @@ const completedClicked = event => {
} else {
parent.removeClass( 'item__title--completed' )
}
}
)
}
})
}

const getFilterStatus = () => {
const pageURL= decodeURIComponent(window.location.search)
Expand Down Expand Up @@ -133,7 +132,7 @@ $(document).ready( () => {
$( '.item__title > span' ).click( clickToUpdate( 'item__title' ))
$( '.item__edit-description' ).keypress( descriptionEdited )
$( '.item__description > span' ).click( clickToUpdate( 'item__description' ))
$( '.item__toggle' ).click( completedClicked )
$( '.item__menu ul li:first-child' ).click( completedClicked )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use explicit class

$( '.dropdown__toggle' ).click( dropdownToggle )
$( '.star' ).click( starredToggle )
getFilterStatus()
Expand Down
2 changes: 1 addition & 1 deletion views/items/item-menu.pug
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ul
ul(data-id=entry.id)
li Complete
li Add Note
li Share
Expand Down