Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 2 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
Commits on Apr 30, 2012
@bwalex users - add alphabetical name comparator
 * User collection will now be automatically sorted in alphabetical
   order.
2f44668
@bwalex views - tagdrag view bugfix
 * The way the tagdrag worked, it was possible that the state of the
   addtag btn didn't match whether the tagdrag view was visible or not.

 * Overhaul the whole thing and make it persistent.
0465b98
View
8 public/js/app/models/users.js
@@ -13,6 +13,12 @@ define(['appns', 'underscore', 'backbone', 'backbone-relational'], function(App,
url: function() {
return '/api/project/'+ App.globalController.get('projectId') +'/user';
},
- model: App.User
+ model: App.User,
+
+ initialize: function() {
+ this.comparator = function(user) {
+ return user.get('name');
+ };
+ }
});
});
View
15 public/js/app/views/note.js
@@ -95,12 +95,16 @@ define(['appns', 'jquery', 'underscore', 'backbone', 'backbone-relational', 'jqu
},
addTagBtn: function(ev) {
- App.globalController.trigger('btn:addTags');
+ selected = !$(this.el).find('.tabmenu .btn_addtag').hasClass('btn-selected');
+
+ App.globalController.set('tagdrag_visible', selected);
},
- tagbtn: function() {
- $(this.el).find('.tabmenu .btn_addtag')
- .toggleClass('btn-selected');
+ tagbtn: function(sel) {
+ if (sel)
+ $(this.el).find('.tabmenu .btn_addtag').addClass('btn-selected');
+ else
+ $(this.el).find('.tabmenu .btn_addtag').removeClass('btn-selected');
},
destroy: function() {
@@ -131,7 +135,7 @@ define(['appns', 'jquery', 'underscore', 'backbone', 'backbone-relational', 'jqu
//this.model.bind('change', this.render);
this.collection.bind('reset', this.render);
this.collection.bind('add', this.renderNote);
- this.bind('btn:addTags', this.tagbtn);
+ this.bind('change:tagdrag_visible', this.tagbtn);
this.bind('change:filter:tag_ids', this.filterChange);
this.bind('note:force-refetch', this.forceRefetch);
App.globalController.register(this);
@@ -191,6 +195,7 @@ define(['appns', 'jquery', 'underscore', 'backbone', 'backbone-relational', 'jqu
$(this.el).find('#newnotetext').elastic();
$(this.el).find('a[rel]').customOverlay();
$(this.el).find('.autoclear').autoclear();
+ this.tagbtn(App.globalController.get('tagdrag_visible'));
this.collection.each(this.renderNote);
this.toggleLoadMoreBtn();
},
View
18 public/js/app/views/tag_drag.js
@@ -34,23 +34,21 @@ define(['appns', 'jquery', 'underscore', 'backbone', 'backbone-relational', 'jqu
tagName: 'div',
className: 'tagDragListView',
initialize: function() {
- _.bindAll(this, 'render', 'renderTag', 'toggleVisibility', 'removeVisibility', 'destroy');
+ _.bindAll(this, 'render', 'renderTag', 'toggleVisibility', 'destroy');
//this.model.bind('change', this.render);
this.collection.bind('reset', this.render);
this.collection.bind('add', this.renderTag);
- this.bind('btn:addTags', this.toggleVisibility);
- this.bind('clean:addTags', this.removeVisibility);
+ this.bind('change:tagdrag_visible', this.toggleVisibility);
App.globalController.register(this);
},
- toggleVisibility: function() {
- $(this.el).toggleClass('hide');
- },
-
- removeVisibility: function() {
- $(this.el).addClass('hide');
+ toggleVisibility: function(show) {
+ if (show)
+ $(this.el).removeClass('hide');
+ else
+ $(this.el).addClass('hide');
},
destroy: function() {
@@ -63,9 +61,9 @@ define(['appns', 'jquery', 'underscore', 'backbone', 'backbone-relational', 'jqu
render: function() {
$(this.el).html(this.template.render({}));
- this.removeVisibility();
console.log("render in TagDragListView: %o", this);
this.collection.each(this.renderTag);
+ this.toggleVisibility(App.globalController.get('tagdrag_visible'));
console.log(this);
},
View
15 public/js/app/views/task.js
@@ -449,12 +449,16 @@ define(['appns', 'jquery', 'underscore', 'backbone', 'backbone-relational', 'jqu
},
addTagBtn: function(ev) {
- App.globalController.trigger('btn:addTags');
+ selected = !$(this.el).find('.tabmenu .btn_addtag').hasClass('btn-selected');
+
+ App.globalController.set('tagdrag_visible', selected);
},
- tagbtn: function() {
- $(this.el).find('.tabmenu .btn_addtag')
- .toggleClass('btn-selected');
+ tagbtn: function(sel) {
+ if (sel)
+ $(this.el).find('.tabmenu .btn_addtag').addClass('btn-selected');
+ else
+ $(this.el).find('.tabmenu .btn_addtag').removeClass('btn-selected');
},
destroy: function() {
@@ -506,7 +510,7 @@ define(['appns', 'jquery', 'underscore', 'backbone', 'backbone-relational', 'jqu
this.collection.bind('add', this.renderTaskTop);
this.collection.bind('reset', this.render);
- this.bind('btn:addTags', this.tagbtn);
+ this.bind('change:tagdrag_visible', this.tagbtn);
this.bind('btn:task:showCompleted', this.refetch);
this.bind('tasks:sort', this.refreshSort);
App.globalController.register(this);
@@ -520,6 +524,7 @@ define(['appns', 'jquery', 'underscore', 'backbone', 'backbone-relational', 'jqu
$(this.el).html(this.template.render({showCompleted: sc}));
$(this.el).find('.autoclear').autoclear();
+ this.tagbtn(App.globalController.get('tagdrag_visible'));
this.collection.each(this.renderTask);
},
View
15 public/js/app/views/wiki.js
@@ -539,12 +539,16 @@ define(['appns', 'jquery', 'underscore', 'backbone', 'backbone-relational', 'jqu
},
addTagBtn: function(ev) {
- App.globalController.trigger('btn:addTags');
+ selected = !$(this.el).find('.tabmenu .btn_addtag').hasClass('btn-selected');
+
+ App.globalController.set('tagdrag_visible', selected);
},
- tagbtn: function() {
- $(this.el).find('.tabmenu .btn_addtag')
- .toggleClass('btn-selected');
+ tagbtn: function(sel) {
+ if (sel)
+ $(this.el).find('.tabmenu .btn_addtag').addClass('btn-selected');
+ else
+ $(this.el).find('.tabmenu .btn_addtag').removeClass('btn-selected');
},
destroy: function() {
@@ -599,7 +603,7 @@ define(['appns', 'jquery', 'underscore', 'backbone', 'backbone-relational', 'jqu
this.collection.bind('add', this.renderWiki);
this.collection.bind('reset', this.render);
- this.bind('btn:addTags', this.tagbtn);
+ this.bind('change:tagdrag_visible', this.tagbtn);
this.bind('change:filter:tag_ids', this.filterChange);
this.bind('wiki:force-refetch', this.forceRefetch);
@@ -621,6 +625,7 @@ define(['appns', 'jquery', 'underscore', 'backbone', 'backbone-relational', 'jqu
render: function() {
$(this.el).html(this.template.render({}));
+ this.tagbtn(App.globalController.get('tagdrag_visible'));
this.collection.each(this.renderWiki);
},

No commit comments for this range

Something went wrong with that request. Please try again.