Implement drag & reorder functionality & new API #1995
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NOTES:
uses Sortable.js for drag & reorder
manual sorting button is located after A-Z button in toolbar
NEW API method TestPlan.update_case_order()
Manual reorder & API require the testcases.change_testcaseplan
permission
toolbarDropdowns() is called from within toolbarEvents() b/c
it really doesn't make sense to have this as stand-alone function
toolbarEvents() is moved within the TestCases.filter() callback
b/c we need the list of test cases to be fully initialized so we
can get the initial sorting order and use it later
WARNINGS:
may want to unbind the on-click event for rows if users are
having problems with the rows expanding while dragging them
the page doesn't use sortkey for initially displaying the rows
of test cases because this field isn't available in the API result.
Specifically sortkey is a field in the TestCasePlan model, which
is a through model and the .filter() API is querying the TestCase
model instead.