Fixed announcement JavaScript functionality

This commit is contained in:
Andreas Nedbal 2020-05-07 20:36:14 +02:00
parent 8a8c2667de
commit c76f839ea7
2 changed files with 5 additions and 5 deletions

View File

@ -73,13 +73,13 @@ _ready = ->
lineColor: bodyColor lineColor: bodyColor
density: 23000 density: 23000
$(".alert-announcement").each -> $(".announcement").each ->
aId = $(this)[0].dataset.announcementId aId = $(this)[0].dataset.announcementId
unless (window.localStorage.getItem("announcement#{aId}")) unless (window.localStorage.getItem("announcement#{aId}"))
$(this).toggleClass("hidden") $(this).toggleClass("d-none")
$(document).on "click", ".alert-announcement button.close", (evt) -> $(document).on "click", ".announcement button.close", (evt) ->
announcement = event.target.closest(".alert-announcement") announcement = event.target.closest(".announcement")
aId = announcement.dataset.announcementId aId = announcement.dataset.announcementId
window.localStorage.setItem("announcement#{aId}", true) window.localStorage.setItem("announcement#{aId}", true)

View File

@ -1,6 +1,6 @@
.announcement__container .announcement__container
- @active_announcements.each do |announcement| - @active_announcements.each do |announcement|
.alert.announcement.alert-info.alert-dismissable.hidden{ data: { 'announcement-id': announcement.id } } .alert.announcement.alert-info.alert-dismissable.d-none{ data: { 'announcement-id': announcement.id } }
.container .container
%button.close{ type: "button", "data-dismiss" => "alert" } %button.close{ type: "button", "data-dismiss" => "alert" }
%span{ "aria-hidden" => "true" } × %span{ "aria-hidden" => "true" } ×