Skip to content

Instantly share code, notes, and snippets.

@vbauerster
Created October 8, 2015 17:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vbauerster/d9e43c09d3349dce40e7 to your computer and use it in GitHub Desktop.
Save vbauerster/d9e43c09d3349dce40e7 to your computer and use it in GitHub Desktop.
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