From the course: Hotwire: Reactive Ruby on Rails Applications

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Dividing the list into two

Dividing the list into two

- [Instructor] To finish the application, we'll divide the list in two so that the finished tasks are in a dedicated list so they are not mixed. Open the list template, and instead of using the tasks variable, use a new one named to-do tasks, which will only have yes, the to-do tasks. At this point, add a subtitle for the done tasks. XL size, top margin, a little bottom, done. Copy the UL containing the tasks and paste it under the H3. Change the ID to done tasks, and in the render, use a new variable for the done tasks. Let's create a couple of scopes for the queries. Open the model and add the first scope for done tasks, which will filter by status to do. It'll sort by modification date. Add another one for done tasks. Filter in by status, done. It'll sort by modification date, showing the nearest ones first. Now open the controller and in the index action, rename tasks to to do tasks. And instead of…

Contents