Skip to content
Snippets Groups Projects
Commit de427dc5 authored by Mike Greiling's avatar Mike Greiling
Browse files

use $ sign to make it clear when dealing with jQuery object

parent 4f8087d6
No related branches found
No related tags found
1 merge request!8031Resolve "Clicking markdown 'Preview' tab spawns two XHR requests"
Loading
@@ -16,19 +16,19 @@
Loading
@@ -16,19 +16,19 @@
   
MarkdownPreview.prototype.ajaxCache = {}; MarkdownPreview.prototype.ajaxCache = {};
   
MarkdownPreview.prototype.showPreview = function(form) { MarkdownPreview.prototype.showPreview = function($form) {
var mdText, preview; var mdText, preview;
preview = form.find('.js-md-preview'); preview = $form.find('.js-md-preview');
mdText = form.find('textarea.markdown-area').val(); mdText = $form.find('textarea.markdown-area').val();
if (mdText.trim().length === 0) { if (mdText.trim().length === 0) {
preview.text('Nothing to preview.'); preview.text('Nothing to preview.');
this.hideReferencedUsers(form); this.hideReferencedUsers($form);
} else { } else {
preview.text('Loading...'); preview.text('Loading...');
this.renderMarkdown(mdText, (function(response) { this.renderMarkdown(mdText, (function(response) {
preview.html(response.body); preview.html(response.body);
preview.renderGFM(); preview.renderGFM();
this.renderReferencedUsers(response.references.users, form); this.renderReferencedUsers(response.references.users, $form);
}).bind(this)); }).bind(this));
} }
}; };
Loading
@@ -58,13 +58,13 @@
Loading
@@ -58,13 +58,13 @@
}); });
}; };
   
MarkdownPreview.prototype.hideReferencedUsers = function(form) { MarkdownPreview.prototype.hideReferencedUsers = function($form) {
form.find('.referenced-users').hide(); $form.find('.referenced-users').hide();
}; };
   
MarkdownPreview.prototype.renderReferencedUsers = function(users, form) { MarkdownPreview.prototype.renderReferencedUsers = function(users, $form) {
var referencedUsers; var referencedUsers;
referencedUsers = form.find('.referenced-users'); referencedUsers = $form.find('.referenced-users');
if (referencedUsers.length) { if (referencedUsers.length) {
if (users.length >= this.referenceThreshold) { if (users.length >= this.referenceThreshold) {
referencedUsers.show(); referencedUsers.show();
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment