diff options
| author | Teddy Wing | 2013-03-23 19:25:13 -0400 |
|---|---|---|
| committer | Teddy Wing | 2013-03-23 19:25:13 -0400 |
| commit | 3f42211c8f46c7d1761dc0f0789fcee35429b274 (patch) | |
| tree | 489441da2e04817551c8790b323ebd9b2b1717f4 /better-scrumdo.js | |
| parent | 6d90016ef2a7990f95f465e731286efd5b9e429b (diff) | |
| download | ScrumDo-Trellic-3f42211c8f46c7d1761dc0f0789fcee35429b274.tar.bz2 | |
Remove column wraparound
Moving left or right at an edge column onto a non-existent column will
keep position on current column, instead of doing a wraparound like I
thought it should previously.
Got rid of function to move to next column that has stories, but now I
realise that I will need it back in order to finish arrow movement.
What if there's a column in the middle that's empty? You still need to
get to the next column that has stories. We'll have to work that out.
Diffstat (limited to 'better-scrumdo.js')
| -rw-r--r-- | better-scrumdo.js | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/better-scrumdo.js b/better-scrumdo.js index 4b0ceab..1d2bc7e 100644 --- a/better-scrumdo.js +++ b/better-scrumdo.js @@ -127,12 +127,11 @@ $(function() { // Horizontal this.current_left_element = function() { - return this.current.parent().parent().prev(this.column_el).find(this.el).first(); + return this.previous_column().find(this.el).first(); }; this.current_right_element = function() { - // return this.current.parent().parent().next(this.column_el).find(this.el).first(); - return this.next_column_with_stories().find(this.el).first(); + return this.next_column().find(this.el).first(); }; // Column methods @@ -161,14 +160,14 @@ $(function() { }; this.sibling_column = function(column_index, offset) { - var that = this; - var wraparound = function(index) { - if (index < 0) { return that.total_columns - 1; } - else if (index >= that.total_columns) { return 0; } - else { return index; } - }; + // Don't let people move outside the edge columns + var new_column_index = column_index + offset; + if (new_column_index >= this.total_columns + || new_column_index < 0) { + return this.current_column(); + } - return this.$column_el.eq(wraparound(column_index + offset)); + return this.$column_el.eq(column_index + offset); }; this.next_column = function() { @@ -179,31 +178,6 @@ $(function() { return this.sibling_column(this.current_column_index(), -1); }; - this.next_column_with_stories = function() { - var column = this.$column_el.eq(this.current_column_index() + 1); - console.log('THE NEXT THREE LINES OF COLUMNS'); - console.log(this.next_column()); - console.log(this.sibling_column(this.current_column_index(), 2)); - console.log(this.sibling_column(this.current_column_index(), 3)); - // console.log(this.current_column_index()); - // console.log(column.index()); - // while (!this.column_has_stories(column.index())) { - // console.log(this.column_has_stories(column.index())); - // column = this.next_column(); - // } - - // do { - // console.log(this.column_has_stories(column.index())); - // column = this.next_column(); - // } while (!this.column_has_stories(column.index())); - - return column; - }; - - this.previous_column_with_stories = function() { - - }; - return this; }; |
