Commit 184a9ecaf6cf25e429fe5653380e356b25a15a90

Authored by Riyad Preukschas
1 parent c4f3c54e

Add user_color_scheme_class helper

app/helpers/application_helper.rb
@@ -126,6 +126,10 @@ module ApplicationHelper @@ -126,6 +126,10 @@ module ApplicationHelper
126 Gitlab::Theme.css_class_by_id(current_user.try(:theme_id)) 126 Gitlab::Theme.css_class_by_id(current_user.try(:theme_id))
127 end 127 end
128 128
  129 + def user_color_scheme_class
  130 + current_user.dark_scheme ? :black : :white
  131 + end
  132 +
129 def show_last_push_widget?(event) 133 def show_last_push_widget?(event)
130 event && 134 event &&
131 event.last_push_to_non_root? && 135 event.last_push_to_non_root? &&
app/views/snippets/_blob.html.haml
@@ -6,8 +6,7 @@ @@ -6,8 +6,7 @@
6 = link_to "raw", raw_project_snippet_path(@project, @snippet), class: "btn very_small", target: "_blank" 6 = link_to "raw", raw_project_snippet_path(@project, @snippet), class: "btn very_small", target: "_blank"
7 .file_content.code 7 .file_content.code
8 - unless @snippet.content.empty? 8 - unless @snippet.content.empty?
9 - %div{class: current_user.dark_scheme ? "black" : "white"}  
10 - :preserve  
11 - #{raw @snippet.colorize(formatter: :gitlab)} 9 + %div{class: user_color_scheme_class}
  10 + = raw @snippet.colorize(formatter: :gitlab)
12 - else 11 - else
13 %p.nothing_here_message Empty file 12 %p.nothing_here_message Empty file
app/views/tree/blob/_text.html.haml
@@ -8,8 +8,7 @@ @@ -8,8 +8,7 @@
8 - else 8 - else
9 .file_content.code 9 .file_content.code
10 - unless blob.empty? 10 - unless blob.empty?
11 - %div{class: current_user.dark_scheme ? "black" : "white"}  
12 - = preserve do  
13 - = raw blob.colorize(formatter: :gitlab) 11 + %div{class: user_color_scheme_class}
  12 + = raw blob.colorize(formatter: :gitlab)
14 - else 13 - else
15 %p.nothing_here_message Empty file 14 %p.nothing_here_message Empty file