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

DRY up #format_text calls, using most apt overload

Alexander Brandon Coles1ee3bb18592b
diff --git a/app/views/messages/show.html.erb b/app/views/messages/show.html.erb
index 5ec9cbdda7d..d7406de0ebd 100644
--- a/app/views/messages/show.html.erb
+++ b/app/views/messages/show.html.erb
@@ -37,7 +37,7 @@ See COPYRIGHT and LICENSE files for more details.
<div class="forum-message">
<p class="author additional-information"><%= authoring @topic.created_at, @topic.author %></p>
<div class="wiki op-uc-container">
- <%= format_text(@topic.content, object: @topic, attachments: @topic.attachments) %>
+ <%= format_text(@topic, :content, attachments: @topic.attachments) %>
</div>
<% resource = message_attachment_representer(@topic) %>
diff --git a/app/views/news/_news.html.erb b/app/views/news/_news.html.erb
index a20fb3c6d35..c4dead767c9 100644
--- a/app/views/news/_news.html.erb
+++ b/app/views/news/_news.html.erb
@@ -33,7 +33,7 @@ See COPYRIGHT and LICENSE files for more details.
<div class="comment">
<% if news.summary.present? %>
<div class="summary">
- <%= format_text(news.summary, object: news) %>
+ <%= format_text(news, :summary) %>
</div>
<% end %>
<%= "(#{t(:label_x_comments, count: news.comments_count)})" if news.comments_count > 0 %>
diff --git a/app/views/news/show.html.erb b/app/views/news/show.html.erb
index a285fc7d3e0..8dd081cbb25 100644
--- a/app/views/news/show.html.erb
+++ b/app/views/news/show.html.erb
@@ -82,12 +82,12 @@ See COPYRIGHT and LICENSE files for more details.
<% end %>
<% if @news.summary.present? %>
<div class="summary">
- <%= format_text(@news.summary, object: @news) %>
+ <%= format_text(@news, :summary) %>
</div>
<% end %>
<p class="author additional-information"><%= authoring @news.created_at, @news.author %></p>
<div class="op-uc-container">
- <%= format_text(@news.description, object: @news) %>
+ <%= format_text(@news, :description) %>
</div>
<br>
<div id="comments" class="news--comments comments">
@@ -105,7 +105,7 @@ See COPYRIGHT and LICENSE files for more details.
alt: t(:button_delete) %>
</div>
<h4 class="author additional-information"><%= avatar(comment.author) %><%= authoring comment.created_at, comment.author %></h4>
- <%= format_text(comment.comments, object: comment) %>
+ <%= format_text(comment, :comments) %>
</div>
<% end %>
</div>
diff --git a/app/views/work_package_mailer/_work_package_details.html.erb b/app/views/work_package_mailer/_work_package_details.html.erb
index a6878f9c205..81b1173dd06 100644
--- a/app/views/work_package_mailer/_work_package_details.html.erb
+++ b/app/views/work_package_mailer/_work_package_details.html.erb
@@ -47,4 +47,4 @@ See COPYRIGHT and LICENSE files for more details.
<% end %>
</ul>
-<%= format_text(work_package.description, attribute: :description, only_path: false, object: work_package, project: work_package.project) %>
+<%= format_text(work_package, :description, only_path: false) %>
diff --git a/modules/documents/app/views/documents/_document.html.erb b/modules/documents/app/views/documents/_document.html.erb
index 40cbc14b664..64e113ae3f7 100644
--- a/modules/documents/app/views/documents/_document.html.erb
+++ b/modules/documents/app/views/documents/_document.html.erb
@@ -31,5 +31,5 @@ See COPYRIGHT and LICENSE files for more details.
<p class="document-category-elements--date"><em><%= format_time(document.updated_at) %></em></p>
<div class="wiki op-uc-container">
- <%= format_text(document.description) %>
+ <%= format_text(document, :description) %>
</div>