Skip to content

Commit

Permalink
sort
Browse files Browse the repository at this point in the history
  • Loading branch information
mezod committed Mar 2, 2015
1 parent c101279 commit e4f800c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 27 deletions.
5 changes: 3 additions & 2 deletions app/scripts/apps/kanban/show/show_controller.js
Expand Up @@ -271,9 +271,10 @@ define([

//update numElems
if(from != to){
var counter = $('#'+from).find('#counter').get([0]).textContent;
console.log($('#'+from+"-column").find('#counter'));
var counter = $('#'+from+"-column").find('#counter').get([0]).textContent;
counter = parseInt(counter)-1;
$('#'+from).find('#counter').text(counter);
$('#'+from+"-column").find('#counter').text(counter);
}
},

Expand Down
44 changes: 23 additions & 21 deletions app/scripts/apps/kanban/show/show_view.js
Expand Up @@ -310,55 +310,54 @@ define([

customSort: function(e){
console.log("column:customsort");
var column = this.columnId;
this.options.viewComparator = 'position';
this.collection.sort();
this.activateStyles(e,'.customSort');
this.activateStyles(column,'.customSort');
},

dateCreatedSort: function(e){
console.log("column:datecreatedsort");
var column = this.columnId;
this.options.viewComparator = 'dateCreated';
this.collection.sort();
this.activateStyles(e,'.dateCreatedSort');
$(e.currentTarget).addClass("dateCreatedSortInverse").removeClass("dateCreatedSort");
this.activateStyles(column,'.dateCreatedSort');
$('#'+column+'-column span.dateCreatedSort').addClass("dateCreatedSortInverse").removeClass("dateCreatedSort");
},

dateCreatedSortInverse: function(e){
console.log("column:datecreatedsortinverse");
var column = this.columnId;
this.options.viewComparator = 'dateCreated';
this.collection.sort();
this.activateStyles(e,'.dateCreatedSort');
$(e.currentTarget).addClass("dateCreatedSort").removeClass("dateCreatedSortInverse");
this.activateStyles(column,'.dateCreatedSortInverse');
// this.collection.reverse();
// this.collection.sort();
$('#'+column+'-column span.dateCreatedSortInverse').addClass("dateCreatedSort").removeClass("dateCreatedSortInverse");
},

dateCompletedSort: function(e){
console.log("column:datecompletedsort");
var column = this.columnId;
this.options.viewComparator = 'dateCompleted';
this.collection.sort();
this.activateStyles(e,'.dateCompletedSort');
this.activateStyles(column,'.dateCompletedSort');
$('#'+column+'-column span.dateCompletedSort').addClass("dateCompletedSortInverse").removeClass("dateCompletedSort");
},

dateCompletedSortInverse: function(e){
console.log("column:datecompletedsortinverse");
var column = this.columnId;
this.options.viewComparator = 'dateCompleted';
this.collection.sort();
this.activateStyles(e,'.dateCompletedSort');
},

activateStyles: function(e, id){
//console.log(e.currentTarget.parentNode);
//console.log(e.currentTarget.parentNode.parentNode);

console.log('wololo');
console.log($(e.currentTarget));
console.log($(e.currentTarget).siblings("span"));

$(e.currentTarget).siblings("span").removeClass("selected");
$(e.currentTarget).addClass("selected");
this.activateStyles(column,'.dateCompletedSortInverse');
$('#'+column+'-column span.dateCompletedSortInverse').addClass("dateCompletedSort").removeClass("dateCompletedSortInverse");
},

// var column = e.currentTarget.parentNode.parentNode.parentNode.id;
// $('#'+column+' span').removeClass("active");
// $('#'+column+' span'+id).addClass("active");
activateStyles: function(column, id){
$('#'+column+'-column span').removeClass("selected");
$('#'+column+'-column span'+id).addClass("selected");
},

onRender: function(){
Expand Down Expand Up @@ -394,6 +393,9 @@ define([
});

console.log(this.columnId);
console.log(this.cid);
console.log(this);
//debugger;
}

});
Expand Down
4 changes: 2 additions & 2 deletions app/styles/styles.css
Expand Up @@ -6979,7 +6979,7 @@ body,
}
#main-region #kanban-board .column ul {
list-style: none;
height: 100%;
height: calc(100% - 40px);
}
#main-region #kanban-board .column ul .inputTask {
height: 80px;
Expand Down Expand Up @@ -7082,7 +7082,7 @@ body,
#main-region #kanban-board #onhold-column {
display: inline-block;
width: 100%;
height: calc(100% - 200px);
height: calc(100% - 240px);
}
#main-region #kanban-board #onhold-column .column-header {
border-top: 1px solid #dddddd;
Expand Down
4 changes: 2 additions & 2 deletions app/styles/styles.less
Expand Up @@ -378,7 +378,7 @@ html, body, #content, #layout{

ul{
list-style: none;
height: 100%;
height: calc(100% - 40px);

.inputTask{
height: 80px;
Expand Down Expand Up @@ -511,7 +511,7 @@ html, body, #content, #layout{
#onhold-column{
display:inline-block;
width:100%;
height:calc(100% - 200px);
height:calc(100% - 240px);

.column-header{
border-top: 1px solid @grey;
Expand Down

0 comments on commit e4f800c

Please sign in to comment.