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

Reorganize settings and update page layouts

Mir Bhatia2f82d73fb15f
diff --git a/app/controllers/admin/settings/date_format_settings_controller.rb b/app/controllers/admin/settings/date_format_settings_controller.rb
new file mode 100644
index 00000000000..0be8d79f0fd
--- /dev/null
+++ b/app/controllers/admin/settings/date_format_settings_controller.rb
@@ -0,0 +1,61 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2023 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 COPYRIGHT and LICENSE files for more details.
+#++
+
+module Admin::Settings
+ class DateFormatSettingsController < ::Admin::SettingsController
+ current_menu_item [:show] do
+ :calendars_and_dates
+ end
+
+ before_action :validate_start_of_week_year, only: :update
+
+ def default_breadcrumb
+ t(:label_date_format)
+ end
+
+ def show_local_breadcrumb
+ true
+ end
+
+ private
+
+ def validate_start_of_week_year
+ start_of_week = params[:settings][:start_of_week]
+ start_of_year = params[:settings][:first_week_of_year]
+
+ if start_of_week.present? ^ start_of_year.present?
+ flash[:error] = I18n.t(
+ 'settings.display.first_date_of_week_and_year_set',
+ first_week_setting_name: I18n.t(:setting_first_week_of_year),
+ day_of_week_setting_name: I18n.t(:setting_start_of_week)
+ )
+ redirect_to action: :show
+ end
+ end
+ end
+end
diff --git a/app/controllers/admin/settings/working_days_settings_controller.rb b/app/controllers/admin/settings/working_days_settings_controller.rb
index 77c6705dcb6..0b559779b92 100644
--- a/app/controllers/admin/settings/working_days_settings_controller.rb
+++ b/app/controllers/admin/settings/working_days_settings_controller.rb
@@ -1,3 +1,31 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2023 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 COPYRIGHT and LICENSE files for more details.
+#++
+
module Admin::Settings
class WorkingDaysSettingsController < ::Admin::SettingsController
current_menu_item [:show] do
@@ -5,7 +33,7 @@ module Admin::Settings
end
def default_breadcrumb
- t(:label_calendars_and_dates)
+ t(:label_working_days)
end
def show_local_breadcrumb
diff --git a/app/views/admin/settings/date_format_settings/show.html.erb b/app/views/admin/settings/date_format_settings/show.html.erb
new file mode 100644
index 00000000000..faa22a94fb5
--- /dev/null
+++ b/app/views/admin/settings/date_format_settings/show.html.erb
@@ -0,0 +1,66 @@
+<%#-- copyright
+OpenProject is an open source project management software.
+Copyright (C) 2012-2023 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 COPYRIGHT and LICENSE files for more details.
+
+++#%>
+
+<%= toolbar title: t(:label_date_format) %>
+
+<%= styled_form_tag(
+ admin_settings_working_days_path,
+ method: :patch,
+ class: 'op-working-days-admin-settings'
+ ) do %>
+
+ <section class="form--section">
+
+ <div class="form--field">
+ <%= setting_select :date_format,
+ Settings::Definition[:date_format].allowed.collect {|f| [Date.today.strftime(f), f]},
+ blank: :label_language_based,
+ container_class: '-wide' %>
+ </div>
+
+ <div class="form--field">
+ <%= setting_select :time_format,
+ Settings::Definition[:time_format].allowed.collect {|f| [Time.now.strftime(f), f]},
+ blank: :label_language_based,
+ container_class: '-wide' %>
+ </div>
+
+ <div class="form--field">
+ <%= setting_select :first_week_of_year, [[day_name(1),'1'], [day_name(4),'4']], blank: :label_language_based, container_class: '-wide' %>
+ <span class="form--field-instructions">
+ <%= t('settings.display.first_week_of_year_text') %>
+ <br/>
+ <%= static_link_to :display_settings_documentation, label: t('documentation.see_more_link') %>
+ </span>
+ </div>
+
+ </section>
+
+ <%= styled_button_tag t(:button_save), class: '-highlight -with-icon icon-checkmark' %>
+<% end %>
diff --git a/app/views/admin/settings/display_settings/show.html.erb b/app/views/admin/settings/display_settings/show.html.erb
index d6eca6d868f..e490dfc2a89 100644
--- a/app/views/admin/settings/display_settings/show.html.erb
+++ b/app/views/admin/settings/display_settings/show.html.erb
@@ -36,33 +36,6 @@ See COPYRIGHT and LICENSE files for more details.
<%= setting_multiselect :available_languages, all_lang_options_for_select(false) %>
</div>
- <div class="form--field">
- <%= setting_select :start_of_week, [[day_name(1),'1'], [day_name(6),'6'], [day_name(7),'7']], blank: :label_language_based, container_class: '-slim' %>
- </div>
-
- <div class="form--field">
- <%= setting_select :first_week_of_year, [[day_name(1),'1'], [day_name(4),'4']], blank: :label_language_based, container_class: '-slim' %>
- <span class="form--field-instructions">
- <%= t('settings.display.first_week_of_year_text') %>
- <br/>
- <%= static_link_to :display_settings_documentation, label: t('documentation.see_more_link') %>
- </span>
- </div>
-
- <div class="form--field">
- <%= setting_select :date_format,
- Settings::Definition[:date_format].allowed.collect {|f| [Date.today.strftime(f), f]},
- blank: :label_language_based,
- container_class: '-slim' %>
- </div>
-
- <div class="form--field">
- <%= setting_select :time_format,
- Settings::Definition[:time_format].allowed.collect {|f| [Time.now.strftime(f), f]},
- blank: :label_language_based,
- container_class: '-slim' %>
- </div>
-
<div class="form--field">
<%= setting_select :user_format, @options[:user_format], container_class: '-slim' %>
</div>
diff --git a/app/views/admin/settings/working_days_settings/show.html.erb b/app/views/admin/settings/working_days_settings/show.html.erb
index ea2fe8feda7..2455352a92b 100644
--- a/app/views/admin/settings/working_days_settings/show.html.erb
+++ b/app/views/admin/settings/working_days_settings/show.html.erb
@@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
-<%= toolbar title: t(:label_calendars_and_dates) %>
+<%= toolbar title: t(:label_working_days) %>
<div class="op-toast -warning">
<div class="op-toast--content">
@@ -42,28 +42,43 @@ See COPYRIGHT and LICENSE files for more details.
method: :patch,
class: 'op-working-days-admin-settings'
) do %>
+
<section class="form--section">
- <p>
- <%= t("working_days.info").html_safe %>
- </p>
- <div class="form--field op-working-days-admin-settings--day-selectors" id="setting_working_days">
- <%= setting_multiselect :working_days,
- I18n.t('date.day_names').rotate.zip(WeekDay::DAY_RANGE),
- direction: :horizontal,
- label: false %>
- </div>
- </section>
+ <fieldset class="form--fieldset">
+ <legend class="form--fieldset-legend"><%= t('settings.working_days.section_work_week') %></legend>
+
+ <p>
+ <%= t("working_days.info").html_safe %>
+ </p>
+
+ <div class="form--field">
+ <%= setting_select :start_of_week, [[day_name(1),'1'], [day_name(6),'6'], [day_name(7),'7']], blank: :label_language_based, container_class: '-wide' %>
+ </div>
+
+ <div class="form--field op-working-days-admin-settings--day-selectors" id="setting_working_days">
+ <%= setting_multiselect :working_days,
- <div class="spot-divider"></div>
+ I18n.t('date.day_names').rotate.zip(WeekDay::DAY_RANGE),
+ direction: :horizontal %>
+ </div>
+
+ </fieldset>
+ </section>
<section class="form--section">
- <p>
- <%= t("working_days.instance_wide_info").html_safe %>
- </p>
- <%= angular_component_tag 'op-non-working-days-list',
- data: { modified_non_working_days: @modified_non_working_days } %>
+ <fieldset class="form--fieldset">
+ <legend class="form--fieldset-legend"><%= t('settings.working_days.section_holidays_and_closures') %></legend>
+ <p>
+ <%= t("working_days.instance_wide_info").html_safe %>
+ </p>
+ <%= angular_component_tag 'op-non-working-days-list',
+ data: { modified_non_working_days: @modified_non_working_days } %>
+
+ </fieldset>
</section>
+
+
<%= styled_button_tag t(:button_apply_changes), class: '-highlight -with-icon icon-checkmark' %>
<% end %>
diff --git a/config/initializers/menus.rb b/config/initializers/menus.rb
index c221e2808e5..73579a62dc4 100644
--- a/config/initializers/menus.rb
+++ b/config/initializers/menus.rb
@@ -283,9 +283,21 @@ Redmine::MenuManager.map :admin_menu do |menu|
menu.push :calendars_and_dates,
{ controller: '/admin/settings/working_days_settings', action: :show },
if: Proc.new { User.current.admin? },
- caption: :label_calendars_and_date,
+ caption: :label_calendars_and_dates,
icon: 'calendar'
+ menu.push :working_days,
+ { controller: '/admin/settings/working_days_settings', action: :show },
+ if: Proc.new { User.current.admin? },
+ caption: :label_working_days,
+ parent: :calendars_and_dates
+
+ menu.push :date_format,
+ { controller: '/admin/settings/date_format_settings', action: :show },
+ if: Proc.new { User.current.admin? },
+ caption: :label_date_format,
+ parent: :calendars_and_dates
+
menu.push :settings,
{ controller: '/admin/settings/general_settings', action: :show },
if: Proc.new { User.current.admin? },
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 89a265f32a2..bdb33c2115b 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1691,6 +1691,7 @@ en:
label_database_version: "PostgreSQL version"
label_date: "Date"
label_date_and_time: "Date and time"
+ label_date_format: "Date format"
label_date_from: "From"
label_date_from_to: "From %{start} to %{end}"
label_date_to: "To"
@@ -2103,7 +2104,7 @@ en:
label_workflow: "Workflow"
label_workflow_plural: "Workflows"
label_workflow_summary: "Summary"
- # label_working_days: "Working days"
+ label_working_days: "Working days"
label_x_closed_work_packages_abbr:
one: "1 closed"
other: "%{count} closed"
@@ -2727,6 +2728,7 @@ en:
setting_welcome_on_homescreen: "Display welcome block on homescreen"
setting_work_package_list_default_highlighting_mode: "Default highlighting mode"
setting_work_package_list_default_highlighted_attributes: "Default inline highlighted attributes"
+ setting_working_days: "Working days"
settings:
general: "General"
@@ -2765,6 +2767,9 @@ en:
status: "Entire row by Status"
type: "Entire row by Type"
priority: "Entire row by Priority"
+ working_days:
+ section_work_week: "Work week"
+ section_holidays_and_closures: "Holidays and closures"
text_formatting:
markdown: 'Markdown'
plain: 'Plain text'
@@ -3193,10 +3198,8 @@ en:
working_days:
info: >
- <b>Define days considered part of the work week</b><br/>
Days that are not selected are skipped when scheduling work packages (and not included in the day count). These can be overriden at a work-package level.
instance_wide_info: >
- <b>Specific non-working days (holidays and closures)</b><br/>
Dates added to the list below are considered non-working and skipped when scheduling work packages.
change_button: "Change working days"
warning: >
diff --git a/config/routes.rb b/config/routes.rb
index 5f2b06ff1e1..e7eeb5021bb 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -401,6 +401,7 @@ OpenProject::Application.routes.draw do
resource :work_packages, controller: '/admin/settings/work_packages_settings', only: %i[show update]
resource :working_days, controller: '/admin/settings/working_days_settings', only: %i[show update]
resource :users, controller: '/admin/settings/users_settings', only: %i[show update]
+ resource :date_format, controller: '/admin/settings/date_format_settings', only: %i[show update]
# Redirect /settings to general settings
get '/', to: redirect('/admin/settings/general')