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

Add storage tab shown at the project settings (#9224)

Oliver Günther375554277a8a
diff --git a/app/controllers/project_settings/storage_controller.rb b/app/controllers/project_settings/storage_controller.rb
new file mode 100644
index 00000000000..b3638426dde
--- /dev/null
+++ b/app/controllers/project_settings/storage_controller.rb
@@ -0,0 +1,38 @@
+#-- encoding: UTF-8
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2021 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See docs/COPYRIGHT.rdoc for more details.
+#++
+
+class ProjectSettings::StorageController < ProjectSettingsController
+ menu_item :settings_storage
+
+ def show
+ render template: 'project_settings/storage',
+ locals: { storage: @project.count_required_storage }
+ end
+end
diff --git a/app/helpers/project_settings_helper.rb b/app/helpers/project_settings_helper.rb
index adc6124bf15..858b6959031 100644
--- a/app/helpers/project_settings_helper.rb
+++ b/app/helpers/project_settings_helper.rb
@@ -79,7 +79,12 @@ module ProjectSettingsHelper
action: { controller: '/backlogs_project_settings', action: 'show' },
label: :label_backlogs,
if: ->(project) { project.module_enabled?('backlogs') }
- }
+ },
+ {
+ name: 'storage',
+ action: { controller: '/project_settings/storage', action: 'show' },
+ label: :label_required_disk_storage
+ },
]
end
end
diff --git a/app/views/projects/form/attributes/_storage_field.html.erb b/app/views/project_settings/_storage_field.html.erb
similarity index 100%
rename from app/views/projects/form/attributes/_storage_field.html.erb
rename to app/views/project_settings/_storage_field.html.erb
diff --git a/app/views/projects/form/_required_storage.html.erb b/app/views/project_settings/storage.html.erb
similarity index 79%
rename from app/views/projects/form/_required_storage.html.erb
rename to app/views/project_settings/storage.html.erb
index d674cc39610..3253842dbd8 100644
--- a/app/views/projects/form/_required_storage.html.erb
+++ b/app/views/project_settings/storage.html.erb
@@ -26,19 +26,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See docs/COPYRIGHT.rdoc for more details.
++#%>
+<% html_title t(:label_required_disk_storage) %>
+<%= toolbar title: t(:label_required_disk_storage) %>
-<% if storage['total'] > 0 %>
-<fieldset class="form--fieldset">
- <legend class="form--fieldset-legend"><%=t(:label_required_disk_storage)%></legend>
+<section class="form--section">
+ <% if storage['modules'].empty? %>
+ <%= no_results_box custom_title: t('projects.settings.storage.no_results_title_text') %>
+ <% end %>
<% storage['modules'].each do |label, value| %>
- <%= render partial: 'projects/form/attributes/storage_field',
+ <%= render partial: 'storage_field',
locals: { label: I18n.t(label), value: value } %>
<% end %>
<%# Hide total when there's only one module %>
<% if storage['modules'].length > 1 %>
- <%= render partial: 'projects/form/attributes/storage_field',
+ <%= render partial: 'storage_field',
locals: { label: t(:label_total), value: storage['total'] } %>
<% end %>
-</fieldset>
-<% end %>
+</section>
diff --git a/app/views/projects/_edit.html.erb b/app/views/projects/_edit.html.erb
deleted file mode 100644
index 53f8e8fcb25..00000000000
--- a/app/views/projects/_edit.html.erb
+++ /dev/null
@@ -1,45 +0,0 @@
-<%#-- copyright
-OpenProject is an open source project management software.
-Copyright (C) 2012-2021 the OpenProject GmbH
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License version 3.
-
-OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-Copyright (C) 2006-2013 Jean-Philippe Lang
-Copyright (C) 2010-2013 the ChiliProject Team
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-See docs/COPYRIGHT.rdoc for more details.
-
-++#%>
-
-<%= render partial: 'toolbar' %>
-
-<%= labelled_tabular_form_for @altered_project, url: project_path(@project) do |f| %>
- <%= render partial: '/projects/form',
- locals: {
- f: f,
- project: @altered_project,
- errors: @errors,
- render_advanced: false,
- render_types: false,
- render_modules: false,
- render_custom_fields: false
- } %>
-
- <%= f.button t(:button_save), class: 'button -highlight -with-icon icon-checkmark' %>
-<% end %>
diff --git a/app/views/projects/_form.html.erb b/app/views/projects/_form.html.erb
deleted file mode 100644
index 6102888c6fd..00000000000
--- a/app/views/projects/_form.html.erb
+++ /dev/null
@@ -1,52 +0,0 @@
-<%#-- copyright
-OpenProject is an open source project management software.
-Copyright (C) 2012-2021 the OpenProject GmbH
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License version 3.
-
-OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-Copyright (C) 2006-2013 Jean-Philippe Lang
-Copyright (C) 2010-2013 the ChiliProject Team
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-See docs/COPYRIGHT.rdoc for more details.
-
-++#%>
-
-<% content_for :header_tags do %>
- <meta name="required_script" content="project_form_listener" />
-<% end %>
-
-<%= error_messages_for_contract(project, errors) unless local_assigns[:no_error_messages] %>
-
-<!--[form:project]-->
-
-<section class="form--section">
- <%= render partial: "projects/form/project_attributes",
- locals: { project: project, form: f, is_copy: local_assigns[:is_copy], render_advanced: render_advanced } %>
-
- <%= call_hook(:view_projects_form, project: project, form: f) %>
-</section>
-
-<% if project.persisted? %>
- <section class="form--section">
- <%= render partial: "projects/form/required_storage",
- locals: { project: project, storage: project.count_required_storage } %>
- </section>
-<% end %>
-
-<!--[eoform:project]-->
diff --git a/app/views/projects/form/attributes/_description.html.erb b/app/views/projects/form/attributes/_description.html.erb
deleted file mode 100644
index b2ed25b4798..00000000000
--- a/app/views/projects/form/attributes/_description.html.erb
+++ /dev/null
@@ -1,37 +0,0 @@
-<%#-- copyright
-OpenProject is an open source project management software.
-Copyright (C) 2012-2021 the OpenProject GmbH
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License version 3.
-
-OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-Copyright (C) 2006-2013 Jean-Philippe Lang
-Copyright (C) 2010-2013 the ChiliProject Team
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-See docs/COPYRIGHT.rdoc for more details.
-
-++#%>
-
-<div class="form--field -visible-overflow">
- <%= form.text_area :description,
- id: :project_description,
- with_text_formatting: true,
- help_text: { attribute: :description, 'attribute-scope': :Project },
- macros: false,
- container_class: '-xxwide' %>
-</div>
diff --git a/app/views/projects/form/attributes/_hidden_field.html.erb b/app/views/projects/form/attributes/_hidden_field.html.erb
deleted file mode 100644
index 158fe6c0a9f..00000000000
--- a/app/views/projects/form/attributes/_hidden_field.html.erb
+++ /dev/null
@@ -1,31 +0,0 @@
-<%#-- copyright
-OpenProject is an open source project management software.
-Copyright (C) 2012-2021 the OpenProject GmbH
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License version 3.
-
-OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-Copyright (C) 2006-2013 Jean-Philippe Lang
-Copyright (C) 2010-2013 the ChiliProject Team
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-See docs/COPYRIGHT.rdoc for more details.
-
-++#%>
-
-<% options ||= {} %>
-<%= form.hidden_field name, {value: (value.nil? ? "" : value)}.merge(options) %>
diff --git a/app/views/projects/form/attributes/_name.html.erb b/app/views/projects/form/attributes/_name.html.erb
deleted file mode 100644
index 8eab2a34e1a..00000000000
--- a/app/views/projects/form/attributes/_name.html.erb
+++ /dev/null
@@ -1,35 +0,0 @@
-<%#-- copyright
-OpenProject is an open source project management software.
-Copyright (C) 2012-2021 the OpenProject GmbH
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License version 3.
-
-OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-Copyright (C) 2006-2013 Jean-Philippe Lang
-Copyright (C) 2010-2013 the ChiliProject Team
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-See docs/COPYRIGHT.rdoc for more details.
-
-++#%>
-
-<div class="form--field -required">
- <%= form.text_field :name,
- required: true,
- help_text: { attribute: :name, 'attribute-scope': :Project },
- container_class: '-wide' %>
-</div>
diff --git a/app/views/projects/form/attributes/_parent_id.html.erb b/app/views/projects/form/attributes/_parent_id.html.erb
deleted file mode 100644
index 6be951d75a8..00000000000
--- a/app/views/projects/form/attributes/_parent_id.html.erb
+++ /dev/null
@@ -1,44 +0,0 @@
-<%#-- copyright
-OpenProject is an open source project management software.
-Copyright (C) 2012-2021 the OpenProject GmbH
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License version 3.
-
-OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-Copyright (C) 2006-2013 Jean-Philippe Lang
-Copyright (C) 2010-2013 the ChiliProject Team
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-See docs/COPYRIGHT.rdoc for more details.
-
-++#%>
-
-<%
- project = form.object
- allowed_parents = allowed_parent_projects(project).to_a
-%>
-
-<% unless allowed_parents.empty? %>
- <div class="form--field">
- <%= form.select :parent_id,
- project_tree_options_for_select(allowed_parents,
- selected: project.parent),
- include_blank: true,
- help_text: { attribute: :parent, 'attribute-scope': :Project },
- container_class: '-wide' %>
- </div>
-<% end %>
diff --git a/app/views/projects/form/attributes/_public.html.erb b/app/views/projects/form/attributes/_public.html.erb
deleted file mode 100644
index 087934712e7..00000000000
--- a/app/views/projects/form/attributes/_public.html.erb
+++ /dev/null
@@ -1,33 +0,0 @@
-<%#-- copyright
-OpenProject is an open source project management software.
-Copyright (C) 2012-2021 the OpenProject GmbH
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License version 3.
-
-OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-Copyright (C) 2006-2013 Jean-Philippe Lang
-Copyright (C) 2010-2013 the ChiliProject Team
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-See docs/COPYRIGHT.rdoc for more details.
-
-++#%>
-
-<div class="form--field">
- <%= form.check_box :public,
- help_text: { attribute: :public, 'attribute-scope': :Project } %>
-</div>
diff --git a/app/views/projects/form/attributes/_status.html.erb b/app/views/projects/form/attributes/_status.html.erb
deleted file mode 100644
index 44fa87e9532..00000000000
--- a/app/views/projects/form/attributes/_status.html.erb
+++ /dev/null
@@ -1,51 +0,0 @@
-<%#-- copyright
-OpenProject is an open source project management software.
-Copyright (C) 2012-2021 the OpenProject GmbH
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License version 3.
-
-OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-Copyright (C) 2006-2013 Jean-Philippe Lang
-Copyright (C) 2010-2013 the ChiliProject Team
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-See docs/COPYRIGHT.rdoc for more details.
-
-++#%>
-
-<%
- project = form.object
- project.build_status unless project.status
-%>
-
-<%= form.fields_for :status, project.status do |status_form| %>
- <div class="form--field">
- <%= status_form.select :code,
- project_options_for_status(project),
- help_text: { attribute: :status, 'attribute-scope': :Project },
- include_blank: true,
- container_class: '-wide' %>
- </div>
- <div class="form--field -visible-overflow">
- <%= status_form.text_area :explanation,
- with_text_formatting: true,
- macros: false,
- help_text: { attribute: :statusExplanation, 'attribute-scope': :Project },
- preview_context: project_preview_context(project.status, project),
- container_class: '-xxwide' %>
- </div>
-<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index c48f6c863ea..3c6f58527d2 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -251,6 +251,8 @@ en:
versions:
no_results_title_text: There are currently no versions for the project.
no_results_content_text: Create a new version
+ storage:
+ no_results_title_text: There is no additional recorded disk space consumed by this project.
members:
index: