Skip to content

vixinet/bibash-todo-rails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Training project

This project aims at going through all rails specificities through a step by step project. Each steps increments in complexitiy.

Area to discover

  • bundle cli
  • rails cli
  • rails console
  • rails server
  • Github basics
  • Controllers
  • Models
  • Migrations
  • Views
  • Partials
  • Helpers
  • Routing
  • Tasks
  • Mailers
  • Device
  • Filtering data
  • Slug (to_param, to_slug)
  • Class methods
  • Object methods
  • TDD
  • Validations
  • relations belongs_to
  • relations has_one
  • relations has_many
  • relations has_and_belongs_to_many
  • relation through
  • Assets pipeline
  • CRF tokens
  • Data query (.all, .where, .where.not, .order, etc)
  • STI
  • Shallow routing
  • Destroy cascade
  • Destroy nullify

Taks

  1. Create a new project rails new
  2. Scaffold a resource Project with a name and a description as a string
  3. Validates the presence of name
  4. Generate a controller StaticPages with an action home
  5. Change the content of the new action to Welcome all
  6. Prevent the destroy action for Project model (through the routes)
  7. Set StaticPages#home as the root of the web app
  8. Add (manually) a new action to the StaticPages called privacy and accesible via /privacy
  9. Add (manually) a new action to the StaticPages called terms and accesible via /legal
  10. Add a route to access StaticPages#terms (Create on last step) via /legal-terms
  11. Add (manually) a new action to the StaticPages called location and accesible via /location
  12. Change the action StaticPages#location to render a view map when we try to access /location?view=map
  13. Generate a migration adding the field rating as a float to the model Project
  14. Add a validation to Project model to accept only rating values between 1 and 5 included.
  15. Generate a model Todo with a label as a string and a project as a references
  16. Look into the new model file to see what was generated
  17. Look into the schema file and look what was generated
  18. Validates the presence of label
  19. Test within the rails console
  20. Pretend to scaffold the controller
  21. Find the right arguments to skip the existing model files
  22. Add a has_many relation in Project to show all its related Todo
  23. Restrict the access to Todo#index in the routing file
  24. Display the todos of a Project in the Project#index endpoint
  25. Generate a migration to add priority attribute to Todo as a integer
  26. Declare this field as an enum in Todo model with the possible values of :high, :medium, :low
  27. Add the class method total to Project in order to get Project.total returning the amount of projects in the data base
  28. Add the class method total to Todo in order to get Todo.total returning the amount of todos in the data base
  29. The sentence We currently have n todos within n projects to the home page. Both n should refer to the newly created class methods and todos and projects should plurialize according to the amount.
  30. Do training (1) listed below if you need a refresh of the points we went trough.
  31. Scaffold a resource Task with fields done as a boolean, label as a string, todo as a reference
  32. Test label is present
  33. Test label is unique through the Todo
  34. Test todo is required
  35. Test done is false at creation
  36. Test Task gets deleted when we delete parent Todo
  37. Test project exists (has_one through)
  38. Test Task gets deleted when we delete parent Project
  39. Generate a mailer ProjectMailer with notify_admin sending an email saying New project NAME was created. Accese HERE where NAME is the name of the project and HERE is a url to the project.
  40. Call the mailer from project#create when the creation is a success
  41. Add a method open_tasks to Todo returning the current open tasks in it
  42. Add a method open_tasks to Todo returning a booblean regarding if it still has open tasks
  43. Change the destroy method of todo to raise an StandardError when we try to delete a Todo with open tasks
  44. Add 3 images representing :high, :medium, :low priority
  45. Display the image corresponding the priority of a Todo from the assets in the corresponding views
  46. Move the code you just wrote to todos_helper.rb
  47. Add a logo to the public folder and display it on every page

Training (1)

  1. Scaffold Milestone which as a label, a deadline and belongs to a project
  2. All fields are required to create a Milestone
  3. In a project the show view displays all milestones
  4. Order them to see first the next in line (or past if one exists)
  5. Add status attribute to a Project with the enum values :open, :close
  6. The default status when creating a new project is :open
  7. milestone.active? should return true if the project is :open or false if the project isn't :open
  8. Scaffold Label ressource which has a label, and a color
  9. Validate the label is present
  10. Validate the color is in the format #FFF or #FFFFFF. F being an hecadecimal value 0-9A-Fa-F
  11. a Label can be part of many projects a Project can have many labels (use has_and_belongs_to_many relation)
  12. Add a column Labels in the index view of Projects showing the amount of labels related to the Project
  13. List all labels related to the Project in the show view of Projects
  14. The background of a label cell should be the color defined in the label
  15. List all projects related to the Label in the show view of Labels
  16. The route /labels should not be accessible anymore
  17. Remove the field description from the project in the interface and the database
  18. The Project field status must be editable through the create and edit forms
  19. Display the Project's rating in the show view