summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-04-13 08:46:30 +0100
committerPhil Hughes <me@iamphill.com>2016-04-14 10:28:05 +0100
commit094cafcaa7c135a839a7329ed06fdd5d19a05f4b (patch)
treef92d9ce5e475db524501498c8578027647b13c61
parent7a1800fec87133e9971a83b457c969b5adaf5919 (diff)
downloadgitlab-ce-094cafcaa7c135a839a7329ed06fdd5d19a05f4b.tar.gz
Removed GL Actions class
-rw-r--r--app/assets/javascripts/gl_form.js.coffee11
-rw-r--r--app/assets/javascripts/gl_form_actions.js.coffee43
-rw-r--r--app/views/projects/notes/_hints.html.haml3
3 files changed, 0 insertions, 57 deletions
diff --git a/app/assets/javascripts/gl_form.js.coffee b/app/assets/javascripts/gl_form.js.coffee
index aff3e909ce1..d540cc4dc46 100644
--- a/app/assets/javascripts/gl_form.js.coffee
+++ b/app/assets/javascripts/gl_form.js.coffee
@@ -11,13 +11,6 @@ class @GLForm
@form.data 'gl-form', @
destroy: ->
- # Destroy actions
- actions = @form.data 'form-actions'
-
- if actions?
- actions.clearEventListeners()
- @form.data 'form-actions', null
-
# Clean form listeners
@clearEventListeners()
@form.data 'gl-form', null
@@ -38,10 +31,6 @@ class @GLForm
autosize(@textarea)
- # Setup action buttons
- actions = new GLFormActions @form, @textarea
- @form.data 'form-actions', actions
-
# form and textarea event listeners
@addEventListeners()
diff --git a/app/assets/javascripts/gl_form_actions.js.coffee b/app/assets/javascripts/gl_form_actions.js.coffee
deleted file mode 100644
index d8de63a2be9..00000000000
--- a/app/assets/javascripts/gl_form_actions.js.coffee
+++ /dev/null
@@ -1,43 +0,0 @@
-class @GLFormActions
- constructor: (@form, @textarea) ->
- @clearEventListeners()
- @addEventListeners()
-
- clearEventListeners: ->
- @form.off 'click', '.js-toolbar-button'
-
- addEventListeners: ->
- @form.on 'click', '.js-toolbar-button', @toolbarButtonClick
-
- toolbarButtonClick: (e) =>
- $btn = $(e.currentTarget)
-
- # Get the prefix from the button
- prefix = $btn.data('prefix')
- @addPrefixToTextarea(prefix)
-
- addPrefixToTextarea: (prefix) ->
- caretStart = @textarea.get(0).selectionStart
- caretEnd = @textarea.get(0).selectionEnd
- textEnd = @textarea.val().length
-
- beforeSelection = @textarea.val().substring 0, caretStart
- afterSelection = @textarea.val().substring caretEnd, textEnd
-
- beforeSelectionSplit = beforeSelection.split ''
- beforeSelectionLength = beforeSelection.length
-
- # Get the last character in the before selection
- beforeSelectionLastChar = beforeSelectionSplit[beforeSelectionLength - 1]
-
- if beforeSelectionLastChar? and beforeSelectionLastChar isnt ''
- # Append a white space char to the prefix if the previous char isn't a space
- prefix = " #{prefix}"
-
- # Update the textarea
- @textarea.val beforeSelection + prefix + afterSelection
- @textarea.get(0).setSelectionRange caretStart + prefix.length, caretEnd + prefix.length
-
- # Focus the textarea
- @textarea.focus()
- @textarea.trigger('keyup')
diff --git a/app/views/projects/notes/_hints.html.haml b/app/views/projects/notes/_hints.html.haml
index 0c6758210b1..0b002043408 100644
--- a/app/views/projects/notes/_hints.html.haml
+++ b/app/views/projects/notes/_hints.html.haml
@@ -1,7 +1,4 @@
.comment-toolbar.clearfix
- %button.toolbar-button.js-toolbar-button{ type: 'button', data: { prefix: ':' }, tabindex: '-1' }
- = icon('smile-o', class: 'toolbar-button-icon')
- Emoji
.toolbar-text
Styling with
= link_to 'Markdown', help_page_path('markdown', 'markdown'), target: '_blank', tabindex: -1