BigW Consortium Gitlab

boards_controller.rb 876 Bytes
Newer Older
1
class Projects::BoardsController < Projects::ApplicationController
2
  include BoardsResponses
Felipe Artur committed
3
  include IssuableCollections
4

5
  before_action :authorize_read_board!, only: [:index, :show]
6
  before_action :assign_endpoint_vars
7 8

  def index
9 10 11
    @boards = Boards::ListService.new(project, current_user).execute

    respond_with_boards
12
  end
13

14
  def show
15 16
    @board = project.boards.find(params[:id])

17
    respond_with_board
18
  end
19 20 21

  private

22 23 24
  def assign_endpoint_vars
    @boards_endpoint = project_boards_url(project)
    @bulk_issues_path = bulk_update_project_issues_path(project)
Felipe Artur committed
25
    @namespace_path = project.namespace.full_path
26 27 28
    @labels_endpoint = project_labels_path(project)
  end

29
  def authorize_read_board!
30
    return access_denied! unless can?(current_user, :read_board, project)
31
  end
32 33

  def serialize_as_json(resource)
34
    resource.as_json(only: [:id])
35
  end
36
end