Created
May 15, 2013 00:31
-
-
Save bobholt/5580832 to your computer and use it in GitHub Desktop.
Keel Module Template Files
This file contains hidden or 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
/** | |
* app/framework/Message | |
* | |
* Enumeration of messages | |
* | |
* @author Bob Holt | |
*/ | |
define([ | |
'keel/Message', | |
'underscore' | |
], | |
function(frameworkMessage, _) { | |
'use strict'; | |
var message = _.extend({ | |
// App-specific Messages | |
}, frameworkMessage); | |
return message; | |
}); |
This file contains hidden or 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
/** | |
* app/services/AccountService | |
* | |
* Proxy for resource on the server. | |
* | |
* @author Bob Holt | |
*/ | |
define(['app/domain/Repository'], | |
function(Repository) { | |
'use strict'; | |
// Module level variables act as singletons | |
var _url = '/someURL'; | |
return { | |
postMethod: function(data, successCallback, errorCallback) { | |
$.ajax({ | |
url: _url, | |
type: 'POST', | |
contentType: 'application/json', | |
data: JSON.stringify(data), | |
success: successCallback, | |
error: errorCallback | |
}); | |
}, | |
putMethod: function(data, successCallback, errorCallback) { | |
$.ajax({ | |
url: _url, | |
type: 'PUT', | |
contentType: 'application/json', | |
data: JSON.stringify(data), | |
success: successCallback, | |
error: errorCallback | |
}); | |
}, | |
deleteMethod: function(doneCallback, failCallback) { | |
$.ajax({ | |
url: _url, | |
type: 'DELETE', | |
success: doneCallbacks, | |
error: failCallbacks | |
}); | |
} | |
}; | |
}); |
This file contains hidden or 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
/** | |
* app/widgets/keel/KeelWidget | |
* | |
* @author Bob Holt | |
*/ | |
define( | |
[ | |
'keel/BaseView', | |
'text!app/widgets/keel/KeelTemplate.html' | |
], | |
function( BaseView, KeelTemplate ) { | |
'use strict'; | |
return BaseView.extend({ | |
tagName: 'div', | |
// elements: [], | |
template: { | |
name: 'KeelTemplate', | |
source: KeelTemplate | |
}//, | |
// events: { | |
// }, | |
// postRender: function() { | |
// this.addChild({ | |
// id: 'AnotherWidget', | |
// viewClass: AnotherWidget, | |
// parentElement: this.$el, | |
// options: {} | |
// }); | |
// } | |
}); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment