harley / todo-starter

This project provides the start code for my students to work on Assignment 3.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Starter Code

This project provides the start code for you to work on Assignment 3.

If you're using your own project from Assignment 2, please still clone this project and take a look at the code and try to understand it.

A few things you can play with:

Setting up

  • Git clone the project to the computer
  • If you're on a Mac, run the app with shotgun app.rb then open http://localhost:9393
  • If yu're on Windows, run the app with ruby app.rb then open http://localhost:4567
  • Look at data/0.md, add some mock data and reload the browser to make sure it works correctly
  • Mark items as Done/Undone on the browser and check data/0.md
  • Add a few new item to the list on the browser and check data/0.md

Code

  • Look at views/layout.html.erb and make sure you ask if there's anything unclear.

  • Look at views/index.html.erb and try to see if you can determine how this file determines what gets displayed on the browser.

  • Look at app.rb and write down all the possible routes you can identify. Fill in the block below (replace ... with the correct text)

    GET / to display all items
    POST /...
    POST /...
    
  • Look at item.rb and make sure you can explain its structure. You can type irb, then require_relative "item" to play with it. See this screenshot for some examples.

    $ irb
    >> require_relative "item"
    >> Item.new("Buy milk")
    
  • Look at list.rb and similarly, understand what accessors are available and what methods are available. Similarly, you can test the List class from the code console (screenshot)

    >> require_relative "list" #=> true
    >> List.new(0) #=> #<List:0x007fcebb85cb40 @id=0, @lines=[], @items=[]>
    >> List.new(1) #=> #<List:0x007fcebd0e02c0 @id=1, @lines=[], @items=[]>
    >> list = List.new(0) #=> #<List:0x007fcebd0b0a48 @id=0, @lines=[], @items=[]>
    >> list.load_from_file
    >> list.filename #=> "data/0.md"
    >> list.name #=> "Today 😇"
    >> list.items #=> <an array of Item objects>
    >> list.items.map {|e| e.display_line} #=> <an array of strings>
    

Improvements

See the Assignment 3 page for the list of items you can work on. Rename this file to NOTES.md and create a new README.md file with the user stories listed there (and mark the ones completed).

About

This project provides the start code for my students to work on Assignment 3.


Languages

Language:JavaScript 78.1%Language:Ruby 10.5%Language:CSS 5.8%Language:HTML 5.5%