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
Fix|Refactor: Perform lookup for `action_text` only when necessary
Aaron Contrerasf6175c51731b
diff --git a/app/helpers/no_results_helper.rb b/app/helpers/no_results_helper.rbindex e25b8361463..c3bba8141f5 100644--- a/app/helpers/no_results_helper.rb+++ b/app/helpers/no_results_helper.rb@@ -1,3 +1,5 @@+# frozen_string_literal: true+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2023 the OpenProject GmbH@@ -36,26 +38,34 @@ module NoResultsHelper# - 'action_url' The url for the link in the content.# - 'display_action' Whether or not the link should be displayed.# - 'custom_title' custom text for the title.- # - 'custom_action_text' custom text for the title.+ # - 'custom_action_text' custom text for the action.## Calling this on its on without any arguments creates the box in its simplest# form with only the title. Providing an action_url and display_action: true# Displays the box with the title and link to the passed in url.- # The title and action_text are found using the locales key lookup unless+ # The title_text and action_text are found using the locales key lookup unless# custom_title and custom_action_text are provided.+ #+ # In the case of action_text, lookup is also only performed if display_action+ # is true, in order not to perform unnecessary lookups when action_text+ # shouldn't even be considered.def no_results_box(action_url: nil,display_action: false,custom_title: nil,custom_action_text: nil)-- title = custom_title || t('.no_results_title_text', cascade: true)- action_text = custom_action_text || t('.no_results_content_text')+ title_text = custom_title || t('.no_results_title_text', cascade: true) || ''+ action_text = if display_action+ custom_action_text || t('.no_results_content_text')+ else+ ''+ end+ action_url = action_url || ''render partial: '/common/no_results',locals: {- title_text: title,- action_text: display_action ? action_text : '',- action_url: action_url || ''+ title_text:,+ action_text:,+ action_url:}endend