next change | 102:325b3b4ce18b |
previous change | 43:d1ff547fa61d |
Permissions: -rw-r--r--
0 | $(function() { |
8
8:39ac2486b9d3
Use events to not smear workspaces all over the code.
Anton Shestakov <engored@ya.ru>
previous changes: 7:5c5d433b3a14
line |
diff
|
window.fruitbar = new Backbone.View(); |
43
43:d1ff547fa61d
Use localStorage to remember used workspaces.
Anton Shestakov <engored@ya.ru>
previous changes: 38:5d6f82b74afa
line |
diff
|
fruitbar.workspaces = new Workspaces(); |
7
7:5c5d433b3a14
Moving toward a multi-workspace work model. There's no auth, knowing workspace id gives full access.
Anton Shestakov <engored@ya.ru>
previous changes: 0:a02e94c5b96b
line |
diff
|
fruitbar.tasks = new Tasks(); |
7:5c5d433b3a14
Moving toward a multi-workspace work model. There's no auth, knowing workspace id gives full access.
Anton Shestakov <engored@ya.ru>
previous changes: 0:a02e94c5b96b
line |
diff
|
fruitbar.projects = new Projects(); |
7:5c5d433b3a14
Moving toward a multi-workspace work model. There's no auth, knowing workspace id gives full access.
Anton Shestakov <engored@ya.ru>
previous changes: 0:a02e94c5b96b
line |
diff
|
fruitbar.router = new Router(); |
0 | |
9
9:8a7155aff782
Abort all requests on workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 8:39ac2486b9d3
line |
diff
|
fruitbar.xhrs = []; |
10
10:363ae86d0822
Simple transition for workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 9:8a7155aff782
line |
diff
|
fruitbar.xhrs.done = function() { |
10:363ae86d0822
Simple transition for workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 9:8a7155aff782
line |
diff
|
return _(this).all(function(xhr) { |
10:363ae86d0822
Simple transition for workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 9:8a7155aff782
line |
diff
|
return xhr.readyState == 4; |
10:363ae86d0822
Simple transition for workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 9:8a7155aff782
line |
diff
|
}); |
10:363ae86d0822
Simple transition for workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 9:8a7155aff782
line |
diff
|
}; |
9
9:8a7155aff782
Abort all requests on workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 8:39ac2486b9d3
line |
diff
|
fruitbar.xhrs.abort = function() { |
9:8a7155aff782
Abort all requests on workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 8:39ac2486b9d3
line |
diff
|
_(this).each(function(xhr) { |
9:8a7155aff782
Abort all requests on workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 8:39ac2486b9d3
line |
diff
|
xhr.abort(); |
9:8a7155aff782
Abort all requests on workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 8:39ac2486b9d3
line |
diff
|
}); |
9:8a7155aff782
Abort all requests on workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 8:39ac2486b9d3
line |
diff
|
|
9:8a7155aff782
Abort all requests on workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 8:39ac2486b9d3
line |
diff
|
this.length = 0; |
9:8a7155aff782
Abort all requests on workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 8:39ac2486b9d3
line |
diff
|
}; |
9:8a7155aff782
Abort all requests on workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 8:39ac2486b9d3
line |
diff
|
|
24
24:fe92472b29b7
Fetching projects and tasks all at once.
Anton Shestakov <engored@ya.ru>
previous changes: 13:ce5b6e9b69b2
line |
diff
|
fruitbar.fetchAll = function(url) { |
24:fe92472b29b7
Fetching projects and tasks all at once.
Anton Shestakov <engored@ya.ru>
previous changes: 13:ce5b6e9b69b2
line |
diff
|
return Backbone.ajax({ |
24:fe92472b29b7
Fetching projects and tasks all at once.
Anton Shestakov <engored@ya.ru>
previous changes: 13:ce5b6e9b69b2
line |
diff
|
url: url, |
24:fe92472b29b7
Fetching projects and tasks all at once.
Anton Shestakov <engored@ya.ru>
previous changes: 13:ce5b6e9b69b2
line |
diff
|
type: 'GET', |
24:fe92472b29b7
Fetching projects and tasks all at once.
Anton Shestakov <engored@ya.ru>
previous changes: 13:ce5b6e9b69b2
line |
diff
|
dataType: 'json' |
24:fe92472b29b7
Fetching projects and tasks all at once.
Anton Shestakov <engored@ya.ru>
previous changes: 13:ce5b6e9b69b2
line |
diff
|
}).done(function(data) { |
33
33:9dfe8668e7fe
Update Underscore (1.4.3), Backbone (1.0.0) and Shard.
Anton Shestakov <engored@ya.ru>
previous changes: 26:17f590c312bd
line |
diff
|
fruitbar.projects.set(data['projects']); |
33:9dfe8668e7fe
Update Underscore (1.4.3), Backbone (1.0.0) and Shard.
Anton Shestakov <engored@ya.ru>
previous changes: 26:17f590c312bd
line |
diff
|
fruitbar.tasks.set(data['tasks']); |
24
24:fe92472b29b7
Fetching projects and tasks all at once.
Anton Shestakov <engored@ya.ru>
previous changes: 13:ce5b6e9b69b2
line |
diff
|
}); |
24:fe92472b29b7
Fetching projects and tasks all at once.
Anton Shestakov <engored@ya.ru>
previous changes: 13:ce5b6e9b69b2
line |
diff
|
}; |
24:fe92472b29b7
Fetching projects and tasks all at once.
Anton Shestakov <engored@ya.ru>
previous changes: 13:ce5b6e9b69b2
line |
diff
|
|
25
25:79ae5c1900a2
Reorganize ui.js a bit.
Anton Shestakov <engored@ya.ru>
previous changes: 24:fe92472b29b7
line |
diff
|
fruitbar.workspaceTitleDisplayer = new Displayer({ |
25:79ae5c1900a2
Reorganize ui.js a bit.
Anton Shestakov <engored@ya.ru>
previous changes: 24:fe92472b29b7
line |
diff
|
el: $('.workspace-title') |
25:79ae5c1900a2
Reorganize ui.js a bit.
Anton Shestakov <engored@ya.ru>
previous changes: 24:fe92472b29b7
line |
diff
|
}); |
25:79ae5c1900a2
Reorganize ui.js a bit.
Anton Shestakov <engored@ya.ru>
previous changes: 24:fe92472b29b7
line |
diff
|
|
43
43:d1ff547fa61d
Use localStorage to remember used workspaces.
Anton Shestakov <engored@ya.ru>
previous changes: 38:5d6f82b74afa
line |
diff
|
fruitbar.workspaceTabs = new WorkspaceTabsView({ |
43:d1ff547fa61d
Use localStorage to remember used workspaces.
Anton Shestakov <engored@ya.ru>
previous changes: 38:5d6f82b74afa
line |
diff
|
el: $('.workspace-tabs'), |
43:d1ff547fa61d
Use localStorage to remember used workspaces.
Anton Shestakov <engored@ya.ru>
previous changes: 38:5d6f82b74afa
line |
diff
|
collection: fruitbar.workspaces, |
43:d1ff547fa61d
Use localStorage to remember used workspaces.
Anton Shestakov <engored@ya.ru>
previous changes: 38:5d6f82b74afa
line |
diff
|
templates: { |
43:d1ff547fa61d
Use localStorage to remember used workspaces.
Anton Shestakov <engored@ya.ru>
previous changes: 38:5d6f82b74afa
line |
diff
|
tab: $.trim($('#workspace-tab-template').html()) |
43:d1ff547fa61d
Use localStorage to remember used workspaces.
Anton Shestakov <engored@ya.ru>
previous changes: 38:5d6f82b74afa
line |
diff
|
} |
43:d1ff547fa61d
Use localStorage to remember used workspaces.
Anton Shestakov <engored@ya.ru>
previous changes: 38:5d6f82b74afa
line |
diff
|
}); |
43:d1ff547fa61d
Use localStorage to remember used workspaces.
Anton Shestakov <engored@ya.ru>
previous changes: 38:5d6f82b74afa
line |
diff
|
|
25
25:79ae5c1900a2
Reorganize ui.js a bit.
Anton Shestakov <engored@ya.ru>
previous changes: 24:fe92472b29b7
line |
diff
|
fruitbar.projectCounter = new CollectionCounterView({ |
25:79ae5c1900a2
Reorganize ui.js a bit.
Anton Shestakov <engored@ya.ru>
previous changes: 24:fe92472b29b7
line |
diff
|
el: $('.project-counter'), |
25:79ae5c1900a2
Reorganize ui.js a bit.
Anton Shestakov <engored@ya.ru>
previous changes: 24:fe92472b29b7
line |
diff
|
collection: fruitbar.projects, |
25:79ae5c1900a2
Reorganize ui.js a bit.
Anton Shestakov <engored@ya.ru>
previous changes: 24:fe92472b29b7
line |
diff
|
plurals: ['project', 'projects'] |
25:79ae5c1900a2
Reorganize ui.js a bit.
Anton Shestakov <engored@ya.ru>
previous changes: 24:fe92472b29b7
line |
diff
|
}); |
25:79ae5c1900a2
Reorganize ui.js a bit.
Anton Shestakov <engored@ya.ru>
previous changes: 24:fe92472b29b7
line |
diff
|
|
25:79ae5c1900a2
Reorganize ui.js a bit.
Anton Shestakov <engored@ya.ru>
previous changes: 24:fe92472b29b7
line |
diff
|
fruitbar.projectsView = new ProjectsView({ |
25:79ae5c1900a2
Reorganize ui.js a bit.
Anton Shestakov <engored@ya.ru>
previous changes: 24:fe92472b29b7
line |
diff
|
el: $('.projects'), |
25:79ae5c1900a2
Reorganize ui.js a bit.
Anton Shestakov <engored@ya.ru>
previous changes: 24:fe92472b29b7
line |
diff
|
collection: fruitbar.projects, |
25:79ae5c1900a2
Reorganize ui.js a bit.
Anton Shestakov <engored@ya.ru>
previous changes: 24:fe92472b29b7
line |
diff
|
tasks: fruitbar.tasks, |
25:79ae5c1900a2
Reorganize ui.js a bit.
Anton Shestakov <engored@ya.ru>
previous changes: 24:fe92472b29b7
line |
diff
|
templates: { |
38
38:5d6f82b74afa
jQuery 2.0.0
Anton Shestakov <engored@ya.ru>
previous changes: 33:9dfe8668e7fe
line |
diff
|
project: $.trim($('#project-template').html()), |
38:5d6f82b74afa
jQuery 2.0.0
Anton Shestakov <engored@ya.ru>
previous changes: 33:9dfe8668e7fe
line |
diff
|
task: $.trim($('#task-template').html()) |
25
25:79ae5c1900a2
Reorganize ui.js a bit.
Anton Shestakov <engored@ya.ru>
previous changes: 24:fe92472b29b7
line |
diff
|
}, |
25:79ae5c1900a2
Reorganize ui.js a bit.
Anton Shestakov <engored@ya.ru>
previous changes: 24:fe92472b29b7
line |
diff
|
controls: { |
25:79ae5c1900a2
Reorganize ui.js a bit.
Anton Shestakov <engored@ya.ru>
previous changes: 24:fe92472b29b7
line |
diff
|
create: $('.btn-new-project') |
25:79ae5c1900a2
Reorganize ui.js a bit.
Anton Shestakov <engored@ya.ru>
previous changes: 24:fe92472b29b7
line |
diff
|
} |
25:79ae5c1900a2
Reorganize ui.js a bit.
Anton Shestakov <engored@ya.ru>
previous changes: 24:fe92472b29b7
line |
diff
|
}); |
25:79ae5c1900a2
Reorganize ui.js a bit.
Anton Shestakov <engored@ya.ru>
previous changes: 24:fe92472b29b7
line |
diff
|
|
8
8:39ac2486b9d3
Use events to not smear workspaces all over the code.
Anton Shestakov <engored@ya.ru>
previous changes: 7:5c5d433b3a14
line |
diff
|
fruitbar.on('workspace', function(workspace) { |
10
10:363ae86d0822
Simple transition for workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 9:8a7155aff782
line |
diff
|
$('body').stop().animate({opacity: 0}); |
10:363ae86d0822
Simple transition for workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 9:8a7155aff782
line |
diff
|
|
9
9:8a7155aff782
Abort all requests on workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 8:39ac2486b9d3
line |
diff
|
this.xhrs.abort(); |
9:8a7155aff782
Abort all requests on workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 8:39ac2486b9d3
line |
diff
|
|
24
24:fe92472b29b7
Fetching projects and tasks all at once.
Anton Shestakov <engored@ya.ru>
previous changes: 13:ce5b6e9b69b2
line |
diff
|
this.workspace = workspace; |
43
43:d1ff547fa61d
Use localStorage to remember used workspaces.
Anton Shestakov <engored@ya.ru>
previous changes: 38:5d6f82b74afa
line |
diff
|
this.workspaces.create({name: workspace}); |
8
8:39ac2486b9d3
Use events to not smear workspaces all over the code.
Anton Shestakov <engored@ya.ru>
previous changes: 7:5c5d433b3a14
line |
diff
|
this.tasks.url = '/' + encodeURIComponent(workspace) + '/tasks/'; |
8:39ac2486b9d3
Use events to not smear workspaces all over the code.
Anton Shestakov <engored@ya.ru>
previous changes: 7:5c5d433b3a14
line |
diff
|
this.projects.url = '/' + encodeURIComponent(workspace) + '/projects/'; |
8:39ac2486b9d3
Use events to not smear workspaces all over the code.
Anton Shestakov <engored@ya.ru>
previous changes: 7:5c5d433b3a14
line |
diff
|
|
24
24:fe92472b29b7
Fetching projects and tasks all at once.
Anton Shestakov <engored@ya.ru>
previous changes: 13:ce5b6e9b69b2
line |
diff
|
this.xhrs.push(this.fetchAll('/' + encodeURIComponent(workspace) + '/all/')); |
10
10:363ae86d0822
Simple transition for workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 9:8a7155aff782
line |
diff
|
|
10:363ae86d0822
Simple transition for workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 9:8a7155aff782
line |
diff
|
_(this.xhrs).each(function(fetch, index, xhrs) { |
10:363ae86d0822
Simple transition for workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 9:8a7155aff782
line |
diff
|
fetch.then(function() { |
10:363ae86d0822
Simple transition for workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 9:8a7155aff782
line |
diff
|
if (xhrs.done()) { |
13
13:ce5b6e9b69b2
Change workspace title after it's loaded.
Anton Shestakov <engored@ya.ru>
previous changes: 11:84505e73e061
line |
diff
|
fruitbar.workspaceTitleDisplayer.render(workspace); |
43
43:d1ff547fa61d
Use localStorage to remember used workspaces.
Anton Shestakov <engored@ya.ru>
previous changes: 38:5d6f82b74afa
line |
diff
|
fruitbar.workspaceTabs.activate(workspace); |
13
13:ce5b6e9b69b2
Change workspace title after it's loaded.
Anton Shestakov <engored@ya.ru>
previous changes: 11:84505e73e061
line |
diff
|
|
10
10:363ae86d0822
Simple transition for workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 9:8a7155aff782
line |
diff
|
$('body').stop().animate({opacity: 1}); |
10:363ae86d0822
Simple transition for workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 9:8a7155aff782
line |
diff
|
} |
10:363ae86d0822
Simple transition for workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 9:8a7155aff782
line |
diff
|
}); |
10:363ae86d0822
Simple transition for workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 9:8a7155aff782
line |
diff
|
}); |
8
8:39ac2486b9d3
Use events to not smear workspaces all over the code.
Anton Shestakov <engored@ya.ru>
previous changes: 7:5c5d433b3a14
line |
diff
|
}); |
7
7:5c5d433b3a14
Moving toward a multi-workspace work model. There's no auth, knowing workspace id gives full access.
Anton Shestakov <engored@ya.ru>
previous changes: 0:a02e94c5b96b
line |
diff
|
|
8
8:39ac2486b9d3
Use events to not smear workspaces all over the code.
Anton Shestakov <engored@ya.ru>
previous changes: 7:5c5d433b3a14
line |
diff
|
fruitbar.once('workspace', function() { |
9
9:8a7155aff782
Abort all requests on workspace change.
Anton Shestakov <engored@ya.ru>
previous changes: 8:39ac2486b9d3
line |
diff
|
window.setInterval(function() { |
24
24:fe92472b29b7
Fetching projects and tasks all at once.
Anton Shestakov <engored@ya.ru>
previous changes: 13:ce5b6e9b69b2
line |
diff
|
fruitbar.xhrs.push(fruitbar.fetchAll('/' + encodeURIComponent(fruitbar.workspace) + '/all/')); |
26
26:17f590c312bd
Cleanup.
Anton Shestakov <engored@ya.ru>
previous changes: 25:79ae5c1900a2
line |
diff
|
}, 60000); |
8
8:39ac2486b9d3
Use events to not smear workspaces all over the code.
Anton Shestakov <engored@ya.ru>
previous changes: 7:5c5d433b3a14
line |
diff
|
}); |
43
43:d1ff547fa61d
Use localStorage to remember used workspaces.
Anton Shestakov <engored@ya.ru>
previous changes: 38:5d6f82b74afa
line |
diff
|
|
43:d1ff547fa61d
Use localStorage to remember used workspaces.
Anton Shestakov <engored@ya.ru>
previous changes: 38:5d6f82b74afa
line |
diff
|
fruitbar.workspaces.fetch(); |
43:d1ff547fa61d
Use localStorage to remember used workspaces.
Anton Shestakov <engored@ya.ru>
previous changes: 38:5d6f82b74afa
line |
diff
|
|
8
8:39ac2486b9d3
Use events to not smear workspaces all over the code.
Anton Shestakov <engored@ya.ru>
previous changes: 7:5c5d433b3a14
line |
diff
|
Backbone.history.start(); |
0 | }); |