--- a/static/js/framework/views/base.js Thu Dec 27 02:42:10 2012 +0900
+++ b/static/js/framework/views/base.js Fri Dec 28 01:43:34 2012 +0900
+var Displayer = Backbone.View.extend({
+ render: function(text) {
var CollectionCounterView = CollectionView.extend({
initialize: function(options) {
+ if ('plurals' in options) {
+ this.makeTitle = function(n) {
+ return n + ' ' + options.plurals[n == 1 ? 0 : 1];
- this.$el.html(this.collection.models.length);
+ this.$el.html(this.makeTitle(this.collection.models.length));
+ makeTitle: function(n) {
--- a/static/js/ui.js Thu Dec 27 02:42:10 2012 +0900
+++ b/static/js/ui.js Fri Dec 28 01:43:34 2012 +0900
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
+ collection: fruitbar.projects,
+ plurals: ['project', 'projects']
fruitbar.projectsView = new ProjectsView({
fruitbar.on('workspace', function(workspace) {
$('body').stop().animate({opacity: 0});
+ this.workspaceTitleDisplayer.render(workspace);
this.tasks.url = '/' + encodeURIComponent(workspace) + '/tasks/';
--- a/templates/index.html Thu Dec 27 02:42:10 2012 +0900
+++ b/templates/index.html Fri Dec 28 01:43:34 2012 +0900
- All projects <small>(<span class="project-counter"></span>)</small>
+ <span class="muted">Workspace</span> <span class="workspace-title"></span> <small>(<span class="project-counter"></span>)</small>