Commit 184a9ecaf6cf25e429fe5653380e356b25a15a90
1 parent
c4f3c54e
Exists in
master
and in
4 other branches
Add user_color_scheme_class helper
Showing
3 changed files
with
8 additions
and
6 deletions
Show diff stats
app/helpers/application_helper.rb
| ... | ... | @@ -126,6 +126,10 @@ module ApplicationHelper |
| 126 | 126 | Gitlab::Theme.css_class_by_id(current_user.try(:theme_id)) |
| 127 | 127 | end |
| 128 | 128 | |
| 129 | + def user_color_scheme_class | |
| 130 | + current_user.dark_scheme ? :black : :white | |
| 131 | + end | |
| 132 | + | |
| 129 | 133 | def show_last_push_widget?(event) |
| 130 | 134 | event && |
| 131 | 135 | event.last_push_to_non_root? && | ... | ... |
app/views/snippets/_blob.html.haml
| ... | ... | @@ -6,8 +6,7 @@ |
| 6 | 6 | = link_to "raw", raw_project_snippet_path(@project, @snippet), class: "btn very_small", target: "_blank" |
| 7 | 7 | .file_content.code |
| 8 | 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 | 11 | - else |
| 13 | 12 | %p.nothing_here_message Empty file | ... | ... |
app/views/tree/blob/_text.html.haml
| ... | ... | @@ -8,8 +8,7 @@ |
| 8 | 8 | - else |
| 9 | 9 | .file_content.code |
| 10 | 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 | 13 | - else |
| 15 | 14 | %p.nothing_here_message Empty file | ... | ... |