helios 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +50 -21
- data/README.md +27 -2
- data/helios.gemspec +10 -6
- data/lib/helios.rb +10 -4
- data/lib/helios/backend.rb +29 -22
- data/lib/helios/backend/data.rb +10 -5
- data/lib/helios/backend/in-app-purchase.rb +4 -2
- data/lib/helios/backend/newsstand.rb +97 -0
- data/lib/helios/backend/passbook.rb +8 -2
- data/lib/helios/backend/push-notification.rb +25 -12
- data/lib/helios/commands/console.rb +4 -10
- data/lib/helios/commands/new.rb +0 -1
- data/lib/helios/commands/server.rb +4 -1
- data/lib/helios/frontend.rb +6 -14
- data/lib/helios/frontend/images/helios.svg +33 -0
- data/lib/helios/frontend/javascripts/helios.coffee +39 -3
- data/lib/helios/frontend/javascripts/helios/collections.coffee +10 -2
- data/lib/helios/frontend/javascripts/helios/models.coffee +4 -1
- data/lib/helios/frontend/javascripts/helios/router.coffee +13 -1
- data/lib/helios/frontend/javascripts/helios/views.coffee +82 -8
- data/lib/helios/frontend/javascripts/vendor/jquery/jquery.fileupload-ui.js +807 -0
- data/lib/helios/frontend/javascripts/vendor/jquery/jquery.fileupload.js +1201 -0
- data/lib/helios/frontend/javascripts/vendor/jquery/jquery.ui.widget.js +530 -0
- data/lib/helios/frontend/javascripts/vendor/linkheaders.js +117 -0
- data/lib/helios/frontend/stylesheets/_iphone.sass +1 -1
- data/lib/helios/frontend/stylesheets/screen.sass +2 -6
- data/lib/helios/frontend/templates/{entities.jst.tpl → data/entities.jst.tpl} +0 -0
- data/lib/helios/frontend/templates/{receipts.jst.tpl → in-app-purchase/receipts.jst.tpl} +0 -0
- data/lib/helios/frontend/templates/navigation.jst.tpl +31 -0
- data/lib/helios/frontend/templates/newsstand/issues.jst.tpl +16 -0
- data/lib/helios/frontend/templates/newsstand/new.jst.tpl +28 -0
- data/lib/helios/frontend/templates/{passes.jst.tpl → passbook/passes.jst.tpl} +0 -0
- data/lib/helios/frontend/templates/{compose.jst.tpl → push-notification/compose.jst.tpl} +0 -0
- data/lib/helios/frontend/templates/{devices.jst.tpl → push-notification/devices.jst.tpl} +0 -0
- data/lib/helios/frontend/views/index.haml +4 -28
- data/lib/helios/templates/.env.erb +1 -0
- data/lib/helios/templates/.gitignore +3 -0
- data/lib/helios/version.rb +1 -1
- metadata +86 -20
- data/lib/helios/frontend/stylesheets/_bariol.scss +0 -41
@@ -1,19 +1,25 @@
|
|
1
1
|
require 'rack/passbook'
|
2
|
+
|
3
|
+
require 'sinatra/base'
|
2
4
|
require 'sinatra/param'
|
3
5
|
|
4
6
|
class Helios::Backend::Passbook < Sinatra::Base
|
5
7
|
helpers Sinatra::Param
|
6
8
|
|
7
|
-
def initialize(app, options = {})
|
9
|
+
def initialize(app, options = {}, &block)
|
8
10
|
super(Rack::Passbook.new)
|
9
11
|
end
|
10
12
|
|
13
|
+
before do
|
14
|
+
content_type :json
|
15
|
+
end
|
16
|
+
|
11
17
|
get '/passes' do
|
12
18
|
param :q, String
|
13
19
|
|
14
20
|
passes = Rack::Passbook::Pass.dataset
|
15
21
|
passes = passes.filter("tsv @@ to_tsquery('english', ?)", "#{params[:q]}:*") if params[:q] and not params[:q].empty?
|
16
|
-
|
22
|
+
|
17
23
|
if params[:page] or params[:per_page]
|
18
24
|
param :page, Integer, default: 1, min: 1
|
19
25
|
param :per_page, Integer, default: 100, in: (1..100)
|
@@ -1,11 +1,23 @@
|
|
1
1
|
require 'rack/push-notification'
|
2
|
+
|
3
|
+
require 'sinatra/base'
|
2
4
|
require 'sinatra/param'
|
3
5
|
|
6
|
+
require 'houston'
|
7
|
+
|
4
8
|
class Helios::Backend::PushNotification < Sinatra::Base
|
5
|
-
helpers Sinatra::Param
|
9
|
+
helpers Sinatra::Param
|
10
|
+
attr_reader :apn_certificate, :apn_environment
|
6
11
|
|
7
|
-
def initialize(app, options = {})
|
12
|
+
def initialize(app, options = {}, &block)
|
8
13
|
super(Rack::PushNotification.new)
|
14
|
+
|
15
|
+
@apn_certificate = options[:apn_certificate] || ENV['APN_CERTIFICATE']
|
16
|
+
@apn_environment = options[:apn_environment] || ENV['APN_ENVIRONMENT']
|
17
|
+
end
|
18
|
+
|
19
|
+
before do
|
20
|
+
content_type :json
|
9
21
|
end
|
10
22
|
|
11
23
|
get '/devices/?' do
|
@@ -79,16 +91,17 @@ class Helios::Backend::PushNotification < Sinatra::Base
|
|
79
91
|
|
80
92
|
def client
|
81
93
|
begin
|
82
|
-
return nil unless
|
83
|
-
|
84
|
-
client = case
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
94
|
+
return nil unless apn_certificate and ::File.exist?(apn_certificate)
|
95
|
+
|
96
|
+
client = case apn_environment.to_sym
|
97
|
+
when :development
|
98
|
+
Houston::Client.development
|
99
|
+
when :production
|
100
|
+
Houston::Client.production
|
101
|
+
end
|
102
|
+
|
103
|
+
client.certificate = ::File.read(apn_certificate)
|
104
|
+
|
92
105
|
return client
|
93
106
|
rescue
|
94
107
|
return nil
|
@@ -6,19 +6,13 @@ command :console do |c|
|
|
6
6
|
require 'irb'
|
7
7
|
require 'dotenv'
|
8
8
|
require 'sequel'
|
9
|
-
|
10
|
-
@env = {}
|
11
|
-
@env.update Dotenv::Environment.new(".env")
|
12
|
-
|
13
|
-
Sequel.connect(@env['DATABASE_URL'])
|
14
|
-
|
15
|
-
require 'rack/core-data'
|
16
|
-
require 'rack/push-notification'
|
17
|
-
require 'rack/in-app-purchase'
|
18
|
-
require 'rack/passbook'
|
9
|
+
require 'helios'
|
19
10
|
|
20
11
|
include Rack
|
21
12
|
|
13
|
+
Dotenv.load
|
14
|
+
Sequel.connect(ENV['DATABASE_URL'])
|
15
|
+
|
22
16
|
ARGV.clear
|
23
17
|
IRB.start
|
24
18
|
end
|
data/lib/helios/commands/new.rb
CHANGED
@@ -28,6 +28,10 @@ def validate_database_settings!
|
|
28
28
|
|
29
29
|
say_error "DATABASE_URL environment variable not set in .env or in Rails config/database.yml" and abort if ENV['DATABASE_URL'].nil?
|
30
30
|
|
31
|
+
uri = URI(ENV['DATABASE_URL'])
|
32
|
+
|
33
|
+
say_error "DATABASE_URL environment variable not set to PostgreSQL database" and abort unless ["postgres", "postgresql"].include?(uri.scheme)
|
34
|
+
|
31
35
|
begin
|
32
36
|
db = Sequel.connect(ENV['DATABASE_URL'])
|
33
37
|
db.test_connection
|
@@ -36,7 +40,6 @@ def validate_database_settings!
|
|
36
40
|
case error.message
|
37
41
|
when /database "(.+)" does not exist/
|
38
42
|
if agree "Would you like to create this database now? (y/n)"
|
39
|
-
uri = URI(db.uri)
|
40
43
|
host, database = uri.host, uri.path.delete("/")
|
41
44
|
|
42
45
|
log 'createdb', database
|
data/lib/helios/frontend.rb
CHANGED
@@ -26,6 +26,9 @@ module Helios
|
|
26
26
|
|
27
27
|
js :application, '/javascripts/application.js', [
|
28
28
|
'javascripts/vendor/jquery.js',
|
29
|
+
'javascripts/vendor/jquery/jquery.ui.widget.js',
|
30
|
+
'javascripts/vendor/jquery/jquery.fileupload.js',
|
31
|
+
'javascripts/vendor/jquery/jquery.fileupload-ui.js',
|
29
32
|
'javascripts/vendor/underscore.js',
|
30
33
|
'javascripts/vendor/backbone.js',
|
31
34
|
'javascripts/vendor/backbone.paginator.js',
|
@@ -35,8 +38,8 @@ module Helios
|
|
35
38
|
'javascripts/vendor/foundation.js',
|
36
39
|
'javascripts/vendor/foundation/foundation.dropdown.js',
|
37
40
|
'javascripts/vendor/foundation/foundation.reveal.js',
|
38
|
-
'javascripts/vendor/foundation/*',
|
39
41
|
'javascripts/vendor/date.js',
|
42
|
+
'javascripts/vendor/linkheaders.js',
|
40
43
|
'javascripts/helios.js',
|
41
44
|
'javascripts/helios/models.js',
|
42
45
|
'javascripts/helios/collections.js',
|
@@ -50,25 +53,14 @@ module Helios
|
|
50
53
|
]
|
51
54
|
end
|
52
55
|
|
53
|
-
|
54
|
-
serve_jst '/javascripts/helios/templates.js'
|
56
|
+
serve_jst '/javascripts/helios/templates.js', root: settings.root + '/templates'
|
55
57
|
|
56
58
|
get '' do
|
57
59
|
redirect request.fullpath + "/"
|
58
60
|
end
|
59
61
|
|
60
62
|
get '/' do
|
61
|
-
haml :
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
module Sinatra
|
67
|
-
module AssetPack
|
68
|
-
class Package
|
69
|
-
def production_path
|
70
|
-
add_cache_buster(@path, *files).gsub(/^\//, "")
|
71
|
-
end
|
63
|
+
haml :index
|
72
64
|
end
|
73
65
|
end
|
74
66
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
3
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
4
|
+
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
5
|
+
width="200px" height="100px" viewBox="0 0 200 100" enable-background="new 0 0 200 100" xml:space="preserve">
|
6
|
+
<g>
|
7
|
+
<path fill="#BFBC3D" d="M11.75,44.979c1.637-2.497,5.251-5.166,11.019-5.166c11.708,0,14.463,7.49,14.463,14.982v21.518
|
8
|
+
c0,2.587-2.065,4.477-4.647,4.477c-2.757,0-4.649-1.89-4.649-4.477V56.515c0-4.908-1.98-8.265-7.575-8.265
|
9
|
+
c-6.458,0-8.61,3.788-8.61,8.869v19.193c0,2.587-1.98,4.477-4.647,4.477c-2.669,0-4.65-1.89-4.65-4.477V23.457
|
10
|
+
c0-2.582,2.065-4.649,4.65-4.649c2.582,0,4.647,2.068,4.647,4.649V44.979z"/>
|
11
|
+
<path fill="#BFBC3D" d="M62.28,39.813c14.548,0,17.216,11.192,17.216,17.13c0,3.186,0,6.889-5.251,6.889H52.98
|
12
|
+
c0,6.196,4.392,9.041,10.074,9.041c3.788,0,6.455-1.296,8.522-2.67c0.945-0.604,1.635-0.949,2.755-0.949
|
13
|
+
c2.239,0,4.046,1.808,4.046,4.048c0,1.379-0.689,2.494-1.464,3.186c-1.464,1.379-6.026,4.735-13.859,4.735
|
14
|
+
c-11.967,0-19.372-6.459-19.372-20.835C43.683,47.217,50.571,39.813,62.28,39.813z M53.238,56.086h17.048
|
15
|
+
c0-4.221-2.412-8.352-8.006-8.352C57.286,47.734,53.669,50.574,53.238,56.086z"/>
|
16
|
+
<path fill="#BFBC3D" d="M95.676,23.457v47.175c0,1.033,1.033,1.55,1.637,1.55c2.409,0,4.304,1.895,4.304,4.306
|
17
|
+
c0,2.412-1.895,4.302-4.304,4.302c-6.715,0-10.934-3.785-10.934-11.019V23.457c0-2.582,2.066-4.649,4.647-4.649
|
18
|
+
C93.611,18.807,95.676,20.875,95.676,23.457z"/>
|
19
|
+
<path fill="#BFBC3D" d="M106.433,30.257c0-3.96,1.982-5.683,5.51-5.683c3.615,0,5.598,1.722,5.598,5.683
|
20
|
+
c0,3.356-1.982,5.424-5.598,5.424C108.415,35.682,106.433,33.614,106.433,30.257z M116.595,76.142c0,2.582-2.07,4.647-4.652,4.647
|
21
|
+
s-4.647-2.065-4.647-4.647V44.979c0-2.584,2.065-4.65,4.647-4.65s4.652,2.065,4.652,4.65V76.142z"/>
|
22
|
+
<path fill="#BFBC3D" d="M142.248,81.223c-11.623,0-18.857-6.63-18.857-20.664c0-14.116,7.234-20.746,18.857-20.746
|
23
|
+
c11.618,0,18.853,6.63,18.853,20.746C161.101,74.593,153.866,81.223,142.248,81.223z M142.248,47.734
|
24
|
+
c-6.201,0-9.471,4.304-9.471,12.825c0,8.437,3.27,12.743,9.471,12.743c6.196,0,9.47-4.307,9.47-12.743
|
25
|
+
C151.718,52.038,148.444,47.734,142.248,47.734z"/>
|
26
|
+
<path fill="#BFBC3D" d="M176.675,51.176c0,6.372,21.177,3.444,21.177,17.649c0,8.091-6.884,12.223-15.754,12.223
|
27
|
+
c-7.4,0-13.085-3.356-15.233-6.026c-0.692-0.857-1.038-1.632-1.038-2.665c0-2.24,1.896-4.136,4.136-4.136
|
28
|
+
c0.857,0,1.72,0.259,2.67,1.033c2.323,1.895,5.164,3.531,9.466,3.531c3.877,0,6.371-1.032,6.371-3.443
|
29
|
+
c0-6.977-21.089-3.357-21.089-17.993c0-7.748,6.455-11.536,14.376-11.536c6.109,0,11.536,2.324,13.947,5.336
|
30
|
+
c0.517,0.689,0.857,1.293,0.857,2.584c0,2.238-1.891,4.131-4.131,4.131c-1.203,0-1.979-0.517-2.928-1.206
|
31
|
+
c-1.896-1.376-4.219-2.755-7.746-2.755C178.57,47.904,176.675,49.025,176.675,51.176z"/>
|
32
|
+
</g>
|
33
|
+
</svg>
|
@@ -8,6 +8,7 @@ window.Helios = {
|
|
8
8
|
|
9
9
|
initialize: ->
|
10
10
|
window.app = new Helios.Routers.Root
|
11
|
+
|
11
12
|
for entity in Helios.entities.models
|
12
13
|
do (entity) ->
|
13
14
|
name = entity.get('name').toLowerCase()
|
@@ -16,7 +17,7 @@ window.Helios = {
|
|
16
17
|
window.app.route entity.url(), name
|
17
18
|
|
18
19
|
window.app.views.entities = new Helios.Views.Entities({collection: Helios.entities})
|
19
|
-
window.app.views.entities.render()
|
20
|
+
window.app.views.entities.render() if Helios.services['data']
|
20
21
|
|
21
22
|
Backbone.history.start({
|
22
23
|
root: window.location.pathname,
|
@@ -26,11 +27,46 @@ window.Helios = {
|
|
26
27
|
}
|
27
28
|
|
28
29
|
$ ->
|
30
|
+
$.fn.serializeMultipart = ->
|
31
|
+
obj = $(this)
|
32
|
+
|
33
|
+
formData = new FormData()
|
34
|
+
$.each $(obj).find("input[type='file']"), (i, tag) ->
|
35
|
+
$.each $(tag)[0].files, (j, file) ->
|
36
|
+
formData.append tag.name, file
|
37
|
+
|
38
|
+
params = $(obj).serializeArray()
|
39
|
+
$.each params, (i, val) ->
|
40
|
+
formData.append val.name, val.value
|
41
|
+
|
42
|
+
formData
|
43
|
+
|
29
44
|
$(document).foundation()
|
30
45
|
$('body').delegate 'a[href^=#]', 'click', (event) ->
|
31
46
|
event.preventDefault()
|
32
47
|
href = $(this).attr('href')
|
33
48
|
window.app.navigate(href, {trigger: true, replace: true})
|
34
49
|
|
35
|
-
Helios.
|
36
|
-
|
50
|
+
Helios.services = {}
|
51
|
+
$.ajax(type: 'OPTIONS', url: "/", success: (data, status, xhr) ->
|
52
|
+
header = xhr.getResponseHeader("Link")
|
53
|
+
$.linkheaders(header).each (idx, link) ->
|
54
|
+
href = link.attr('href')
|
55
|
+
rel = link.rels()[0]
|
56
|
+
|
57
|
+
switch rel
|
58
|
+
when "Helios::Backend::Data"
|
59
|
+
Helios.services['data'] = href
|
60
|
+
when "Helios::Backend::InAppPurchase"
|
61
|
+
Helios.services['in-app-purchase'] = href
|
62
|
+
when "Helios::Backend::Newsstand"
|
63
|
+
Helios.services['newsstand'] = href
|
64
|
+
when "Helios::Backend::PushNotification"
|
65
|
+
Helios.services['push-notification'] = href
|
66
|
+
when "Helios::Backend::Passbook"
|
67
|
+
Helios.services['passbook'] = href
|
68
|
+
|
69
|
+
Helios.entities = new Helios.Collections.Entities
|
70
|
+
Helios.entities.fetch(type: 'OPTIONS', url: (Helios.services['data'] || "") + '/resources', success: Helios.initialize, error: Helios.initialize)
|
71
|
+
)
|
72
|
+
|
@@ -70,7 +70,7 @@ class Helios.Collections.Devices extends Helios.Collection
|
|
70
70
|
|
71
71
|
class Helios.Collections.Receipts extends Helios.Collection
|
72
72
|
model: Helios.Models.Receipt
|
73
|
-
|
73
|
+
|
74
74
|
fields: ['transaction_id', 'product_id', 'purchase_date', 'original_transaction_id', 'original_purchase_date', 'app_item_id', 'version_external_identifier', 'bid', 'bvrs', 'ip_address']
|
75
75
|
|
76
76
|
paginator_core:
|
@@ -78,7 +78,6 @@ class Helios.Collections.Receipts extends Helios.Collection
|
|
78
78
|
dataType: 'json'
|
79
79
|
url: '/receipts?'
|
80
80
|
|
81
|
-
|
82
81
|
class Helios.Collections.Passes extends Helios.Collection
|
83
82
|
model: Helios.Models.Pass
|
84
83
|
url: '/passes'
|
@@ -89,3 +88,12 @@ class Helios.Collections.Passes extends Helios.Collection
|
|
89
88
|
dataType: 'json'
|
90
89
|
url: '/passes?'
|
91
90
|
|
91
|
+
class Helios.Collections.Issues extends Helios.Collection
|
92
|
+
model: Helios.Models.Issue
|
93
|
+
url: '/issues'
|
94
|
+
fields: ['name', 'title', 'summary', 'published_at', 'expires_at']
|
95
|
+
|
96
|
+
paginator_core:
|
97
|
+
type: 'GET'
|
98
|
+
dataType: 'json'
|
99
|
+
url: '/issues?'
|
@@ -13,8 +13,11 @@ class Helios.Models.Resource extends Backbone.Model
|
|
13
13
|
|
14
14
|
class Helios.Models.Device extends Backbone.Model
|
15
15
|
idAttribute: "token"
|
16
|
-
|
16
|
+
|
17
17
|
class Helios.Models.Receipt extends Backbone.Model
|
18
18
|
idAttribute: "transaction_id"
|
19
19
|
|
20
20
|
class Helios.Models.Pass extends Backbone.Model
|
21
|
+
|
22
|
+
class Helios.Models.Issue extends Backbone.Model
|
23
|
+
idAttribute: "name"
|
@@ -4,6 +4,10 @@ class Helios.Routers.Root extends Backbone.Router
|
|
4
4
|
|
5
5
|
initialize: (options) ->
|
6
6
|
@views = {}
|
7
|
+
|
8
|
+
@views.navigation = new Helios.Views.Navigation
|
9
|
+
@views.navigation.render()
|
10
|
+
|
7
11
|
super
|
8
12
|
|
9
13
|
routes:
|
@@ -12,6 +16,7 @@ class Helios.Routers.Root extends Backbone.Router
|
|
12
16
|
'push-notification': 'push_notification'
|
13
17
|
'in-app-purchase': 'in_app_purchase'
|
14
18
|
'passbook': 'passbook'
|
19
|
+
'newsstand': 'newsstand'
|
15
20
|
|
16
21
|
index: ->
|
17
22
|
Helios.entities.fetch(type: 'OPTIONS')
|
@@ -22,17 +27,24 @@ class Helios.Routers.Root extends Backbone.Router
|
|
22
27
|
|
23
28
|
push_notification: ->
|
24
29
|
@devices ?= new Helios.Collections.Devices
|
30
|
+
@devices.paginator_core.url = Helios.services['push-notification'] + '/devices'
|
25
31
|
@views.devices ?= new Helios.Views.Devices(collection: @devices)
|
26
32
|
@views.devices.render()
|
27
33
|
|
28
34
|
in_app_purchase: ->
|
29
35
|
@receipts ?= new Helios.Collections.Receipts
|
36
|
+
@receipts.paginator_core.url = Helios.services['in-app-purchase'] + '/receipts'
|
30
37
|
@views.receipts ?= new Helios.Views.Receipts(collection: @receipts)
|
31
38
|
@views.receipts.render()
|
32
39
|
|
33
40
|
passbook: ->
|
34
41
|
@passes ?= new Helios.Collections.Passes
|
42
|
+
@passes.paginator_core.url = Helios.services['passbook'] + '/passes'
|
35
43
|
@views.passes ?= new Helios.Views.Passes(collection: @passes)
|
36
44
|
@views.passes.render()
|
37
45
|
|
38
|
-
|
46
|
+
newsstand: ->
|
47
|
+
@issues ?= new Helios.Collections.Issues
|
48
|
+
@issues.paginator_core.url = Helios.services['newsstand'] + '/issues'
|
49
|
+
@views.issues ?= new Helios.Views.Issues(collection: @issues)
|
50
|
+
@views.issues.render()
|
@@ -1,5 +1,12 @@
|
|
1
|
+
class Helios.Views.Navigation extends Backbone.View
|
2
|
+
template: JST['navigation']
|
3
|
+
el: "[role='navigation']"
|
4
|
+
|
5
|
+
render: =>
|
6
|
+
@$el.html(@template())
|
7
|
+
|
1
8
|
class Helios.Views.Entities extends Backbone.View
|
2
|
-
template: JST['entities']
|
9
|
+
template: JST['data/entities']
|
3
10
|
el: "[role='main']"
|
4
11
|
|
5
12
|
events:
|
@@ -36,7 +43,7 @@ class Helios.Views.Entity extends Backbone.View
|
|
36
43
|
@
|
37
44
|
|
38
45
|
class Helios.Views.Devices extends Backbone.View
|
39
|
-
template: JST['devices']
|
46
|
+
template: JST['push-notification/devices']
|
40
47
|
el: "[role='main']"
|
41
48
|
|
42
49
|
events:
|
@@ -53,8 +60,8 @@ class Helios.Views.Devices extends Backbone.View
|
|
53
60
|
render: =>
|
54
61
|
@$el.html(@template())
|
55
62
|
|
56
|
-
@composeView ?= new Helios.Views.Compose()
|
57
|
-
@composeView.render()
|
63
|
+
# @composeView ?= new Helios.Views.Compose()
|
64
|
+
# @composeView.render()
|
58
65
|
@$el.find("#datagrid").html(@datagrid.el)
|
59
66
|
|
60
67
|
@
|
@@ -65,7 +72,7 @@ class Helios.Views.Devices extends Backbone.View
|
|
65
72
|
@collection.fetch()
|
66
73
|
|
67
74
|
class Helios.Views.Compose extends Backbone.View
|
68
|
-
template: JST['compose']
|
75
|
+
template: JST['push-notification/compose']
|
69
76
|
el: "#compose-modal"
|
70
77
|
|
71
78
|
events:
|
@@ -108,7 +115,8 @@ class Helios.Views.Compose extends Backbone.View
|
|
108
115
|
if $("input[name='recipients']:checked").val() == "specified"
|
109
116
|
tokens = [$form.find("#tokens").val()]
|
110
117
|
|
111
|
-
$.ajax(
|
118
|
+
$.ajax(
|
119
|
+
url:"/message"
|
112
120
|
type: "POST"
|
113
121
|
dataType: "json"
|
114
122
|
data: {
|
@@ -181,7 +189,7 @@ class Helios.Views.Compose extends Backbone.View
|
|
181
189
|
$time.find(".date").text(Date.now().toString("dddd, MMMM d"))
|
182
190
|
|
183
191
|
class Helios.Views.Receipts extends Backbone.View
|
184
|
-
template: JST['receipts']
|
192
|
+
template: JST['in-app-purchase/receipts']
|
185
193
|
el: "[role='main']"
|
186
194
|
|
187
195
|
events:
|
@@ -207,7 +215,7 @@ class Helios.Views.Receipts extends Backbone.View
|
|
207
215
|
@collection.fetch()
|
208
216
|
|
209
217
|
class Helios.Views.Passes extends Backbone.View
|
210
|
-
template: JST['passes']
|
218
|
+
template: JST['passbook/passes']
|
211
219
|
el: "[role='main']"
|
212
220
|
|
213
221
|
events:
|
@@ -231,3 +239,69 @@ class Helios.Views.Passes extends Backbone.View
|
|
231
239
|
e.preventDefault()
|
232
240
|
@collection.query = $(e.target).val()
|
233
241
|
@collection.fetch()
|
242
|
+
|
243
|
+
class Helios.Views.Issues extends Backbone.View
|
244
|
+
template: JST['newsstand/issues']
|
245
|
+
el: "[role='main']"
|
246
|
+
|
247
|
+
events:
|
248
|
+
'keyup form.filter input': 'filter'
|
249
|
+
|
250
|
+
initialize: ->
|
251
|
+
@datagrid = new Backbone.Datagrid({
|
252
|
+
collection: @collection,
|
253
|
+
columns: @collection.fields,
|
254
|
+
paginated: true,
|
255
|
+
perPage: 20
|
256
|
+
})
|
257
|
+
|
258
|
+
$.ajax(
|
259
|
+
url: Helios.services['newsstand'] + "/issues/new",
|
260
|
+
type: "HEAD",
|
261
|
+
error: ->
|
262
|
+
$(".auxiliary button").prop('disabled', true)
|
263
|
+
)
|
264
|
+
|
265
|
+
render: =>
|
266
|
+
@$el.html(@template())
|
267
|
+
@$el.find("#datagrid").html(@datagrid.el)
|
268
|
+
|
269
|
+
@newView ?= new Helios.Views.NewIssue()
|
270
|
+
@newView.render()
|
271
|
+
|
272
|
+
@
|
273
|
+
|
274
|
+
filter: (e) ->
|
275
|
+
e.preventDefault()
|
276
|
+
@collection.query = $(e.target).val()
|
277
|
+
@collection.fetch()
|
278
|
+
|
279
|
+
class Helios.Views.NewIssue extends Backbone.View
|
280
|
+
template: JST['newsstand/new']
|
281
|
+
el: "#new-issue-modal"
|
282
|
+
|
283
|
+
events:
|
284
|
+
'submit form': 'submit'
|
285
|
+
'click button#create': 'submit'
|
286
|
+
|
287
|
+
render: ->
|
288
|
+
@$el.html(@template())
|
289
|
+
|
290
|
+
@
|
291
|
+
|
292
|
+
submit: ->
|
293
|
+
$form = @$el.find("form#new")
|
294
|
+
console.log($form.find("input[type='file']"))
|
295
|
+
$.ajax(
|
296
|
+
url: $form.attr("action")
|
297
|
+
type: "POST"
|
298
|
+
dataType: "json"
|
299
|
+
data: $form.serializeMultipart()
|
300
|
+
cache: false
|
301
|
+
contentType: false
|
302
|
+
processData: false
|
303
|
+
success: (data) ->
|
304
|
+
console.log("Success", data)
|
305
|
+
error: (data) ->
|
306
|
+
console.log("Failure", data)
|
307
|
+
)
|