diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb index 55fa8acf1bc..c5f5b4f6c4f 100644 --- a/app/controllers/categories_controller.rb +++ b/app/controllers/categories_controller.rb @@ -40,29 +40,15 @@ class CategoriesController < ApplicationController @category = @project.categories.build end - def create # rubocop:disable Metrics/AbcSize + def create @category = @project.categories.build @category.attributes = permitted_params.category if @category.save - respond_to do |format| - format.html do - flash[:notice] = I18n.t(:notice_successful_create) - redirect_to project_settings_categories_path(@project) - end - format.js do - render locals: { project: @project, category: @category } - end - end + flash[:notice] = I18n.t(:notice_successful_create) + redirect_to project_settings_categories_path(@project) else - respond_to do |format| - format.html do - render action: :new, status: :unprocessable_entity - end - format.js do - render(:update) { |page| page.alert(@category.errors.full_messages.join('\n')) } - end - end + render action: :new, status: :unprocessable_entity end end diff --git a/app/views/categories/create.js.erb b/app/views/categories/create.js.erb deleted file mode 100644 index e21944ffa7a..00000000000 --- a/app/views/categories/create.js.erb +++ /dev/null @@ -1,30 +0,0 @@ -<%#-- copyright -OpenProject is an open source project management software. -Copyright (C) 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. - -++#%> - -jQuery('#work_package_category_id').empty().append("<%= escape_javascript(options_from_collection_for_select(project.categories, "id", "name", category.id)) %>");