Commit 09fc4f55 authored by Fatih Acet's avatar Fatih Acet

Review fixes.

parent 9ae7e99a
......@@ -35,8 +35,8 @@
autosize(this.textarea);
// form and textarea event listeners
this.addEventListeners();
gl.text.init(this.form);
}
gl.text.init(this.form);
// hide discard button
this.form.find('.js-note-discard').hide();
return this.form.show();
......
......@@ -131,11 +131,11 @@
gl.utils.animateToElement = function($el) {
var top = $el.offset().top;
gl.navBarHeight = gl.navBarHeight || $('.navbar-gitlab').height();
gl.navLinksHieght = gl.navLinksHieght || $('.nav-links').height();
gl.navLinksHeight = gl.navLinksHeight || $('.nav-links').height();
gl.mrTabsHeight = gl.mrTabsHeight || $('.merge-request-tabs').height();
return $('body, html').animate({
scrollTop: top - (gl.navBarHeight + gl.navLinksHieght + gl.mrTabsHeight)
scrollTop: top - (gl.navBarHeight + gl.navLinksHeight + gl.mrTabsHeight)
}, 200);
};
......
......@@ -494,18 +494,16 @@
if (currentContent === initialContent) {
this.removeNoteEditForm($el);
$el.find('.js-md-write-button').trigger('click');
}
else {
var $buttons = $el.find('.note-form-actions');
var isWidgetVisible = gl.utils.isInViewport($el[0]);
var isWidgetVisible = gl.utils.isInViewport($el.get(0));
if (!isWidgetVisible) {
gl.utils.animateToElement($el);
}
$el.find('.js-edit-warning').show();
$el.find('.js-md-write-button').trigger('click');
isAllowed = false;
}
......@@ -553,7 +551,6 @@
var $target = $(e.target);
var note = $target.closest('.note');
note.find('.js-edit-warning').hide();
note.find('.js-md-write-button').trigger('click');
this.revertNoteEditForm($target);
return this.removeNoteEditForm(note);
};
......@@ -566,6 +563,7 @@
$editForm.insertBefore('.notes-form');
$editForm.find('.js-comment-button').enable();
$editForm.find('.js-edit-warning').hide();
$editForm.find('.js-md-write-button').trigger('click');
};
Notes.prototype.getEditFormSelector = function($el) {
......@@ -582,6 +580,7 @@
var form = note.find('.current-note-edit-form');
note.removeClass('is-editting');
form.removeClass('current-note-edit-form');
form.find('.js-edit-warning').hide();
// Replace markdown textarea text with original note text.
return form.find('.js-note-text').val(form.find('form.edit-note').data('original-note'));
};
......@@ -898,8 +897,8 @@
new GLForm($editForm.find('form'));
$editForm.find('form').attr('action', postUrl);
$editForm.find('.formTargetId').val(targetId);
$editForm.find('.formTargetType').val(targetType);
$editForm.find('.js-form-target-id').val(targetId);
$editForm.find('.js-form-target-type').val(targetType);
$editForm.find('.js-note-text').focus().val(originalContent);
}
......
.note-edit-form
= form_tag '#', method: :put, remote: true, class: 'edit-note common-note-form js-quick-submit' do
= hidden_field_tag :authenticity_token, form_authenticity_token
= hidden_field_tag :target_id, '', class: 'formTargetId'
= hidden_field_tag :target_type, '', class: 'formTargetType'
= hidden_field_tag :target_id, '', class: 'js-form-target-id'
= hidden_field_tag :target_type, '', class: 'js-form-target-type'
= render layout: 'projects/md_preview', locals: { preview_class: 'md-preview' } do
= render 'projects/zen', attr: 'note[note]', classes: 'note-textarea js-note-text js-task-list-field', placeholder: "Write a comment or drag your files here..."
= render 'projects/notes/hints'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment