Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Address CR comments

Dombi Attilaa96fdd1de130
diff --git a/config/locales/en.yml b/config/locales/en.yml
index de8d83c86a2..9d8817ed940 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1235,12 +1235,12 @@ en:
type:
type_and_class_name_mismatch: "must be a Project::Gate"
date:
- non_continuous_dates: "can’t be earlier than the previous %{step}'s end date."
+ non_continuous_dates: "can't be earlier than the previous %{step}'s end date."
project/stage:
attributes:
date_range:
start_date_must_be_before_end_date: "start date must be before the end date."
- non_continuous_dates: "can’t be earlier than the previous %{step}'s end date."
+ non_continuous_dates: "can't be earlier than the previous %{step}'s end date."
incomplete: "is incomplete."
type:
type_and_class_name_mismatch: "must be a Project::Stage"
diff --git a/frontend/src/turbo/turbo-global-listeners.ts b/frontend/src/turbo/turbo-global-listeners.ts
index 0f379be5681..8ad1914e8fd 100644
--- a/frontend/src/turbo/turbo-global-listeners.ts
+++ b/frontend/src/turbo/turbo-global-listeners.ts
@@ -69,7 +69,7 @@ export function addTurboGlobalListeners() {
const element = event.target as HTMLElement;
// In case the element is an OpenProject custom dom element, morphing is prevented.
- if (element.tagName.startsWith('OPCE-')) {
+ if (element.tagName.toUpperCase().startsWith('OPCE-')) {
event.preventDefault();
}
});
diff --git a/lib/primer/open_project/forms/date_picker.html.erb b/lib/primer/open_project/forms/date_picker.html.erb
index 0483d34c951..7b55923f0a4 100644
--- a/lib/primer/open_project/forms/date_picker.html.erb
+++ b/lib/primer/open_project/forms/date_picker.html.erb
@@ -1,3 +1,32 @@
+<%#-- copyright
+OpenProject is an open source project management software.
+Copyright (C) the OpenProject GmbH
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License version 3.
+
+OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+Copyright (C) 2006-2013 Jean-Philippe Lang
+Copyright (C) 2010-2013 the ChiliProject Team
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+See COPYRIGHT and LICENSE files for more details.
+
+++#%>
+
<%= render(FormControl.new(input: @input, tag: :"primer-datepicker-field")) do %>
<%= content_tag(:div, **@field_wrap_arguments) do %>
<%# leading spinner implies a leading visual %>
diff --git a/lib/primer/open_project/forms/date_picker.rb b/lib/primer/open_project/forms/date_picker.rb
index f3089f101f7..6c7de2fc830 100644
--- a/lib/primer/open_project/forms/date_picker.rb
+++ b/lib/primer/open_project/forms/date_picker.rb
@@ -1,5 +1,33 @@
# frozen_string_literal: true
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
module Primer
module OpenProject
module Forms
diff --git a/lib/primer/open_project/forms/dsl/range_date_picker_input.rb b/lib/primer/open_project/forms/dsl/range_date_picker_input.rb
index e3a5710228d..0b79a36b068 100644
--- a/lib/primer/open_project/forms/dsl/range_date_picker_input.rb
+++ b/lib/primer/open_project/forms/dsl/range_date_picker_input.rb
@@ -1,5 +1,33 @@
# frozen_string_literal: true
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
module Primer
module OpenProject
module Forms
diff --git a/lib/primer/open_project/forms/dsl/single_date_picker_input.rb b/lib/primer/open_project/forms/dsl/single_date_picker_input.rb
index d62eed45b22..7a356bdfba4 100644
--- a/lib/primer/open_project/forms/dsl/single_date_picker_input.rb
+++ b/lib/primer/open_project/forms/dsl/single_date_picker_input.rb
@@ -1,5 +1,33 @@
# frozen_string_literal: true
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
module Primer
module OpenProject
module Forms
diff --git a/modules/overviews/app/components/project_life_cycles/sections/edit_component.rb b/modules/overviews/app/components/project_life_cycles/sections/edit_component.rb
index d0016f8b313..69e395d772f 100644
--- a/modules/overviews/app/components/project_life_cycles/sections/edit_component.rb
+++ b/modules/overviews/app/components/project_life_cycles/sections/edit_component.rb
@@ -32,10 +32,6 @@ module ProjectLifeCycles
include ApplicationHelper
include OpTurbo::Streamable
include OpPrimer::ComponentHelpers
-
- def life_cycle_steps
- model.life_cycle_steps.active.eager_load(:definition).order(position: :asc)
- end
end
end
end
diff --git a/modules/overviews/app/components/project_life_cycles/sections/edit_dialog_component.html.erb b/modules/overviews/app/components/project_life_cycles/sections/edit_dialog_component.html.erb
index 7ff822ece82..a2eab213ea0 100644
--- a/modules/overviews/app/components/project_life_cycles/sections/edit_dialog_component.html.erb
+++ b/modules/overviews/app/components/project_life_cycles/sections/edit_dialog_component.html.erb
@@ -1,7 +1,7 @@
<%=
render(Primer::Alpha::Dialog.new(title: t("label_life_cycle_step_plural"),
size: :large,
- id: "edit-project-life-cycles-dialog")) do |d|
+ id: dialog_id)) do |d|
d.with_header(variant: :large)
d.with_body(classes: "Overlay-body_autocomplete_height") do
render(::ProjectLifeCycles::Sections::EditComponent.new(model))
@@ -10,7 +10,7 @@
component_collection do |footer_collection|
footer_collection.with_component(Primer::ButtonComponent.new(
data: {
- 'close-dialog-id': "edit-project-life-cycles-dialog"
+ "close-dialog-id": dialog_id
}
)) do
t("button_cancel")
diff --git a/modules/overviews/app/components/project_life_cycles/sections/edit_dialog_component.rb b/modules/overviews/app/components/project_life_cycles/sections/edit_dialog_component.rb
index 584b01af793..45f2689421e 100644
--- a/modules/overviews/app/components/project_life_cycles/sections/edit_dialog_component.rb
+++ b/modules/overviews/app/components/project_life_cycles/sections/edit_dialog_component.rb
@@ -32,6 +32,10 @@ module ProjectLifeCycles
include ApplicationHelper
include OpTurbo::Streamable
include OpPrimer::ComponentHelpers
+
+ def dialog_id
+ "edit-project-life-cycles-dialog"
+ end
end
end
end
diff --git a/modules/overviews/app/components/project_life_cycles/sections/project_life_cycles/show_component.rb b/modules/overviews/app/components/project_life_cycles/sections/project_life_cycles/show_component.rb
index 4c2e552c8d8..43e1f19da34 100644
--- a/modules/overviews/app/components/project_life_cycles/sections/project_life_cycles/show_component.rb
+++ b/modules/overviews/app/components/project_life_cycles/sections/project_life_cycles/show_component.rb
@@ -40,18 +40,14 @@ module ProjectLifeCycles
end
def render_value
- case model
- when Project::Gate
- render(Primer::Beta::Text.new) do
- concat helpers.format_date(model.date)
- end
- when Project::Stage
- render(Primer::Beta::Text.new) do
- concat [
- helpers.format_date(model.start_date),
- helpers.format_date(model.end_date)
- ].join(" - ")
- end
+ render(Primer::Beta::Text.new) do
+ concat [
+ model.start_date,
+ model.end_date
+ ]
+ .compact
+ .map { |d| helpers.format_date(d) }
+ .join(" - ")
end
end
diff --git a/modules/overviews/app/components/project_life_cycles/sections/show_component.html.erb b/modules/overviews/app/components/project_life_cycles/sections/show_component.html.erb
index 0aa8e9678fe..c8a801c9f9d 100644
--- a/modules/overviews/app/components/project_life_cycles/sections/show_component.html.erb
+++ b/modules/overviews/app/components/project_life_cycles/sections/show_component.html.erb
@@ -21,7 +21,7 @@
flex_layout do |details_container|
@life_cycle_steps.each_with_index do |life_cycle_step, i|
- margin = i == @life_cycle_steps.size - 1 ? 0 : 3
+ margin = i == @life_cycle_steps.size - 1 ? 0 : 3
details_container.with_row(mb: margin) do
render(ProjectLifeCycles::Sections::ProjectLifeCycles::ShowComponent.new(
life_cycle_step
diff --git a/modules/overviews/app/components/project_life_cycles/sections/show_component.rb b/modules/overviews/app/components/project_life_cycles/sections/show_component.rb
index f7af8e54be1..f848609e596 100644
--- a/modules/overviews/app/components/project_life_cycles/sections/show_component.rb
+++ b/modules/overviews/app/components/project_life_cycles/sections/show_component.rb
@@ -37,8 +37,7 @@ module ProjectLifeCycles
super
@project = project
- @life_cycle_steps =
- @project.life_cycle_steps.active.eager_load(:definition).order(position: :asc)
+ @life_cycle_steps = @project.available_life_cycle_steps
end
private
diff --git a/modules/overviews/lib/overviews/engine.rb b/modules/overviews/lib/overviews/engine.rb
index e9ba90c450d..f9e5988c90b 100644
--- a/modules/overviews/lib/overviews/engine.rb
+++ b/modules/overviews/lib/overviews/engine.rb
@@ -47,8 +47,7 @@ module Overviews
OpenProject::AccessControl.permission(:view_project)
.controller_actions
.push(
- "overviews/overviews/show",
- "overviews/overviews/project_life_cycles_sidebar"
+ "overviews/overviews/show"
)
OpenProject::AccessControl.permission(:view_project_attributes)
diff --git a/spec/contracts/project_life_cycle_steps/base_contract_spec.rb b/spec/contracts/project_life_cycle_steps/base_contract_spec.rb
index 0b928f849f4..8bb93c4a5b6 100644
--- a/spec/contracts/project_life_cycle_steps/base_contract_spec.rb
+++ b/spec/contracts/project_life_cycle_steps/base_contract_spec.rb
@@ -37,7 +37,7 @@ RSpec.describe ProjectLifeCycleSteps::BaseContract do
let(:contract) { described_class.new(project, user) }
let(:project) { build_stubbed(:project) }
- context "with authorised user" do
+ context "with authorized user" do
let(:user) { build_stubbed(:user) }
let(:project) { build_stubbed(:project, available_life_cycle_steps: steps) }
let(:steps) { [] }
@@ -145,7 +145,7 @@ RSpec.describe ProjectLifeCycleSteps::BaseContract do
end
end
- context "with unauthorised user" do
+ context "with unauthorized user" do
let(:user) { build_stubbed(:user) }
it_behaves_like "contract user is unauthorized"
diff --git a/spec/features/projects/life_cycle/overview_page/dialog/permission_spec.rb b/spec/features/projects/life_cycle/overview_page/dialog/permission_spec.rb
index 1623d8ae85d..85da512cea9 100644
--- a/spec/features/projects/life_cycle/overview_page/dialog/permission_spec.rb
+++ b/spec/features/projects/life_cycle/overview_page/dialog/permission_spec.rb
@@ -60,6 +60,7 @@ RSpec.describe "Edit project stages and gates on project overview page", :js, :w
expect(page).to have_text("Project lifecycle")
end
end
+ end
describe "with Edit project permissions" do
let(:permissions) { [:view_project, :view_project_stages_and_gates, :edit_project] }
diff --git a/spec/features/projects/project_custom_fields/overview_page/dialog/permission_spec.rb b/spec/features/projects/project_custom_fields/overview_page/dialog/permission_spec.rb
index ba44fca7a03..57989382553 100644
--- a/spec/features/projects/project_custom_fields/overview_page/dialog/permission_spec.rb
+++ b/spec/features/projects/project_custom_fields/overview_page/dialog/permission_spec.rb
@@ -31,7 +31,6 @@ require_relative "../shared_context"
RSpec.describe "Edit project custom fields on project overview page", :js do
include_context "with seeded projects, members and project custom fields"
-
let(:overview_page) { Pages::Projects::Show.new(project) }
describe "with insufficient View attributes permissions" do
diff --git a/spec/models/project/stage_spec.rb b/spec/models/project/stage_spec.rb
index 5fc4234345a..99388f780f8 100644
--- a/spec/models/project/stage_spec.rb
+++ b/spec/models/project/stage_spec.rb
@@ -139,6 +139,9 @@ RSpec.describe Project::Stage do
.and_return([])
expect(subject.working_days_count).to eq(0)
+
+ expect(Day).to have_received(:working).with(no_args)
+ expect(Day).to have_received(:from_range).with(from: subject.start_date, to: subject.end_date)
end
end
end
diff --git a/spec/support/pages/projects/show.rb b/spec/support/pages/projects/show.rb
index bae1d5210bb..4877c69ab00 100644
--- a/spec/support/pages/projects/show.rb
+++ b/spec/support/pages/projects/show.rb
@@ -51,12 +51,12 @@ module Pages
def expect_no_visible_sidebar
expect_angular_frontend_initialized
- expect(page).to have_no_css(".op-grid-page--grid-container")
+ expect(page).to have_no_css(".op-grid-page--sidebar")
end
def expect_visible_sidebar
expect_angular_frontend_initialized
- expect(page).to have_css(".op-grid-page--grid-container")
+ expect(page).to have_css(".op-grid-page--sidebar")
end
def within_project_attributes_sidebar(&)