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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add LinkAttributeFilter to be able to add "target" attribute. Thus the "privacy policy"-link opens automatically in a new tab
Henriette Darge318a0e56fd3e
diff --git a/app/controllers/concerns/accounts/user_consent.rb b/app/controllers/concerns/accounts/user_consent.rbindex 2f79fda1914..ae6467e420d 100644--- a/app/controllers/concerns/accounts/user_consent.rb+++ b/app/controllers/concerns/accounts/user_consent.rb@@ -61,7 +61,7 @@ module Accounts::UserConsentdef decline_consentmessage = I18n.t('consent.decline_warning_message') + "\n"message <<- if Setting.consent_decline_mail+ if Setting.consent_decline_mail.present?I18n.t('consent.contact_this_mail_address', mail_address: Setting.consent_decline_mail)elseI18n.t('consent.contact_your_administrator')diff --git a/app/views/account/_user_consent_check.html.erb b/app/views/account/_user_consent_check.html.erbindex 7d3e66449d7..487f360b5f3 100644--- a/app/views/account/_user_consent_check.html.erb+++ b/app/views/account/_user_consent_check.html.erb@@ -1,6 +1,6 @@<section class="form--section"><p>- <%= format_text user_consent_instructions(consenting_user) %>+ <%= format_text user_consent_instructions(consenting_user), { target: '_blank' } %></p><label class="form--label-with-check-box -required -no-ellipsis">@@ -8,6 +8,6 @@<input type="checkbox" name="consent_check" class="form--check-box" required="required" /></div>- <%= format_text consent_checkbox_label %>+ <p><%= consent_checkbox_label %></p></label></section>diff --git a/lib/open_project/text_formatting/filters/link_attribute_filter.rb b/lib/open_project/text_formatting/filters/link_attribute_filter.rbnew file mode 100644index 00000000000..3172e15ac17--- /dev/null+++ b/lib/open_project/text_formatting/filters/link_attribute_filter.rb@@ -0,0 +1,47 @@+#-- encoding: UTF-8++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2021 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 OpenProject::TextFormatting+ module Filters+ class LinkAttributeFilter < HTML::Pipeline::Filter+ def call+ links.each do |node|+ node['target'] = context[:target] if context[:target].present?+ end++ doc+ end++ def links+ doc.xpath(".//a[contains(@href,'/')]")+ end+ end+ end+enddiff --git a/lib/open_project/text_formatting/formats/markdown/formatter.rb b/lib/open_project/text_formatting/formats/markdown/formatter.rbindex ce01571164a..bb4a9799c01 100644--- a/lib/open_project/text_formatting/formats/markdown/formatter.rb+++ b/lib/open_project/text_formatting/formats/markdown/formatter.rb@@ -55,6 +55,7 @@ module OpenProject::TextFormatting::Formats::Markdownsyntax_highlightattachmentrelative_link+ link_attributefigure_wrappedbem_cssautolink