Skip to main content

Subscribe to GoRails to get access to this episode and all other pro episodes, and new awesome content every month.

Subscribe Now
Only $19/month

Unlimited access. Cancel anytime.

10 Rails & Vue.js Trello Clone - Part 4

Episode 220 · December 19, 2017

This episode we handle drag and drop of cards in their own column and also between columns in our boards

Javascript VueJS


Transcripts

Subscribe or login to view the transcript for this episode.

Discussion


Gravatar
Mark Oveson (4,370 XP) on

I am loving this series! This is such a cool project. The combination of acts_as_list and Vue makes it seem effortless.

I had one minor suggestion for the code in the cardMoved function. Rather than finding the list index, would it be better to just set a constant to the new list itself, and then use that object to set the list_id in the ajax request? Here's what I did:

const card_list = this.lists.find((list) => {
return list.cards.find((card) => {
return card.id === element.id
})
});

Then when setting up data, I did this, which seems a bit cleaner:

data.append("card[list_id]", card_list.id);

Thanks for the great material!

Gravatar
Chris Oliver (167,500 XP) on

Yeah, that is true since we don't use it really anywhere else. 👍


Login or create an account to join the conversation.