From 489e8992cfb4076fb4bf7f1c68bd945d30a26bbf Mon Sep 17 00:00:00 2001
From: Douwe Maan <douwe@selenight.nl>
Date: Fri, 12 Aug 2016 20:19:52 -0500
Subject: [PATCH] Link to slash commands documentation from form hints

---
 app/views/projects/notes/_form.html.haml  |  2 +-
 app/views/projects/notes/_hints.html.haml | 11 +++++++++--
 app/views/shared/issuable/_form.html.haml |  2 +-
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/app/views/projects/notes/_form.html.haml b/app/views/projects/notes/_form.html.haml
index b2a31607824..759c72b2477 100644
--- a/app/views/projects/notes/_form.html.haml
+++ b/app/views/projects/notes/_form.html.haml
@@ -15,7 +15,7 @@
       classes: 'note-textarea js-note-text',
       placeholder: "Write a comment or drag your files here...",
       supports_slash_commands: true
-    = render 'projects/notes/hints'
+    = render 'projects/notes/hints', supports_slash_commands: true
     .error-alert
 
   .note-form-actions.clearfix
diff --git a/app/views/projects/notes/_hints.html.haml b/app/views/projects/notes/_hints.html.haml
index 25466e7562e..cf6e14648cc 100644
--- a/app/views/projects/notes/_hints.html.haml
+++ b/app/views/projects/notes/_hints.html.haml
@@ -1,8 +1,15 @@
+- supports_slash_commands = local_assigns.fetch(:supports_slash_commands, false)
 .comment-toolbar.clearfix
   .toolbar-text
     Styling with
     = link_to 'Markdown', help_page_path('markdown/markdown'), target: '_blank', tabindex: -1
-    is supported
+    - if supports_slash_commands
+      and
+      = link_to 'slash commands', help_page_path('workflow/slash_commands'), target: '_blank', tabindex: -1
+      are
+    - else
+      is
+    supported
   %button.toolbar-button.markdown-selector{ type: 'button', tabindex: '-1' }
     = icon('file-image-o', class: 'toolbar-button-icon')
-    Attach a file
\ No newline at end of file
+    Attach a file
diff --git a/app/views/shared/issuable/_form.html.haml b/app/views/shared/issuable/_form.html.haml
index 7e4062c8d4d..25b29ccf70d 100644
--- a/app/views/shared/issuable/_form.html.haml
+++ b/app/views/shared/issuable/_form.html.haml
@@ -32,7 +32,7 @@
                                classes: 'note-textarea',
                                placeholder: "Write a comment or drag your files here...",
                                supports_slash_commands: !issuable.persisted?
-      = render 'projects/notes/hints'
+      = render 'projects/notes/hints', supports_slash_commands: !issuable.persisted?
       .clearfix
       .error-alert
 
-- 
GitLab