From e4aa5a5c8f9d8a4b556aeba003160017821ed9a3 Mon Sep 17 00:00:00 2001 From: Riyad Preukschas Date: Wed, 10 Oct 2012 00:16:52 +0200 Subject: Extract and split GFM auto-completion setup JS * static initialization and setup moved to assets * per request initialization moved to layout partial --- app/views/layouts/_init_auto_complete.html.haml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 app/views/layouts/_init_auto_complete.html.haml (limited to 'app/views/layouts/_init_auto_complete.html.haml') diff --git a/app/views/layouts/_init_auto_complete.html.haml b/app/views/layouts/_init_auto_complete.html.haml new file mode 100644 index 00000000000..87a74655128 --- /dev/null +++ b/app/views/layouts/_init_auto_complete.html.haml @@ -0,0 +1,17 @@ +:javascript + $(function() { + autocompleteMembersUrl = "#{ "/api/v2/projects/#{@project.code}/members" if @project }"; + autocompleteMembersParams.private_token = "#{current_user.authentication_token}"; + + autocompleteEmojiData = #{raw emoji_autocomplete_source}; + // convert the list so that the items have the right format for completion + autocompleteEmojiData = $.map(autocompleteEmojiData, function(value) { + return { + name: value, + insert: value+':', + image: '#{image_path("emoji")}/'+value+'.png' + } + }); + + setupGfmAutoComplete(); + }); -- cgit v1.2.1