-
Notifications
You must be signed in to change notification settings - Fork 227
Add move to list option to Methodology cards #1580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 19 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
941aa68
Add move to list option in card
nicolachr abf51e4
Add specs
nicolachr d67902a
Add CHANGELOG entry
nicolachr 7b8fab7
Move inline with other actions
nicolachr e682e68
Merge branch 'develop' into cards/add-list-dropdown
nicolachr 4b709e4
Address APR findings
nicolachr 746bb51
track card list moves in the activity feed
nicolachr c9e6ed0
move list filtering out of the card actions partial
nicolachr 92acb8e
Merge branch 'develop' into cards/add-list-dropdown
nicolachr 14aebeb
Merge branch 'develop' into cards/add-list-dropdown
nicolachr fa11864
Show all lists in dropdown, disable card's current list
nicolachr 8c59b71
Scope card show cache key to card's list
nicolachr b4264cb
Track move_to_list as an update activity
nicolachr 87511f2
Merge branch 'develop' into cards/add-list-dropdown
nicolachr 1b2ed24
Merge branch 'develop' into cards/add-list-dropdown
nicolachr 12944aa
Extract card move actions into sub-resource controllers
nicolachr ef8960f
Fix cache invalidation and atomic save in card position/transfer
nicolachr 17cc212
Remove unused Eventable from Card model
nicolachr eb91548
Merge branch 'develop' into cards/add-list-dropdown
nicolachr 458f24e
Remove transfer controller
aapomm 651c2c9
Update the positions controller to use EventPublisher
aapomm 0c1187a
Merge branch 'develop' into cards/add-list-dropdown
aapomm 77992f9
Merge branch 'develop' into cards/add-list-dropdown
aapomm 42135fd
Add PositionsController for Lists and rename concern
aapomm f782d5b
Simplify cache key and use link_to_if
aapomm 73e3e33
Add back payload data and use :update for positions controller
aapomm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| class Cards::PositionController < AuthenticatedController | ||
| include ActivityTracking | ||
| include ProjectScoped | ||
| include ValidateMove | ||
|
|
||
| before_action :set_current_board_and_list | ||
| before_action :set_card | ||
| before_action :set_prev_item_and_next_item | ||
| before_action :validate_move_params | ||
|
|
||
| def create | ||
| Card.transaction do | ||
| List.move(@card, prev_item: @prev_item, next_item: @next_item) | ||
|
|
||
| if new_list | ||
| @card.list = new_list | ||
| @card.save! | ||
| end | ||
| end | ||
|
|
||
| track_updated(@card) | ||
|
|
||
| render json: { | ||
| is_card: true, | ||
| id: @card.id, | ||
| link: polymorphic_path([current_project, @board, @card.reload.list, @card]), | ||
| moveLink: project_board_list_card_position_path(current_project, @board, @card.reload.list, @card) | ||
| } | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def move_params | ||
| params.permit(:card_id, :project_id, :board_id, :list_id, :next_id, :prev_id, :new_list_id) | ||
| end | ||
|
|
||
| def moveable_items | ||
| @board.cards | ||
| end | ||
|
|
||
| def moveable_item_name | ||
| 'card' | ||
| end | ||
|
|
||
| def moveable_parent | ||
| new_list || @list | ||
| end | ||
|
|
||
| def new_list | ||
| @board.lists.find(move_params[:new_list_id]) if move_params[:new_list_id] | ||
| end | ||
|
|
||
| def set_card | ||
| @card = @board.cards.find(params[:card_id]) | ||
| end | ||
|
|
||
| def set_current_board_and_list | ||
| @board = current_project.boards.includes(:lists).find(params[:board_id]) | ||
| @list = @board.lists.includes(:cards).find(params[:list_id]) | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| class Cards::TransferController < AuthenticatedController | ||
| include ActivityTracking | ||
| include ProjectScoped | ||
|
|
||
| before_action :set_current_board_and_list | ||
| before_action :set_card | ||
|
|
||
| def create | ||
| target_list = @board.lists.find(params[:new_list_id]) | ||
|
|
||
| if target_list.id == @card.list_id | ||
| redirect_to [current_project, @board, @list, @card], alert: 'Task is already in that list.' | ||
| return | ||
| end | ||
|
|
||
| Card.transaction do | ||
| if (next_card = @card.next_card) | ||
| next_card.update_attribute(:previous_id, @card.previous_id) | ||
| end | ||
|
|
||
| @card.list_id = target_list.id | ||
| @card.previous_id = target_list.last_card&.id | ||
| @card.save! | ||
| end | ||
|
|
||
| track_updated(@card) | ||
| redirect_to [current_project, @board, target_list, @card], notice: 'Task moved.' | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def set_card | ||
| @card = @board.cards.find(params[:card_id]) | ||
| end | ||
|
|
||
| def set_current_board_and_list | ||
| @board = current_project.boards.includes(:lists).find(params[:board_id]) | ||
| @list = @board.lists.includes(:cards).find(params[:list_id]) | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.