Anton Shestakov <av6@dwimlabs.net>, Mon, 18 Sep 2017 00:50:22 +0800
provision: target newer Nginx versions (>1.7.5 for add_header with always)
static/js/ui.js
Permissions: -rw-r--r--
window.fruitbar = new Backbone.View(); fruitbar.workspaces = new Workspaces(); fruitbar.tasks = new Tasks(); fruitbar.projects = new Projects(); fruitbar.router = new Router(); fruitbar.xhrs.done = function() { return _(this).all(function(xhr) { return xhr.readyState === 4; fruitbar.xhrs.abort = function() { _(this).each(function(xhr) { fruitbar.fetchAll = function(url) { fruitbar.projects.set(data.projects); fruitbar.tasks.set(data.tasks); fruitbar.workspaceTitleDisplayer = new Displayer({ el: $('.workspace-title') fruitbar.workspaceTabs = new WorkspaceTabsView({ el: $('.workspace-tabs'), collection: fruitbar.workspaces, tab: $.trim($('#workspace-tab-template').html()) fruitbar.projectCounter = new CollectionCounterView({ el: $('.project-counter'), collection: fruitbar.projects, plurals: ['project', 'projects'] fruitbar.projectsView = new ProjectsView({ collection: fruitbar.projects, project: $.trim($('#project-template').html()), task: $.trim($('#task-template').html()) create: $('.btn-new-project') fruitbar.on('workspace', function(workspace) { $('body').stop().animate({opacity: 0}); this.workspace = workspace; this.workspaces.create({name: workspace}); this.tasks.url = '/' + encodeURIComponent(workspace) + '/tasks/'; this.projects.url = '/' + encodeURIComponent(workspace) + '/projects/'; this.xhrs.push(this.fetchAll('/' + encodeURIComponent(workspace) + '/all/')); _(this.xhrs).each(function(fetch, index, xhrs) { fruitbar.workspaceTitleDisplayer.render(workspace); fruitbar.workspaceTabs.activate(workspace); $('body').stop().animate({opacity: 1}); fruitbar.once('workspace', function() { window.setInterval(function() { fruitbar.xhrs.push(fruitbar.fetchAll('/' + encodeURIComponent(fruitbar.workspace) + '/all/')); fruitbar.workspaces.fetch(); Backbone.history.start();