-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
433-365 : dropdown on navbar and profile #963
Conversation
computed: { | ||
authenticityToken() { | ||
return document.querySelector('meta[name="csrf-token"]').content | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this authenticityToken
is required. I see the existing DeleteButton
has it as well but i think that was left there by mistake and is not used there either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for working on this @vurtn 🙏🏾 , the changes look great! 🚀 .
Apologies for the long delay in reviewing this.
A few minor comments and questions below. No worries if you don't get to them, i'm happy to merge this in and tackle any further changes ourselves.
import SubmitButton from './SubmitButton' | ||
import SpacerField from './SpacerField' | ||
import SubmitButton from './SubmitButton' | ||
import DeleteLink from './DeleteLink' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing you have prettier
or some other auto-formatting tool enabled. Not a big deal in this case, but for future changes, would be great if you could disable it or have it respect our project settings (based on StandardRB with some customizations.
spec/requests/users_spec.rb
Outdated
expect(response).not_to be_successful | ||
expect(response.response_code).to eq(302) # Redirection | ||
expect(response.header["Location"]).to eq('http://www.example.com/users/sign_in') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this spec! I think the expectations above can be simplified to:
expect(response).not_to be_successful | |
expect(response.response_code).to eq(302) # Redirection | |
expect(response.header["Location"]).to eq('http://www.example.com/users/sign_in') | |
expect(response).to redirect_to new_user_session_path | |
|
||
.navbar { | ||
z-index: 10; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to recreate the problem you mentioned with the 'burger' showing up in the wrong place. When i comment out this z-index, everything still seems to work fine. Could you double check and describe steps to recreate if you're still seeing it happen?
app/javascript/components/NavBar.vue
Outdated
<div class="sub-item"> | ||
<FeedbackButton | ||
classes="navbar-item" | ||
action="software_feedbacks/new" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This action
property seems to be obsolete (i know it existed before your changes -- must've been inadvertently left behind previously).
<form :action="action" method="post" ref="form"> | ||
<AuthTokenInput /> | ||
<input type="hidden" name="_method" value="delete" /> | ||
<a href="#" :class="classes" v-on:click="submit"><slot /></a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: i have a slight preference to put <slot />
on its own line, to give it a little more visibility.
When scanning a component template, it's helpful to be able to quickly spot any slots defined.
Yes, i run into this sometimes too and don't fully understand it. |
Great find @vurtn! I created #992 to track this. Also, i appreciate the level of detail in your PR description, including the screenshots and explanations of some of the decisions you made and things you ran into. Very helpful! 🔥 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vurtn , i went ahead and made the minor changes from the previous review.
Thanks so much for your work on this! 🙌🏾 .
Sorry for my english.
Why
The main issue i tried to solve (#433) is about adding a dropdown in the right part of the navbar. I added a link to edit the profile of the current user (#365).
What
DeleteLink
FeedbackButton
NavBar.spec.js
user_spec.rb
How
I added the dropdown in the navbar with Buefy and had to make some changes.
First was the buttons/button style in the navbar. I added a parameter to
FeedbackButton
because it is already a link and the value by default is the button style (it's keeping the current style by default to not break some code elsewhere (and it's name is Button so... 😄 ). The button to disconnect the user is a real button so i created another component to have the same behavior but with a link.I used the Logout condition to show the dropdown in the navbar and added a z-index on the navbar because some components are above sometimes. It's visible on small screens like on this gif :
The burger on the page is above the navbar.
In the dropdown menu there is a link to edit our profile :
Testing
Some test failed due to the new structure of the navbar in
NavBar.spec.js
. The main issue was this part :The dropdown div is a
navbar-item
, so the links inside it matcha.navbar-item
and.navbar-item a
selectors. The return is an array and not a set so i had duplicates and the test failed. I changed the lines above to :I kept the spread operator because if we need to select something else, we will just add the new catches to this array like before. The navbar contains only links now so the only duplicate i had was the root page because of the burger link for the small screens. I excluded it of the query selector. I added the new links to the test of admin buttons.
I added a test in
user_spec.rb
to verify that the user is redirected to the sign in page if he is not logged in while trying to access the profile page.Next Steps
Unknown. Maybe create some tests with a context like "with the right credentials" (and its complementary of course) to check the access to resources.
Outstanding Questions, Concerns and Other Notes
Webpack throwing this error sometimes when i'm testing and i still don't understand why :
Accessibility
Not seem to be concerned now.
Security
Not seem to be concerned (now ?).
Meta
I didn't search why but i created a new account in the app and have the volonteer profile. The
FeedbackButton
is shown in the navbar but when i click on it i have this message :I think something is wrong 😄 The
FeedbackButton
have thev-if="visible('Feedback')"
condition and the item is shown but i am not authorized to access it.Pre-Merge Checklist
I think the reviewer will check this so i let it empty.
appropriate
Best regards and stay safe !