summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-04-05 10:34:02 +0100
committerPhil Hughes <me@iamphill.com>2016-04-14 10:28:05 +0100
commitff7fb09ea80036045e6fd17624b894f389de38b9 (patch)
tree82bbafa79edd374ab149ca856703db79eb1aff10
parent5dd01f572c9a7504f34c5a3b30792197c856bd6f (diff)
downloadgitlab-ce-ff7fb09ea80036045e6fd17624b894f389de38b9.tar.gz
Updated issue form to use new GLForm
-rw-r--r--app/assets/javascripts/dispatcher.js.coffee2
-rw-r--r--app/assets/javascripts/gl_form.js.coffee12
-rw-r--r--app/views/projects/issues/_form.html.haml2
-rw-r--r--app/views/shared/issuable/_form.html.haml2
4 files changed, 12 insertions, 6 deletions
diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee
index 70fd6f50e9c..6efbe214aad 100644
--- a/app/assets/javascripts/dispatcher.js.coffee
+++ b/app/assets/javascripts/dispatcher.js.coffee
@@ -35,7 +35,7 @@ class Dispatcher
new Diff()
when 'projects:issues:new','projects:issues:edit'
shortcut_handler = new ShortcutsNavigation()
- new DropzoneInput($('.issue-form'))
+ new GLForm($('.issue-form'))
new IssuableForm($('.issue-form'))
when 'projects:merge_requests:new', 'projects:merge_requests:edit'
new Diff()
diff --git a/app/assets/javascripts/gl_form.js.coffee b/app/assets/javascripts/gl_form.js.coffee
index 087a46cbac2..aff3e909ce1 100644
--- a/app/assets/javascripts/gl_form.js.coffee
+++ b/app/assets/javascripts/gl_form.js.coffee
@@ -1,7 +1,11 @@
class @GLForm
constructor: (@form) ->
- @textarea = @form.find('.js-note-text')
+ @textarea = @form.find('textarea.js-gfm-input')
+ # Before we start, we should clean up any previous data for this form
+ @destroy()
+
+ # Setup the form
@setupForm()
@form.data 'gl-form', @
@@ -9,8 +13,10 @@ class @GLForm
destroy: ->
# Destroy actions
actions = @form.data 'form-actions'
- actions.clearEventListeners()
- @form.data 'form-actions', null
+
+ if actions?
+ actions.clearEventListeners()
+ @form.data 'form-actions', null
# Clean form listeners
@clearEventListeners()
diff --git a/app/views/projects/issues/_form.html.haml b/app/views/projects/issues/_form.html.haml
index 33c48199ba5..7076f5db015 100644
--- a/app/views/projects/issues/_form.html.haml
+++ b/app/views/projects/issues/_form.html.haml
@@ -1,4 +1,4 @@
-= form_for [@project.namespace.becomes(Namespace), @project, @issue], html: { class: 'form-horizontal issue-form gfm-form js-quick-submit js-requires-input' } do |f|
+= form_for [@project.namespace.becomes(Namespace), @project, @issue], html: { class: 'form-horizontal issue-form common-note-form js-quick-submit js-requires-input' } do |f|
= render 'shared/issuable/form', f: f, issuable: @issue
:javascript
diff --git a/app/views/shared/issuable/_form.html.haml b/app/views/shared/issuable/_form.html.haml
index 6de07a92cd7..d77c74e5d7a 100644
--- a/app/views/shared/issuable/_form.html.haml
+++ b/app/views/shared/issuable/_form.html.haml
@@ -29,7 +29,7 @@
= render layout: 'projects/md_preview', locals: { preview_class: "md-preview", referenced_users: true } do
= render 'projects/zen', f: f, attr: :description,
- classes: 'description form-control'
+ classes: 'note-textarea'
= render 'projects/notes/hints'
.clearfix
.error-alert