diff options
| author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-08-01 17:11:56 -0300 |
|---|---|---|
| committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-08-17 12:58:58 -0300 |
| commit | 0fb9210dbb38cd45fc8da052317a9aaf830e1db9 (patch) | |
| tree | 62a34f98cb2eae7d87352654789a916c3e3427da /app | |
| parent | 4f45d11363c4bedb9a68fc461d931abf6f93b5f0 (diff) | |
| download | gitlab-ce-0fb9210dbb38cd45fc8da052317a9aaf830e1db9.tar.gz | |
Add endpoint to allow users to move lists
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/projects/board_lists_controller.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/controllers/projects/board_lists_controller.rb b/app/controllers/projects/board_lists_controller.rb index 8100ff7f05d..6783341c266 100644 --- a/app/controllers/projects/board_lists_controller.rb +++ b/app/controllers/projects/board_lists_controller.rb @@ -1,4 +1,6 @@ class Projects::BoardListsController < Projects::ApplicationController + rescue_from ActiveRecord::RecordNotFound, with: :record_not_found + def create list = Boards::Lists::CreateService.new(project, list_params).execute @@ -11,9 +13,29 @@ class Projects::BoardListsController < Projects::ApplicationController end end + def update + service = Boards::Lists::MoveService.new(project, move_params) + + respond_to do |format| + if service.execute + format.json { head :ok } + else + format.json { head :unprocessable_entity } + end + end + end + private + def record_not_found(exception) + render json: { error: exception.message }, status: :not_found + end + def list_params params.require(:list).permit(:label_id) end + + def move_params + params.require(:list).permit(:position).merge(id: params[:id]) + end end |
