Anton Shestakov <engored@ya.ru>, Fri, 11 Jan 2013 14:23:54 +0900
Create and use different database for tests; also move ResourceList and CRUDResource to fruitbar.crud.
static/js/ui.js
Permissions: -rw-r--r--
window.fruitbar = new Backbone.View(); fruitbar.tasks = new Tasks(); fruitbar.projects = new Projects(); fruitbar.router = new Router(); fruitbar.workspaceTitleDisplayer = new Displayer({ el: $('.workspace-title') fruitbar.projectCounter = new CollectionCounterView({ el: $('.project-counter'), collection: fruitbar.projects, plurals: ['project', 'projects'] fruitbar.projectsView = new ProjectsView({ collection: fruitbar.projects, project: $('#project-template').html(), task: $('#task-template').html() create: $('.btn-new-project') fruitbar.xhrs.done = function() { return _(this).all(function(xhr) { return xhr.readyState == 4; fruitbar.xhrs.abort = function() { _(this).each(function(xhr) { fruitbar.on('workspace', function(workspace) { $('body').stop().animate({opacity: 0}); this.tasks.url = '/' + encodeURIComponent(workspace) + '/tasks/'; this.projects.url = '/' + encodeURIComponent(workspace) + '/projects/'; this.xhrs.push(this.tasks.fetch(), this.projects.fetch()); _(this.xhrs).each(function(fetch, index, xhrs) { fruitbar.workspaceTitleDisplayer.render(workspace); $('body').stop().animate({opacity: 1}); fruitbar.once('workspace', function() { window.setInterval(function() { fruitbar.xhrs.push(fruitbar.tasks.fetch({update: true})); window.setInterval(function() { fruitbar.xhrs.push(fruitbar.projects.fetch({update: true})); Backbone.history.start();