2016-08-01 16:09:41 +00:00
|
|
|
class Projects::BoardsController < Projects::ApplicationController
|
2017-08-28 21:56:49 +00:00
|
|
|
include BoardsResponses
|
2017-08-31 17:48:57 +00:00
|
|
|
include IssuableCollections
|
2016-08-15 22:50:23 +00:00
|
|
|
|
2016-10-05 19:24:29 +00:00
|
|
|
before_action :authorize_read_board!, only: [:index, :show]
|
2017-08-28 21:56:49 +00:00
|
|
|
before_action :assign_endpoint_vars
|
2016-10-05 19:24:29 +00:00
|
|
|
|
|
|
|
def index
|
2017-08-28 21:56:49 +00:00
|
|
|
@boards = Boards::ListService.new(project, current_user).execute
|
|
|
|
|
|
|
|
respond_with_boards
|
2016-10-05 19:24:29 +00:00
|
|
|
end
|
2016-08-08 22:03:41 +00:00
|
|
|
|
2016-08-01 16:09:41 +00:00
|
|
|
def show
|
2016-10-05 20:08:55 +00:00
|
|
|
@board = project.boards.find(params[:id])
|
|
|
|
|
2017-08-28 21:56:49 +00:00
|
|
|
respond_with_board
|
2016-08-01 16:09:41 +00:00
|
|
|
end
|
2016-08-08 22:03:41 +00:00
|
|
|
|
|
|
|
private
|
|
|
|
|
2017-08-28 21:56:49 +00:00
|
|
|
def assign_endpoint_vars
|
|
|
|
@boards_endpoint = project_boards_url(project)
|
|
|
|
@bulk_issues_path = bulk_update_project_issues_path(project)
|
2017-09-04 19:55:29 +00:00
|
|
|
@namespace_path = project.namespace.full_path
|
2017-08-28 21:56:49 +00:00
|
|
|
@labels_endpoint = project_labels_path(project)
|
|
|
|
end
|
|
|
|
|
2016-08-08 22:03:41 +00:00
|
|
|
def authorize_read_board!
|
2016-08-15 22:50:23 +00:00
|
|
|
return access_denied! unless can?(current_user, :read_board, project)
|
2016-08-08 22:03:41 +00:00
|
|
|
end
|
2016-10-05 20:08:55 +00:00
|
|
|
|
|
|
|
def serialize_as_json(resource)
|
2016-10-11 02:29:20 +00:00
|
|
|
resource.as_json(only: [:id])
|
2016-10-05 20:08:55 +00:00
|
|
|
end
|
2016-08-01 16:09:41 +00:00
|
|
|
end
|