Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
717c3022
Commit
717c3022
authored
Jul 11, 2017
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IssueNotesRefactor: Implement up arrow to edit last note.
parent
d45a8e00
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
4 deletions
+41
-4
app/assets/javascripts/notes/components/issue_comment_form.vue
...ssets/javascripts/notes/components/issue_comment_form.vue
+13
-0
app/assets/javascripts/notes/components/issue_note.vue
app/assets/javascripts/notes/components/issue_note.vue
+10
-0
app/assets/javascripts/notes/components/issue_note_form.vue
app/assets/javascripts/notes/components/issue_note_form.vue
+14
-0
app/assets/javascripts/notes/stores/issue_notes_store.js
app/assets/javascripts/notes/stores/issue_notes_store.js
+2
-2
app/views/shared/issuable/_close_reopen_button.html.haml
app/views/shared/issuable/_close_reopen_button.html.haml
+2
-2
No files found.
app/assets/javascripts/notes/components/issue_comment_form.vue
View file @
717c3022
...
...
@@ -4,6 +4,7 @@
import
UserAvatarLink
from
'
../../vue_shared/components/user_avatar/user_avatar_link.vue
'
;
import
MarkdownField
from
'
../../vue_shared/components/markdown/field.vue
'
;
import
IssueNoteSignedOutWidget
from
'
./issue_note_signed_out_widget.vue
'
;
import
eventHub
from
'
../event_hub
'
;
export
default
{
props
:
{},
...
...
@@ -101,6 +102,17 @@ export default {
handleError
()
{
new
Flash
(
'
Something went wrong while adding your comment. Please try again.
'
);
// eslint-disable-line
},
editMyLastNote
()
{
if
(
this
.
note
===
''
)
{
const
myLastNoteId
=
$
(
'
.js-my-note
'
).
last
().
attr
(
'
id
'
);
if
(
myLastNoteId
)
{
eventHub
.
$emit
(
'
EnterEditMode
'
,
{
noteId
:
parseInt
(
myLastNoteId
.
replace
(
'
note_
'
,
''
),
10
),
});
}
}
},
},
mounted
()
{
const
issuableDataEl
=
document
.
getElementById
(
'
js-issuable-app-initial-data
'
);
...
...
@@ -143,6 +155,7 @@ export default {
ref=
"textarea"
slot=
"textarea"
placeholder=
"Write a comment or drag your files here..."
@
keydown.up=
"editMyLastNote"
@
keydown.meta.enter=
"handleSave()"
>
</textarea>
</markdown-field>
...
...
app/assets/javascripts/notes/components/issue_note.vue
View file @
717c3022
...
...
@@ -6,6 +6,7 @@ import UserAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_
import
IssueNoteHeader
from
'
./issue_note_header.vue
'
;
import
IssueNoteActions
from
'
./issue_note_actions.vue
'
;
import
IssueNoteBody
from
'
./issue_note_body.vue
'
;
import
eventHub
from
'
../event_hub
'
;
export
default
{
props
:
{
...
...
@@ -37,6 +38,7 @@ export default {
return
{
'
is-editing
'
:
this
.
isEditing
,
'
disabled-content
'
:
this
.
isDeleting
,
'
js-my-note
'
:
this
.
author
.
id
===
window
.
gon
.
current_user_id
,
target
:
this
.
targetNoteHash
===
this
.
noteAnchorId
,
};
},
...
...
@@ -100,6 +102,14 @@ export default {
this
.
isEditing
=
false
;
},
},
created
()
{
eventHub
.
$on
(
'
EnterEditMode
'
,
({
noteId
})
=>
{
if
(
noteId
===
this
.
note
.
id
)
{
this
.
isEditing
=
true
;
this
.
$store
.
dispatch
(
'
scrollToNoteIfNeeded
'
,
$
(
this
.
$el
));
}
});
},
};
</
script
>
...
...
app/assets/javascripts/notes/components/issue_note_form.vue
View file @
717c3022
<
script
>
import
MarkdownField
from
'
../../vue_shared/components/markdown/field.vue
'
;
import
eventHub
from
'
../event_hub
'
;
export
default
{
props
:
{
...
...
@@ -39,6 +40,18 @@ export default {
note
:
this
.
note
,
});
},
editMyLastNote
()
{
if
(
this
.
note
===
''
)
{
const
discussion
=
$
(
this
.
$el
).
closest
(
'
.discussion-notes
'
);
const
myLastNoteId
=
discussion
.
find
(
'
.js-my-note
'
).
last
().
attr
(
'
id
'
);
if
(
myLastNoteId
)
{
eventHub
.
$emit
(
'
EnterEditMode
'
,
{
noteId
:
parseInt
(
myLastNoteId
.
replace
(
'
note_
'
,
''
),
10
),
});
}
}
},
},
computed
:
{
isDirty
()
{
...
...
@@ -75,6 +88,7 @@ export default {
slot=
"textarea"
placeholder=
"Write a comment or drag your files here..."
@
keydown.meta.enter=
"handleUpdate"
@
keydown.up=
"editMyLastNote"
@
keydown.esc=
"cancelHandler(true)"
>
</textarea>
</markdown-field>
...
...
app/assets/javascripts/notes/stores/issue_notes_store.js
View file @
717c3022
...
...
@@ -197,10 +197,10 @@ const actions = {
if
(
!
skipMutalityCheck
&&
(
awardName
===
'
thumbsup
'
||
awardName
===
'
thumbsdown
'
))
{
const
counterAward
=
awardName
===
'
thumbsup
'
?
'
thumbsdown
'
:
'
thumbsup
'
;
const
n
ote
=
context
.
getters
.
notesById
[
noteId
];
const
targetN
ote
=
context
.
getters
.
notesById
[
noteId
];
let
amIAwarded
=
false
;
n
ote
.
award_emoji
.
forEach
((
a
)
=>
{
targetN
ote
.
award_emoji
.
forEach
((
a
)
=>
{
if
(
a
.
name
===
counterAward
&&
a
.
user
.
id
===
window
.
gon
.
current_user_id
)
{
amIAwarded
=
true
;
}
...
...
app/views/shared/issuable/_close_reopen_button.html.haml
View file @
717c3022
...
...
@@ -4,9 +4,9 @@
-
if
can_update
&&
is_current_user
=
link_to
"Close
#{
display_issuable_type
}
"
,
close_issuable_url
(
issuable
),
method:
button_method
,
class:
"hidden-xs hidden-sm btn btn-grouped btn-close
#{
issuable_button_visibility
(
issuable
,
true
)
}
"
,
title:
"Close
#{
display_issuable_type
}
"
class:
"hidden-xs hidden-sm btn btn-grouped btn-close
js-btn-issue-action
#{
issuable_button_visibility
(
issuable
,
true
)
}
"
,
title:
"Close
#{
display_issuable_type
}
"
=
link_to
"Reopen
#{
display_issuable_type
}
"
,
reopen_issuable_url
(
issuable
),
method:
button_method
,
class:
"hidden-xs hidden-sm btn btn-grouped btn-reopen
#{
issuable_button_visibility
(
issuable
,
false
)
}
"
,
title:
"Reopen
#{
display_issuable_type
}
"
class:
"hidden-xs hidden-sm btn btn-grouped btn-reopen
js-btn-issue-action
#{
issuable_button_visibility
(
issuable
,
false
)
}
"
,
title:
"Reopen
#{
display_issuable_type
}
"
-
elsif
can_update
&&
!
is_current_user
=
render
'shared/issuable/close_reopen_report_toggle'
,
issuable:
issuable
-
else
...
...
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