2016-08-01 12:09:41 -04:00
|
|
|
class Projects::BoardsController < Projects::ApplicationController
|
2016-08-30 09:50:46 -04:00
|
|
|
include IssuableCollections
|
2016-08-15 18:50:23 -04:00
|
|
|
|
2016-10-05 15:24:29 -04:00
|
|
|
before_action :authorize_read_board!, only: [:index, :show]
|
|
|
|
|
|
|
|
def index
|
|
|
|
@boards = ::Boards::ListService.new(project, current_user).execute
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html
|
|
|
|
format.json do
|
|
|
|
render json: @boards.as_json(only: [:id, :name])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2016-08-08 18:03:41 -04:00
|
|
|
|
2016-08-01 12:09:41 -04:00
|
|
|
def show
|
2016-08-15 18:50:23 -04:00
|
|
|
::Boards::CreateService.new(project, current_user).execute
|
2016-08-01 12:09:41 -04:00
|
|
|
end
|
2016-08-08 18:03:41 -04:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def authorize_read_board!
|
2016-08-15 18:50:23 -04:00
|
|
|
return access_denied! unless can?(current_user, :read_board, project)
|
2016-08-08 18:03:41 -04:00
|
|
|
end
|
2016-08-01 12:09:41 -04:00
|
|
|
end
|