eventifier 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -5
- data/README.textile +9 -0
- data/app/assets/javascripts/eventifier/notifications.coffee +61 -43
- data/app/assets/javascripts/eventifier/templates/dropdown.jst.ejs +12 -0
- data/app/assets/javascripts/eventifier/templates/settings.jst.ejs +16 -0
- data/app/assets/stylesheets/eventifier/notifications.scss +85 -157
- data/eventifier.gemspec +1 -2
- data/lib/eventifier/preferences.rb +1 -1
- data/spec/eventifier/preferences_spec.rb +12 -2
- metadata +4 -18
- data/app/assets/javascripts/eventifier/templates/dropdown.hamlc +0 -10
- data/app/assets/javascripts/eventifier/templates/settings.hamlc +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7eeb507b3facc87104e612dcf5f454fee45ab860
|
4
|
+
data.tar.gz: 2d0a8c1ad42b8f79377fa0dd0f53ea4575f710c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 096457df743d5314bfe5fa999038b3780a396ce706ae8c5706fefe89cd534581574e7ede97e3264a71893444a1dcf546618572647e91f8c8a4b87c00eac62f95
|
7
|
+
data.tar.gz: 0063f2f63b4a9bb7e11dc54ed4d4d09e36518c3dc1eb23e74b4c29163ed6b5e548343d30cc59957380c0c060189f33c70c2f2e6e5754d7b0bb5e5ae32c032d0e
|
data/Gemfile
CHANGED
data/README.textile
CHANGED
@@ -54,6 +54,15 @@ h4. Add notifications indicator in interface
|
|
54
54
|
|
55
55
|
Eventifier provides a notification tool for your users.
|
56
56
|
|
57
|
+
<pre><code>
|
58
|
+
<div class="notifications">
|
59
|
+
<a href="#" class="notifications-toggle">
|
60
|
+
<span class="icon-notifications"></span>
|
61
|
+
<span class="notifications-alert"></span>
|
62
|
+
</a>
|
63
|
+
</div>
|
64
|
+
</code></pre>
|
65
|
+
|
57
66
|
<pre><code>
|
58
67
|
# app/views/layouts/application.erb
|
59
68
|
<div class="notifications"></div>
|
@@ -1,22 +1,37 @@
|
|
1
|
-
#= require hamlcoffee
|
2
1
|
#= require eventifier/templates/dropdown
|
3
2
|
#= require eventifier/templates/settings
|
3
|
+
|
4
4
|
# Usage
|
5
|
-
#
|
5
|
+
#
|
6
|
+
# window.notifications = new NotificationDropdown
|
7
|
+
# or with options
|
8
|
+
# window.notifications = new NotificationDropdown trigger: '.notifications-toggle', pollTime: 60, limit: 10, push: true
|
9
|
+
|
10
|
+
# Options
|
11
|
+
# trigger - The selector for a dom element to add an onClick action to, which triggers the toggling of the notifications dropdown. This is just the selector, not the jQuery object
|
12
|
+
# eg: new NotificationDropdown trigger: '.btn.notifications-toggle'
|
13
|
+
#
|
14
|
+
# limit (default: 5) - Limit the number of notifications to get in each load
|
15
|
+
#
|
16
|
+
# pollTime (default: 30) - Time in seconds between checks for new notifications
|
17
|
+
#
|
18
|
+
# push (default: false) - Enable HTML5 pushState for url changes. When set to true, onclick actions onto individual notifications are overriden and caught by either Backbone's history.nagivate (if Backbone is defined) or native browser history.pushState handler
|
6
19
|
|
7
20
|
class window.NotificationDropdown
|
8
21
|
template: JST['eventifier/templates/dropdown']
|
9
22
|
settingsTemplate: JST['eventifier/templates/settings']
|
10
23
|
|
11
24
|
constructor: (options) ->
|
12
|
-
{@
|
25
|
+
{@trigger, @limit, @pollTime, @push} = options
|
26
|
+
@trigger ||= '.notifications-toggle'
|
13
27
|
@limit = @limit || 5
|
14
|
-
@pollTime = @pollTime ||
|
28
|
+
@pollTime = @pollTime || 30
|
15
29
|
@push = @push || false
|
16
30
|
|
17
|
-
|
18
31
|
[@notifications, @renderedNotifications, @unreadCount, @lastReadAt] = [[], [], 0, new Date()]
|
19
32
|
|
33
|
+
@el = $(@template(@))
|
34
|
+
|
20
35
|
@render()
|
21
36
|
@loadMore(limit: 14)
|
22
37
|
setTimeout =>
|
@@ -26,42 +41,44 @@ class window.NotificationDropdown
|
|
26
41
|
render: =>
|
27
42
|
@unsetEvents()
|
28
43
|
@renderedNotifications = []
|
29
|
-
@el.
|
44
|
+
@el.attr('tabindex', 0).appendTo $('body')
|
45
|
+
|
30
46
|
@renderNotifications()
|
31
47
|
# @checkVisibility()
|
32
48
|
|
33
49
|
@setEvents()
|
34
50
|
|
35
51
|
checkVisibility: =>
|
36
|
-
@el.addClass("
|
37
|
-
@el.find('#
|
52
|
+
@el.addClass("notifications-active").find('#notifications-dropdown').attr('opacity': 0)
|
53
|
+
@el.find('#notifications-dropdown').offset (index, coords)=>
|
38
54
|
coords.left = 10 if coords.left < 0
|
39
|
-
if coords.left + @el.find('#
|
40
|
-
coords.left = $(window).width() - @el.find('#
|
55
|
+
if coords.left + @el.find('#notifications-dropdown').width() > $(window).width()
|
56
|
+
coords.left = $(window).width() - @el.find('#notifications-dropdown').width() - 5
|
41
57
|
|
42
|
-
@el.find('#
|
58
|
+
@el.find('#notifications-dropdown').offset coords
|
43
59
|
|
44
|
-
if @el.find('#
|
45
|
-
@el.find('#
|
60
|
+
if @el.find('#notifications-dropdown').position().left > -@el.find('#notifications-dropdown').width()/2
|
61
|
+
@el.find('#notifications-dropdown').addClass('left_nipple')
|
46
62
|
|
47
|
-
@el.removeClass("
|
63
|
+
@el.removeClass("notifications-active").find('#notifications-dropdown').attr('opacity': 1)
|
48
64
|
|
49
65
|
setEvents: =>
|
50
|
-
|
51
|
-
@el.on 'click', '.
|
66
|
+
$('body').on 'click', @trigger, @toggleDropdown
|
67
|
+
@el.on 'click', '.toggle-notifications-settings', @toggleSettings
|
52
68
|
@el.on 'click', '#email_settings_default', @defaultSettings
|
53
|
-
@el.on 'click', '.
|
69
|
+
@el.on 'click', '.save-settings', @saveSettings
|
54
70
|
@el.on 'addNotifications', @renderNotifications
|
55
71
|
@el.on 'addNotifications', @setUnreadCount
|
56
72
|
@el.on 'poll', @poll
|
57
|
-
@el.find('
|
73
|
+
@el.find('.notifications-list-pane').on 'scroll', @scrolling
|
58
74
|
$(window).on 'click', @blurNotifications
|
59
75
|
if @push
|
60
|
-
@el.on 'click', '#
|
76
|
+
@el.on 'click', '#notifications-dropdown ol a', @pushUrl
|
61
77
|
|
62
78
|
@
|
63
79
|
|
64
80
|
unsetEvents: =>
|
81
|
+
$('body').off 'click', @trigger, @toggleDropdown
|
65
82
|
@el.off()
|
66
83
|
|
67
84
|
pushUrl: (e)=>
|
@@ -86,9 +103,10 @@ class window.NotificationDropdown
|
|
86
103
|
else
|
87
104
|
@el
|
88
105
|
.find('ol')
|
89
|
-
.prepend(@lastInserted = $("<li />")
|
106
|
+
.prepend( @lastInserted = $("<li />")
|
90
107
|
.addClass('unread')
|
91
|
-
.html(notification.html)
|
108
|
+
.html(notification.html)
|
109
|
+
)
|
92
110
|
else
|
93
111
|
@el
|
94
112
|
.find('ol')
|
@@ -98,33 +116,37 @@ class window.NotificationDropdown
|
|
98
116
|
@lastInserted = null
|
99
117
|
|
100
118
|
isActive: =>
|
101
|
-
@el.hasClass('
|
119
|
+
@el.hasClass('notifications-active')
|
102
120
|
|
103
121
|
isAlerting: =>
|
104
122
|
@unreadCount > 0
|
105
123
|
|
106
|
-
toggleDropdown: (
|
107
|
-
|
124
|
+
toggleDropdown: (e)=>
|
125
|
+
e.preventDefault() if e?
|
108
126
|
|
109
|
-
@el.toggleClass('
|
127
|
+
@el.toggleClass('notifications-active')
|
110
128
|
@setLastRead()
|
111
129
|
|
112
|
-
|
113
|
-
|
130
|
+
blurNotifications: (e)=>
|
131
|
+
if @isActive() && $.inArray($(@trigger)[0], $(e.target).parents()) < 0 && $.inArray(@el.get(0), $(e.target).parents()) < 0
|
132
|
+
@toggleDropdown()
|
133
|
+
|
134
|
+
toggleSettings: (e)=>
|
135
|
+
e.preventDefault() if e?
|
114
136
|
$.ajax
|
115
137
|
url: "/eventifier/preferences"
|
116
138
|
success: (data)=>
|
117
|
-
@el.find("
|
139
|
+
@el.find(".notifications-settings-pane").html(@settingsTemplate(settings: data))
|
118
140
|
@defaultSettings() if @arrayFromObject($.makeArray(data)).default
|
119
|
-
@el.toggleClass('
|
141
|
+
@el.toggleClass('notifications-show-settings')
|
120
142
|
|
121
143
|
defaultSettings: =>
|
122
|
-
@el.find("
|
144
|
+
@el.find(".notifications-settings-pane").toggleClass("disabled")
|
123
145
|
@el.find("input:not([id='email_settings_default'])").each ->
|
124
146
|
$(@).attr(disabled: !$(@).attr('disabled')).prop('checked', true)
|
125
147
|
|
126
|
-
saveSettings: (
|
127
|
-
|
148
|
+
saveSettings: (e)=>
|
149
|
+
e.preventDefault() if e?
|
128
150
|
|
129
151
|
serializedSettings = {}
|
130
152
|
@el.find("input:checked").each ->
|
@@ -134,17 +156,13 @@ class window.NotificationDropdown
|
|
134
156
|
url: "/eventifier/preferences"
|
135
157
|
type: "PUT"
|
136
158
|
data: preferences: serializedSettings
|
137
|
-
success: (data)=> @el.toggleClass('
|
159
|
+
success: (data)=> @el.toggleClass('notifications-show-settings')
|
138
160
|
error: -> alert "There was a problem saving your settings"
|
139
161
|
|
140
162
|
hide: =>
|
141
|
-
@el.removeClass('
|
163
|
+
@el.removeClass('notifications-active')
|
142
164
|
$(window).off 'click', @blurNotifications
|
143
165
|
|
144
|
-
blurNotifications: (event)=>
|
145
|
-
if @isActive() and $.inArray(@el[0], $(event.target).parents()) < 0
|
146
|
-
@toggleDropdown()
|
147
|
-
|
148
166
|
loadMore: (params = {})=>
|
149
167
|
$.ajax
|
150
168
|
url: "/eventifier/notifications"
|
@@ -165,12 +183,12 @@ class window.NotificationDropdown
|
|
165
183
|
updateAlert: =>
|
166
184
|
if @unreadCount == 0
|
167
185
|
displayCount = null
|
168
|
-
@
|
186
|
+
$(@trigger).removeClass('notifications-alerting')
|
169
187
|
else
|
170
188
|
displayCount = @unreadCount
|
171
|
-
@
|
189
|
+
$(@trigger).addClass('notifications-alerting')
|
172
190
|
|
173
|
-
@
|
191
|
+
$(@trigger).find(".notifications-alert").html(displayCount)
|
174
192
|
$('title').html (index, old_html) ->
|
175
193
|
if old_html.match /^\(\d+\).*/
|
176
194
|
if displayCount > 0
|
@@ -222,9 +240,9 @@ class window.NotificationDropdown
|
|
222
240
|
Math.max(@lastReadAt.getTime()/1000, @newestNotificationTime()/1000)
|
223
241
|
|
224
242
|
scrolling: =>
|
225
|
-
scrollWindow = @el.find('
|
243
|
+
scrollWindow = @el.find('.notifications-list-pane')
|
226
244
|
|
227
|
-
if (scrollWindow.scrollTop() + scrollWindow.innerHeight() >= scrollWindow[0].scrollHeight -
|
245
|
+
if (scrollWindow.scrollTop() + scrollWindow.innerHeight() >= scrollWindow[0].scrollHeight - 100)
|
228
246
|
@loadMore(after: @oldestNotificationTime()/1000)
|
229
247
|
|
230
248
|
arrayFromObject: (collection)->
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<div id="notifications-dropdown">
|
2
|
+
<header class="notifications-header">
|
3
|
+
<a href="#" class="toggle-notifications-settings pull-right">Settings</a>
|
4
|
+
<span class="notifications-heading">Notifications</span>
|
5
|
+
</header>
|
6
|
+
<div class="notifications-list-pane">
|
7
|
+
<ol class="notifications-list">
|
8
|
+
<li class="none">You have no notifications</li>
|
9
|
+
</ol>
|
10
|
+
</div>
|
11
|
+
<div class="notifications-settings-pane"></div>
|
12
|
+
</div>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<form id="email_notification_settings">
|
2
|
+
<fieldset class="notifications-settings-fieldset">
|
3
|
+
<legend>Receive emails for:</legend>
|
4
|
+
<% $.each(settings, function(i, setting) { %>
|
5
|
+
<label for="email_settings_<%= setting.key %>">
|
6
|
+
<input type='checkbox' checked='<%= setting.value %>'
|
7
|
+
id="email_settings_<%= setting.key %>" name="<%= setting.key %>"
|
8
|
+
value="<%= setting.value %>" />
|
9
|
+
<%= setting.label %>
|
10
|
+
</label>
|
11
|
+
<% }) %>
|
12
|
+
<div class="notifications-settings-buttons">
|
13
|
+
<button class="save-settings">Save</button>
|
14
|
+
</div>
|
15
|
+
</fieldset>
|
16
|
+
</form>
|
@@ -1,168 +1,96 @@
|
|
1
|
-
@
|
2
|
-
@
|
3
|
-
@
|
4
|
-
@import "compass/css3/transform";
|
5
|
-
|
6
|
-
@mixin respond-to($media) {
|
7
|
-
@if $media == iphone {
|
8
|
-
@media only screen and (max-width: 320px) { @content }
|
9
|
-
}
|
10
|
-
@else if $media == iphone-landscape {
|
11
|
-
@media only screen and (max-width: 480px) { @content }
|
12
|
-
}
|
13
|
-
@else if $media == ipad {
|
14
|
-
@media only screen and (max-width: 980px) { @content }
|
15
|
-
}
|
16
|
-
@else if $media == ipad-landscape {
|
17
|
-
@media only screen and (max-width: 1024px) { @content }
|
1
|
+
@mixin eventifier-respond-to($media) {
|
2
|
+
@if $media == desktop {
|
3
|
+
@media only screen and (min-width: 460px) { @content }
|
18
4
|
}
|
19
5
|
}
|
20
6
|
|
21
|
-
.
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
position: absolute;
|
47
|
-
top: -5px;
|
48
|
-
right: -5px;
|
49
|
-
padding: 3px 6px;
|
50
|
-
background: red;
|
51
|
-
color: white;
|
52
|
-
border: 1px solid black;
|
53
|
-
box-shadow: 0 1px 1px rgba(black, 0.4);
|
54
|
-
text-shadow: 0 1px 1px rgba(black, 0.4);
|
55
|
-
font-size: 11px;
|
56
|
-
text-indent: 0;
|
57
|
-
line-height: 1;
|
58
|
-
}
|
7
|
+
.pull-right { float: right; }
|
8
|
+
|
9
|
+
.notifications-header {
|
10
|
+
padding: 15px;
|
11
|
+
background: white;
|
12
|
+
}
|
13
|
+
.notifications-heading {
|
14
|
+
font: bold 16px inherit;
|
15
|
+
}
|
16
|
+
|
17
|
+
#notifications-dropdown {
|
18
|
+
position: fixed;
|
19
|
+
width: 100%;
|
20
|
+
border: 1px solid gray;
|
21
|
+
top: 0;
|
22
|
+
left: 0;
|
23
|
+
right: 0;
|
24
|
+
bottom: 0;
|
25
|
+
z-index: 10020;
|
26
|
+
&:focus { outline: none }
|
27
|
+
@include eventifier-respond-to(desktop) {
|
28
|
+
width: 420px;
|
29
|
+
left: auto;
|
30
|
+
right: 15px;
|
31
|
+
bottom: 20px;
|
59
32
|
}
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
33
|
+
}
|
34
|
+
#notifications-dropdown { display: none }
|
35
|
+
#notifications-dropdown.notifications-active { display: block }
|
36
|
+
|
37
|
+
.notifications-toggle { position: relative; }
|
38
|
+
.notifications-alert {
|
39
|
+
top: 10px;
|
40
|
+
right: -2px;
|
41
|
+
padding: 0;
|
42
|
+
width: 18px;
|
43
|
+
height: 18px;
|
44
|
+
background: #ff535f;
|
45
|
+
font-size: 12px;
|
46
|
+
line-height: 16px;
|
47
|
+
border-radius: 50%;
|
48
|
+
text-align: center;
|
49
|
+
}
|
50
|
+
.notifications-alert { display: none; }
|
51
|
+
.notifications-alerting .notifications-alert { display: block; }
|
52
|
+
|
53
|
+
.notifications-list-pane, .notifications-settings-pane {
|
54
|
+
overflow: scroll;
|
55
|
+
height: 100%;
|
56
|
+
}
|
57
|
+
.notifications-list {
|
58
|
+
margin: 0;
|
59
|
+
padding: 0;
|
60
|
+
list-style: none;
|
61
|
+
&:focus { outline: none }
|
62
|
+
li {
|
65
63
|
padding: 0;
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
background-color: #f2f2f2;
|
70
|
-
strong {
|
71
|
-
display: block;
|
72
|
-
font-size: 13px;
|
73
|
-
padding: 5px 5px 10px;
|
74
|
-
}
|
75
|
-
label {
|
64
|
+
background: #f9f9f9;
|
65
|
+
&.unread a, a:focus { background-color: white; }
|
66
|
+
a {
|
76
67
|
display: block;
|
77
|
-
|
78
|
-
font
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
float: left;
|
83
|
-
margin-left: -25px;
|
84
|
-
}
|
68
|
+
padding: 15px;
|
69
|
+
font: 13px/1.2 $font_regular;
|
70
|
+
overflow: hidden;
|
71
|
+
color: inherit;
|
72
|
+
&:hover { text-decoration: none; }
|
85
73
|
}
|
86
|
-
&.disabled label:not([for='email_settings_default']) { opacity: 0.5; }
|
87
|
-
.buttons { text-align: center; }
|
88
74
|
}
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
#
|
94
|
-
|
95
|
-
|
96
|
-
width: 290px;
|
97
|
-
outline: none;
|
98
|
-
z-index: 100;
|
99
|
-
top: 44px;
|
100
|
-
right: -50px;
|
101
|
-
border: 2px solid #d9d9d9;
|
102
|
-
border-radius: 2px;
|
103
|
-
@include box-shadow(inset 0px 1px 0px #475560, 0px 0px 15px rgba(0,0,0,.23));
|
104
|
-
@include transition(all .1s ease-out);
|
105
|
-
&:before {
|
106
|
-
content: '';
|
107
|
-
position: absolute;
|
108
|
-
top: -8px;
|
109
|
-
right: 60px;
|
110
|
-
background: #fff;
|
111
|
-
width: 14px;
|
112
|
-
height: 14px;
|
113
|
-
@include transform(rotate(45deg));
|
114
|
-
box-shadow: -1px -1px 1px rgba(black, .2);
|
115
|
-
@include respond-to(iphone-landscape) { display: none }
|
116
|
-
}
|
117
|
-
&.left_nipple:before { left: 30px; right: auto; }
|
118
|
-
header {
|
119
|
-
margin: 0;
|
120
|
-
padding: 5px;
|
121
|
-
background: white;
|
122
|
-
h4 {
|
123
|
-
margin: 0;
|
124
|
-
font-weight: bold;
|
125
|
-
font-size: 12px;
|
126
|
-
line-height: 1.3;
|
127
|
-
}
|
128
|
-
a.toggle_settings {
|
129
|
-
float: right;
|
130
|
-
font-size: 11px;
|
131
|
-
}
|
132
|
-
}
|
133
|
-
ol {
|
134
|
-
display: block;
|
135
|
-
margin: 0;
|
136
|
-
padding: 0;
|
137
|
-
width: 100%;
|
138
|
-
max-height:380px;
|
139
|
-
overflow: auto;
|
140
|
-
list-style: none;
|
141
|
-
background-color: #f2f2f2;
|
142
|
-
li {
|
143
|
-
display: block;
|
144
|
-
margin: 0;
|
145
|
-
padding: 5px;
|
146
|
-
font-size: 11px;
|
147
|
-
border-top: 1px solid white;
|
148
|
-
border-bottom: 1px solid #e5e5e5;
|
149
|
-
&.unread { background-color: #d3d3d3; }
|
150
|
-
a {
|
151
|
-
display: block;
|
152
|
-
overflow: visible;
|
153
|
-
padding-left: 38px;
|
154
|
-
word-break: break-all;
|
155
|
-
}
|
156
|
-
img.avatar {
|
157
|
-
float: left;
|
158
|
-
margin-left: -35px;
|
159
|
-
width: 28px;
|
160
|
-
height: 28px;
|
161
|
-
}
|
162
|
-
}
|
163
|
-
}
|
164
|
-
}
|
165
|
-
&.notifications_active #notification_dropdown {
|
75
|
+
}
|
76
|
+
|
77
|
+
.notifications-settings-pane {
|
78
|
+
display: none;
|
79
|
+
background-color: #f2f2f2;
|
80
|
+
fieldset { display: block; }
|
81
|
+
label {
|
166
82
|
display: block;
|
83
|
+
margin-bottom: 15px;
|
84
|
+
padding-left: 35px;
|
85
|
+
input {
|
86
|
+
float: left;
|
87
|
+
margin-left: -25px;
|
88
|
+
}
|
167
89
|
}
|
90
|
+
&.disabled label:not([for='email_settings_default']) { opacity: 0.5; }
|
91
|
+
.notifications-settings-buttons { text-align: center; }
|
168
92
|
}
|
93
|
+
.notifications-show-settings {
|
94
|
+
.notifications-list-pane { display: none; }
|
95
|
+
.notifications-settings-pane { display: block; }
|
96
|
+
}
|
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.
|
4
|
+
s.version = '0.2.0'
|
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"
|
@@ -19,7 +19,6 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.add_runtime_dependency 'rails', '>= 4.0.3'
|
20
20
|
s.add_runtime_dependency "bson_ext"
|
21
21
|
s.add_runtime_dependency 'haml-rails', '~> 0.4'
|
22
|
-
s.add_runtime_dependency 'haml_coffee_assets'
|
23
22
|
s.add_runtime_dependency 'coffee-rails', '~> 4.0.0'
|
24
23
|
s.add_runtime_dependency 'compass-rails'
|
25
24
|
s.add_runtime_dependency 'multi_json', '>= 1.7.4'
|
@@ -74,8 +74,8 @@ describe Eventifier::Preferences do
|
|
74
74
|
|
75
75
|
it "updates the user's email preferences" do
|
76
76
|
preferences.update(
|
77
|
-
'create_posts_notify_readers' => '',
|
78
|
-
'create_comments_notify_post_readers' => '0'
|
77
|
+
'create_posts_notify_readers' => 'enabled',
|
78
|
+
'create_comments_notify_post_readers' => '0',
|
79
79
|
)
|
80
80
|
|
81
81
|
expect(
|
@@ -86,6 +86,16 @@ describe Eventifier::Preferences do
|
|
86
86
|
).to be_falsey
|
87
87
|
end
|
88
88
|
|
89
|
+
it 'handles false as false' do
|
90
|
+
preferences.update(
|
91
|
+
'create_posts_notify_readers' => false
|
92
|
+
)
|
93
|
+
|
94
|
+
expect(
|
95
|
+
settings.preferences['email']['create_posts_notify_readers']
|
96
|
+
).to be_falsey
|
97
|
+
end
|
98
|
+
|
89
99
|
it "sets everything to false if no preferences are supplied" do
|
90
100
|
preferences.update({})
|
91
101
|
|
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Sampimon
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-10-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -54,20 +54,6 @@ dependencies:
|
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '0.4'
|
57
|
-
- !ruby/object:Gem::Dependency
|
58
|
-
name: haml_coffee_assets
|
59
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
-
requirements:
|
61
|
-
- - ">="
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: '0'
|
64
|
-
type: :runtime
|
65
|
-
prerelease: false
|
66
|
-
version_requirements: !ruby/object:Gem::Requirement
|
67
|
-
requirements:
|
68
|
-
- - ">="
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: '0'
|
71
57
|
- !ruby/object:Gem::Dependency
|
72
58
|
name: coffee-rails
|
73
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -224,8 +210,8 @@ files:
|
|
224
210
|
- app/assets/images/eventifier/notifications-bell.png
|
225
211
|
- app/assets/images/eventifier/notifications-tower.png
|
226
212
|
- app/assets/javascripts/eventifier/notifications.coffee
|
227
|
-
- app/assets/javascripts/eventifier/templates/dropdown.
|
228
|
-
- app/assets/javascripts/eventifier/templates/settings.
|
213
|
+
- app/assets/javascripts/eventifier/templates/dropdown.jst.ejs
|
214
|
+
- app/assets/javascripts/eventifier/templates/settings.jst.ejs
|
229
215
|
- app/assets/stylesheets/eventifier/notifications.scss
|
230
216
|
- app/helpers/eventifier/notification_helper.rb
|
231
217
|
- app/helpers/eventifier/path_helper.rb
|
@@ -1,10 +0,0 @@
|
|
1
|
-
%a.toggle_dropdown{ href: "#" }
|
2
|
-
View Notifications
|
3
|
-
%span.notification_alert
|
4
|
-
#notification_dropdown
|
5
|
-
%header
|
6
|
-
%a.toggle_settings{ href: '#' } Settings
|
7
|
-
%h4 Notifications
|
8
|
-
%ol.notifications_dropdown_list
|
9
|
-
%li.none You have no notifications
|
10
|
-
#settings_pane
|
@@ -1,11 +0,0 @@
|
|
1
|
-
%form#email_notification_settings
|
2
|
-
|
3
|
-
%strong Receive emails for:
|
4
|
-
|
5
|
-
- for i, setting of @
|
6
|
-
%label{ for: "email_settings_#{setting.key}" }
|
7
|
-
%input{ type: 'checkbox', checked: setting.value, id: "email_settings_#{setting.key}", name: setting.key, value: setting.value }
|
8
|
-
= setting.label
|
9
|
-
|
10
|
-
.buttons
|
11
|
-
%button.save_settings Save
|