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 text rendering logic into ruby component
Aaron Contrerasa8db7a90121a
diff --git a/app/components/work_packages/share/modal_body_component.html.erb b/app/components/work_packages/share/modal_body_component.html.erbindex 177f08ec96c..35e4c405b3f 100644--- a/app/components/work_packages/share/modal_body_component.html.erb+++ b/app/components/work_packages/share/modal_body_component.html.erb@@ -88,24 +88,12 @@if @shares.blank?border_box.with_row dorender(Primer::Beta::Blankslate.new) do |component|- if params[:filters].blank?- component.with_visual_icon(icon: :people, size: :medium)- component.with_heading(tag: :h2).with_content(I18n.t('work_package.sharing.text_empty_state_header') )- component.with_description do- flex_layout do |flex|- flex.with_row(mb: 2) do- render(Primer::Beta::Text.new(color: :subtle)) { I18n.t('work_package.sharing.text_empty_state_description') }- end- end- end- else- component.with_visual_icon(icon: :search, size: :medium)- component.with_heading(tag: :h2).with_content(I18n.t('work_package.sharing.text_empty_search_header') )- component.with_description do- flex_layout do |flex|- flex.with_row(mb: 2) do- render(Primer::Beta::Text.new(color: :subtle)) { I18n.t('work_package.sharing.text_empty_search_description') }- end+ component.with_visual_icon(icon: blankslate_config[:icon], size: :medium)+ component.with_heading(tag: :h2).with_content(blankslate_config[:heading_text])+ component.with_description do+ flex_layout do |flex|+ flex.with_row(mb: 2) do+ render(Primer::Beta::Text.new(color: :subtle)) { blankslate_config[:description_text] }endendenddiff --git a/app/components/work_packages/share/modal_body_component.rb b/app/components/work_packages/share/modal_body_component.rbindex d0fe87d3d8a..740bff54a42 100644--- a/app/components/work_packages/share/modal_body_component.rb+++ b/app/components/work_packages/share/modal_body_component.rb@@ -57,6 +57,20 @@ module WorkPackages'op-share-wp-active-shares'end+ def blankslate_config+ @blankslate_config ||= {}.tap do |config|+ if params[:filters].blank?+ config[:icon] = :people+ config[:heading_text] = I18n.t('work_package.sharing.text_empty_state_header')+ config[:description_text] = I18n.t('work_package.sharing.text_empty_state_description')+ else+ config[:icon] = :search+ config[:heading_text] = I18n.t('work_package.sharing.text_empty_search_header')+ config[:description_text] = I18n.t('work_package.sharing.text_empty_search_description')+ end+ end+ end+def type_filter_options[{ label: I18n.t('work_package.sharing.filter.project_member'),