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

Allow dismiss none

Oliver Günther5f1a4005c719
diff --git a/app/helpers/errors_helper.rb b/app/helpers/errors_helper.rb
index f9cc42d21e0..a41b5fb2101 100644
--- a/app/helpers/errors_helper.rb
+++ b/app/helpers/errors_helper.rb
@@ -94,9 +94,8 @@ module ErrorsHelper
@message_details = arg[:message_details]
respond_to do |format|
format.html do
- binding.pry
error_message = "[#{I18n.t(:error_code, code: @status)}] #{@message}\n#{@message_details}"
- flash[:error] = error_message
+ flash.now[:op_primer_flash] = { scheme: :danger, message: error_message, dismiss_scheme: :none }
render template: "common/error", layout: use_layout, status: @status
end
format.any do
diff --git a/app/helpers/flash_messages_helper.rb b/app/helpers/flash_messages_helper.rb
index cf047b012ae..4cb83c8878e 100644
--- a/app/helpers/flash_messages_helper.rb
+++ b/app/helpers/flash_messages_helper.rb
@@ -47,7 +47,7 @@ module FlashMessagesHelper
def render_flash_content(key, content)
case key
when :op_primer_flash
- render_flash_message(content[:scheme] || :default, content[:message])
+ render_flash_message(content[:scheme] || :default, content[:message], **content.except(:message))
else
render_flash_message(key, content)
end
@@ -74,8 +74,8 @@ module FlashMessagesHelper
end
end
- def render_flash_message(type, message)
- render(OpPrimer::FlashComponent.new(scheme: mapped_flash_type(type))) do
+ def render_flash_message(type, message, **args)
+ render(OpPrimer::FlashComponent.new(scheme: mapped_flash_type(type), **args.except(:scheme))) do
join_flash_messages(message)
end
end
diff --git a/app/views/common/_error_base.html.erb b/app/views/common/_error_base.html.erb
deleted file mode 100644
index ef3c0370018..00000000000
--- a/app/views/common/_error_base.html.erb
+++ /dev/null
@@ -1,53 +0,0 @@
-<%#-- 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.
-
-++#%>
-
-<div class="op-toast--wrapper">
- <div class="op-toast--casing">
- <div id="errorExplanation"
- data-members-form-target="errorExplanation"
- class="op-toast errorExplanation -error <%= local_assigns[:classes] || '' %>"
- tabindex="0"
- role="alert">
- <div class="op-toast--content">
- <% if content_for?(:error_details) %>
- <p>
- <strong><%= error_message %></strong>
- </p>
- <%= content_for :error_details %>
- <% else %>
- <%= error_message %>
- <% end %>
- </div>
-
- <span class="close-handler" role="button" tabindex="0" aria-label="{{ ::I18n.t('js.close_popup_title') }}">
- <%= op_icon('icon-close') %>
- </span>
- </div>
- </div>
-</div>
diff --git a/app/views/common/_validation_error.html.erb b/app/views/common/_validation_error.html.erb
deleted file mode 100644
index 109649f48f2..00000000000
--- a/app/views/common/_validation_error.html.erb
+++ /dev/null
@@ -1,42 +0,0 @@
-<%#-- 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.
-
-++#%>
-
-<% content_for :error_details, flush: true do %>
- <%= list_of_messages(base_error_messages) %>
- <%= text_header_invalid_fields(base_error_messages, fields_error_messages) %>
- <%= list_of_messages(fields_error_messages) %>
-<% end %>
-
-<%= render partial: "common/error_base",
- locals: {
- error_message: t("activerecord.errors.template.header",
- model: object_name,
- count: base_error_messages.count + fields_error_messages.count)
- }
-%>