summaryrefslogtreecommitdiff
path: root/app/controllers/projects
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-08-01 16:23:16 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-08-17 12:58:58 -0300
commited9943d0130f4a581156afcf038f2b51fd9cea9f (patch)
tree752a531108dcc88595a0870382772d5f972348a7 /app/controllers/projects
parente1998844781b92d118f25cb8f8c0cbd293a25708 (diff)
downloadgitlab-ce-ed9943d0130f4a581156afcf038f2b51fd9cea9f.tar.gz
Add endpoint to allow users to create a new board list
Diffstat (limited to 'app/controllers/projects')
-rw-r--r--app/controllers/projects/board_lists_controller.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/controllers/projects/board_lists_controller.rb b/app/controllers/projects/board_lists_controller.rb
new file mode 100644
index 00000000000..8100ff7f05d
--- /dev/null
+++ b/app/controllers/projects/board_lists_controller.rb
@@ -0,0 +1,19 @@
+class Projects::BoardListsController < Projects::ApplicationController
+ def create
+ list = Boards::Lists::CreateService.new(project, list_params).execute
+
+ respond_to do |format|
+ if list.valid?
+ format.json { render json: list.as_json(only: [:id, :list_type, :position], methods: [:title], include: { label: { only: [:id, :title, :color] } }) }
+ else
+ format.json { render json: list.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ private
+
+ def list_params
+ params.require(:list).permit(:label_id)
+ end
+end