From cc22a2640f7d9aed743739c583d1fa8f11af2b91 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 4 Sep 2015 17:07:24 -0400 Subject: [PATCH] Add syntax highlight scheme to notes rendered client-side --- app/assets/javascripts/notes.js.coffee | 1 + app/assets/javascripts/syntax_highlight.coffee | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee index 0021d17d85..b7f2c63c5a 100644 --- a/app/assets/javascripts/notes.js.coffee +++ b/app/assets/javascripts/notes.js.coffee @@ -123,6 +123,7 @@ class @Notes if @isNewNote(note) @note_ids.push(note.id) $('ul.main-notes-list').append(note.html) + $('.js-syntax-highlight').syntaxHighlight() @initTaskList() ### diff --git a/app/assets/javascripts/syntax_highlight.coffee b/app/assets/javascripts/syntax_highlight.coffee index 510f15d1b4..71295cd4b0 100644 --- a/app/assets/javascripts/syntax_highlight.coffee +++ b/app/assets/javascripts/syntax_highlight.coffee @@ -5,5 +5,8 @@ # #
# +$.fn.syntaxHighlight = -> + $(this).addClass(gon.user_color_scheme) + $(document).on 'ready page:load', -> - $('.js-syntax-highlight').addClass(gon.user_color_scheme) + $('.js-syntax-highlight').syntaxHighlight()