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
[#40187] Uploaded IFC Model can't be set as Standard Model (#9984)
Wieland Lindenthal466eaff6ac04
diff --git a/modules/bim/app/views/bim/ifc_models/ifc_models/_form.html.erb b/modules/bim/app/views/bim/ifc_models/ifc_models/_form.html.erbindex 9246947a0bd..216780a3bc9 100644--- a/modules/bim/app/views/bim/ifc_models/ifc_models/_form.html.erb+++ b/modules/bim/app/views/bim/ifc_models/ifc_models/_form.html.erb@@ -95,6 +95,9 @@ See COPYRIGHT and LICENSE files for more details.}});};+ jQuery("#bim_ifc_models_ifc_model_is_default").change(function(e){+ setDirectUploadFileName();+ });jQuery("input[type=file]").change(function(e){setDirectUploadFileName();diff --git a/modules/bim/spec/features/ifc_models/ifc_upload_shared_examples.rb b/modules/bim/spec/features/ifc_models/ifc_upload_shared_examples.rbindex b77730accf9..1ff631b0fb7 100644--- a/modules/bim/spec/features/ifc_models/ifc_upload_shared_examples.rb+++ b/modules/bim/spec/features/ifc_models/ifc_upload_shared_examples.rb@@ -2,6 +2,7 @@ shared_examples 'can upload an IFC file' dolet(:user) { FactoryBot.create :admin }let(:project) { FactoryBot.create :project, enabled_module_names: %i[bim] }let(:ifc_fixture) { ::UploadedFile.load_from('modules/bim/spec/fixtures/files/minimal.ifc') }+ let(:set_tick_is_default_after_file) { true }before dologin_as user@@ -9,18 +10,34 @@ shared_examples 'can upload an IFC file' doallow_any_instance_of(Bim::IfcModels::BaseContract).to receive(:ifc_attachment_is_ifc).and_return trueend- it 'should allow uploading an IFC file' do- visit new_bcf_project_ifc_model_path(project_id: project.identifier)+ shared_examples 'allows uploading an IFC file' do+ it 'allows uploading an IFC file' do+ visit new_bcf_project_ifc_model_path(project_id: project.identifier)- page.attach_file("file", ifc_fixture.path, visible: :all)+ page.find('#bim_ifc_models_ifc_model_is_default').set(true) unless set_tick_is_default_after_file+ page.attach_file("file", ifc_fixture.path, visible: :all)+ page.find('#bim_ifc_models_ifc_model_is_default').set true if set_tick_is_default_after_file- click_on "Create"+ click_on "Create"- expect(page).to have_content("Upload succeeded")+ expect(page).to have_content("Upload succeeded")- expect(Attachment.count).to eq 1- expect(Attachment.first[:file]).to eq model_name+ expect(Attachment.count).to eq 1+ expect(Attachment.first[:file]).to eq model_name- expect(Bim::IfcModels::IfcModel.count).to eq 1+ expect(Bim::IfcModels::IfcModel.count).to eq 1++ expect(Bim::IfcModels::IfcModel.first.is_default).to be_truthy+ end+ end++ context 'when setting checkbox is_default before selecting file' do+ let(:set_tick_is_default_after_file) { false }++ it_behaves_like 'allows uploading an IFC file'+ end++ context 'when setting checkbox is_default after selecting file' do+ it_behaves_like 'allows uploading an IFC file'endend