participateapp / web-client

Participate! is an app for democratic decision making
MIT License
6 stars 1 forks source link

Submitting a new proposal (finish implementation) #4

Closed oliverbarnes closed 8 years ago

oliverbarnes commented 8 years ago

User story:

As a participant
After I've signed-up/logged-in through facebook
I want to create a simple proposal.

After login, user sees the Home route, and a link to "Create a Proposal".

Clicking on the link will change route to NewProposalRoute (we're using sporto/hop for routing), and render a view with the new proposal form

The form includes title and body (not implemented yet) fields, and a submit button. It uses https://github.com/debois/elm-mdl elements.

When submitted, it sends a POST /proposals request with the following JSON-API payload:

{
  "data": {
    "type": "proposal",
    "attributes": {
      "title": "Title",
      "body":  "Body"
    }
  }
}

The request includes an authorization header with the bearer token we got from the API during the Facebook oauth flow.

On submittal, the API should respond with a 201 Created and return a payload with the created proposal. We don't need to do anything with this yet, this is a big enough scope for this issue, I think.

Please let me know if anything doesn't make sense or isn't familiar.

I'd say implementation is at 90% right now, but as you noticed, I put the horses before the carriage and now the compiler errors are a little overwhelming. I'd start by getting the Proposal encoding working. After that, I expect the compiler errors will be a lot more helpful.

Feel free to backtrack the commits til something is compiling, but I ask that you then go adding pieces back in while keeping with the current architecture and naming conventions, diverging only when really necessary.

Please submit a WIP pull request once you have your own branch going, so I can follow progress and comment along.