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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
64820f9a
Commit
64820f9a
authored
Aug 23, 2017
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IssueNotesRefactor: Show placeholder note immediately when editing.
Obviously not one of the best commits I always do.
parent
46ed6cd8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
7 deletions
+46
-7
app/assets/javascripts/notes/components/issue_note.vue
app/assets/javascripts/notes/components/issue_note.vue
+25
-6
app/assets/javascripts/notes/components/issue_note_header.vue
...assets/javascripts/notes/components/issue_note_header.vue
+7
-1
app/assets/stylesheets/pages/notes.scss
app/assets/stylesheets/pages/notes.scss
+14
-0
No files found.
app/assets/javascripts/notes/components/issue_note.vue
View file @
64820f9a
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
return
{
return
{
isEditing
:
false
,
isEditing
:
false
,
isDeleting
:
false
,
isDeleting
:
false
,
isRequesting
:
false
,
};
};
},
},
components
:
{
components
:
{
...
@@ -37,7 +38,8 @@
...
@@ -37,7 +38,8 @@
},
},
classNameBindings
()
{
classNameBindings
()
{
return
{
return
{
'
is-editing
'
:
this
.
isEditing
,
'
is-editing
'
:
this
.
isEditing
&&
!
this
.
isRequesting
,
'
is-requesting being-posted
'
:
this
.
isRequesting
,
'
disabled-content
'
:
this
.
isDeleting
,
'
disabled-content
'
:
this
.
isDeleting
,
target
:
this
.
targetNoteHash
===
this
.
noteAnchorId
,
target
:
this
.
targetNoteHash
===
this
.
noteAnchorId
,
};
};
...
@@ -82,20 +84,27 @@
...
@@ -82,20 +84,27 @@
note
:
{
note
:
noteText
},
note
:
{
note
:
noteText
},
},
},
};
};
this
.
isRequesting
=
true
;
this
.
oldContent
=
this
.
note
.
note_html
;
this
.
note
.
note_html
=
noteText
;
this
.
updateNote
(
data
)
this
.
updateNote
(
data
)
.
then
(()
=>
{
.
then
(()
=>
{
this
.
isEditing
=
false
;
this
.
isEditing
=
false
;
this
.
isRequesting
=
false
;
$
(
this
.
$refs
.
noteBody
.
$el
).
renderGFM
();
$
(
this
.
$refs
.
noteBody
.
$el
).
renderGFM
();
this
.
$refs
.
noteBody
.
resetAutoSave
();
this
.
$refs
.
noteBody
.
resetAutoSave
();
callback
();
callback
();
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
Flash
(
this
.
isRequesting
=
false
;
'
Something went wrong while editing your comment. Please try again.
'
,
this
.
isEditing
=
true
;
'
alert
'
,
this
.
$nextTick
(()
=>
{
$
(
parentElement
));
const
msg
=
'
Something went wrong while editing your comment. Please try again.
'
;
callback
();
Flash
(
msg
,
'
alert
'
,
$
(
this
.
$el
));
this
.
recoverNoteContent
(
noteText
);
callback
();
});
});
});
},
},
formCancelHandler
(
shouldConfirm
,
isDirty
)
{
formCancelHandler
(
shouldConfirm
,
isDirty
)
{
...
@@ -104,8 +113,18 @@
...
@@ -104,8 +113,18 @@
if
(
!
confirm
(
'
Are you sure you want to cancel editing this comment?
'
))
return
;
if
(
!
confirm
(
'
Are you sure you want to cancel editing this comment?
'
))
return
;
}
}
this
.
$refs
.
noteBody
.
resetAutoSave
();
this
.
$refs
.
noteBody
.
resetAutoSave
();
if
(
this
.
oldContent
)
{
this
.
note
.
note_html
=
this
.
oldContent
;
this
.
oldContent
=
null
;
}
this
.
isEditing
=
false
;
this
.
isEditing
=
false
;
},
},
recoverNoteContent
(
noteText
)
{
// we need to do this to prevent noteForm inconsistent content warning
// this is something we intentionally do so we need to recover the content
this
.
note
.
note
=
noteText
;
this
.
$refs
.
noteBody
.
$refs
.
noteForm
.
note
=
noteText
;
// TODO: This could be better
},
},
},
created
()
{
created
()
{
eventHub
.
$on
(
'
enterEditMode
'
,
({
noteId
})
=>
{
eventHub
.
$on
(
'
enterEditMode
'
,
({
noteId
})
=>
{
...
...
app/assets/javascripts/notes/components/issue_note_header.vue
View file @
64820f9a
...
@@ -85,12 +85,18 @@
...
@@ -85,12 +85,18 @@
</span>
</span>
<a
<a
:href=
"noteTimestampLink"
:href=
"noteTimestampLink"
@
click=
"updateTargetNoteHash"
>
@
click=
"updateTargetNoteHash"
class=
"note-timestamp"
>
<time-ago-tooltip
<time-ago-tooltip
:time=
"createdAt"
:time=
"createdAt"
tooltip-placement=
"bottom"
tooltip-placement=
"bottom"
/>
/>
</a>
</a>
<i
class=
"fa fa-spinner fa-spin editing-spinner"
aria-label=
"Comment is being updated"
aria-hidden=
"true"
>
</i>
</span>
</span>
</span>
</span>
<div
<div
...
...
app/assets/stylesheets/pages/notes.scss
View file @
64820f9a
...
@@ -100,6 +100,20 @@ ul.notes {
...
@@ -100,6 +100,20 @@ ul.notes {
}
}
}
}
.editing-spinner
{
display
:
none
;
}
&
.is-requesting
{
.note-timestamp
{
display
:
none
;
}
.editing-spinner
{
display
:
inline-block
;
}
}
&
.is-editing
{
&
.is-editing
{
.note-header
,
.note-header
,
.note-text
,
.note-text
,
...
...
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