From 8fea4f74ed1e98db835f35be3cbb3735233e0346 Mon Sep 17 00:00:00 2001 From: Fire Demon Date: Sat, 1 Aug 2020 21:29:59 -0500 Subject: [Feature, UI] Add settings to customize CSS of profile pages and web app --- app/views/accounts/show.html.haml | 3 +++ app/views/layouts/application.html.haml | 5 +++++ .../settings/preferences/appearance/show.html.haml | 24 ++++++++++++++++++++++ app/views/statuses/show.html.haml | 4 ++++ 4 files changed, 36 insertions(+) (limited to 'app/views') diff --git a/app/views/accounts/show.html.haml b/app/views/accounts/show.html.haml index b1f237618..9eda36f1e 100644 --- a/app/views/accounts/show.html.haml +++ b/app/views/accounts/show.html.haml @@ -16,6 +16,9 @@ = opengraph 'og:type', 'profile' = render 'og', account: @account, url: short_account_url(@account, only_path: false) +- content_for :header_overrides do + - if @account&.user&.setting_style_css_profile.present? + = stylesheet_link_tag user_profile_css_path(id: @account.id), media: 'all' = render 'header', account: @account, with_bio: true diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index aa3c560cb..f3f29f43e 100755 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -39,6 +39,9 @@ - if Setting.custom_css.present? = stylesheet_link_tag custom_css_path, media: 'all' + + - if current_account&.user&.setting_style_css_webapp.present? + = stylesheet_link_tag user_webapp_css_path(current_account.id), media: 'all' - if current_account&.user&.setting_style_dashed_nest :css @@ -63,6 +66,8 @@ { text-decoration: none; } + + = yield :header_overrides %body{ class: body_classes } = content_for?(:content) ? yield(:content) : yield diff --git a/app/views/settings/preferences/appearance/show.html.haml b/app/views/settings/preferences/appearance/show.html.haml index 8d4c182c3..c89ca6e28 100644 --- a/app/views/settings/preferences/appearance/show.html.haml +++ b/app/views/settings/preferences/appearance/show.html.haml @@ -63,5 +63,29 @@ .fields-group = f.input :setting_expand_spoilers, as: :boolean, wrapper: :with_label + %h4= t 'appearance.custom_css' + + .fields-group + = f.input :setting_style_css_profile, as: :text, wrapper: :with_label + + - if current_user.setting_style_css_profile_errors.present? + %p + %strong= t('appearance.custom_css_error') + + %ul + - current_user.setting_style_css_profile_errors.each do |error| + %li.hint= error + + .fields-group + = f.input :setting_style_css_webapp, as: :text, wrapper: :with_label + + - if current_user&.setting_style_css_webapp_errors.present? + %p + %strong= t('appearance.custom_css_error') + + %ul + - current_user.setting_style_css_webapp_errors.each do |error| + %li.hint= error + .actions = f.button :button, t('generic.save_changes'), type: :submit diff --git a/app/views/statuses/show.html.haml b/app/views/statuses/show.html.haml index 873df7fbd..c06f6ebce 100644 --- a/app/views/statuses/show.html.haml +++ b/app/views/statuses/show.html.haml @@ -16,6 +16,10 @@ = render 'og_description', activity: @status = render 'og_image', activity: @status, account: @account +- content_for :header_overrides do + - if @account&.user&.setting_style_css_profile.present? + = stylesheet_link_tag user_profile_css_path(id: @account.id), media: 'all' + .grid .column-0 .activity-stream.h-entry -- cgit