Skip to content

Commit

Permalink
use hoverIntent to open Notifications menu more intentionally
Browse files Browse the repository at this point in the history
  • Loading branch information
amdomanska committed Jul 24, 2023
1 parent 6f3a86e commit f6f0717
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
4 changes: 4 additions & 0 deletions cms/sass/components/_dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
}
}

.dropdown--notifications {
@extend .dropdown;
}

.dropdown__menu {
display: none;
padding: 0;
Expand Down
8 changes: 8 additions & 0 deletions portality/static/js/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ doaj.notifications.notificationsReceived = function(data) {
}

$(".notification_action_link").on("click", doaj.notifications.notificationClicked);
$("#dropdown__trigger--notifications").hoverIntent(doaj.notifications.showDropdown, doaj.notifications.hideDropdown);
}

doaj.notifications.showDropdown = function(e) {
$("#top_notifications").show();
}
doaj.notifications.hideDropdown = function() {
$("#top_notifications").hide();
}

doaj.notifications.notificationClicked = function(event) {
Expand Down
9 changes: 9 additions & 0 deletions portality/static/js/vendors/jquery.hoverIntent.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions portality/templates/_js_includes.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

{# get jquery js #}
<script type="text/javascript" src="/static/vendor/jquery-3.4.1/jquery-3.4.1.min.js"></script>
<script src="/static/js/vendors/jquery.hoverIntent.min.js"></script>
{# get bootstrap js #}
{# TODO: this is probably not the right place to keep this file #}
{# I’m using a much smaller & reduced version of Boostrap’s JS, with some modified classes and only the components we need #}
Expand Down
4 changes: 2 additions & 2 deletions portality/templates/layouts/dashboard_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ <h2 class="sr-only">DOAJ Dashboard</h2>
</a>
<ul class="unstyled-list flex-center">
{# ~~->Notifications:Feature~~ #}
<li class="dropdown flex-center">
<a href="/dashboard/notifications" class="dropdown__trigger label" role="button" aria-haspopup="true" aria-expanded="false">
<li class="dropdown--notifications flex-center">
<a href="/dashboard/notifications" class="dropdown__trigger label" id="dropdown__trigger--notifications" role="button" aria-haspopup="true" aria-expanded="false">
<span><span data-feather="bell" aria-hidden="true"></span> Notifications <span class="js-notifications-count"></span></span>
</a>
<ul class="dropdown__menu notifications" id="top_notifications"></ul>
Expand Down

0 comments on commit f6f0717

Please sign in to comment.