Skip to content

Instantly share code, notes, and snippets.

@excid3
Last active May 14, 2017 13:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save excid3/ac0d362ddae46746c219 to your computer and use it in GitHub Desktop.
Save excid3/ac0d362ddae46746c219 to your computer and use it in GitHub Desktop.
handleSuccess: (data) =>
if data.length > 0
items = $.map data, (notification) ->
"<a class='dropdown-item' href='#{notification.url}'>#{notification.actor} #{notification.action} #{notification.notifiable.type}</a>"
$("[data-behavior='unread-count']").text(items.length)
$("[data-behavior='notification-items']").html(items)
else
$("[data-behavior='unread-count']").text(items.length)
$("[data-behavior='notification-items']").html("<p>No new notifications</p>")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment