summaryrefslogtreecommitdiff
path: root/app/assets/javascripts
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-08-27 16:24:51 +0000
committerDouwe Maan <douwe@gitlab.com>2015-08-27 16:24:51 +0000
commit30555c1d24af25aca0c6e85f52234a8a570b7691 (patch)
treefd40fb02e465ae97db65d9e3fb89ba26bd8237ee /app/assets/javascripts
parentabb5b9f6e526195c4eb027d5b7c28e070d9ac3c1 (diff)
parentce0a0feff45b47b6c03b9ab01d815b651840a7b2 (diff)
downloadgitlab-ce-30555c1d24af25aca0c6e85f52234a8a570b7691.tar.gz
Merge branch 'rs-remove-user-color-scheme-class' into 'master'
Apply syntax highlighting to fenced code blocks client-side Instead of applying the syntax highlighting scheme class to these blocks server-side, we use Javascript and Gon to apply the user's color scheme (or the default) client-side. This will make it easier to cache these blocks in the future because they're no longer state-dependent. See merge request !1203
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r--app/assets/javascripts/syntax_highlight.coffee9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/assets/javascripts/syntax_highlight.coffee b/app/assets/javascripts/syntax_highlight.coffee
new file mode 100644
index 00000000000..510f15d1b49
--- /dev/null
+++ b/app/assets/javascripts/syntax_highlight.coffee
@@ -0,0 +1,9 @@
+# Applies a syntax highlighting color scheme CSS class to any element with the
+# `js-syntax-highlight` class
+#
+# ### Example Markup
+#
+# <div class="js-syntax-highlight"></div>
+#
+$(document).on 'ready page:load', ->
+ $('.js-syntax-highlight').addClass(gon.user_color_scheme)