Fix: NGワード設定画面のエラー

This commit is contained in:
KMY 2025-02-28 15:15:39 +09:00
parent f533e8cd22
commit e975a98b9f
4 changed files with 15 additions and 15 deletions

View file

@ -21,6 +21,10 @@ module Admin
false
end
def avoid_save?
true
end
private
def after_update_redirect_path

View file

@ -13,6 +13,12 @@ module Admin
return unless validate
if avoid_save?
flash[:notice] = I18n.t('generic.changes_saved_msg')
redirect_to after_update_redirect_path
return
end
@admin_settings = Form::AdminSettings.new(settings_params)
if @admin_settings.save
@ -33,6 +39,10 @@ module Admin
admin_ng_words_path
end
def avoid_save?
false
end
private
def settings_params
@ -40,7 +50,7 @@ module Admin
end
def settings_params_test
params.require(:form_admin_settings)[:ng_words_test]
params.expect(form_admin_settings: [ng_words_test: [keywords: [], strangers: [], temporary_ids: []]])['ng_words_test']
end
end
end

View file

@ -1,16 +1,8 @@
# frozen_string_literal: true
class SystemCssController < ActionController::Base # rubocop:disable Rails/ApplicationController
before_action :set_user_roles
def show
expires_in 3.minutes, public: true
render content_type: 'text/css'
end
private
def set_user_roles
@user_roles = UserRole.providing_styles
end
end

View file

@ -1,6 +0,0 @@
<%- @user_roles.each do |role| %>
.user-role-<%= role.id %> {
--user-role-accent: <%= role.color %>;
}
<%- end %>