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

Support rendering flash messages on create failure

Alexander Brandon Coles23e56d7b9e22
diff --git a/app/components/projects/new_component.html.erb b/app/components/projects/new_component.html.erb
index d5f4d2d6eda..748b31cd8d2 100644
--- a/app/components/projects/new_component.html.erb
+++ b/app/components/projects/new_component.html.erb
@@ -38,6 +38,9 @@ See COPYRIGHT and LICENSE files for more details.
autoscroll_behavior: :smooth
}
) do
+%>
+ <%= render_flash_messages_as_turbo_streams %>
+ <%=
settings_primer_form_with(model: project) do |f|
flex_layout do |container|
container.with_row(mb: 3) do
@@ -65,5 +68,5 @@ See COPYRIGHT and LICENSE files for more details.
end
end
end
- end
-%>
+ %>
+<% end %>
diff --git a/app/components/projects/new_component.rb b/app/components/projects/new_component.rb
index 1b2cf4d418c..f8067c9393f 100644
--- a/app/components/projects/new_component.rb
+++ b/app/components/projects/new_component.rb
@@ -33,6 +33,7 @@ module Projects
include ApplicationHelper
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable
+ include FlashMessagesHelper
options :project, :template, :copy_options
end
diff --git a/spec/features/projects/create_spec.rb b/spec/features/projects/create_spec.rb
index b9e2684ab23..c102fd57f46 100644
--- a/spec/features/projects/create_spec.rb
+++ b/spec/features/projects/create_spec.rb
@@ -228,6 +228,8 @@ RSpec.describe "Projects", "creation",
click_on "Create"
+ expect_and_dismiss_flash type: :error, message: /^Creation failed/
+
expect(page).to have_field "Required Foo", validation_error: "can't be blank."
end
end