2013-09-12 14:18:44 -04:00
|
|
|
/*global app, me*/
|
2013-08-29 23:38:28 -04:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var BasePage = require('./base');
|
|
|
|
var templates = require('../templates');
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = BasePage.extend({
|
|
|
|
template: templates.pages.main,
|
2013-09-12 14:18:44 -04:00
|
|
|
classBindings: {
|
|
|
|
'shouldAskForAlertsPermission': '.enableAlerts'
|
|
|
|
},
|
|
|
|
events: {
|
|
|
|
'click .enableAlerts': 'enableAlerts'
|
|
|
|
},
|
2013-08-29 23:38:28 -04:00
|
|
|
initialize: function (spec) {
|
2013-09-12 14:18:44 -04:00
|
|
|
me.shouldAskForAlertsPermission = app.notifier.shouldAskPermission();
|
2013-08-29 23:38:28 -04:00
|
|
|
this.renderAndBind();
|
2013-09-12 14:18:44 -04:00
|
|
|
},
|
|
|
|
enableAlerts: function () {
|
|
|
|
app.notifier.askPermission(function () {
|
|
|
|
var shouldAsk = app.notifier.shouldAskPermission();
|
|
|
|
if (!shouldAsk) {
|
|
|
|
app.notifier.show({
|
|
|
|
title: 'Ok, sweet!',
|
|
|
|
description: "You'll now be notified of stuff that happens."
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2013-08-29 23:38:28 -04:00
|
|
|
}
|
|
|
|
});
|