LT-67 Storing the activeServer in user's profile

This commit is contained in:
Bruno Alves de Faria authored and Erik Ziegler committed 2016-08-04 16:49:51 +02:00
1 parent 1ca585bfb0
commit 9bf96f24d7
6 files changed
+56 -19

No files matched your search

@@ -19,7 +19,7 @@ Template.serverInformationForm.events({
submit: function(event, instance) {
event.preventDefault();
var formData = FormUtils.getFormData(instance.data.$form);
Meteor.call('saveServer', formData, function(error) {
Meteor.call('serverSave', formData, function(error) {
if (error) {
// TODO: check for errors: not-authorized, data-write
console.log('>>>>ERROR', error);
@@ -14,6 +14,13 @@
<td>{{this.type}}</td>
<td class="text-right">
<div class="btn-group" role="group" aria-label="Actions">
<button class="btn btn-sm btn-default js-use-server" title="Use this server" disabled="{{#if isActive this}}disabled{{/if}}">
{{#if isActive this}}
<i class="fa fa-check-square-o"></i>
{{else}}
<i class="fa fa-square-o"></i>
{{/if}}
</button>
<button class="btn btn-sm btn-default js-edit-server" title="Edit">
<i class="fa fa-pencil"></i>
</button>
@@ -1,4 +1,7 @@
Template.serverInformationList.helpers({
isActive: function(server) {
return server._id === Meteor.user().profile.activeServer;
},
servers: function() {
return Servers.find().fetch();
}
@@ -14,11 +17,15 @@ Template.serverInformationList.events({
},
'click .js-remove-server': function(event, instance) {
var id = this._id;
Meteor.call('removeServer', this._id, function(error) {
if (error) {
// TODO: check for errors: not-authorized, data-write
console.log('>>>>ERROR', error);
}
Meteor.call('serverRemove', this._id, function(error) {
// TODO: [custom-servers] check for errors: not-authorized, data-write
});
},
'click .js-use-server': function(event, instance) {
console.debug('>>>>clicked');
var id = this._id;
Meteor.call('serverSetActive', this._id, function(error) {
// TODO: [custom-servers] check for errors: not-authorized, data-write
});
}
});