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
iv
gitlab-ce
Commits
f2d94c5d
Commit
f2d94c5d
authored
Apr 15, 2016
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Scroll to the last comment I made and edit it.
parent
2ac0050b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
7 deletions
+29
-7
app/assets/javascripts/notes.js.coffee
app/assets/javascripts/notes.js.coffee
+24
-3
app/views/projects/notes/_note.html.haml
app/views/projects/notes/_note.html.haml
+5
-4
No files found.
app/assets/javascripts/notes.js.coffee
View file @
f2d94c5d
...
...
@@ -75,6 +75,9 @@ class @Notes
# when issue status changes, we need to refresh data
$
(
document
).
on
"issuable:change"
,
@
refresh
# when a key is clicked on the notes
$
(
document
).
on
"keydown"
,
".js-note-text"
,
@
keydownNoteText
cleanBinding
:
->
$
(
document
).
off
"ajax:success"
,
".js-main-target-form"
$
(
document
).
off
"ajax:success"
,
".js-discussion-note-form"
...
...
@@ -92,10 +95,19 @@ class @Notes
$
(
document
).
off
"click"
,
".js-note-target-reopen"
$
(
document
).
off
"click"
,
".js-note-target-close"
$
(
document
).
off
"click"
,
".js-note-discard"
$
(
document
).
off
"keydown"
,
".js-note-text"
$
(
'.note .js-task-list-container'
).
taskList
(
'disable'
)
$
(
document
).
off
'tasklist:changed'
,
'.note .js-task-list-container'
keydownNoteText
:
(
e
)
->
$this
=
$
(
this
)
if
$this
.
val
()
is
''
and
e
.
which
is
38
#aka the up key
myLastNote
=
$
(
"li.note[data-author-id='
#{
gon
.
current_user_id
}
'][data-editable]:last"
)
if
myLastNote
.
length
myLastNoteEditBtn
=
myLastNote
.
find
(
'.js-note-edit'
)
myLastNoteEditBtn
.
trigger
(
'click'
,
[
true
,
myLastNote
])
initRefresh
:
->
clearInterval
(
Notes
.
interval
)
Notes
.
interval
=
setInterval
=>
...
...
@@ -343,7 +355,7 @@ class @Notes
Adds a hidden div with the original content of the note to fill the edit note form with
if the user cancels
###
showEditForm
:
(
e
)
->
showEditForm
:
(
e
,
scrollTo
,
myLastNote
)
->
e
.
preventDefault
()
note
=
$
(
this
).
closest
(
".note"
)
note
.
addClass
"is-editting"
...
...
@@ -355,8 +367,17 @@ class @Notes
note
.
find
(
".js-note-attachment-delete"
).
show
()
new
GLForm
form
form
.
find
(
".js-note-text"
).
focus
()
if
scrollTo
?
and
myLastNote
?
# scroll to the bottom
# so the open of the last element doesn't make a jump
$
(
'html, body'
).
scrollTop
(
$
(
document
).
height
());
$
(
'html, body'
).
animate
({
scrollTop
:
myLastNote
.
offset
().
top
-
150
},
500
,
->
form
.
find
(
".js-note-text"
).
focus
()
);
else
form
.
find
(
".js-note-text"
).
focus
()
###
Called in response to clicking the edit note link
...
...
app/views/projects/notes/_note.html.haml
View file @
f2d94c5d
%li
.timeline-entry
{
id:
dom_id
(
note
),
class:
[
dom_class
(
note
),
"note-row-#{note.id}"
,
(
'system-note'
if
note
.
system
)]
}
-
note_editable
=
note_editable?
(
note
)
%li
.timeline-entry
{
id:
dom_id
(
note
),
class:
[
dom_class
(
note
),
"note-row-#{note.id}"
,
(
'system-note'
if
note
.
system
)],
data:
{
author_id:
note
.
author
.
id
,
editable:
note_editable
}
}
.timeline-entry-inner
.timeline-icon
%a
{
href:
user_path
(
note
.
author
)}
...
...
@@ -15,16 +16,16 @@
-
if
access
%span
.note-role
=
access
-
if
note_editable
?
(
note
)
-
if
note_editable
=
link_to
'#'
,
title:
'Edit comment'
,
class:
'note-action-button js-note-edit'
do
=
icon
(
'pencil'
)
=
link_to
namespace_project_note_path
(
note
.
project
.
namespace
,
note
.
project
,
note
),
title:
'Remove comment'
,
method: :delete
,
data:
{
confirm:
'Are you sure you want to remove this comment?'
},
remote:
true
,
class:
'note-action-button js-note-delete danger'
do
=
icon
(
'trash-o'
)
.note-body
{
class:
note_editable
?
(
note
)
?
'js-task-list-container'
:
''
}
.note-body
{
class:
note_editable
?
'js-task-list-container'
:
''
}
.note-text
=
preserve
do
=
markdown
(
note
.
note
,
pipeline: :note
,
cache_key:
[
note
,
"note"
])
-
if
note_editable
?
(
note
)
-
if
note_editable
=
render
'projects/notes/edit_form'
,
note:
note
=
edited_time_ago_with_tooltip
(
note
,
placement:
'bottom'
,
html_class:
'note_edited_ago'
,
include_author:
true
)
...
...
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