Created
August 23, 2014 19:16
-
-
Save bmax/7d164d665c406473baec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
actions: { | |
show: function (item) { | |
if (item) { | |
item.set('showRoomForm', true); | |
} else { | |
this.controller.set('showForm', true); | |
} | |
}, | |
hide: function (item) { | |
if (item) { | |
item.set('showRoomForm', false); | |
} else { | |
this.controller.set('showForm', false); | |
} | |
}, | |
submitOp: function () { | |
var _this = this; | |
var op_name = this.controller.get('operation_name'); | |
if (op_name) { | |
console.log(op_name); | |
var operation = this.store.createRecord('operation', { name: op_name }).save().then(function() { | |
// do something here? | |
_this.controller.set('showForm', false); | |
_this.controller.set('operation_name', null); | |
console.log('success'); | |
}, | |
function(jq) { | |
// do something here? | |
console.log('error submitting operation'); | |
console.log(jq); | |
}); | |
} | |
}, | |
submitRoom: function(item) { | |
var _this = this; | |
var room_name = item.get('room_name'); | |
if (room_name) { | |
console.log(room_name); | |
/*var operation = this.store.createRecord('operation', { name: op_name }).save().then(function() { | |
// do something here? | |
_this.controller.set('showForm', false); | |
_this.controller.set('operation_name', null); | |
console.log('success'); | |
}, | |
function(jq) { | |
// do something here? | |
console.log('error submitting operation'); | |
console.log(jq); | |
});*/ | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment