-
Notifications
You must be signed in to change notification settings - Fork 1
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
Added notifications #161
base: dev
Are you sure you want to change the base?
Added notifications #161
Conversation
…ntend # Conflicts: # app/views/layouts/_navbar.html.erb
<% if user_signed_in? %> | ||
<form class="form-inline"> | ||
<% if current_user.contact_requests.any? %> | ||
<a href="<%= user_contact_requests_path(current_user) %>"> <i class="fa fa-bell" style="color: red; padding: 3px"></i> </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.
I would extract all styles into an appropriate css file
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 wouldn't like to do that, because if someone else uses the bell icon, they don't necessarily want my styling...
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.
Yes but you could use a class like notification-bell
or something like that. I just don't like to have HTML, CSS and application logic all in one file 😅 But if you prefer the inline styling that's fine for me because it's not such a big issue 👍
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 agree with @felixauringer. If someone doesn't like the styling, the class can be changed even easier
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.
My thought was to have descriptive methods in the model. We want to check whether the user has notifications, so I would name the method notifications?
. This also makes it easier to change the defintion of a notification without touching the view again
@@ -60,6 +60,14 @@ def init | |||
self.username ||= email.split('@', 2)[0] | |||
end | |||
|
|||
def has_contact_request? |
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.
def has_contact_request? | |
def notifications? |
app/models/user.rb
Outdated
contact_requests.any? | ||
end | ||
|
||
def count_contact_requests |
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.
def count_contact_requests | |
def notification_count |
Co-authored-by: Felix Auringer <[email protected]>
Closes #128