Created
October 8, 2015 17:33
-
-
Save vbauerster/d9e43c09d3349dce40e7 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
define(function(require){ | |
//var React = require('react'); | |
var jQuery = require('jquery'); | |
//var TemplatesPanel = require('modules/pathboard/common/views/templatesPanel'); | |
//var Templates = require('modules/pathboard/common/models/templates'); | |
//var templates = new Templates(); | |
//var Loading = require('ui/react/loading'); | |
//var Panel = require('ui/react/modals/panel'); | |
var templateServiceApi = (function($) { | |
return { | |
getSystemTemplates: function () { | |
return $.get('/api/courses/templates/general'); | |
} | |
} | |
})(jQuery); | |
var templatesModule = (function(api) { | |
var loading; | |
return { | |
load: function(cb) { | |
loading = true; | |
return api.getSystemTemplates().then(function (response) { | |
loading = false; | |
return response; | |
}).then(cb); | |
}, | |
isLoading: function() { | |
return loading; | |
} | |
} | |
})(templateServiceApi); | |
console.log('loading:', templatesModule.isLoading()); | |
templatesModule.load().then(function (data) { | |
console.log(data); | |
console.log('loading:', templatesModule.isLoading()); | |
}); | |
console.log('loading:', templatesModule.isLoading()); | |
/* | |
*<div className='nano'> | |
* <div className='content'> | |
* </div> | |
*</div> | |
*/ | |
// methods | |
//templates.load(); | |
//templates.loadTEmplate(templateId) | |
//isLoading() | |
//React.render( | |
//<div> | |
//<button />, | |
//<TemplatesPanel templates={templates} />, | |
//</div> | |
//document.body | |
//); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment