spectral-workbench icon indicating copy to clipboard operation
spectral-workbench copied to clipboard

Copy the correct link from the contribution page and insert it on the Recent Spectra Section for the contributor's name that currently has a broken link

Open Georjane opened this issue 3 years ago • 11 comments

Fixes #(update with issue number)

Make sure these boxes are checked before your pull request is ready to be reviewed and merged. Thanks!

  • [x] tests pass -- rake test
  • [x] code is in uniquely-named feature branch, and has been rebased on top of latest master (especially if you've been asked to make additional changes)
  • [x] pull request are descriptively named
  • [x] if possible, multiple commits squashed if they're smaller changes
  • [ ] reviewed/confirmed/tested by another contributor or maintainer

Please be sure you've reviewed our contribution guidelines at https://publiclab.org/wiki/contributing-to-public-lab-software

Thanks!

Georjane avatar Dec 20 '21 10:12 Georjane

Thanks for opening this pull request! This space is protected by our Code of Conduct - and we're here to help. Dangerbot will test out your code and reply in a bit with some pointers and requests. Also please refer here for installation help 💿 There may be some errors, but don't worry! We'll work through them with you! 👍🎉😄
One thing that can help to get started is to make sure you've included a link back to the original issue you're solving, in the format fixes #0000 (for example). And to make sure the PR title describes what you're trying to do! (often it can be the same as the issue title) Thanks! 🙌
Then, you can say hello in our chatroom & share a link to this PR to get a review! 👋 ✅

welcome[bot] avatar Dec 20 '21 10:12 welcome[bot]

gitpod-io[bot] avatar Dec 20 '21 10:12 gitpod-io[bot]

This looks great. I assume you tested it manually but do you see any opportunity for a test? If not, shall we merge this? Thanks!!!

jywarren avatar Dec 20 '21 16:12 jywarren

This looks great. I assume you tested it manually but do you see any opportunity for a test? If not, shall we merge this? Thanks!!!

Sure Jeff, I can definitely try to write a test for this. Thanks

Georjane avatar Dec 21 '21 02:12 Georjane

Hey @Georjane for writing test you can checkout the system test in spectral-workbench and plots2 repo for reference. https://github.com/publiclab/spectral-workbench/blob/main/test/system/upload_test.rb https://github.com/publiclab/plots2/blob/main/test/system/dashboard_test.rb

The idea would be to navigate to the recent spectral page link and then find the element on this page, click on it and check for redirect

Thanks very much @Tlazypanda This is very helpful

Georjane avatar Dec 21 '21 06:12 Georjane

Hey @Georjane can you please clear the merge conflicts through the command line so the tests can be run and then we can debug this?

Also sharing this link for reference on how to remove merge conflicts through the command line if needed - https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line

Tlazypanda avatar Jan 07 '22 12:01 Tlazypanda

Hi @jywarren @Tlazypanda @TildaDares 👋🏽 I think I fixed the link for the spectrum author and I added the tests. But I have a question while the format that was in the code profile_path(@user) was not working while /profile/user_id works. See the two codes below.

working code

<a class="author-profile" data-transition="slide" href="/profile/<%=h spectrum.author %>"><%= spectrum.author %></a>

code not working

<a class="author-profile" data-transition="slide" href="<%= profile_path(spectrum.author) %>"><%= spectrum.author %></a> Thank you

Georjane avatar Jan 19 '22 11:01 Georjane

@Georjane Since the route for profile was not created with a resourceful route (resources :profile), helper methods like _url and path are not available for use. You can read more about it in the Rails docs.

You can also use route helpers with routes like https://github.com/publiclab/spectral-workbench/blob/7291df72288a41d080ac91d66d66154435b749b0/config/routes.rb#L29 by using as https://guides.rubyonrails.org/routing.html#naming-routes

I hope that helps.

TildaDares avatar Jan 19 '22 11:01 TildaDares

@Georjane Since the route for profile was not created with a resourceful route (resources :profile), helper methods like _url and path are not available for use. You can read more about it in the Rails docs.

You can also use route helpers with routes like

https://github.com/publiclab/spectral-workbench/blob/7291df72288a41d080ac91d66d66154435b749b0/config/routes.rb#L29

by using as https://guides.rubyonrails.org/routing.html#naming-routes I hope that helps.

woow this is very helpful @TildaDares Thank you very much. This means get '/profile/:id', to: 'users#show', as: :profile will create a routeprofile_path and this will solve the problem of the author broken link right?

Georjane avatar Jan 19 '22 11:01 Georjane

@TildaDares I tried creating a fto for this issue, please can you check it out here, https://github.com/publiclab/spectral-workbench/issues/869 thank you! 🙏🏽

Georjane avatar Jan 19 '22 12:01 Georjane

Oh cool - so does that mean after #869 is solved, we should be able to rebase this and it should work? Thanks!!

jywarren avatar Jan 30 '22 22:01 jywarren