Skip to content

Commit

Permalink
page-view, projetos, push notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
mlpassos committed Oct 4, 2016
1 parent 4952eca commit 502e41d
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 40 deletions.
6 changes: 4 additions & 2 deletions app/components/page-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ export default Ember.Component.extend({
if (ct.length) {
// alert('existe page-content');
ct.delegate('a', 'click', function(e) {
e.preventDefault();
// e.preventDefault();
let url = $(this).attr('href');
// console.log($(this).attr('href') + ' substituido com sucesso!');
// window.open( $(this).attr('href'), 'popup' );
let ref = window.open(url, '_blank', 'location=yes');
// console.log('trocou');
// alert('tem');
var ref = cordova.InAppBrowser.open(url, '_blank', 'location=yes');
});
}
}
Expand Down
72 changes: 37 additions & 35 deletions app/routes/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,45 +17,47 @@ export default Ember.Route.extend({
} else {
alert('nao existe InAppBrowser');
}
var push = PushNotification.init({
android: {
senderID: "605443485040"
},
browser: {
pushServiceURL: 'https://ember-secom-app.firebaseio.com'
},
ios: {
alert: "true",
badge: "true",
sound: "true"
},
windows: {}
});
PushNotification.hasPermission(function(data) {
if (data.isEnabled) {
var push = PushNotification.init({
android: {
senderID: "605443485040",
forceShow: "true"
},
browser: {
pushServiceURL: 'https://ember-secom-app.firebaseio.com'
},
ios: {
alert: "true",
badge: "true",
sound: "true"
},
windows: {}
});

push.on('registration', function(data) {
// data.registrationId
alert('registrado ' + data.registrationId);
});
push.on('registration', function(data) {
// data.registrationId
alert('registrado ' + data.registrationId);
});

push.on('notification', function(data) {
// alert('mensagem: ' + data.message);
navigator.notification.alert(
data.message, // message
function(){}, // callback
data.title, // title
'Ok' // buttonName
);
// data.message,
// data.title,
// data.count,
// data.sound,
// data.image,
// data.additionalData
});
push.on('notification', function(data) {
// alert('mensagem: ' + data.message);
navigator.notification.alert(
data.message, // message
function(){}, // callback
data.title, // title
'Ok' // buttonName
);
});

push.on('error', function(e) {
alert(e.message);
push.on('error', function(e) {
alert('Erro de push: ' + e.message);
});
} else {
alert('Push is off');
}
});

},
model() {
return props;
Expand Down
24 changes: 22 additions & 2 deletions app/routes/projetos.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,28 @@ export default Ember.Route.extend({
title:'Projetos',
content: 'Em breve'
},
// model() {
// // return this.store.findRecord('page', 'biizu');
// return this.get('props');
// }
model() {
// return this.store.findRecord('page', 'biizu');
return this.get('props');
return Ember.RSVP.hash({
biizu: this.store.findRecord('page', 'biizu'),
paraResponde: this.store.findRecord('page', 'para-responde'),
publicom: this.store.findRecord('page', 'publicom'),
radioEscola: this.store.findRecord('page', 'radio-escola'),
asfemBel: this.store.findRecord('page', 'projeto-jornal-das-feiras-asfembel')
});
},
setupController(controller, models) {
this._super(...arguments);
controller.set('biizu', models.biizu);
controller.set('paraResponde', models.paraResponde);
controller.set('publicom', models.publicom);
controller.set('radioEscola', models.radioEscola);
controller.set('asfemBel', models.asfemBel);
controller.set('props', this.get('props'));
// or, more concisely:
// controller.setProperties(models);
}
});
5 changes: 5 additions & 0 deletions app/serializers/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
case 'findRecord':
console.log('page.findRecord: ', target);
payload = payload.page;
// payload = payload.map((page) => {
payload.oldId = payload.id;
payload.id = payload.slug;
// return page;
// });
payload = {page: payload};
break;
default:
Expand Down
11 changes: 10 additions & 1 deletion app/templates/projetos.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<div class="container">
{{page-view page=model}}
{{page-view page=biizu}}
<hr>
{{page-view page=paraResponde}}
<hr>
{{page-view page=publicom}}
<hr>
{{page-view page=radioEscola}}
<hr>
{{page-view page=asfemBel}}
<hr>
</div>
{{outlet}}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 502e41d

Please sign in to comment.