eventifier 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d52731cd16ffb326dcbbe039e149bc442971937
4
- data.tar.gz: e7ebe723f92488ea85e6e56035df3e6587024d7b
3
+ metadata.gz: 41a67bb13760a2f1a78c49d6d9d636f2b096c23f
4
+ data.tar.gz: 2144b9aa120796684514725552d0b45d2dcd3205
5
5
  SHA512:
6
- metadata.gz: 66f36403d9168dd4f495999c4f2a33ac37f02b27016328413164617c88544fdfc3cf9c938022c8e8b1e12dfb12ce1588baf1b5b5bcc8b5b04dc51c37010fd6f2
7
- data.tar.gz: 5c7bdc1a45b559b0fdb1b2784f9327f24232c3273d7648fc856f741e5f05de11c90a2dbe3ca7946b6b27cbf1a3e7fc24ce5ff465e8e558ccf399ae22ba5a1247
6
+ metadata.gz: 187b9888e74d11719d69ee8fc92aa493e14faef16fa91d90620037a59d6475c8b3c925ba9632d2b21bd621d39153740447b24bf01c43d7a6418201590b3a1590
7
+ data.tar.gz: 64418fd35804cc999a9bb79663ba40c831cbe04337bae498b55cb6906a5575f6a149de007829bdd62f7b53b9abeb8d871655cf44daea0a706fe9f0e6163f8f05
@@ -58,17 +58,25 @@ class window.NotificationDropdown
58
58
  $.each @notifications, (index, notification)=>
59
59
  unless $.inArray(notification.id, @renderedNotifications) >= 0
60
60
  if new Date(notification.created_at) > @lastReadAt
61
- @el
62
- .find('ol')
63
- .prepend $("<li />")
64
- .addClass('unread')
65
- .html(notification.html)
61
+ console.log @lastInserted
62
+ if @lastInserted?
63
+ @lastInserted.after @lastInserted = $("<li />")
64
+ .addClass('unread')
65
+ .html(notification.html)
66
+ else
67
+ @el
68
+ .find('ol')
69
+ .prepend @lastInserted = $("<li />")
70
+ .addClass('unread')
71
+ .html(notification.html)
66
72
  else
67
73
  @el
68
74
  .find('ol')
69
75
  .append($("<li />").html(notification.html))
70
76
  @renderedNotifications.push notification.id
71
77
 
78
+ @lastInserted = null
79
+
72
80
  isActive: =>
73
81
  @el.hasClass('notifications_active')
74
82
 
@@ -12,19 +12,13 @@ class Eventifier::NotificationsController < Eventifier::ApplicationController
12
12
  private
13
13
 
14
14
  def notifications
15
- scope = current_user.notifications.limit(per_page)
15
+ scope = current_user.notifications.order("notifications.created_at DESC").limit(per_page)
16
16
  scope = scope.where("notifications.created_at < ?", after) if params[:after]
17
17
  scope = scope.where("notifications.created_at > ?", since) if params[:since]
18
18
  scope = scope.where(
19
19
  "notifications.created_at > ?", current_user.notifications_last_read_at
20
20
  ) if params[:recent]
21
21
 
22
- if params[:since]
23
- scope = scope.order("notifications.created_at ASC")
24
- else
25
- scope = scope.order("notifications.created_at DESC")
26
- end
27
-
28
22
  scope
29
23
  end
30
24
 
data/eventifier.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |s|
3
3
  s.name = "eventifier"
4
- s.version = '0.0.11'
4
+ s.version = '0.0.12'
5
5
  s.authors = ["Nathan Sampimon", "Peter Murray", "Pat Allan"]
6
6
  s.email = ["nathan@inspire9.com"]
7
7
  s.homepage = "http://github.com/inspire9/eventifier"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Sampimon