OSDN Git Service

Add user_color_scheme_class helper
authorRiyad Preukschas <riyad@informatik.uni-bremen.de>
Tue, 27 Nov 2012 21:49:22 +0000 (22:49 +0100)
committerRiyad Preukschas <riyad@informatik.uni-bremen.de>
Tue, 27 Nov 2012 21:51:05 +0000 (22:51 +0100)
app/helpers/application_helper.rb
app/views/snippets/_blob.html.haml
app/views/tree/blob/_text.html.haml

index 8f4d908..a689213 100644 (file)
@@ -126,6 +126,10 @@ module ApplicationHelper
     Gitlab::Theme.css_class_by_id(current_user.try(:theme_id))
   end
 
+  def user_color_scheme_class
+    current_user.dark_scheme ? :black : :white
+  end
+
   def show_last_push_widget?(event)
     event &&
       event.last_push_to_non_root? &&
index 68a5f2b..ed51830 100644 (file)
@@ -6,8 +6,7 @@
       = link_to "raw", raw_project_snippet_path(@project, @snippet), class: "btn very_small", target: "_blank"
   .file_content.code
     - unless @snippet.content.empty?
-      %div{class: current_user.dark_scheme ? "black" : "white"}
-        :preserve
-          #{raw @snippet.colorize(formatter: :gitlab)}
+      %div{class: user_color_scheme_class}
+        = raw @snippet.colorize(formatter: :gitlab)
     - else
       %p.nothing_here_message Empty file
index 37b0ff8..122e275 100644 (file)
@@ -8,8 +8,7 @@
 - else
   .file_content.code
     - unless blob.empty?
-      %div{class: current_user.dark_scheme ? "black" : "white"}
-        = preserve do
-          = raw blob.colorize(formatter: :gitlab)
+      %div{class: user_color_scheme_class}
+        = raw blob.colorize(formatter: :gitlab)
     - else
       %p.nothing_here_message Empty file