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 show action on IFC models [ci skip]
Wieland Lindenthale306d5791b5c
diff --git a/modules/ifc_models/app/assets/stylesheets/ifc_models/ifc_models.sass b/modules/ifc_models/app/assets/stylesheets/ifc_models/ifc_models.sassindex 1821471ad1a..eb0c27a3764 100644--- a/modules/ifc_models/app/assets/stylesheets/ifc_models/ifc_models.sass+++ b/modules/ifc_models/app/assets/stylesheets/ifc_models/ifc_models.sass@@ -2,11 +2,13 @@// The IFC viewer shall fill the viewport to the bottom.// This is different to how we style #content else where.-.controller-ifc_models\/ifc_models.action-show_defaults- #content- display: flex- flex-direction: column- height: 100%+.controller-ifc_models\/ifc_models+ &.action-show,+ &.action-show_defaults+ #content+ display: flex+ flex-direction: column+ height: 100%.xeokit-tree-panelcolor: white@@ -16,24 +18,6 @@padding: 20px 0border-bottom: 1px solid #47748b- //ul- // p- // color: #fff- // padding: 10px- //- // li- // a- // padding: 0- // font-size: 1.1em- // display: block- // &:hover- // color: #7386D5- // background: #fff- //- // &.active > a, a[aria-expanded="true"]- // color: #fff- // background: #6d7fcc-labelcolor: white@@ -62,9 +46,19 @@height: 60px// Use our own icon font instead of including Xeokit's FontAwesome+ button[class^="fa-"],+ button[class*=" fa-"]+ &::before+ font-family: "openproject-icon-font" !important.fa-home::before- font-family: "openproject-icon-font" !important@include icon-mixin-home+ .fa-info-circle::before+ @include icon-mixin-info2+ .fa-cut::before+ @include icon-mixin-cut+ .fa-cube::before+ @include icon-mixin-modules+#myNavCubeCanvasposition: absolutediff --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 02b2ca12959..a59204eeb0e 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@@ -33,9 +33,10 @@ module ::IFCModelsinclude IFCModelsHelperbefore_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 show_defaults]+ before_action :find_ifc_model_object, except: %i[index new create]before_action :find_all_ifc_models, only: %i[show show_defaults]- before_action :provision_gon, only: %i[show_defaults]+ before_action :provision_gon_defaults, only: %i[show_defaults]+before_action :authorize@@ -54,7 +55,9 @@ module ::IFCModelsdef edit; end- def show; end+ def show+ provision_gon([@ifc_model])+ enddef show_defaultsif @ifc_models.empty?@@ -117,14 +120,19 @@ module ::IFCModels.order('created_at ASC')end- def provision_gon+ def provision_gon_defaults+ provision_gon(@ifc_models.select { |model| model.is_default })+ end++ def provision_gon(models_to_load = [])+ models_to_load = Hash[models_to_load.map { |ifc_model| [ifc_model.id, true] }]gon.ifc_models = {projects: [{ id: @project.identifier, name: @project.name }],models: @ifc_models.map do |ifc_model|model = {}model[:id] = ifc_model.idmodel[:name] = ifc_model.title- model[:default] = ifc_model.is_default+ model[:default] = (!!models_to_load[ifc_model.id])modelend,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 da197a7ee77..1b3a8a732ae 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@@ -34,6 +34,7 @@ See doc/COPYRIGHT.rdoc for more details.<% content_for :header_tags do %><%= stylesheet_link_tag "ifc_models/ifc_models", media: 'all' %>+ <%= include_gon(nonce: content_security_policy_script_nonce) %><% end %>@@ -56,8 +57,6 @@ See doc/COPYRIGHT.rdoc for more details.<% if @ifc_model.converted? %><div class="ifc-model-viewer-container">- <ifc-viewer-entry data-ifc-model-id="<%= @ifc_model.id %>"- data-xkt-file-url="<%= attachment_content_url(@ifc_model.xkt_attachment) %>"- data-metadata-file-url="<%= attachment_content_url(@ifc_model.metadata_attachment) %>"></ifc-viewer-entry>+ <ifc-viewer-entry></ifc-viewer-entry></div><% end %>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 9f5e96bb234..1d5b78587bf 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@@ -34,6 +34,7 @@ See doc/COPYRIGHT.rdoc for more details.<% content_for :header_tags do %><%= stylesheet_link_tag "ifc_models/ifc_models", media: 'all' %>+ <%= include_gon(nonce: content_security_policy_script_nonce) %><% end %><%= toolbar title: t('ifc_models.label_default_ifc_models') do %>@@ -44,10 +45,6 @@ See doc/COPYRIGHT.rdoc for more details.</li><% end %>-<% content_for :header_tags do %>- <%= include_gon(nonce: content_security_policy_script_nonce) %>-<% end %>-<% if @default_ifc_models.empty? %><div class="notification-box -error"><div class="notification-box--content">@@ -65,9 +62,6 @@ See doc/COPYRIGHT.rdoc for more details.<% if @default_ifc_models.map(&:converted?).uniq == [true] %><div class="ifc-model-viewer-container">- <% @ifc_model = @default_ifc_models.first %>- <ifc-viewer-entry data-ifc-model-id="<%= @ifc_model.id %>"- data-xkt-file-url="<%= attachment_content_url(@ifc_model.xkt_attachment) %>"- data-metadata-file-url="<%= attachment_content_url(@ifc_model.metadata_attachment) %>"></ifc-viewer-entry>+ <ifc-viewer-entry></ifc-viewer-entry></div><% end %>