diff options
author | Marin Jankovski <marin@gitlab.com> | 2014-10-02 06:46:09 +0000 |
---|---|---|
committer | Marin Jankovski <marin@gitlab.com> | 2014-10-02 06:46:09 +0000 |
commit | b420ab7b1ce8d5b37b3829701bc708c62a1470ca (patch) | |
tree | 3fd9fe94f2b81b2bd00864329fd61e23ad039e33 | |
parent | a950783ab2f123698b3ca391202ecd9173636ede (diff) | |
parent | dae670bd693cbfc19cbef1258d228534cfd0ad7e (diff) | |
download | gitlab-ce-b420ab7b1ce8d5b37b3829701bc708c62a1470ca.tar.gz |
Merge branch 'fix_selecting_them_upload' into 'master'
Fix selecting them upload
Related to https://gitlab.com/gitlab-org/gitlab-ce/commit/58c0a4f5cf27f76f1dc0474197b8aca06b6db12d#note_293570
See merge request !198
-rw-r--r-- | app/assets/javascripts/markdown_area.js.coffee | 22 | ||||
-rw-r--r-- | app/assets/javascripts/zen_mode.js.coffee | 4 | ||||
-rw-r--r-- | app/views/projects/issues/_form.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/merge_requests/_form.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/merge_requests/_new_submit.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/milestones/_form.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/notes/_form.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/wikis/_form.html.haml | 2 |
8 files changed, 21 insertions, 17 deletions
diff --git a/app/assets/javascripts/markdown_area.js.coffee b/app/assets/javascripts/markdown_area.js.coffee index a971e5dbf1d..fca7b5bc030 100644 --- a/app/assets/javascripts/markdown_area.js.coffee +++ b/app/assets/javascripts/markdown_area.js.coffee @@ -12,13 +12,13 @@ $(document).ready -> btnAlert = "<button type=\"button\"" + alertAttr + ">×</button>" project_image_path_upload = window.project_image_path_upload or null - $("textarea.markdown-area").wrap "<div class=\"div-dropzone\"></div>" - + $("textarea.markdown-area").wrap "<div class=\"div-dropzone\"></div>" + $(".div-dropzone").parent().addClass "div-dropzone-wrapper" $(".div-dropzone").append divHover $(".div-dropzone-hover").append iconPicture - $(".div-dropzone").append divSpinner + $(".div-dropzone").append divSpinner $(".div-dropzone-spinner").append iconSpinner $(".div-dropzone-spinner").css "opacity": 0 @@ -27,12 +27,12 @@ $(document).ready -> dropzone = $(".div-dropzone").dropzone( url: project_image_path_upload dictDefaultMessage: "" - clickable: false + clickable: true paramName: "markdown_img" maxFilesize: 10 uploadMultiple: false acceptedFiles: "image/jpg,image/jpeg,image/gif,image/png" - headers: + headers: "X-CSRF-Token": $("meta[name=\"csrf-token\"]").attr("content") previewContainer: false @@ -91,7 +91,7 @@ $(document).ready -> handlePaste = (e) -> e.preventDefault() my_event = e.originalEvent - + if my_event.clipboardData and my_event.clipboardData.items processItem(my_event) @@ -115,7 +115,7 @@ $(document).ready -> return item i++ return false - + pasteText = (text) -> caretStart = $(child)[0].selectionStart caretEnd = $(child)[0].selectionEnd @@ -126,12 +126,12 @@ $(document).ready -> $(child).val beforeSelection + text + afterSelection $(".markdown-area").trigger "input" - getFilename = (e) -> + getFilename = (e) -> if window.clipboardData and window.clipboardData.getData value = window.clipboardData.getData("Text") else if e.clipboardData and e.clipboardData.getData value = e.clipboardData.getData("text/plain") - + value = value.split("\r") value.first() @@ -154,7 +154,7 @@ $(document).ready -> success: (e, textStatus, response) -> insertToTextArea(filename, formatLink(response.responseJSON.link)) - + error: (response) -> showError(response.responseJSON.message) @@ -190,7 +190,7 @@ $(document).ready -> $(".markdown-selector").click (e) -> e.preventDefault() - $(@).closest(".div-dropzone-wrapper").find(".div-dropzone").click() + $(@).closest('.gfm-form').find('.div-dropzone').click() return return diff --git a/app/assets/javascripts/zen_mode.js.coffee b/app/assets/javascripts/zen_mode.js.coffee index 21ac212df0e..0c9942a4014 100644 --- a/app/assets/javascripts/zen_mode.js.coffee +++ b/app/assets/javascripts/zen_mode.js.coffee @@ -32,6 +32,8 @@ class @ZenMode @active_zen_area = @active_checkbox.parent().find('textarea') @active_zen_area.focus() window.location.hash = ZenMode.fullscreen_prefix + @active_checkbox.prop('id') + # Disable dropzone in ZEN mode + Dropzone.forElement('.div-dropzone').disable() exitZenMode: => if @active_zen_area isnt null @@ -41,6 +43,8 @@ class @ZenMode @active_checkbox = null window.location.hash = '' window.scrollTo(window.pageXOffset, @scroll_position) + # Enable dropzone when leaving ZEN mode + Dropzone.forElement('.div-dropzone').enable() checkboxFromLocationHash: (e) -> id = $.trim(window.location.hash.replace('#' + ZenMode.fullscreen_prefix, '')) diff --git a/app/views/projects/issues/_form.html.haml b/app/views/projects/issues/_form.html.haml index a4a6b0005c7..6016c02b7f5 100644 --- a/app/views/projects/issues/_form.html.haml +++ b/app/views/projects/issues/_form.html.haml @@ -8,7 +8,7 @@ .alert.alert-info = "Please review the <strong>#{link_to "guidelines for contribution", contribution_guide_url}</strong> to this repository.".html_safe - = form_for [@project, @issue], html: { class: 'form-horizontal issue-form' } do |f| + = form_for [@project, @issue], html: { class: 'form-horizontal issue-form gfm-form' } do |f| = render 'projects/issuable_form', f: f, issuable: @issue .form-group = f.label :label_ids, class: 'control-label' do diff --git a/app/views/projects/merge_requests/_form.html.haml b/app/views/projects/merge_requests/_form.html.haml index 154a01f59ad..015d47eabf7 100644 --- a/app/views/projects/merge_requests/_form.html.haml +++ b/app/views/projects/merge_requests/_form.html.haml @@ -1,4 +1,4 @@ -= form_for [@project, @merge_request], html: { class: "merge-request-form form-horizontal" } do |f| += form_for [@project, @merge_request], html: { class: 'merge-request-form form-horizontal gfm-form' } do |f| .merge-request-form-info = render 'projects/issuable_form', f: f, issuable: @merge_request .form-group diff --git a/app/views/projects/merge_requests/_new_submit.html.haml b/app/views/projects/merge_requests/_new_submit.html.haml index 84bf81441b1..9c51c40d32c 100644 --- a/app/views/projects/merge_requests/_new_submit.html.haml +++ b/app/views/projects/merge_requests/_new_submit.html.haml @@ -9,7 +9,7 @@ %span.pull-right = link_to 'Change branches', new_project_merge_request_path(@project) -= form_for [@project, @merge_request], html: { class: "merge-request-form" } do |f| += form_for [@project, @merge_request], html: { class: "merge-request-form gfm-form" } do |f| .panel.panel-default .panel-body diff --git a/app/views/projects/milestones/_form.html.haml b/app/views/projects/milestones/_form.html.haml index df79125eae6..27069802d5a 100644 --- a/app/views/projects/milestones/_form.html.haml +++ b/app/views/projects/milestones/_form.html.haml @@ -5,7 +5,7 @@ %hr -= form_for [@project, @milestone], html: {class: "new_milestone form-horizontal"} do |f| += form_for [@project, @milestone], html: {class: "new_milestone form-horizontal gfm-form"} do |f| -if @milestone.errors.any? .alert.alert-danger %ul diff --git a/app/views/projects/notes/_form.html.haml b/app/views/projects/notes/_form.html.haml index 65d7f081545..52d6719a2ed 100644 --- a/app/views/projects/notes/_form.html.haml +++ b/app/views/projects/notes/_form.html.haml @@ -1,4 +1,4 @@ -= form_for [@project, @note], remote: true, html: { :'data-type' => 'json', multipart: true, id: nil, class: "new_note js-new-note-form common-note-form" }, authenticity_token: true do |f| += form_for [@project, @note], remote: true, html: { :'data-type' => 'json', multipart: true, id: nil, class: "new_note js-new-note-form common-note-form gfm-form" }, authenticity_token: true do |f| = note_target_fields = f.hidden_field :commit_id = f.hidden_field :line_code diff --git a/app/views/projects/wikis/_form.html.haml b/app/views/projects/wikis/_form.html.haml index 0a24e36ae84..1e39e4dd774 100644 --- a/app/views/projects/wikis/_form.html.haml +++ b/app/views/projects/wikis/_form.html.haml @@ -1,4 +1,4 @@ -= form_for [@project, @page], method: @page.persisted? ? :put : :post, html: { class: 'form-horizontal' } do |f| += form_for [@project, @page], method: @page.persisted? ? :put : :post, html: { class: 'form-horizontal gfm-form' } do |f| -if @page.errors.any? #error_explanation .alert.alert-danger |