Add: #883 管理者の設定したカスタムCSSをユーザー単位で無効にするオプション (#902)

* Add: #883 管理者の設定したカスタムCSSをユーザー単位で無効にするオプション

* ラベル変更
This commit is contained in:
KMY(雪あすか) 2024-11-01 12:09:24 +09:00 committed by GitHub
parent b30086dc6b
commit 943db145e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 56 additions and 14 deletions

View file

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

View file

@ -34,7 +34,10 @@
= csrf_meta_tags unless skip_csrf_meta_tags?
%meta{ name: 'style-nonce', content: request.content_security_policy_nonce }
= stylesheet_link_tag custom_css_path, skip_pipeline: true, host: root_url, media: 'all'
- if server_css?
= stylesheet_link_tag custom_css_path, skip_pipeline: true, host: root_url, media: 'all'
- else
= stylesheet_link_tag system_css_path, skip_pipeline: true, host: root_url, media: 'all'
- if user_custom_css?
= stylesheet_link_tag user_custom_css_path({ version: user_custom_css_version }), skip_pipeline: true, host: root_url, media: 'all'

View file

@ -8,6 +8,13 @@
= render 'shared/error_messages', object: current_user
= f.simple_fields_for :settings, current_user.settings do |ff|
.fields-group
= ff.input :'web.use_server_css',
hint: false,
label: I18n.t('simple_form.labels.defaults.setting_use_server_css'),
kmyblue: true,
wrapper: :with_label
.fields-group
= ff.input :'web.use_custom_css',
hint: false,

View file

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