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 - Ruby on Rails Tutorial
From the course: Hotwire: Reactive Ruby on Rails Applications
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
-
-
-
-
-
-
-
(Locked)
Introduction2m 24s
-
(Locked)
Making the list page compact3m 25s
-
(Locked)
Adding new tasks with Turbo Streams2m 55s
-
(Locked)
Editing a task3m 28s
-
(Locked)
Showing form errors2m 39s
-
(Locked)
Removing tasks2m 18s
-
(Locked)
Checking and unchecking tasks3m 33s
-
(Locked)
Dividing the list into two3m 2s
-
(Locked)
-