Skip to content

Commit 9a6985e

Browse files
author
Becky Sroufe
committed
Merging upstream/master
2 parents 483ff99 + fcb41be commit 9a6985e

22 files changed

+320
-92
lines changed

Gruntfile.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ module.exports = function (grunt) {
2929
'<%- path.dist %>',
3030
'<%- path.temp %>',
3131
'<%- path.bower %>'
32+
],
33+
34+
dist: [
35+
'<%- path.dist %>'
3236
]
3337
},
3438

@@ -113,8 +117,8 @@ module.exports = function (grunt) {
113117
'cd <%- path.app %>',
114118
'rsync . $cwd/<%- path.dist %> ' +
115119
'--update --delete --verbose --recursive ' +
116-
'--exclude ./less --exclude ./style'
117-
].join('&&')
120+
'--exclude less --exclude style'
121+
].join('&&')
118122
},
119123

120124
sourcemap_links: {
@@ -209,6 +213,7 @@ module.exports = function (grunt) {
209213
});
210214

211215
grunt.registerTask('build-dev', [
216+
'clean:dist',
212217
'bower',
213218
'shell:sync_dev',
214219
'less',
@@ -217,7 +222,7 @@ module.exports = function (grunt) {
217222

218223
grunt.registerTask('build-prod', [
219224
'set-prod',
220-
'clean',
225+
'clean:all',
221226
'bower',
222227
'copy',
223228
'less',

app/app-js/app-start.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ define(function (require) {
77
var Marionette = require('marionette'),
88
app = require('app'),
99

10-
api = require('entities/api/api.module'),
11-
service = require('entities/service/service.module'),
12-
alert = require('entities/alert/alert.module'),
10+
apiEntity = require('entities/api/api.module'),
11+
serviceEntity = require('entities/service/service.module'),
12+
alertEntity = require('entities/alert/alert.module'),
1313

1414
header = require('modules/header/header.module'),
1515
menu = require('modules/menu/menu.module'),
@@ -26,9 +26,9 @@ define(function (require) {
2626
};
2727

2828
// start entity modules
29-
api.start();
30-
service.start();
31-
alert.start();
29+
apiEntity.start();
30+
serviceEntity.start();
31+
alertEntity.start();
3232

3333
// start rendering modules
3434
header.start();

app/app-js/entities/alert/alert.controller.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,14 @@ define(function (require) {
5050
},
5151

5252
removeAlert: function (alert) {
53-
this.alerts.remove(alert);
54-
this.alertRegistry[alert.hash()] = false;
53+
var alert = this.alertRegistry[alert.hash()];
54+
if (alert) {
55+
this.alerts.remove(alert);
56+
delete this.alertRegistry[alert.hash()];
57+
}
5558
},
5659

57-
clearAlerts: function (alert) {
60+
clearAlerts: function () {
5861
this.alertRegistry = {};
5962
this.alerts.reset();
6063
},

app/app-js/entities/alert/alert.model.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ define(function (require) {
77
defaults: {
88
title: 'Alert Title',
99
message: 'Alert message',
10-
state: 'danger' // {danger|warn|info|success}
10+
state: 'danger', // {danger|warn|info|success}
11+
uniqueGroup: null,
12+
uniqueValue: null
1113
},
1214

1315
hash: function () {

app/app-js/entities/api/call/genericOutput.model.js

+5
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@ define(function (require) {
1313
},
1414

1515
fetch: function (options) {
16+
var self = this;
17+
1618
options = options || {};
1719
options.url = this.urlRoot + '/' + this.get('serviceKey') + '/' + this.get('endpointKey');
20+
options.error = function () {
21+
self.set('output', null);
22+
};
1823

1924
return GenericOutputModel.__super__.fetch.call(this, options);
2025
},

app/app-js/entities/api/call/genericUri.model.js

+5
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@ define(function (require) {
1313
},
1414

1515
fetch: function (options) {
16+
var self = this;
17+
1618
options = options || {};
1719
options.url = this.urlRoot + '/' + this.get('serviceKey') + '/' + this.get('endpointKey');
20+
options.error = function () {
21+
self.set('uri', null);
22+
};
1823

1924
return GenericUriModel.__super__.fetch.call(this, options);
2025
}

app/app-js/entities/api/call/sampleUri.model.js

+6-15
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,14 @@ define(function (require) {
1414
},
1515

1616
fetch: function (options) {
17-
var serviceName = appChannel.reqres.request('lookup:serviceName', this.get('serviceKey'));
17+
var self = this;
18+
serviceName = appChannel.reqres.request('lookup:serviceName', this.get('serviceKey'));
1819

1920
options = options || {};
20-
21-
_.extend(options, {
22-
url: this.urlRoot + '/' + this.get('serviceKey') + '/' + this.get('endpointKey'),
23-
24-
error: function () {
25-
var alert = {
26-
title: 'You haven\'t authenticated with the ' + serviceName + ' API.',
27-
message: 'Connect with a data source on the left to begin',
28-
state: 'danger'
29-
};
30-
31-
appChannel.commands.execute('add:alert', alert);
32-
}
33-
});
21+
options.url = this.urlRoot + '/' + this.get('serviceKey') + '/' + this.get('endpointKey');
22+
options.error = function () {
23+
self.set('uri', null);
24+
};
3425

3526
return SampleUriModel.__super__.fetch.call(this, options);
3627
}

app/app-js/entities/api/call/tryUri.model.js

+11
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ define(function (require) {
1010
output: null
1111
},
1212

13+
fetch: function (options) {
14+
var self = this;
15+
16+
options = options || {};
17+
options.error = function () {
18+
self.set('output', null);
19+
};
20+
21+
TryUriModel.__super__.fetch.apply(this, arguments);
22+
},
23+
1324
parse: function (response) {
1425
return {
1526
output: JSON.stringify(response, null, 2)

app/app-js/entities/service/endpoint/endpoint.model.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ define(function (require) {
66

77
defaults: {
88
endpointName: null,
9-
endpointKey: null
9+
endpointKey: null,
10+
disabledMessage: null
1011
}
1112
});
1213

app/app-js/entities/service/service.controller.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ define(function (require) {
1313
reqres: {
1414
'get:serviceCollection': 'getServiceCollection',
1515
'lookup:serviceName': 'lookupServiceName',
16-
'lookup:endpointName': 'lookupEndpointName'
16+
'lookup:endpointName': 'lookupEndpointName',
17+
'is:endpointDisabled': 'isEndpointDisabled'
1718
},
1819

1920
commands: {
@@ -56,6 +57,10 @@ define(function (require) {
5657

5758
lookupEndpointName: function (serviceKey, endpointKey) {
5859
return services.lookupEndpointName(serviceKey, endpointKey);
60+
},
61+
62+
isEndpointDisabled: function (serviceKey, endpointKey) {
63+
return services.isEndpointDisabled(serviceKey, endpointKey);
5964
}
6065
});
6166

app/app-js/entities/service/services.js

+66-12
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,88 @@ define(function (require) {
99
'endpointKey': 'userprofile'
1010
}, {
1111
'endpointName': 'User\'s friends list',
12-
'endpointKey': 'ownerfriends'
12+
'endpointKey': 'ownerfriends',
13+
'disabledTitle': 'Our Apologies!',
14+
'disabledMessage':
15+
'Live demonstration of some Facebook features is currently disabled, ' +
16+
'pending approval from Facebook.'
1317
}, {
1418
'endpointName': 'User\'s news feed',
15-
'endpointKey': 'ownernews'
19+
'endpointKey': 'ownernews',
20+
'disabledTitle': 'Our Apologies!',
21+
'disabledMessage':
22+
'Live demonstration of some Facebook features is currently disabled, ' +
23+
'pending approval from Facebook.'
1624
}, {
1725
'endpointName': 'User\'s status feed',
18-
'endpointKey': 'ownerstatus'
26+
'endpointKey': 'ownerstatus',
27+
'disabledTitle': 'Our Apologies!',
28+
'disabledMessage':
29+
'Live demonstration of some Facebook features is currently disabled, ' +
30+
'pending approval from Facebook.'
1931
}, {
2032
'endpointName': 'User\'s created events',
21-
'endpointKey': 'ownerevents'
33+
'endpointKey': 'ownerevents',
34+
'disabledTitle': 'Our Apologies!',
35+
'disabledMessage':
36+
'Live demonstration of some Facebook features is currently disabled, ' +
37+
'pending approval from Facebook.'
2238
}, {
2339
'endpointName': 'User\'s group details',
24-
'endpointKey': 'ownergroups'
40+
'endpointKey': 'ownergroups',
41+
'disabledTitle': 'Our Apologies!',
42+
'disabledMessage':
43+
'Live demonstration of some Facebook features is currently disabled, ' +
44+
'pending approval from Facebook.'
2545
}, {
2646
'endpointName': 'User\'s likes',
27-
'endpointKey': 'ownerlikes'
47+
'endpointKey': 'ownerlikes',
48+
'disabledTitle': 'Our Apologies!',
49+
'disabledMessage':
50+
'Live demonstration of some Facebook features is currently disabled, ' +
51+
'pending approval from Facebook.'
2852
}, {
2953
'endpointName': 'Links shared by user',
30-
'endpointKey': 'ownerlinks'
54+
'endpointKey': 'ownerlinks',
55+
'disabledTitle': 'Our Apologies!',
56+
'disabledMessage':
57+
'Live demonstration of some Facebook features is currently disabled, ' +
58+
'pending approval from Facebook.'
3159
}, {
3260
'endpointName': 'User\'s photos',
33-
'endpointKey': 'ownerphotos'
61+
'endpointKey': 'ownerphotos',
62+
'disabledTitle': 'Our Apologies!',
63+
'disabledMessage':
64+
'Live demonstration of some Facebook features is currently disabled, ' +
65+
'pending approval from Facebook.'
3466
}, {
3567
'endpointName': 'Posts shared by user',
36-
'endpointKey': 'ownerposts'
68+
'endpointKey': 'ownerposts',
69+
'disabledTitle': 'Our Apologies!',
70+
'disabledMessage':
71+
'Live demonstration of some Facebook features is currently disabled, ' +
72+
'pending approval from Facebook.'
3773
}, {
3874
'endpointName': 'Albums shared by user',
39-
'endpointKey': 'owneralbums'
75+
'endpointKey': 'owneralbums',
76+
'disabledTitle': 'Our Apologies!',
77+
'disabledMessage':
78+
'Live demonstration of some Facebook features is currently disabled, ' +
79+
'pending approval from Facebook.'
4080
}, {
4181
'endpointName': 'User\'s notes',
42-
'endpointKey': 'ownernotes'
82+
'endpointKey': 'ownernotes',
83+
'disabledTitle': 'Our Apologies!',
84+
'disabledMessage':
85+
'Live demonstration of some Facebook features is currently disabled, ' +
86+
'pending approval from Facebook.'
4387
}, {
4488
'endpointName': 'User\'s videos',
45-
'endpointKey': 'ownervideos'
89+
'endpointKey': 'ownervideos',
90+
'disabledTitle': 'Our Apologies!',
91+
'disabledMessage':
92+
'Live demonstration of some Facebook features is currently disabled, ' +
93+
'pending approval from Facebook.'
4694
}]
4795
}, {
4896
'serviceName': 'Twitter',
@@ -133,6 +181,12 @@ define(function (require) {
133181
return endpoint.length && endpoint[0].endpointName;
134182
};
135183

184+
services.isEndpointDisabled = function (serviceKey, endpointKey) {
185+
var service = _.where(this, { serviceKey: serviceKey }),
186+
endpoint = service.length && _.where(service[0].endpoints, { endpointKey: endpointKey });
187+
return endpoint.length && endpoint[0].disabledMessage;
188+
};
189+
136190
services.clone = function () {
137191
var _services = _.clone(this);
138192

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
2-
{{#title}}<p><strong>{{title}}</strong>&nbsp;{{message}}</p>{{/title}}
2+
{{#title}}<p><strong>{{title}}&nbsp;</strong>{{/title}}{{message}}</p>

app/app-js/modules/alert/alert.view.js

+5-10
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ define(function (require) {
66

77
AlertView = Marionette.ItemView.extend({
88
template: template,
9-
className: 'alert alert-danger fade',
9+
className: 'alert fade',
1010

1111
events: {
1212
'click .close': 'closeClicked'
@@ -16,21 +16,16 @@ define(function (require) {
1616
moduleChannel.vent.trigger('close:alert', this.model);
1717
},
1818

19+
onRender: function () {
20+
this.$el.addClass('alert-' + this.model.get('state'));
21+
},
22+
1923
onShow: function () {
2024
var self = this;
2125

2226
_.delay(function () {
2327
self.$el.addClass('in');
2428
}, 100);
25-
},
26-
27-
remove: function () {
28-
var self = this,
29-
args = arguments;
30-
31-
_.delay(function () {
32-
AlertView.__super__.remove.apply(self, args);
33-
}, 500);
3429
}
3530
});
3631

app/app-js/modules/footer/footer.view.html

+3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ <h4>Contact Us</h4>
99
<a href="https://angel.co/api-network" class="angellist" target="_blank" data-bypass>
1010
</a>
1111
</div>
12+
1213
<!--
1314
<a href="legal">Legal</a>
1415
<a href="tos">Terms of Service</a>
1516
<a href="privacy">Privacy</a>
17+
<a href="contact">Contact</a>
1618
-->
19+
1720
<h6>Copyright &copy; 2014 Engine, Inc.</h6>

app/app-js/modules/menu/menu.controller.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ define(function (require) {
2424
},
2525

2626
showMenu: function (serviceKey, endpointKey) {
27+
// Clear all alerts before each selection
28+
appChannel.commands.execute('clear:alerts');
29+
2730
if (!this.menuView || this.menuView.isClosed) {
2831
this.menuView = new MenuView({
2932
collection: this.services
@@ -37,7 +40,7 @@ define(function (require) {
3740
}
3841

3942
if (endpointKey) {
40-
moduleChannel.vent.trigger('select:endpoint', serviceKey, endpointKey);
43+
moduleChannel.vent.trigger('select:endpoint', serviceKey, endpointKey);
4144
}
4245
}
4346
});

0 commit comments

Comments
 (0)