Skip to content

Commit

Permalink
fixed: moving impediments on taskboard to different status not workin…
Browse files Browse the repository at this point in the history
…g anymore
  • Loading branch information
maser committed Apr 15, 2011
1 parent 48c8e17 commit 695a0d8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/views/rb_impediments/_impediment.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<div class="meta">
<div class="story_id"><%= impediment.parent_id %></div>
<div class="status_id"><%= impediment.status_id %></div>
<div class="status_transitions"><%= impediment.status.find_new_statuses_allowed_to(User.current.roles_for_project(impediment.project), impediment.tracker).map(&:id).join(',') %></div>
<%= render :partial => "shared/model_errors", :object => impediment.errors %>
</div>
</div>
15 changes: 14 additions & 1 deletion assets/javascripts/impediment.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@ RB.Impediment = RB.Object.create(RB.Task, {
url: url,
data: data
}
}
},


// is a status change to newStatus allowed?
canChangeIntoStatus: function(newStatus) {
var curStatus = parseInt(this.$.find('.status_id').text());
var trackerId = parseInt(this.$.find('.tracker_id').text());

if (newStatus == curStatus) {
return true;
} else {
var allowed = $.map(this.$.find('.status_transitions').text().split(','), function(id) { return parseInt(id); });
return allowed.indexOf(newStatus) != -1;
}
}
});
4 changes: 3 additions & 1 deletion assets/javascripts/taskboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ RB.Taskboard = RB.Object.create(RB.Model, {
placeholder: 'placeholder',
start: self.dragStart,
stop: self.dragStop,
update: self.dragComplete
update: self.dragComplete,
activate: self.dragInitPossibleStatus,
deactivate: self.dragResetPossibleStatus
});

// Initialize each task in the board
Expand Down

0 comments on commit 695a0d8

Please sign in to comment.