Commit acba6dc3 authored by Felipe Artur's avatar Felipe Artur

Improve boards validation code and fix sidebar resources

parent 34d050f6
...@@ -127,7 +127,8 @@ module LabelsHelper ...@@ -127,7 +127,8 @@ module LabelsHelper
if project if project
project_labels_path(project, :json) project_labels_path(project, :json)
elsif @group elsif @group
group_labels_path(@group, :json, only_group_labels: only_group_labels) options = { only_group_labels: only_group_labels } if only_group_labels
group_labels_path(@group, :json, options)
else else
dashboard_labels_path(:json) dashboard_labels_path(:json)
end end
......
...@@ -7,7 +7,11 @@ class Board < ActiveRecord::Base ...@@ -7,7 +7,11 @@ class Board < ActiveRecord::Base
validates :name, presence: true validates :name, presence: true
validates :project, presence: true, if: -> { respond_to?(:group_id) && !group } validates :project, presence: true, if: :project_needed?
def project_needed?
true
end
def backlog_list def backlog_list
lists.merge(List.backlog).take lists.merge(List.backlog).take
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
show_no: "true", show_no: "true",
show_any: "true", show_any: "true",
project_id: @project&.try(:id), project_id: @project&.try(:id),
labels: labels_filter_path(true), labels: labels_filter_path(false),
namespace_path: @project.try(:namespace).try(:full_path), namespace_path: @project.try(:namespace).try(:full_path),
project_path: @project.try(:path) }, project_path: @project.try(:path) },
":data-issue-update" => "'#{build_issue_link_base}/' + issue.iid + '.json'" } ":data-issue-update" => "'#{build_issue_link_base}/' + issue.iid + '.json'" }
......
- milestone_filter_opts = { format: :json }
- milestone_filter_opts = milestone_filter_opts.merge(only_group_milestones: true) if board.group_board?
.block.milestone .block.milestone
.title .title
Milestone Milestone
...@@ -19,7 +16,7 @@ ...@@ -19,7 +16,7 @@
name: "issue[milestone_id]", name: "issue[milestone_id]",
"v-if" => "issue.milestone" } "v-if" => "issue.milestone" }
.dropdown .dropdown
%button.dropdown-menu-toggle.js-milestone-select.js-issue-board-sidebar{ type: "button", data: { toggle: "dropdown", show_no: "true", field_name: "issue[milestone_id]", milestones: milestones_filter_path(milestone_filter_opts), ability_name: "issue", use_id: "true", default_no: "true" }, %button.dropdown-menu-toggle.js-milestone-select.js-issue-board-sidebar{ type: "button", data: { toggle: "dropdown", show_no: "true", field_name: "issue[milestone_id]", milestones: milestones_filter_path(format: :json), ability_name: "issue", use_id: "true", default_no: "true" },
":data-selected" => "milestoneTitle", ":data-selected" => "milestoneTitle",
":data-issuable-id" => "issue.iid", ":data-issuable-id" => "issue.iid",
":data-issue-update" => "'#{build_issue_link_base}/' + issue.iid + '.json'" } ":data-issue-update" => "'#{build_issue_link_base}/' + issue.iid + '.json'" }
......
...@@ -9,6 +9,10 @@ module EE ...@@ -9,6 +9,10 @@ module EE
validates :group, presence: true, unless: :project validates :group, presence: true, unless: :project
end end
def project_needed?
!group
end
def milestone def milestone
return nil unless parent.feature_available?(:issue_board_milestone) return nil unless parent.feature_available?(:issue_board_milestone)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment