debian-mirror-gitlab/app/controllers/projects/boards_controller.rb

41 lines
969 B
Ruby
Raw Normal View History

2016-09-13 17:45:13 +05:30
class Projects::BoardsController < Projects::ApplicationController
2018-03-17 18:26:18 +05:30
include BoardsResponses
2016-11-03 12:29:30 +05:30
include IssuableCollections
2016-09-13 17:45:13 +05:30
2018-03-17 18:26:18 +05:30
before_action :check_issues_available!
2016-11-03 12:29:30 +05:30
before_action :authorize_read_board!, only: [:index, :show]
2018-11-08 19:23:39 +05:30
before_action :boards, only: :index
2018-03-17 18:26:18 +05:30
before_action :assign_endpoint_vars
2016-11-03 12:29:30 +05:30
def index
2018-03-17 18:26:18 +05:30
respond_with_boards
2016-11-03 12:29:30 +05:30
end
2016-09-13 17:45:13 +05:30
def show
2018-11-08 19:23:39 +05:30
@board = boards.find(params[:id])
2016-11-03 12:29:30 +05:30
2018-03-17 18:26:18 +05:30
respond_with_board
2016-09-13 17:45:13 +05:30
end
private
2018-11-08 19:23:39 +05:30
def boards
@boards ||= Boards::ListService.new(project, current_user).execute
end
2018-03-17 18:26:18 +05:30
def assign_endpoint_vars
@boards_endpoint = project_boards_path(project)
@bulk_issues_path = bulk_update_project_issues_path(project)
@namespace_path = project.namespace.full_path
@labels_endpoint = project_labels_path(project)
end
2016-09-13 17:45:13 +05:30
def authorize_read_board!
return access_denied! unless can?(current_user, :read_board, project)
end
2016-11-03 12:29:30 +05:30
def serialize_as_json(resource)
resource.as_json(only: [:id])
end
2016-09-13 17:45:13 +05:30
end