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 partials
ulferts10ef16f75b7a
diff --git a/modules/ifc_models/app/controllers/ifc_models/ifc_models_controller.rb b/modules/ifc_models/app/controllers/ifc_models/ifc_models_controller.rbindex f04ac41ba34..684833ebfc1 100644--- a/modules/ifc_models/app/controllers/ifc_models/ifc_models_controller.rb+++ b/modules/ifc_models/app/controllers/ifc_models/ifc_models_controller.rb@@ -30,7 +30,7 @@module ::IFCModelsclass IFCModelsController < BaseController- include IFCModelsHelper+ helper_method :gonbefore_action :find_project_by_project_id, only: %i[index new create show show_defaults edit update destroy]before_action :find_ifc_model_object, except: %i[index new create]@@ -51,9 +51,7 @@ module ::IFCModelsdef edit; end- def show- provision_gon_for_ifc_model(@ifc_models, [@ifc_model])- end+ def show; enddef show_defaultsif @ifc_models.empty?@@ -61,7 +59,6 @@ module ::IFCModelsend@default_ifc_models = @project.ifc_models.defaults- provision_gon_for_ifc_model(@ifc_models, @default_ifc_models)enddef creatediff --git a/modules/ifc_models/app/views/ifc_models/ifc_models/_no_default_notice.html.erb b/modules/ifc_models/app/views/ifc_models/ifc_models/_no_default_notice.html.erbnew file mode 100644index 00000000000..7edb60da8d2--- /dev/null+++ b/modules/ifc_models/app/views/ifc_models/ifc_models/_no_default_notice.html.erb@@ -0,0 +1,12 @@+<div class="notification-box -error">+ <div class="notification-box--content">+ <p><%= t('ifc_models.no_defaults_warning.title') %></p>+ <ul>+ <li><%= t('ifc_models.no_defaults_warning.check_1') %></li>+ <li><%= t('ifc_models.no_defaults_warning.check_2') %></li>+ </ul>+ <%= link_to(ifc_models_project_ifc_models_path(project), class: 'button', accesskey: accesskey(:edit)) do %>+ <%= op_icon('button--icon icon-edit') %> <%= t('ifc_models.label_edit_defaults') %>+ <% end %>+ </div>+</div>diff --git a/modules/ifc_models/app/views/ifc_models/ifc_models/_show_headers.html.erb b/modules/ifc_models/app/views/ifc_models/ifc_models/_show_headers.html.erbnew file mode 100644index 00000000000..f5b7aa5a065--- /dev/null+++ b/modules/ifc_models/app/views/ifc_models/ifc_models/_show_headers.html.erb@@ -0,0 +1,6 @@+<% content_for :header_tags do %>+ <%= stylesheet_link_tag "ifc_viewer/generic", media: 'all' %>+ <% provision_gon_for_ifc_model(all_models, selected_models) %>+ <%= include_gon(nonce: content_security_policy_script_nonce) %>+<% end %>+diff --git a/modules/ifc_models/app/views/ifc_models/ifc_models/_unconverted_notice.html.erb b/modules/ifc_models/app/views/ifc_models/ifc_models/_unconverted_notice.html.erbnew file mode 100644index 00000000000..0455696afb2--- /dev/null+++ b/modules/ifc_models/app/views/ifc_models/ifc_models/_unconverted_notice.html.erb@@ -0,0 +1,11 @@+<div class="notification-box -info">+ <a href="#" title="close" class="notification-box--close icon-context icon-close"></a>+ <div class="notification-box--content">+ <p><%= t('ifc_models.processing_notice.processing_default') %></p>+ <ul>+ <% unconverted.each do |model| %>+ <li><%= model.title %></li>+ <% end %>+ </ul>+ </div>+</div>diff --git a/modules/ifc_models/app/views/ifc_models/ifc_models/show.html.erb b/modules/ifc_models/app/views/ifc_models/ifc_models/show.html.erbindex 1496adb0c3c..c3c77f8f26c 100644--- a/modules/ifc_models/app/views/ifc_models/ifc_models/show.html.erb+++ b/modules/ifc_models/app/views/ifc_models/ifc_models/show.html.erb@@ -32,11 +32,7 @@ See doc/COPYRIGHT.rdoc for more details.<% html_title h(@ifc_model.title) -%>-<% content_for :header_tags do %>- <%= stylesheet_link_tag "ifc_viewer/generic", media: 'all' %>- <%= include_gon(nonce: content_security_policy_script_nonce) %>-<% end %>-+<%= render partial: 'show_headers', locals: { all_models: @ifc_models, selected_models: [@ifc_model] } %><%= toolbar title: @ifc_model.title do %><% if authorize_for('ifc_models/ifc_models', :edit) %>diff --git a/modules/ifc_models/app/views/ifc_models/ifc_models/show_defaults.html.erb b/modules/ifc_models/app/views/ifc_models/ifc_models/show_defaults.html.erbindex d1ff3ba6db4..8f79f3f97d6 100644--- a/modules/ifc_models/app/views/ifc_models/ifc_models/show_defaults.html.erb+++ b/modules/ifc_models/app/views/ifc_models/ifc_models/show_defaults.html.erb@@ -32,10 +32,7 @@ See doc/COPYRIGHT.rdoc for more details.<% html_title t('ifc_models.label_default_ifc_models') -%>-<% content_for :header_tags do %>- <%= stylesheet_link_tag "ifc_viewer/generic", media: 'all' %>- <%= include_gon(nonce: content_security_policy_script_nonce) %>-<% end %>+<%= render partial: 'show_headers', locals: { all_models: @ifc_models, selected_models: @default_ifc_models } %><%= toolbar title: t('ifc_models.label_default_ifc_models') do %><li class="toolbar-item">@@ -46,33 +43,12 @@ See doc/COPYRIGHT.rdoc for more details.<% end %><% if @default_ifc_models.empty? %>- <div class="notification-box -error">- <div class="notification-box--content">- <p><%= t('ifc_models.no_defaults_warning.title') %></p>- <ul>- <li><%= t('ifc_models.no_defaults_warning.check_1') %></li>- <li><%= t('ifc_models.no_defaults_warning.check_2') %></li>- </ul>- <%= link_to(ifc_models_project_ifc_models_path(@project), class: 'button', accesskey: accesskey(:edit)) do %>- <%= op_icon('button--icon icon-edit') %> <%= t('ifc_models.label_edit_defaults') %>- <% end %>- </div>- </div>+ <%= render partial: 'no_default_notice', locals: { project: @project } %><% else %><% unconverted = @default_ifc_models.reject(&:converted?) %><% if unconverted.any? %>- <div class="notification-box -info">- <a href="#" title="close" class="notification-box--close icon-context icon-close"></a>- <div class="notification-box--content">- <p><%= t('ifc_models.processing_notice.processing_default') %></p>- <ul>- <% unconverted.each do |model| %>- <li><%= model.title %></li>- <% end %>- </ul>- </div>- </div>+ <%= render partial: 'unconverted_notice', locals: { unconverted: unconverted } %><% end %><div class="ifc-viewer--container">