Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gpt
large_projects
gitlabhq1
Commits
0d347ecc
Commit
0d347ecc
authored
8 years ago
by
Jose Ivan Vargas
Browse files
Options
Download
Email Patches
Plain Diff
Provided an extra parameter to the note class to disable the autocomplete functionality
parent
f29e817e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
21 deletions
+19
-21
app/assets/javascripts/gfm_auto_complete.js
app/assets/javascripts/gfm_auto_complete.js
+1
-15
app/assets/javascripts/gl_form.js
app/assets/javascripts/gl_form.js
+10
-3
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+3
-2
app/views/shared/notes/_notes_with_form.html.haml
app/views/shared/notes/_notes_with_form.html.haml
+1
-1
changelogs/unreleased/32086-atwho-is-still-enabled-for-personal-snippet-comments-form.yml
...o-is-still-enabled-for-personal-snippet-comments-form.yml
+4
-0
No files found.
app/assets/javascripts/gfm_auto_complete.js
View file @
0d347ecc
...
...
@@ -14,21 +14,6 @@ class GfmAutoComplete {
this
.
isLoadingData
=
{};
}
_a
=
decodeURI
(
"
%C3%80
"
);
_y
=
decodeURI
(
"
%C3%BF
"
);
regexp
=
new
RegExp
(
"
^(?:
\\
B|[^a-zA-Z0-9_
"
+
atSymbolsWithoutBar
+
"
]|
\\
s)
"
+
flag
+
"
(?!
"
+
atSymbolsWithBar
+
"
)((?:[A-Za-z
"
+
_a
+
"
-
"
+
_y
+
"
0-9_
\
'
\
.
\
+
\
-]|[^
\\
x00-
\\
x7a])*)$
"
,
'
gi
'
);
match
=
regexp
.
exec
(
subtext
);
if
(
match
)
{
return
match
[
1
];
}
else
{
return
null
;
}
}
},
setup
(
input
,
enableMap
=
{
emojis
:
true
,
members
:
true
,
...
...
@@ -39,6 +24,7 @@ class GfmAutoComplete {
})
{
// Add GFM auto-completion to all input fields, that accept GFM input.
this
.
input
=
input
||
$
(
'
.js-gfm-input
'
);
this
.
enableMap
=
enableMap
;
this
.
setupLifecycle
();
}
...
...
This diff is collapsed.
Click to expand it.
app/assets/javascripts/gl_form.js
View file @
0d347ecc
...
...
@@ -7,9 +7,10 @@ import GfmAutoComplete from './gfm_auto_complete';
window
.
gl
=
window
.
gl
||
{};
function
GLForm
(
form
)
{
function
GLForm
(
form
,
enableGFM
=
false
)
{
this
.
form
=
form
;
this
.
textarea
=
this
.
form
.
find
(
'
textarea.js-gfm-input
'
);
this
.
enableGFM
=
enableGFM
;
// Before we start, we should clean up any previous data for this form
this
.
destroy
();
// Setup the form
...
...
@@ -32,8 +33,14 @@ GLForm.prototype.setupForm = function() {
this
.
form
.
addClass
(
'
gfm-form
'
);
// remove notify commit author checkbox for non-commit notes
gl
.
utils
.
disableButtonIfEmptyField
(
this
.
form
.
find
(
'
.js-note-text
'
),
this
.
form
.
find
(
'
.js-comment-button, .js-note-new-discussion
'
));
new
GfmAutoComplete
(
gl
.
GfmAutoComplete
&&
gl
.
GfmAutoComplete
.
dataSources
).
setup
(
this
.
form
.
find
(
'
.js-gfm-input
'
));
new
GfmAutoComplete
(
gl
.
GfmAutoComplete
&&
gl
.
GfmAutoComplete
.
dataSources
).
setup
(
this
.
form
.
find
(
'
.js-gfm-input
'
),
{
emojis
:
true
,
members
:
this
.
enableGFM
,
issues
:
this
.
enableGFM
,
milestones
:
this
.
enableGFM
,
mergeRequests
:
this
.
enableGFM
,
labels
:
this
.
enableGFM
,
});
new
DropzoneInput
(
this
.
form
);
autosize
(
this
.
textarea
);
}
...
...
This diff is collapsed.
Click to expand it.
app/assets/javascripts/notes.js
View file @
0d347ecc
...
...
@@ -27,7 +27,7 @@ const normalizeNewlines = function(str) {
Notes
.
interval
=
null
;
function
Notes
(
notes_url
,
note_ids
,
last_fetched_at
,
view
)
{
function
Notes
(
notes_url
,
note_ids
,
last_fetched_at
,
view
,
enableGFM
=
true
)
{
this
.
updateTargetButtons
=
this
.
updateTargetButtons
.
bind
(
this
);
this
.
updateComment
=
this
.
updateComment
.
bind
(
this
);
this
.
visibilityChange
=
this
.
visibilityChange
.
bind
(
this
);
...
...
@@ -50,6 +50,7 @@ const normalizeNewlines = function(str) {
this
.
notes_url
=
notes_url
;
this
.
note_ids
=
note_ids
;
this
.
enableGFM
=
enableGFM
;
// Used to keep track of updated notes while people are editing things
this
.
updatedNotesTrackingMap
=
{};
this
.
last_fetched_at
=
last_fetched_at
;
...
...
@@ -523,7 +524,7 @@ const normalizeNewlines = function(str) {
Notes
.
prototype
.
setupNoteForm
=
function
(
form
)
{
var
textarea
,
key
;
new
gl
.
GLForm
(
form
);
new
gl
.
GLForm
(
form
,
this
.
enableGFM
);
textarea
=
form
.
find
(
"
.js-note-text
"
);
key
=
[
"
Note
"
,
...
...
This diff is collapsed.
Click to expand it.
app/views/shared/notes/_notes_with_form.html.haml
View file @
0d347ecc
...
...
@@ -23,4 +23,4 @@
to post a comment
:javascript
var
notes
=
new
Notes
(
"
#{
notes_url
}
"
,
#{
@notes
.
map
(
&
:id
).
to_json
}
,
#{
Time
.
now
.
to_i
}
,
"
#{
diff_view
}
"
)
var
notes
=
new
Notes
(
"
#{
notes_url
}
"
,
#{
@notes
.
map
(
&
:id
).
to_json
}
,
#{
Time
.
now
.
to_i
}
,
"
#{
diff_view
}
"
,
false
)
This diff is collapsed.
Click to expand it.
changelogs/unreleased/32086-atwho-is-still-enabled-for-personal-snippet-comments-form.yml
0 → 100644
View file @
0d347ecc
---
title
:
Disable reference prefixes in notes for Snippets
merge_request
:
11278
author
:
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment