rack-push-notification 0.2.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +1 -1
  3. data/Gemfile.lock +12 -50
  4. data/README.md +0 -15
  5. data/lib/rack/push-notification.rb +15 -9
  6. data/lib/rack/push-notification/migrations/001_base_schema.rb +4 -4
  7. data/lib/rack/push-notification/migrations/002_add_full_text_search.rb +9 -16
  8. data/lib/rack/push-notification/{device.rb → models/device.rb} +7 -10
  9. data/rack-push-notification-0.3.0.gem +0 -0
  10. data/rack-push-notification-0.3.1.gem +0 -0
  11. data/rack-push-notification.gemspec +3 -11
  12. metadata +47 -144
  13. data/lib/rack/push-notification/admin.rb +0 -140
  14. data/lib/rack/push-notification/assets/images/wallpaper-clown-fish.jpg +0 -0
  15. data/lib/rack/push-notification/assets/javascripts/application.coffee +0 -28
  16. data/lib/rack/push-notification/assets/javascripts/collections/devices.coffee +0 -29
  17. data/lib/rack/push-notification/assets/javascripts/models/device.coffee +0 -2
  18. data/lib/rack/push-notification/assets/javascripts/routers/root.coffee +0 -30
  19. data/lib/rack/push-notification/assets/javascripts/rpn.coffee +0 -14
  20. data/lib/rack/push-notification/assets/javascripts/templates/_devices.jst.eco +0 -23
  21. data/lib/rack/push-notification/assets/javascripts/templates/_preview.jst.eco +0 -24
  22. data/lib/rack/push-notification/assets/javascripts/templates/compose.jst.eco +0 -46
  23. data/lib/rack/push-notification/assets/javascripts/templates/devices.jst.eco +0 -12
  24. data/lib/rack/push-notification/assets/javascripts/templates/pagination.jst.eco +0 -12
  25. data/lib/rack/push-notification/assets/javascripts/vendor/backbone.js +0 -1431
  26. data/lib/rack/push-notification/assets/javascripts/vendor/backbone.paginator.js +0 -833
  27. data/lib/rack/push-notification/assets/javascripts/vendor/codemirror.javascript.js +0 -411
  28. data/lib/rack/push-notification/assets/javascripts/vendor/codemirror.js +0 -3047
  29. data/lib/rack/push-notification/assets/javascripts/vendor/date.js +0 -104
  30. data/lib/rack/push-notification/assets/javascripts/vendor/jquery.js +0 -9404
  31. data/lib/rack/push-notification/assets/javascripts/vendor/underscore.js +0 -1059
  32. data/lib/rack/push-notification/assets/javascripts/views/compose.coffee +0 -120
  33. data/lib/rack/push-notification/assets/javascripts/views/devices.coffee +0 -23
  34. data/lib/rack/push-notification/assets/javascripts/views/pagination.coffee +0 -29
  35. data/lib/rack/push-notification/assets/stylesheets/_codemirror.sass +0 -219
  36. data/lib/rack/push-notification/assets/stylesheets/_preview.sass +0 -148
  37. data/lib/rack/push-notification/assets/stylesheets/screen.sass +0 -108
  38. data/lib/rack/push-notification/assets/views/index.haml +0 -26
  39. data/lib/rack/push-notification/version.rb +0 -5
