Skip to content

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

chore[#47147]: place the project folder mode & id, with edit behind feature flag

Kabiru Mwenjabf09b8a0a2bc
diff --git a/modules/storages/app/components/storages/projects_storages/row_component.rb b/modules/storages/app/components/storages/projects_storages/row_component.rb
index b34b873e0e2..2fd55538803 100644
--- a/modules/storages/app/components/storages/projects_storages/row_component.rb
+++ b/modules/storages/app/components/storages/projects_storages/row_component.rb
@@ -53,7 +53,9 @@ module Storages::ProjectsStorages
end
def button_links
- [edit_link, delete_link]
+ [delete_link].tap do |links|
+ links.unshift edit_link if OpenProject::FeatureDecisions.storage_project_folders_active?
+ end
end
def edit_link
diff --git a/modules/storages/app/views/storages/project_settings/_form.html.erb b/modules/storages/app/views/storages/project_settings/_form.html.erb
index 342b584eb42..588242ecab1 100644
--- a/modules/storages/app/views/storages/project_settings/_form.html.erb
+++ b/modules/storages/app/views/storages/project_settings/_form.html.erb
@@ -22,56 +22,58 @@
<% end %>
</div>
-<div class="form--field -required">
- <label class="form--label -bold">Project folder</label>
- <div class="form--field-container -horizontal">
- <%= f.label :project_folder_mode, class: "form--label-with-radio-button" do %>
- <%= f.radio_button :project_folder_mode, 'inactive', no_label: true %>
- <%= t(:"storages.label_no_specific_folder") %>
- <% end %>
- </div>
- <p class="form--field-instructions">
- <%= t(:"storages.instructions.no_specific_folder") %>
- </p>
+<% if OpenProject::FeatureDecisions.storage_project_folders_active? %>
+ <div class="form--field -required">
+ <label class="form--label -bold">Project folder</label>
+ <div class="form--field-container -horizontal">
+ <%= f.label :project_folder_mode, class: "form--label-with-radio-button" do %>
+ <%= f.radio_button :project_folder_mode, 'inactive', no_label: true %>
+ <%= t(:"storages.label_no_specific_folder") %>
+ <% end %>
+ </div>
+ <p class="form--field-instructions">
+ <%= t(:"storages.instructions.no_specific_folder") %>
+ </p>
- <div class="form--field-container -horizontal">
- <%= f.label :project_folder_mode, class: "form--label-with-radio-button" do %>
- <%= f.radio_button :project_folder_mode, 'manual', no_label: true %>
- <%= t(:"storages.label_existing_manual_folder") %>
- <% end %>
+ <div class="form--field-container -horizontal">
+ <%= f.label :project_folder_mode, class: "form--label-with-radio-button" do %>
+ <%= f.radio_button :project_folder_mode, 'manual', no_label: true %>
+ <%= t(:"storages.label_existing_manual_folder") %>
+ <% end %>
+ </div>
+ <p class="form--field-instructions -xwide">
+ <%= t(:"storages.instructions.existing_manual_folder") %>
+ </p>
</div>
- <p class="form--field-instructions -xwide">
- <%= t(:"storages.instructions.existing_manual_folder") %>
- </p>
-</div>
-<div style="display:none;" id="storages_manual_folder_selection" class="form--field -required">
- <label class="form--label -bold"> <%= t(:"storages.label_existing_manual_folder_selection") %> </label>
- <div class="form--field-container -horizontal">
- <%= f.text_field :project_folder_id,
- placeholder: t(:"storages.placeholder_existing_folder_selection"),
- container_class: "-middle",
- no_label: true
- %>
+ <div style="display:none;" id="storages_manual_folder_selection" class="form--field -required">
+ <label class="form--label -bold"> <%= t(:"storages.label_existing_manual_folder_selection") %> </label>
+ <div class="form--field-container -horizontal">
+ <%= f.text_field :project_folder_id,
+ placeholder: t(:"storages.placeholder_existing_folder_selection"),
+ container_class: "-middle",
+ no_label: true
+ %>
+ </div>
</div>
-</div>
+
+ <%= nonced_javascript_tag do -%>
+ jQuery(function($) {
+ <%# Show manual folder selection on reload when checked %>
+ $("#storages_project_storage_project_folder_mode_manual").is(':checked') && $("#storages_manual_folder_selection").show();
+
+ $("input[type='radio']").change(function() {
+ if ($(this).val() == 'manual') {
+ $("#storages_manual_folder_selection").show();
+ } else {
+ $("#storages_manual_folder_selection").hide();
+ }
+ })
+ });
+ <% end -%>
+<% end %>
<div class="form--field">
<%= styled_button_tag submit_button_label, class: "-highlight -with-icon icon-checkmark" %>
<%= link_to t(:button_cancel), project_settings_projects_storages_path(@project), class: 'button -with-icon icon-cancel' %>
</div>
-
-<%= nonced_javascript_tag do -%>
- jQuery(function($) {
- <%# Show manual folder selection on reload when checked %>
- $("#storages_project_storage_project_folder_mode_manual").is(':checked') && $("#storages_manual_folder_selection").show();
-
- $("input[type='radio']").change(function() {
- if ($(this).val() == 'manual') {
- $("#storages_manual_folder_selection").show();
- } else {
- $("#storages_manual_folder_selection").hide();
- }
- })
- });
-<% end -%>
diff --git a/modules/storages/lib/open_project/storages/engine.rb b/modules/storages/lib/open_project/storages/engine.rb
index a99e7649ce0..7511efac26c 100644
--- a/modules/storages/lib/open_project/storages/engine.rb
+++ b/modules/storages/lib/open_project/storages/engine.rb
@@ -42,6 +42,7 @@ module OpenProject::Storages
initializer 'openproject_storages.feature_decisions' do
OpenProject::FeatureDecisions.add :storage_file_picking_select_all
+ OpenProject::FeatureDecisions.add :storage_project_folders
OpenProject::FeatureDecisions.add :legacy_upload_preparation
OpenProject::FeatureDecisions.add :managed_project_folders
end
diff --git a/modules/storages/spec/features/manage_project_storage_spec.rb b/modules/storages/spec/features/manage_project_storage_spec.rb
index e9586e466aa..1c64c6f7892 100644
--- a/modules/storages/spec/features/manage_project_storage_spec.rb
+++ b/modules/storages/spec/features/manage_project_storage_spec.rb
@@ -31,7 +31,7 @@ require_relative '../spec_helper'
# Setup storages in Project -> Settings -> File Storages
# This tests assumes that a Storage has already been setup
# in the Admin section, tested by admin_storage_spec.rb.
-describe 'Activation of storages in projects', js: true do
+describe 'Activation of storages in projects', js: true, with_flag: { storage_project_folders: true } do
let(:user) { create(:user) }
# The first page is the Project -> Settings -> General page, so we need
# to provide the user with the edit_project permission in the role.