diff --git a/app/controllers/admin/incoming_mails_controller.rb b/app/controllers/admin/incoming_mails_controller.rb
new file mode 100644
index 0000000000..d1a97f8db4
--- /dev/null
+++ b/app/controllers/admin/incoming_mails_controller.rb
@@ -0,0 +1,45 @@
+#-- encoding: UTF-8
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2020 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-2017 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 Admin::IncomingMailsController < ApplicationController
+ include Concerns::AdminSettingsUpdater
+
+ current_menu_item [:show] do
+ :incoming_mails
+ end
+
+ def default_breadcrumb
+ t(:label_incoming_emails)
+ end
+
+ def show_local_breadcrumb
+ true
+ end
+end
diff --git a/app/controllers/admin/mail_notifications_controller.rb b/app/controllers/admin/mail_notifications_controller.rb
new file mode 100644
index 0000000000..92e8140651
--- /dev/null
+++ b/app/controllers/admin/mail_notifications_controller.rb
@@ -0,0 +1,50 @@
+#-- encoding: UTF-8
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2020 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-2017 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 Admin::MailNotificationsController < ApplicationController
+ include Concerns::AdminSettingsUpdater
+
+ current_menu_item [:show] do
+ :mail_notifications
+ end
+
+ def show
+ @deliveries = ActionMailer::Base.perform_deliveries
+ @notifiables = Redmine::Notifiable.all
+ end
+
+ def default_breadcrumb
+ t(:'activerecord.attributes.user.mail_notification')
+ end
+
+ def show_local_breadcrumb
+ true
+ end
+end
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index 65107105c5..3170c4f076 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -61,7 +61,7 @@ class AdminController < ApplicationController
flash[:error] = I18n.t(:notice_email_error, value: Redmine::CodesetUtil.replace_invalid_utf8(e.message.dup))
end
ActionMailer::Base.raise_delivery_errors = raise_delivery_errors
- redirect_to controller: '/settings', action: 'edit', tab: 'notifications'
+ redirect_to admin_mail_notifications_path
end
def force_user_language
diff --git a/app/controllers/concerns/admin_settings_updater.rb b/app/controllers/concerns/admin_settings_updater.rb
new file mode 100644
index 0000000000..4c05f88546
--- /dev/null
+++ b/app/controllers/concerns/admin_settings_updater.rb
@@ -0,0 +1,52 @@
+#-- encoding: UTF-8
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2020 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-2017 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.
+#++
+
+module Concerns
+ module AdminSettingsUpdater
+ extend ActiveSupport::Concern
+
+ included do
+ layout 'admin'
+
+ before_action :require_admin
+
+ def update
+ if params[:settings]
+ Settings::UpdateService
+ .new(user: current_user)
+ .call(settings: permitted_params.settings.to_h)
+
+ flash[:notice] = t(:notice_successful_update)
+ redirect_to action: 'show', tab: params[:tab]
+ end
+ end
+ end
+ end
+end
diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb
index 3e91fc6074..45fcf253b4 100644
--- a/app/controllers/settings_controller.rb
+++ b/app/controllers/settings_controller.rb
@@ -1,4 +1,5 @@
#-- encoding: UTF-8
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2020 the OpenProject GmbH
@@ -28,13 +29,11 @@
#++
class SettingsController < ApplicationController
- layout 'admin'
+ include Concerns::AdminSettingsUpdater
helper_method :gon
- before_action :require_admin
-
- current_menu_item [:index, :edit] do
+ current_menu_item [:show] do
:settings
end
@@ -45,29 +44,13 @@ class SettingsController < ApplicationController
:settings
end
- def index
- edit
- render action: 'edit'
- end
-
- def edit
- @notifiables = Redmine::Notifiable.all
- if request.post? && params[:settings]
- Settings::UpdateService
- .new(user: current_user)
- .call(settings: permitted_params.settings.to_h)
+ def show
+ @options = {}
+ @options[:user_format] = User::USER_FORMATS_STRUCTURE.keys.map { |f| [User.current.name(f), f.to_s] }
- flash[:notice] = l(:notice_successful_update)
- redirect_to action: 'edit', tab: params[:tab]
- else
- @options = {}
- @options[:user_format] = User::USER_FORMATS_STRUCTURE.keys.map { |f| [User.current.name(f), f.to_s] }
- @deliveries = ActionMailer::Base.perform_deliveries
+ @guessed_host = request.host_with_port.dup
- @guessed_host = request.host_with_port.dup
-
- @custom_style = CustomStyle.current || CustomStyle.new
- end
+ @custom_style = CustomStyle.current || CustomStyle.new
end
def plugin
@@ -89,7 +72,7 @@ class SettingsController < ApplicationController
plugin = Redmine::Plugin.find(params[:id])
plugin.name
else
- l(:label_system_settings)
+ t(:label_system_settings)
end
end
diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb
index 0ca213c487..4f83ac33cf 100644
--- a/app/helpers/settings_helper.rb
+++ b/app/helpers/settings_helper.rb
@@ -37,37 +37,25 @@ module SettingsHelper
{
name: 'general',
partial: 'settings/general',
- path: settings_path,
+ path: general_settings_path,
label: :label_general
},
{
name: 'display',
partial: 'settings/display',
- path: settings_path(tab: :display),
+ path: general_settings_path(tab: :display),
label: :label_display
},
{
name: 'projects',
partial: 'settings/projects',
- path: settings_path(tab: :projects),
+ path: general_settings_path(tab: :projects),
label: :label_project_plural
},
- {
- name: 'notifications',
- partial: 'settings/notifications',
- path: settings_path(tab: :notifications),
- label: :label_mail_notification
- },
- {
- name: 'mail_handler',
- partial: 'settings/mail_handler',
- path: settings_path(tab: :mail_handler),
- label: :label_incoming_emails
- },
{
name: 'repositories',
partial: 'settings/repositories',
- path: settings_path(tab: :repositories),
+ path: general_settings_path(tab: :repositories),
label: :label_repository_plural
}
]
diff --git a/app/views/settings/_mail_handler.html.erb b/app/views/admin/incoming_mails/show.html.erb
similarity index 91%
rename from app/views/settings/_mail_handler.html.erb
rename to app/views/admin/incoming_mails/show.html.erb
index 85517b4bbb..b148cb3e69 100644
--- a/app/views/settings/_mail_handler.html.erb
+++ b/app/views/admin/incoming_mails/show.html.erb
@@ -26,7 +26,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See docs/COPYRIGHT.rdoc for more details.
++#%>
-<%= styled_form_tag({action: 'edit', tab: 'mail_handler'}) do %>
+
+<% html_title t(:label_administration), t(:label_incoming_emails) -%>
+
+<%= toolbar title: t(:label_incoming_emails) %>
+
+<%= styled_form_tag(admin_incoming_mails_path, method: :patch) do %>
<%= l(:text_enumeration_destroy_question, @enumeration.objects_count) %>
diff --git a/app/views/homescreen/blocks/_administration.html.erb b/app/views/homescreen/blocks/_administration.html.erb index 67b6fe940d..2d0f9a54ad 100644 --- a/app/views/homescreen/blocks/_administration.html.erb +++ b/app/views/homescreen/blocks/_administration.html.erb @@ -37,7 +37,7 @@