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 blankslate config setup into separate methods
Aaron Contreras467fe5695bda
diff --git a/app/components/shares/empty_state_component.rb b/app/components/shares/empty_state_component.rbindex df896b87829..1dda0facba9 100644--- a/app/components/shares/empty_state_component.rb+++ b/app/components/shares/empty_state_component.rb@@ -41,18 +41,28 @@ module Sharesattr_reader :strategy, :entity- def blankslate_config # rubocop:disable Metrics/AbcSize- @blankslate_config ||= {}.tap do |config|- if params[:filters].blank?- config[:icon] = :people- config[:heading_text] = I18n.t("sharing.text_empty_state_header")- config[:description_text] = I18n.t("sharing.text_empty_state_description", entity: @entity.class.model_name.human)- else- config[:icon] = :search- config[:heading_text] = I18n.t("sharing.text_empty_search_header")- config[:description_text] = I18n.t("sharing.text_empty_search_description")- end- end+ def blankslate_config+ @blankslate_config ||= if params[:filters].blank?+ unfiltered_blankslate_config+ else+ filtered_blankslate_config+ end+ end++ def unfiltered_blankslate_config+ {+ icon: :people,+ heading_text: I18n.t("sharing.text_empty_state_header"),+ description_text: I18n.t("sharing.text_empty_state_description", entity: @entity.class.model_name.human)+ }+ end++ def filtered_blankslate_config+ {+ icon: :search,+ heading_text: I18n.t("sharing.text_empty_search_header"),+ description_text: I18n.t("sharing.text_empty_search_description")+ }endendenddiff --git a/app/components/shares/project_queries/empty_state_component.rb b/app/components/shares/project_queries/empty_state_component.rbindex 0a6a5d7819a..b02fcb9d8dd 100644--- a/app/components/shares/project_queries/empty_state_component.rb+++ b/app/components/shares/project_queries/empty_state_component.rb@@ -42,22 +42,38 @@ module Sharesattr_reader :strategy, :entity- def blankslate_config # rubocop:disable Metrics/AbcSize- @blankslate_config ||= {}.tap do |config|- if entity.public?- config[:icon] = :people- config[:heading_text] = I18n.t("sharing.project_queries.blank_state.public.header")- config[:description_text] = I18n.t("sharing.project_queries.blank_state.public.description")- elsif params[:filters].blank?- config[:icon] = "share-android"- config[:heading_text] = I18n.t("sharing.project_queries.blank_state.private.header")- config[:description_text] = I18n.t("sharing.project_queries.blank_state.private.description")- else- config[:icon] = :search- config[:heading_text] = I18n.t("sharing.text_empty_search_header")- config[:description_text] = I18n.t("sharing.text_empty_search_description")- end- end+ def blankslate_config+ @blankslate_config ||= if entity.public?+ public_blankslate_config+ elsif params[:filters].blank?+ unfiltered_blankslate_config+ else+ filtered_blankslate_config+ end+ end++ def public_blankslate_config+ {+ icon: :people,+ heading_text: I18n.t("sharing.project_queries.blank_state.public.header"),+ description_text: I18n.t("sharing.project_queries.blank_state.public.description")+ }+ end++ def unfiltered_blankslate_config+ {+ icon: :people,+ heading_text: I18n.t("sharing.project_queries.blank_state.private.header"),+ description_text: I18n.t("sharing.project_queries.blank_state.private.description")+ }+ end++ def filtered_blankslate_config+ {+ icon: :search,+ heading_text: I18n.t("sharing.text_empty_search_header"),+ description_text: I18n.t("sharing.text_empty_search_description")+ }endendend