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
extract documents attachment handling
ulferts6910895b531e
diff --git a/modules/documents/app/helpers/documents_helper.rb b/modules/documents/app/helpers/documents_helper.rbnew file mode 100644index 00000000000..d4f07417bd7--- /dev/null+++ b/modules/documents/app/helpers/documents_helper.rb@@ -0,0 +1,36 @@+#-- encoding: UTF-8+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2020 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-2017 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 docs/COPYRIGHT.rdoc for more details.+#++++module DocumentsHelper+ def api_v3_document_resource(document)+ ::API::V3::Documents::DocumentRepresenter.new(document,+ current_user: current_user,+ embed_links: true)+ end+enddiff --git a/modules/documents/app/views/documents/_form.html.erb b/modules/documents/app/views/documents/_form.html.erbindex 649d660358a..813cc72ba20 100644--- a/modules/documents/app/views/documents/_form.html.erb+++ b/modules/documents/app/views/documents/_form.html.erb@@ -28,9 +28,6 @@ See docs/COPYRIGHT.rdoc for more details.++#%><%= error_messages_for 'document' %>-<% resource = ::API::V3::Documents::DocumentRepresenter.new(f.object,- current_user: current_user,- embed_links: true) %><div class="form--field -required"><%= f.select :category_id,@@ -45,6 +42,6 @@ See docs/COPYRIGHT.rdoc for more details.<%= f.text_area :description,container_class: '-xxwide',with_text_formatting: true,- resource: resource,+ resource: api_v3_document_resource(f.object),preview_context: preview_context(f.object.project) %></div>diff --git a/modules/documents/app/views/documents/show.html.erb b/modules/documents/app/views/documents/show.html.erbindex f6c76b611a4..0dc27ec2e7c 100644--- a/modules/documents/app/views/documents/show.html.erb+++ b/modules/documents/app/views/documents/show.html.erb@@ -52,8 +52,5 @@ See docs/COPYRIGHT.rdoc for more details.<%= format_text @document.description, attachments: @document.attachments %></div>-<% resource = ::API::V3::Documents::DocumentRepresenter.new(@document,- current_user: current_user,- embed_links: true) %>-<%= list_attachments(resource) %>+<%= list_attachments(api_v3_document_resource(@document)) %>