Module: BoardsHelper
- Defined in:
- app/helpers/boards_helper.rb
Instance Method Summary collapse
- #board ⇒ Object
- #board_base_url ⇒ Object
- #board_data ⇒ Object
- #build_issue_link_base ⇒ Object
- #can_admin_board? ⇒ Boolean
- #can_admin_list? ⇒ Boolean
- #can_update? ⇒ Boolean
- #current_board_namespace ⇒ Object
- #current_board_parent ⇒ Object
- #full_path ⇒ Object
- #group_id ⇒ Object
-
#has_missing_boards? ⇒ Boolean
Boards are hidden when extra boards were created but the license does not allow multiple boards.
- #labels_fetch_path ⇒ Object
- #labels_manage_path ⇒ Object
- #multiple_boards_available? ⇒ Boolean
- #releases_fetch_path ⇒ Object
Instance Method Details
#board ⇒ Object
4 5 6 |
# File 'app/helpers/boards_helper.rb', line 4 def board @board end |
#board_base_url ⇒ Object
77 78 79 80 81 82 83 |
# File 'app/helpers/boards_helper.rb', line 77 def board_base_url if board.group_board? group_boards_url(@group) else project_boards_path(@project) end end |
#board_data ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/helpers/boards_helper.rb', line 8 def board_data { board_id: board.id, disabled: board.disabled_for?(current_user).to_s, root_path: root_path, full_path: full_path, can_update: can_update?.to_s, can_admin_list: can_admin_list?.to_s, can_admin_board: can_admin_board?.to_s, time_tracking_limit_to_hours: Gitlab::CurrentSettings.time_tracking_limit_to_hours.to_s, parent: current_board_parent.model_name.param_key, group_id: group_id, labels_filter_base_path: build_issue_link_base, labels_fetch_path: labels_fetch_path, labels_manage_path: labels_manage_path, releases_fetch_path: releases_fetch_path, board_type: board.to_type, has_missing_boards: has_missing_boards?.to_s, multiple_boards_available: multiple_boards_available?.to_s, board_base_url: board_base_url } end |
#build_issue_link_base ⇒ Object
45 46 47 48 49 50 51 |
# File 'app/helpers/boards_helper.rb', line 45 def build_issue_link_base if board.group_board? "/:project_path/-/issues" else project_issues_path(@project) end end |
#can_admin_board? ⇒ Boolean
110 111 112 |
# File 'app/helpers/boards_helper.rb', line 110 def can_admin_board? can?(current_user, :admin_issue_board, current_board_parent) end |
#can_admin_list? ⇒ Boolean
106 107 108 |
# File 'app/helpers/boards_helper.rb', line 106 def can_admin_list? can?(current_user, :admin_issue_board_list, current_board_parent) end |
#can_update? ⇒ Boolean
102 103 104 |
# File 'app/helpers/boards_helper.rb', line 102 def can_update? can?(current_user, :admin_issue, board) end |
#current_board_namespace ⇒ Object
98 99 100 |
# File 'app/helpers/boards_helper.rb', line 98 def current_board_namespace @current_board_namespace = board.group_board? ? @group : @project.namespace end |
#current_board_parent ⇒ Object
94 95 96 |
# File 'app/helpers/boards_helper.rb', line 94 def current_board_parent @current_board_parent ||= @group || @project end |
#full_path ⇒ Object
37 38 39 40 41 42 43 |
# File 'app/helpers/boards_helper.rb', line 37 def full_path if board.group_board? @group.full_path else @project.full_path end end |
#group_id ⇒ Object
31 32 33 34 35 |
# File 'app/helpers/boards_helper.rb', line 31 def group_id return @group.id if board.group_board? @project&.group&.id end |
#has_missing_boards? ⇒ Boolean
Boards are hidden when extra boards were created but the license does not allow multiple boards
90 91 92 |
# File 'app/helpers/boards_helper.rb', line 90 def has_missing_boards? !multiple_boards_available? && current_board_parent.boards.size > 1 end |
#labels_fetch_path ⇒ Object
53 54 55 56 57 58 59 |
# File 'app/helpers/boards_helper.rb', line 53 def labels_fetch_path if board.group_board? group_labels_path(@group, format: :json, only_group_labels: true, include_ancestor_groups: true) else project_labels_path(@project, format: :json, include_ancestor_groups: true) end end |
#labels_manage_path ⇒ Object
61 62 63 64 65 66 67 |
# File 'app/helpers/boards_helper.rb', line 61 def labels_manage_path if board.group_board? group_labels_path(@group) else project_labels_path(@project) end end |
#multiple_boards_available? ⇒ Boolean
85 86 87 |
# File 'app/helpers/boards_helper.rb', line 85 def multiple_boards_available? current_board_parent.multiple_issue_boards_available? end |
#releases_fetch_path ⇒ Object
69 70 71 72 73 74 75 |
# File 'app/helpers/boards_helper.rb', line 69 def releases_fetch_path if board.group_board? group_releases_path(@group) else project_releases_path(@project) end end |