-
Notifications
You must be signed in to change notification settings - Fork 260
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
User edit proposals #414
User edit proposals #414
Conversation
[Edit: Reading your original comment above, I can see you are probably aware of everything I wrote in this comment. Sorry for not reading earlier.] I'm going to start by trying to test the user-facing parts of this from an end-user perspective, since "front-end" is more of my strong area at the moment. I did get an error when clicking the "submit" button after editing a restroom entry. Here is a zipped The error seems to be because the new page is submitted with a restroom entry "id" that isn't already in the database, which, taking a guess, I might expect would happen for adding a totally new restroom, vs submitting an edit. Seems like the submit button functionality needs to be updated a bit. By the way this would be a super great feature, users have definitely been asking for it, so I think it's very exciting to see some headway being made on this issue! |
As for the Travis log:
The step to visit the "edit page" for Winnipeg Restroom is undefined:
We need to update the definitions for the test so Cucumber knows how to visit Winnipeg Restroom's edit page. |
This forces the form to submit to /restrooms with POST. Normally, simple_form_for would submit to /restrooms/:id with PATCH if the restroom already exists, which results in invoking the update method on restroom controller.
Add edit_id to permitted params and add it as a hidden field in the form, which allows it to be submitted. The edit_id set in the 'new' method only affects the value of the field in the form, and not the edit_id for the @Restroom in the create method, since they refer to different objects.
Redirect to the original restroom that was edited. params[:id] is nil because the params here are the ones submitted with the form, and there isn't an id field in the form.
#423 is @stardust66's go at part 3 outlined in the original post, if I understand correctly. |
Implement correct editing behavior
I removed one of the old "contact" tests. Kept the second to test that past behavior remains the same. I think the second one was just a typo for a capitol R in the step. |
Looks like last time I might have just not finished the tests I was writing |
I looked over the step definitions in the cucumber tests, and they seem fine on first glance. I suspect there is a technically relevant typo in there somewhere; Somehow, an error message is being piped into the logic of the test.
see Line 1190 of the Travis test log. (By the way, wading through errors describes most of the time I spent so far on #421, so I know what this sort of thing can be like.) |
Unfortunately, same error as above (
|
Ok! I've actually got something here now :) The new process is:
@tkwidmer would appreciate your eyes on this one! Anyone else can also pull down the branch and mess around with it. I added some tests and also tested that the geocoding updates for a change in address. I still need to write a migration to add an |
Closing in favor of: #487 |
I've got to step back for a bit and might need a second set of eyes, but here's what I have so far for restroom edit proposals.
The general plan is:
The default edit_id is 0, and restroom views will filter for this to avoid showing edits.
So far I've implemented 1,2 and the restroom filter.
I'm having an issue with the edit submission itself, where the form is redirecting to
update
instead ofcreate
. I think this has something to do with the coffeescript/js for submitting a restroom. Essentially, it will run thebefore_action
for:find_restroom
and fail. The id it fails on is the id of the edit where I would like the run thecreate
method and redirect to the id of the original (also theedit_id
on the copy).