@@ -1,120 +0,0 @@
1
- class RPN.Views.Compose extends Backbone.View
2
- template: JST['templates/compose']
3
- partial: JST['templates/_preview']
4
- el: "[role='main']"
5
-
6
- events:
7
- 'submit form': 'submit'
8
- 'click button#send': 'submit'
9
- 'keyup textarea': 'updatePreview'
10
- 'focus textarea': ->
11
- @$el.find("input[type=radio][value=selected]").prop('checked',true)
12
-
13
- initialize: ->
14
- window.setInterval(@updateTime, 10000)
15
-
16
- render: ->
17
- @$el.html(@template())
18
-
19
- @editor = CodeMirror.fromTextArea(document.getElementById("payload"), {
20
- mode: "application/json",
21
- theme: "solarized-dark",
22
- tabMode: "indent",
23
- lineNumbers : true,
24
- matchBrackets: true
25
- })
26
-
27
- @updatePreview()
28
- @updateTime()
29
-
30
- $.ajax("/message"
31
- type: "HEAD"
32
-
33
- error: (data, status) =>
34
- @disable()
35
- )
36
- @
37
-
38
- submit: ->
39
- console.log("submit!")
40
- $form = @$el.find("form#compose")
41
- payload = @editor.getValue()
42
-
43
- tokens = undefined
44
- if $("input[name='recipients']:checked").val() == "specified"
45
- tokens = [$form.find("#tokens").val()]
46
-
47
- $.ajax("/message"
48
- type: "POST"
49
- dataType: "json"
50
- data: {
51
- tokens: tokens,
52
- payload: payload
53
- }
54
- )
55
-
56
- beforeSend: =>
57
- @$el.find(".alert-error, .alert-success").remove()
58
-
59
- success: (data, status) =>
60
- alert = """
61
- <div class="alert alert-block alert-success">
62
- <button type="button" class="close" data-dismiss="alert">×</button>
63
- <h4>Push Notification Succeeded</h4>
64
- </div>
65
- """
66
- @$el.prepend(alert)
67
-
68
- error: (data, status) =>
69
- alert = """
70
- <div class="alert alert-block alert-error">
71
- <button type="button" class="close" data-dismiss="alert">×</button>
72
- <h4>Push Notification Failed</h4>
73
- <p>#{$.parseJSON(data.responseText).error}</p>
74
- </div>
75
- """
76
- @$el.prepend(alert)
77
-
78
-
79
- disable: ->
80
- alert = """
81
- <div class="alert alert-block">
82
- <button type="button" class="close" data-dismiss="alert">×</button>
83
- <h4>Push Notification Sending Unavailable</h4>
84
- <p>Check that Rack::PushNotification initializes with a <tt>:certificate</tt> parameter, and that the certificate exists and is readable in the location specified.</p>
85
- </div>
86
- """
87
-
88
- @$el.prepend(alert)
89
-
90
- $(".iphone").css(opacity: 0.5)
91
-
92
- $form = @$el.find("form#compose")
93
- $form.css(opacity: 0.5)
94
- $form.find("input").disable()
95
-
96
- updatePreview: ->
97
- @$el.find(".preview").html(@partial())
98
-
99
- try
100
- json = $.parseJSON(@editor.getValue())
101
- if alert = json.aps.alert
102
- $(".preview p").text(alert)
103
-
104
- catch error
105
- $(".alert strong").text(error.name)
106
- $(".alert span").text(error.message)
107
- finally
108
- if alert? and alert.length > 0
109
- $(".notification").show()
110
- $(".alert").hide()
111
- else
112
- $(".notification").hide()
113
- $(".alert").show()
114
-
115
- updateTime: ->
116
- $time = $("time")
117
- $time.attr("datetime", Date.now().toISOString())
118
- $time.find(".time").text(Date.now().toString("HH:mm"))
119
- $time.find(".date").text(Date.now().toString("dddd, MMMM d"))
120
-
@@ -1,23 +0,0 @@
1
- class RPN.Views.Devices extends Backbone.View
2
- template: JST['templates/devices']
3
- partial: JST['templates/_devices']
4
- el: "[role='main']"
5
-
6
- events:
7
- 'keyup form.filter input': 'filter'
8
-
9
- initialize: ->
10
- @collection.on 'reset', =>
11
- @$el.find("table").html(@partial(devices: @collection))
12
-
13
- render: ->
14
- @$el.html(@template(devices: @collection))
15
-
16
- @paginationView = new RPN.Views.Pagination(collection: @collection)
17
- @paginationView.render()
18
- @
19
-
20
- filter: (e) ->
21
- e.preventDefault()
22
- @collection.query = $(e.target).val()
23
- @collection.fetch()
@@ -1,29 +0,0 @@
1
- class RPN.Views.Pagination extends Backbone.View
2
- template: JST['templates/pagination']
3
- el: ".pagination"
4
-
5
- events:
6
- 'click a.previous': 'gotoPrevious'
7
- 'click a.next': 'gotoNext'
8
- 'click a.page': 'gotoPage'
9
-
10
- initialize: ->
11
- @collection.on 'reset', =>
12
- @render()
13
-
14
- render: ->
15
- @$el.html(@template(devices: @collection))
16
- @
17
-
18
- gotoPrevious: (e) ->
19
- e.preventDefault()
20
- @collection.requestPreviousPage() unless $(e.target).parent().hasClass("disabled")
21
-
22
- gotoNext: (e) ->
23
- e.preventDefault()
24
- @collection.requestNextPage() unless $(e.target).parent().hasClass("disabled")
25
-
26
- gotoPage: (e) ->
27
- e.preventDefault()
28
- page = $(e.target).text()
29
- @collection.goTo(page)
@@ -1,219 +0,0 @@
1
- .CodeMirror
2
- @extend .span7
3
- float: left
4
- +meslo-font-stack
5
-
6
- .CodeMirror-scroll
7
- +border-radius(5px)
8
-
9
- overflow: auto
10
- height: 200px
11
- // This is needed to prevent an IE[67] bug where the scrolled content
12
- // is visible outside of the scrolling box.
13
- position: relative
14
- border: 1px #ccc solid
15
- margin-bottom: 20px
16
- @extend .span7
17
-
18
- .CodeMirror-gutter
19
- +border-left-radius(5px)
20
-
21
- position: absolute
22
- left: 0
23
- top: 0
24
- z-index: 10
25
- min-width: 2em
26
- height: 100%
27
- padding-right: 15px
28
- margin-right: 10px
29
- border-right: 1px #ccc solid
30
-
31
- .CodeMirror-gutter-text
32
- color: #aaa
33
- text-align: right
34
- padding: .4em .2em .4em .4em
35
- white-space: pre !important
36
-
37
- .CodeMirror-lines
38
- padding: .4em
39
- white-space: pre
40
-
41
- .CodeMirror pre
42
- -moz-border-radius: 0
43
- -webkit-border-radius: 0
44
- -o-border-radius: 0
45
- border-radius: 0
46
- border-width: 0
47
- margin: 0
48
- padding: 0
49
- background: transparent
50
- font-family: inherit
51
- font-size: inherit
52
- padding: 0
53
- margin: 0
54
- white-space: pre
55
- word-wrap: normal
56
- line-height: inherit
57
- color: inherit
58
-
59
- .CodeMirror-wrap
60
- pre
61
- word-wrap: break-word
62
- white-space: pre-wrap
63
- word-break: normal
64
- .CodeMirror-scroll
65
- overflow-x: hidden
66
-
67
- .CodeMirror
68
- textarea
69
- outline: none !important
70
- pre.CodeMirror-cursor
71
- z-index: 10
72
- position: absolute
73
- visibility: hidden
74
- border-left: 1px solid black
75
- border-right: none
76
- width: 0
77
-
78
- .cm-keymap-fat-cursor pre.CodeMirror-cursor
79
- width: auto
80
- border: 0
81
- background: transparent
82
- background: rgba(0, 200, 0, 0.4)
83
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800, endColorstr=#4c00c800)
84
- &:not(#nonsense_id)
85
- filter: progid:DXImageTransform.Microsoft.gradient(enabled=false)
86
-
87
- // .CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite
88
-
89
- .CodeMirror-focused pre.CodeMirror-cursor
90
- visibility: visible
91
-
92
- div.CodeMirror-selected
93
- background: #d9d9d9
94
-
95
- .CodeMirror-focused div.CodeMirror-selected
96
- background: #d7d4f0
97
-
98
- .CodeMirror-searching
99
- background: #ffa
100
- background: rgba(255, 255, 0, 0.4)
101
-
102
- /* Default theme
103
-
104
- .cm-s-default span
105
- &.cm-keyword
106
- color: #708
107
- &.cm-atom
108
- color: #219
109
- &.cm-number
110
- color: #164
111
- &.cm-def
112
- color: #00f
113
- &.cm-variable
114
- color: black
115
- &.cm-variable-2
116
- color: #05a
117
- &.cm-variable-3
118
- color: #085
119
- &.cm-property, &.cm-operator
120
- color: black
121
- &.cm-comment
122
- color: #a50
123
- &.cm-string
124
- color: #a11
125
- &.cm-string-2
126
- color: #f50
127
- &.cm-meta
128
- color: #555
129
- &.cm-error
130
- color: #f00
131
- &.cm-qualifier
132
- color: #555
133
- &.cm-builtin
134
- color: #30a
135
- &.cm-bracket
136
- color: #cc7
137
- &.cm-tag
138
- color: #170
139
- &.cm-attribute
140
- color: #00c
141
- &.cm-header
142
- color: blue
143
- &.cm-quote
144
- color: #090
145
- &.cm-hr
146
- color: #999
147
- &.cm-link
148
- color: #00c
149
-
150
- span
151
- &.cm-header, &.cm-strong
152
- font-weight: bold
153
- &.cm-em
154
- font-style: italic
155
- &.cm-emstrong
156
- font-style: italic
157
- font-weight: bold
158
- &.cm-link
159
- text-decoration: underline
160
-
161
- div.CodeMirror span
162
- &.CodeMirror-matchingbracket
163
- color: #0f0
164
- &.CodeMirror-nonmatchingbracket
165
- color: #f22
166
-
167
- // Solarized (dark) theme
168
-
169
- .cm-s-solarized-dark
170
- color: #839496
171
- div.CodeMirror-selected
172
- background: #586e75
173
- .CodeMirror-gutter,
174
- .CodeMirror-gutter-text,
175
- .CodeMirror-cursor
176
- border-left: 1px solid #839496
177
- span
178
- &.cm-keyword
179
- color: #268bd2
180
- &.cm-atom
181
- color: #b58900
182
- &.cm-number
183
- color: #2aa198
184
- &.cm-def, &.cm-variable
185
- color: #839496
186
- &.cm-variable-2
187
- color: #b58900
188
- &.cm-variable-3
189
- color: #268bd2
190
- &.cm-property
191
- color: #859900
192
- &.cm-operator
193
- color: #2aa198
194
- &.cm-comment
195
- color: #586e75
196
- &.cm-string, &.cm-string-2
197
- color: #2aa198
198
- &.cm-meta
199
- color: #586e75
200
- &.cm-error
201
- color: #dc322f
202
- &.cm-qualifier
203
- color: #268bd2
204
- &.cm-builtin
205
- color: #b58900
206
- &.cm-bracket
207
- color: #dc322f
208
- &.cm-tag
209
- color: #268bd2
210
- &.cm-attribute
211
- color: #839496
212
- &.cm-header
213
- color: #cb4b16
214
- &.cm-quote
215
- color: #586e75
216
- &.cm-hr
217
- color: #cb4b16
218
- &.cm-link
219
- color: #6c71c4
@@ -1,148 +0,0 @@
1
- .alert
2
- @extend .span6
3
-
4
- .message .span7
5
- float: left
6
-
7
- figure.iphone
8
- float: right
9
- padding: 0
10
- margin: 0
11
- width: 320px
12
- height: 480px
13
- background: #444 url("/images/wallpaper-clown-fish.jpg")
14
- position: relative
15
- margin-bottom: 20px
16
-
17
- figure
18
- padding: 0
19
- margin: 0
20
-
21
- header
22
- .status
23
- height: 20px
24
- background: #000
25
- color: #ccc
26
- width: 100%
27
- font-size: 14px
28
-
29
- .signal
30
- margin-left: 5px
31
-
32
- .battery
33
- float: right
34
- margin-right: 5px
35
- display: none
36
-
37
- time
38
- +background-image(linear-gradient(top, transparentize(#fff, 0.7), transparentize(#000, 0.6) 50%, transparentize(#000, 0.5) 51%, transparentize(#111, 0.3)))
39
- +box-shadow(0 1px 1px transparentize(#fff, 0.8))
40
- +text-shadow(0 1px 2px #222)
41
- color: #fff
42
- text-align: center
43
- display: block
44
- height: 98px
45
-
46
- span
47
- display: block
48
-
49
- .time
50
- font-size: 4em
51
- padding: 0.5em 0 0.375em 0
52
-
53
- .date
54
- font-size: 1em
55
-
56
- .notification
57
- +background-image(linear-gradient(top, transparentize(#fff, 0.4), transparentize(#000, 0.3) 15%, transparentize(#111, 0.3)))
58
- +border-radius(10px)
59
-
60
- width: 270px
61
- min-height: 80px
62
- max-height: 200px
63
- padding: 10px
64
- margin: 70px auto 20px auto
65
- overflow: none
66
-
67
-
68
- h1, p
69
- +text-shadow(0 1px 2px #111)
70
- color: #fff
71
- padding-left: 40px
72
- line-height: 1em
73
-
74
- h1
75
- font-size: 1em
76
- font-weight: bold
77
-
78
- footer
79
- +background-image(linear-gradient(top, transparentize(#ccc, 0.5), transparentize(#000, 0.6) 50%, transparentize(#000, 0.5) 51%, transparentize(#111, 0.3)))
80
- position: absolute
81
- bottom: 0px
82
- display: block
83
- +clearfix
84
- width: 320px
85
- height: 98px
86
- border-top: 1px transparentize(#000, 0.4) solid
87
-
88
- @-webkit-keyframes spotlight
89
- 0%
90
- -webkit-mask-position: -800px
91
- 100%
92
- -webkit-mask-position: 0px
93
-
94
- .slider
95
- width: 285px
96
- height: 46px
97
- margin-left: 10px
98
- margin-top: 20px
99
- position: relative
100
- input
101
- -webkit-appearance: none
102
- width: 100%
103
- background: #ddd
104
- padding: 3px
105
- border: 1px solid #525252
106
- -webkit-border-radius: 15px
107
- border-radius: 15px
108
- background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, black), color-stop(1, #222222))
109
-
110
- input
111
- -webkit-appearance: none
112
- width: 100%
113
- background: #ddd
114
- padding: 3px
115
- border: 1px solid #525252
116
- -webkit-border-radius: 15px
117
- border-radius: 15px
118
- background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, black), color-stop(1, #222222))
119
-
120
- .slider input::-webkit-slider-thumb, input::-webkit-slider-thumb
121
- -webkit-appearance: none
122
- z-index: 100
123
- position: relative
124
- width: 68px
125
- height: 44px
126
- -webkit-border-radius: 10px
127
- border-radius: 10px
128
- background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAAYCAYAAAB0kZQKAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAASJJREFUeNpi7OnpYaAC0AXiF0D8mhzNTAzUASBHnAdim4F0BAhIA/EBIC4aSEeAADMQ9wLxRiDmHyhHwIAfNHqMiXZEcXExGJMCiNCjCMTHgDiTkFmM////p4rXe3t78Rm0DIjTgfgLNkkWoGZQij7MQFsQBY2aICC+Rq80gQ2oA/EZIE4YSEeAACcQzwfimVD2gDgCBtKgiVZlIB0BAgbQbBwykI5A5I4BtPsaNLfcHKiQWADEJiAHDERIfAfiLKgjBiQ67kCD/zK2NAFqjMyi0AJQVnPCI78GiBNxFttQF6ZToVjG5ohfoLoOiKcMVO54BA3+swPVntgKxIbEOIAWjvgLxJVA7APE7waisHoKxBFAfGSgSszL0MLnBTmaAQIMAKg/OsrT7JG8AAAAAElFTkSuQmCC'), -webkit-gradient(linear, left top, left bottom, color-stop(0, #fefefe), color-stop(0.49, #dddddd), color-stop(0.51, #d1d1d1), color-stop(1, #a1a1a1))
129
- background-repeat: no-repeat
130
- background-position: 50%
131
-
132
- .slider span
133
- position: absolute
134
- z-index: 99
135
- top: 30%
136
- left: 37%
137
- font-family: "Helvetica Neue", Helvetica, sans-serif
138
- font-size: 24px
139
- color: white
140
- cursor: default
141
- -webkit-user-select: none
142
- -webkit-mask-image: -webkit-gradient(linear, left top, right top, color-stop(0, rgba(0, 0, 0, 0.3)), color-stop(0.45, rgba(0, 0, 0, 0.3)), color-stop(0.5, rgba(0, 0, 0, 1)), color-stop(0.55, rgba(0, 0, 0, 0.3)), color-stop(1, rgba(0, 0, 0, 0.3)))
143
- -webkit-mask-size: 1000px
144
- -webkit-mask-repeat: no-repeat
145
- -webkit-animation-timing-function: ease-in-out
146
- -webkit-animation: spotlight 4s infinite
147
-
148
-