Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edit grids and pathways #384

Merged
merged 1 commit into from
Dec 30, 2015
Merged

edit grids and pathways #384

merged 1 commit into from
Dec 30, 2015

Conversation

chadwhitacre
Copy link
Contributor

Incorporates #377, so merge that first and then rebase here.

To-do

  • remove topics grids under "All Topics Grids" (drag to garbage can? little clicky x or trashcan when loaded?)
  • rename a topic grid
  • remove pathways under "$Topic" "$Grid"
  • rename a pathway
  • keep "All Topics Grids" and "$Topic" "$Grid" alphabetized

@chadwhitacre
Copy link
Contributor Author

yb3htrjjec

@chadwhitacre
Copy link
Contributor Author

What happens if anon tries to edit?

@chadwhitacre
Copy link
Contributor Author

I'm having trouble testing as anon. I can't find localhost:3000 from curl, even with --ipv4.

$ curl http://localhost:3000/
curl: (7) Failed to connect to localhost port 3000: Connection refused
$ curl --ipv4 http://localhost:3000/
curl: (7) Failed to connect to localhost port 3000: Connection refused
$

Postman (h/t @dmtroyer) gives a 500:

screen shot 2015-12-21 at 1 20 04 pm

Is that the anon behavior, then?

@chadwhitacre
Copy link
Contributor Author

I yanked the Cookie from Chrome (which encodes auth, ya?) and put it in Postman and I still get the same 500.

@chadwhitacre
Copy link
Contributor Author

Gosh. Rails and Chrome are using IPv6! 😳

screen shot 2015-12-21 at 1 35 10 pm

$ curl --ipv4 http://localhost:3000/
curl: (7) Failed to connect to localhost port 3000: Connection refused
$ curl --ipv6 http://localhost:3000/
<!DOCTYPE html>
<html ng-app="caac">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="shared/favicon/favicon.ico"/>
    <title></title>
    <link rel="stylesheet" href="app.min.css">
    <link rel="stylesheet" href="vendors.min.css">
    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,400italic,600,600italic,800,800italic">
    <script type="text/javascript" src="//maps.googleapis.com/maps/api/js"></script>
  </head>
  <body>
    <ng-view></ng-view>
    <script type="text/javascript" src="vendors.min.js"></script>
    <script type="text/javascript" src="app.min.js"></script>
  </body>
</html>
$

@chadwhitacre
Copy link
Contributor Author

Okay! Rails wants an application/json POST body, I had been sending form-data from Postman.

Looks like the PUT still works without the Cookie header, which I take it indicates that we aren't sufficiently protecting the endpoint yet.

screen shot 2015-12-21 at 1 37 42 pm

@chadwhitacre
Copy link
Contributor Author

Yeah, these endpoints are wide open:

$ curl --ipv6 http://localhost:3000/pathways/1.json
{"pathway":{"id":1,"name":"Bloo","nodes":[]}}$
$ curl --ipv6 http://localhost:3000/pathways/1.json -X PUT --data-binary '{"name": "Blah"}' -H"Content-Typepplication/json"
$ curl --ipv6 http://localhost:3000/pathways/1.json
{"pathway":{"id":1,"name":"Blah","nodes":[]}}$

Hmm ... I guess we need to fix that app-wide, not just here. I think I'll leave that to another PR for now.

@chadwhitacre
Copy link
Contributor Author

POSTing to pathways also works for anon:

$ curl --ipv6 http://localhost:3000/pathways.json -X POST --data-binary '{"name": "Flam", "grid_id": "1"}' -H"Content-Type: application/json"
{"pathway":{"id":2,"name":"Flam","nodes":[]}}$

@chadwhitacre chadwhitacre changed the title edit grids and pathway edit grids and pathways Dec 21, 2015
@chadwhitacre
Copy link
Contributor Author

8z066ekmgj

@dmtroyer
Copy link
Contributor

Move the endpoint within the api/v1 scope.

@dmtroyer
Copy link
Contributor

OH! And in the rails controller add a call to authenticate_user! in a before_action filter for the pertinent actions ala https://github.com/saxifrage/cityasacampus/blob/edit-map-things/app/controllers/organizers_controller.rb#L3

@dmtroyer
Copy link
Contributor

uhh, I can make those changes on #377 before I merge it?

@chadwhitacre
Copy link
Contributor Author

bxcw7ph3o9

@chadwhitacre
Copy link
Contributor Author

uhh, I can make those changes on #377 before I merge it?

Whichever. #377 is just against #364, so merging #377 is not merging to master.

@dmtroyer
Copy link
Contributor

Whichever. #377 is just against #364, so merging #377 is not merging to master.

Ok, I'm a little confused with the PR hierarchy so I'll just put it somewhere.

@chadwhitacre
Copy link
Contributor Author

I'm a little confused with the PR hierarchy

Yeah, it's gettin' squirrelly. :-)

My expectation is that we would merge #377 to #364 next. Then I'll rebase this PR and get it ready for review & merge to #364 as well.

I'm expecting to keep making smaller PRs against #364 until #364 is ready to merge to master.

@chadwhitacre
Copy link
Contributor Author

#380 is ready for review and merge to master.

#377 is ready for review and merge to #364.

@chadwhitacre
Copy link
Contributor Author

I'll just put it somewhere

I propose that we make another PR against #364 to clean up auth for all of the endpoints in one fell swoop.

@chadwhitacre chadwhitacre mentioned this pull request Dec 21, 2015
7 tasks
@chadwhitacre
Copy link
Contributor Author

Do we have any modals lying around that we could use instead of the stock browser UI popups?

@chadwhitacre
Copy link
Contributor Author

Nothin' called modal in client/.

@chadwhitacre chadwhitacre mentioned this pull request Dec 21, 2015
11 tasks
@chadwhitacre
Copy link
Contributor Author

Not gonna worry about modals for now.

@chadwhitacre
Copy link
Contributor Author

Onward!

@chadwhitacre
Copy link
Contributor Author

Rebased onto #364 at d611e9c. Previous head was 1c5c0ef.

@chadwhitacre
Copy link
Contributor Author

Squashed. Previous head was b17d391.

chadwhitacre added a commit that referenced this pull request Dec 30, 2015
@chadwhitacre chadwhitacre merged commit bbb116c into create-pathways Dec 30, 2015
@chadwhitacre chadwhitacre deleted the edit-map-things branch December 30, 2015 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants