BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
2a18425e
Unverified
Commit
2a18425e
authored
Apr 06, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
phil review changes
parent
75ac2699
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
29 deletions
+20
-29
comment_type_toggle.js
app/assets/javascripts/comment_type_toggle.js
+12
-12
gl_form.js
app/assets/javascripts/gl_form.js
+1
-4
main.js
app/assets/javascripts/main.js
+1
-1
notes.js
app/assets/javascripts/notes.js
+2
-10
note_form.scss
app/assets/stylesheets/pages/note_form.scss
+2
-0
_comment_type_button.html.haml
app/views/projects/notes/_comment_type_button.html.haml
+2
-2
No files found.
app/assets/javascripts/comment_type_toggle.js
View file @
2a18425e
...
...
@@ -2,37 +2,37 @@ import DropLab from '@gitlab-org/droplab';
import
InputSetter
from
'@gitlab-org/droplab/dist/plugins/InputSetter'
;
class
CommentTypeToggle
{
constructor
(
trigger
,
list
,
input
,
button
,
secondary
Button
)
{
this
.
trigger
=
t
rigger
;
this
.
list
=
l
ist
;
this
.
input
=
i
nput
;
this
.
button
=
b
utton
;
this
.
secondaryButton
=
secondary
Button
;
constructor
(
dropdownTrigger
,
dropdownList
,
noteTypeInput
,
submitButton
,
close
Button
)
{
this
.
dropdownTrigger
=
dropdownT
rigger
;
this
.
dropdownList
=
dropdownL
ist
;
this
.
noteTypeInput
=
noteTypeI
nput
;
this
.
submitButton
=
submitB
utton
;
this
.
closeButton
=
close
Button
;
}
initDroplab
()
{
this
.
droplab
=
new
DropLab
();
const
inputSetterConfig
=
[{
input
:
this
.
i
nput
,
input
:
this
.
noteTypeI
nput
,
valueAttribute
:
'data-value'
,
},
{
input
:
this
.
b
utton
,
input
:
this
.
submitB
utton
,
valueAttribute
:
'data-button-text'
,
}];
if
(
this
.
secondary
Button
)
{
if
(
this
.
close
Button
)
{
inputSetterConfig
.
push
({
input
:
this
.
secondary
Button
,
input
:
this
.
close
Button
,
valueAttribute
:
'data-secondary-button-text'
,
},
{
input
:
this
.
secondary
Button
,
input
:
this
.
close
Button
,
valueAttribute
:
'data-secondary-button-text'
,
inputAttribute
:
'data-alternative-text'
,
});
}
this
.
droplab
.
init
(
this
.
trigger
,
this
.
l
ist
,
[
InputSetter
],
{
this
.
droplab
.
init
(
this
.
dropdownTrigger
,
this
.
dropdownL
ist
,
[
InputSetter
],
{
InputSetter
:
inputSetterConfig
});
}
...
...
app/assets/javascripts/gl_form.js
View file @
2a18425e
...
...
@@ -29,10 +29,7 @@ GLForm.prototype.setupForm = function() {
this
.
form
.
find
(
'.div-dropzone'
).
remove
();
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'
));
const
newDiscussionToggle
=
this
.
form
.
find
(
'.js-note-new-discussion'
);
if
(
newDiscussionToggle
)
gl
.
utils
.
disableButtonIfEmptyField
(
this
.
form
.
find
(
'.js-note-text'
),
newDiscussionToggle
);
gl
.
utils
.
disableButtonIfEmptyField
(
this
.
form
.
find
(
'.js-note-text'
),
this
.
form
.
find
(
'.js-comment-button, .js-note-new-discussion'
));
gl
.
GfmAutoComplete
.
setup
(
this
.
form
.
find
(
'.js-gfm-input'
));
new
DropzoneInput
(
this
.
form
);
...
...
app/assets/javascripts/main.js
View file @
2a18425e
...
...
@@ -279,7 +279,7 @@ $(function () {
// Disable form buttons while a form is submitting
$body
.
on
(
'ajax:complete, ajax:beforeSend, submit'
,
'form'
,
function
(
e
)
{
var
buttons
;
buttons
=
$
(
'[type="submit"]'
,
this
);
buttons
=
$
(
'[type="submit"]
, .js-disable-on-submit
'
,
this
);
switch
(
e
.
type
)
{
case
'ajax:beforeSend'
:
case
'submit'
:
...
...
app/assets/javascripts/notes.js
View file @
2a18425e
...
...
@@ -111,18 +111,10 @@ require('./task_list');
$
(
document
).
on
(
"visibilitychange"
,
this
.
visibilityChange
);
// when issue status changes, we need to refresh data
$
(
document
).
on
(
"issuable:change"
,
this
.
refresh
);
$
(
document
).
on
(
'submit'
,
'.js-main-target-form'
,
this
.
disableDropdown
)
// when a key is clicked on the notes
return
$
(
document
).
on
(
"keydown"
,
".js-note-text"
,
this
.
keydownNoteText
);
};
Notes
.
prototype
.
disableDropdown
=
function
(
e
)
{
const
$form
=
$
(
e
.
target
);
$form
.
find
(
'.js-note-new-discussion'
).
disable
();
};
Notes
.
prototype
.
cleanBinding
=
function
()
{
$
(
document
).
off
(
"ajax:success"
,
".js-main-target-form"
);
$
(
document
).
off
(
"ajax:success"
,
".js-discussion-note-form"
);
...
...
@@ -149,9 +141,9 @@ require('./task_list');
this
.
commentTypeToggle
=
new
CommentTypeToggle
(
form
.
querySelector
(
'.js-comment-type-dropdown .dropdown-toggle'
),
form
.
querySelector
(
'.js-comment-type-dropdown .dropdown-menu'
),
document
.
querySelector
(
'.js-main-target-form
#note_type'
),
form
.
querySelector
(
'
#note_type'
),
form
.
querySelector
(
'.js-comment-type-dropdown .js-comment-submit-button'
),
document
.
querySelector
(
'.js-main-target-form
.js-note-target-close'
),
form
.
querySelector
(
'
.js-note-target-close'
),
);
this
.
commentTypeToggle
.
initDroplab
();
...
...
app/assets/stylesheets/pages/note_form.scss
View file @
2a18425e
...
...
@@ -312,6 +312,8 @@
}
.comment-type-dropdown
{
background
:
red
;
.dropdown-toggle
.fa
{
color
:
$white-light
;
padding-right
:
2px
;
...
...
app/views/projects/notes/_comment_type_button.html.haml
View file @
2a18425e
...
...
@@ -3,10 +3,10 @@
.pull-left.btn-group.append-right-10.comment-type-dropdown.js-comment-type-dropdown
%input
.btn.btn-nr.btn-create.comment-btn.js-comment-button.js-comment-submit-button
{
type:
'submit'
,
value:
'Comment'
}
-
if
@note
.
can_be_discussion_note?
=
button_tag
type:
'button'
,
class:
'btn btn-nr dropdown-toggle comment-btn js-note-new-discussion
'
,
data:
{
'dropdown-trigger'
=>
'#resolvable-comment-menu'
}
do
=
button_tag
type:
'button'
,
class:
'btn btn-nr dropdown-toggle comment-btn js-note-new-discussion
js-disable-on-submit'
,
data:
{
'dropdown-trigger'
=>
'#resolvable-comment-menu'
},
'aria-label'
=>
'Open comment type dropdown'
do
=
icon
(
'caret-down'
)
%ul
#resolvable-comment-menu
.dropdown-menu
{
data:
{
dropdown:
true
}
}
%li
#comment
{
data:
{
value:
''
,
'button-text'
=>
'Comment'
,
'secondary-button-text'
=>
'Comment & close merge request'
},
class:
'droplab-item-selected'
}
%li
#comment
.droplab-item-selected
{
data:
{
value:
''
,
'button-text'
=>
'Comment'
,
'secondary-button-text'
=>
"Comment & close #{noteable_type.titleize.downcase}"
}
}
=
icon
(
'check'
)
.description
%strong
Comment
...
...
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