Code Monkey home page Code Monkey logo

tasklistsinatra's Introduction

Task List

We are going to use our new found knowledge of databases and web development to create a task list, powered by Sinatra and SQLite. This project will enable us to persist tasks for a to-do list by adding, listing, and optionally editing and deleting them.

Baseline Setup

This is a pair project. You will work with an assigned pair to complete all project requirements. This project has the regular Git setup:

  • Decide who will fork the repo.
  • Fork the repo to one person's Github account, then add the other person as a collaborator on the project.
  • Both people should clone the project inside their ~/C5/projects directory.

Baseline Requirements

Work together to accomplish this baseline:

For the baseline you will need to create the following project files:

  • A Gemfile with all of the gems necessary for Sinatra, SQLite, and anything else you want to use (pry, rerun, etc).
  • A Sinatra class for your routes, and a root route (/).
  • An index.erb and a layout.erb for your site's root route.

Additionally you will need to do the following to design and create your database:

  • Create a database schema suitable for storing and organizing "tasks". Design this on paper or in a text editor first.
  • Then translate it into SQL code using CREATE TABLE. Put this code in the lib/database.rb file, within the create_schema method.

When you are done with the baseline it should be possible to setup your project on a different computer using the following bash commands:

$ git clone <SSH URL>
$ cd TaskListSinatra
$ bundle
$ ruby create_schema.rb
$ rerun 'ruby tasklist.rb'

Primary Requirements

Database Requirements

  • Use a class that will keep track of the low-level database interaction.
    • The responsibility of this class is to create a database connection and also to create the database schema.
    • The file for this class exists already in lib/database.rb.
  • Create a class that will inherit behavior from the database interaction class that will be responsible for all of the task record (row) persistence.
    • This will include inserting new tasks into the database, and selecting existing tasks from the database.

Task Data Requirements

Each task record will include all of the following. Optional in this context means that the user may choose not to provide this information, but it is still required for your schema:

  • Self-incrementing identifier
  • title: the title of the task (required)
  • description: details about the task (optional)
  • completed_at: the time and date the task was completed (optional)

Web Requirements

  • The home page (root route) of your Sinatra site should show the list of all of the tasks currently in the database.
  • Be able to create a new task:
    • The home page should contain a link to add a new task. This will give the user a form to fill out with the appropriate task fields.
    • After the new task is added, the site should take the user back to the home page which displays the full list of tasks. The new task that was just added should be included in the full list of tasks.

Optional Enhancements

  • Add the ability for the user to mark a task complete
    • Update the list of tasks on the home page to indicate which tasks are complete
    • Update the database interaction class to update a task's completed date
    • Use a form with checkboxes or radio buttons to allow a user to mark a task complete
  • Add the ability for the user to delete an existing task, whether it is complete or not
    • Update the list of tasks on the home page to include a delete link
    • Before the system deletes the task, ask the user for confirmation
    • Update your database interaction class to delete from the database
  • Add the ability for the user to edit the task
    • Re-use the form that was used for the Add task functionality
    • Update the list of tasks on the home page to include an edit link for each task
    • This includes updating your database interaction class to update the database

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.