summaryrefslogtreecommitdiff
path: root/app/views/layouts/_init_auto_complete.html.haml
diff options
context:
space:
mode:
authorRiyad Preukschas <riyad@informatik.uni-bremen.de>2012-10-10 00:16:52 +0200
committerRiyad Preukschas <riyad@informatik.uni-bremen.de>2012-10-10 00:53:55 +0200
commite4aa5a5c8f9d8a4b556aeba003160017821ed9a3 (patch)
tree1bda639e1a82b4f1d5ef112719d4374241145242 /app/views/layouts/_init_auto_complete.html.haml
parenteb92813757d8ec14819ddbab6efae7e7cdd403e6 (diff)
downloadgitlab-ce-e4aa5a5c8f9d8a4b556aeba003160017821ed9a3.tar.gz
Extract and split GFM auto-completion setup JS
* static initialization and setup moved to assets * per request initialization moved to layout partial
Diffstat (limited to 'app/views/layouts/_init_auto_complete.html.haml')
-rw-r--r--app/views/layouts/_init_auto_complete.html.haml17
1 files changed, 17 insertions, 0 deletions
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();
+ });