about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/user_webapp_css_controller.rb33
-rwxr-xr-xapp/views/layouts/application.html.haml28
2 files changed, 34 insertions, 27 deletions
diff --git a/app/controllers/user_webapp_css_controller.rb b/app/controllers/user_webapp_css_controller.rb
index fcfbf9aed..8ad9fbd2e 100644
--- a/app/controllers/user_webapp_css_controller.rb
+++ b/app/controllers/user_webapp_css_controller.rb
@@ -14,10 +14,41 @@ class UserWebappCssController < ApplicationController
 
   private
 
-  def css
+  def css_dashed_nest
+    return unless @account.user&.setting_style_dashed_nest
+
+    %(
+      div[data-nest-level]
+      { border-style: dashed; }
+    )
+  end
+
+  def css_underline_a
+    return unless @account.user&.setting_style_underline_a
+
+    %(
+      .status__content__text a,
+      .reply-indicator__content a,
+      .composer--reply > .content a,
+      .account__header__content a
+      { text-decoration: underline; }
+
+      .status__content__text a:hover,
+      .reply-indicator__content a:hover,
+      .composer--reply > .content a:hover,
+      .account__header__content a:hover
+      { text-decoration: none; }
+    )
+  end
+
+  def css_webapp
     @account.user&.setting_style_css_webapp_errors.blank? ? (@account.user&.setting_style_css_webapp || '') : ''
   end
 
+  def css
+    "#{css_dashed_nest}\n#{css_underline_a}\n#{css_webapp}".squish
+  end
+
   def set_account
     @account = Account.find(params[:id])
   end
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index f3f29f43e..34f742c16 100755
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -39,34 +39,10 @@
 
     - 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
-        div[data-nest-level] {
-          border-style: dashed;
-        }
 
-    - if current_account&.user&.setting_style_underline_a
-      :css
-        .status__content__text a,
-        .reply-indicator__content a,
-        .composer--reply > .content a,
-        .account__header__content a
-        {
-          text-decoration: underline;          
-        }
+    - if current_account&.user.present?
+      = stylesheet_link_tag user_webapp_css_path(current_account.id), media: 'all'
 
-        .status__content__text a:hover,
-        .reply-indicator__content a:hover,
-        .composer--reply > .content a:hover,
-        .account__header__content a:hover
-        {
-          text-decoration: none;          
-        }
-    
     = yield :header_overrides
 
   %body{ class: body_classes }