Commit ad36ddfb authored by Felipe Artur's avatar Felipe Artur

Adjustments and remove project_id not null constraint

parent f216d57a
......@@ -14,6 +14,8 @@ class Groups::BoardsController < Groups::ApplicationController
end
def assign_endpoint_vars
@boards_endpoint = group_boards_path(@group)
@boards_endpoint = group_boards_path(group)
@issues_path = issues_group_path(group)
@bulk_issues_path = ""
end
end
......@@ -30,7 +30,9 @@ class Projects::BoardsController < Projects::ApplicationController
private
def assign_endpoint_vars
@boards_endpoint = project_boards_path(@project)
@boards_endpoint = project_boards_path(project)
@issues_path = project_issues_path(project)
@bulk_issues_path = bulk_update_project_issues_path(@project)
end
def authorize_read_board!
......
......@@ -8,10 +8,10 @@ module BoardsHelper
endpoint: @boards_endpoint,
board_id: board.id,
board_milestone_title: board&.milestone&.title,
disabled: "#{!can?(current_user, :admin_list, @project)}",
issue_link_base: project_issues_path(@project),
disabled: "#{!can?(current_user, :admin_list, @project)}", # Create this permission for groups( if needed )
issue_link_base: @issues_path,
root_path: root_path,
bulk_update_path: bulk_update_project_issues_path(@project),
bulk_update_path: @bulk_issues_path,
default_avatar: image_path(default_avatar)
}
end
......
module EE
module BoardsHelper
def board_data
super.merge(focus_mode_available: @project.feature_available?(:issue_board_focus_mode).to_s)
parent = @group || @project
super.merge(focus_mode_available: parent.feature_available?(:issue_board_focus_mode).to_s)
end
end
end
......@@ -5,7 +5,8 @@ class Board < ActiveRecord::Base
has_many :lists, -> { order(:list_type, :position) }, dependent: :delete_all # rubocop:disable Cop/ActiveRecordDependent
validates :name, :project, presence: true
validates :name, presence: true
validates :project, presence: true, unless: -> { respond_to?(:group_id) }
def backlog_list
lists.merge(List.backlog).take
......
......@@ -10,7 +10,9 @@ module EE
end
def milestone
return nil unless project.feature_available?(:issue_board_milestone)
parent = project || group
return nil unless parent.feature_available?(:issue_board_milestone)
if milestone_id == ::Milestone::Upcoming.id
::Milestone::Upcoming
......
......@@ -14,7 +14,7 @@ module Boards
def create_board!
board = parent.boards.create(params)
byebug
if board.persisted?
board.lists.create(list_type: :backlog)
board.lists.create(list_type: :closed)
......
......@@ -33,7 +33,7 @@
":root-path" => "rootPath",
":board-id" => "boardId",
":key" => "_uid" }
= render "projects/boards/components/sidebar"
=# render "projects/boards/components/sidebar"
%board-add-issues-modal{ "blank-state-image" => render('shared/empty_states/icons/issues.svg'),
"new-issue-path" => "",
"milestone-path" => milestones_filter_dropdown_path,
......
class AddGroupIdToBoards < ActiveRecord::Migration
DOWNTIME = false
def change
def up
change_column_null :boards, :project_id, true
add_column :boards, :group_id, :integer
end
def down
# We cannot rollback project_id not null constraint if there are records
# with null values.
execute "DELETE from boards WHERE project_id IS NULL"
remove_column :boards, :group_id
change_column :boards, :project_id, :integer, null: false
end
end
......@@ -207,7 +207,7 @@ ActiveRecord::Schema.define(version: 20170718190627) do
add_index "award_emoji", ["user_id", "name"], name: "index_award_emoji_on_user_id_and_name", using: :btree
create_table "boards", force: :cascade do |t|
t.integer "project_id", null: false
t.integer "project_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "name", default: "Development", null: false
......
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