Appease the dog overlords

This commit is contained in:
Andreas Nedbal 2022-06-26 03:07:59 +02:00 committed by Karina Kwiatek
parent 8f8ebaf77b
commit 417eee2ddc
2 changed files with 37 additions and 38 deletions

View File

@ -3,23 +3,22 @@ class Settings::ThemeController < ApplicationController
before_action :authenticate_user! before_action :authenticate_user!
def edit def edit; end
end
def update def update
update_attributes = params.require(:theme).permit([ update_attributes = params.require(:theme).permit(%i[
:primary_color, :primary_text, primary_color primary_text
:danger_color, :danger_text, danger_color danger_text
:success_color, :success_text, success_color success_text
:warning_color, :warning_text, warning_color warning_text
:info_color, :info_text, info_color info_text
:dark_color, :dark_text, dark_color dark_text
:light_color, :light_text, light_color light_text
:raised_background, :raised_accent, raised_background raised_accent
:background_color, :body_text, background_color body_text
:muted_text, :input_color, muted_text input_color
:input_text input_text
]) ])
if current_user.theme.nil? if current_user.theme.nil?
current_user.theme = Theme.new update_attributes current_user.theme = Theme.new update_attributes

View File

@ -21,31 +21,31 @@ describe Settings::ThemeController, type: :controller do
describe "#update" do describe "#update" do
let(:user) { FactoryBot.create(:user) } let(:user) { FactoryBot.create(:user) }
let(:update_attributes) do let(:update_attributes) do
{ {
theme: { theme: {
primary_color: 6174129, primary_color: 6174129,
primary_text: 16777215, primary_text: 16777215,
danger_color: 14431557, danger_color: 14431557,
danger_text: 16777215, danger_text: 16777215,
success_color: 2664261, success_color: 2664261,
success_text: 16777215, success_text: 16777215,
warning_color: 16761095, warning_color: 16761095,
warning_text: 2697513, warning_text: 2697513,
info_color: 1548984, info_color: 1548984,
info_text: 16777215, info_text: 16777215,
dark_color: 3422784, dark_color: 3422784,
dark_text: 15658734, dark_text: 15658734,
light_color: 16316922, light_color: 16316922,
light_text: 0, light_text: 0,
raised_background: 16777215, raised_background: 16777215,
raised_accent: 16250871, raised_accent: 16250871,
background_color: 15789556, background_color: 15789556,
body_text: 0, body_text: 0,
muted_text: 7107965, muted_text: 7107965,
input_color: 15789556, input_color: 15789556,
input_text: 0 input_text: 0
} }
} }
end end