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
Jérome Perrin
gitlab-ce
Commits
fdfab012
Commit
fdfab012
authored
Aug 13, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes autosave not enabling comment button when it is restored.
Adds back missing CSS class that was breaking tests
parent
c9ac28fa
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
17 deletions
+20
-17
app/assets/javascripts/autosave.js
app/assets/javascripts/autosave.js
+14
-7
app/assets/javascripts/notes/components/issue_comment_form.vue
...ssets/javascripts/notes/components/issue_comment_form.vue
+4
-4
app/assets/javascripts/notes/mixins/autosave.js
app/assets/javascripts/notes/mixins/autosave.js
+1
-1
app/assets/javascripts/notes/stores/getters.js
app/assets/javascripts/notes/stores/getters.js
+1
-1
app/assets/stylesheets/pages/note_form.scss
app/assets/stylesheets/pages/note_form.scss
+0
-4
No files found.
app/assets/javascripts/autosave.js
View file @
fdfab012
...
...
@@ -2,17 +2,17 @@
import
AccessorUtilities
from
'
./lib/utils/accessor
'
;
window
.
Autosave
=
(
function
()
{
function
Autosave
(
field
,
key
)
{
function
Autosave
(
field
,
key
,
resource
)
{
this
.
field
=
field
;
this
.
isLocalStorageAvailable
=
AccessorUtilities
.
isLocalStorageAccessSafe
();
this
.
resource
=
resource
;
if
(
key
.
join
!=
null
)
{
key
=
key
.
join
(
"
/
"
);
key
=
key
.
join
(
'
/
'
);
}
this
.
key
=
"
autosave/
"
+
key
;
this
.
field
.
data
(
"
autosave
"
,
this
);
this
.
key
=
'
autosave/
'
+
key
;
this
.
field
.
data
(
'
autosave
'
,
this
);
this
.
restore
();
this
.
field
.
on
(
"
input
"
,
(
function
(
_this
)
{
this
.
field
.
on
(
'
input
'
,
(
function
(
_this
)
{
return
function
()
{
return
_this
.
save
();
};
...
...
@@ -29,7 +29,14 @@ window.Autosave = (function() {
if
((
text
!=
null
?
text
.
length
:
void
0
)
>
0
)
{
this
.
field
.
val
(
text
);
}
return
this
.
field
.
trigger
(
"
input
"
);
if
(
!
this
.
resource
&&
this
.
resource
!==
'
issue
'
)
{
this
.
field
.
trigger
(
'
input
'
);
}
else
{
// v-model does not update with jQuery trigger
// https://github.com/vuejs/vue/issues/2804#issuecomment-216968137
const
event
=
new
Event
(
'
change
'
,
{
bubbles
:
true
,
cancelable
:
false
});
this
.
field
.
get
(
0
).
dispatchEvent
(
event
);
}
};
Autosave
.
prototype
.
save
=
function
()
{
...
...
app/assets/javascripts/notes/components/issue_comment_form.vue
View file @
fdfab012
...
...
@@ -184,7 +184,7 @@
}
},
initAutoSave
()
{
this
.
autosave
=
new
Autosave
(
$
(
this
.
$refs
.
textarea
),
[
'
Note
'
,
'
Issue
'
,
this
.
getIssueData
.
id
]);
this
.
autosave
=
new
Autosave
(
$
(
this
.
$refs
.
textarea
),
[
'
Note
'
,
'
Issue
'
,
this
.
getIssueData
.
id
]
,
'
issue
'
);
},
initTaskList
()
{
return
new
TaskList
({
...
...
@@ -211,7 +211,7 @@
<issue-note-signed-out-widget
v-if=
"!isLoggedIn"
/>
<ul
v-else
class=
"notes notes-form timeline
new-note
"
>
class=
"notes notes-form timeline"
>
<li
class=
"timeline-entry"
>
<div
class=
"timeline-entry-inner"
>
<div
class=
"timeline-icon hidden-xs hidden-sm"
>
...
...
@@ -223,10 +223,10 @@
:img-size=
"40"
/>
</div>
<div
>
<div
class=
"timeline-content timeline-content-form"
>
<form
ref=
"commentForm"
class=
"
js-main-target-form timeline-content timeline-content-form common-note
-form"
>
class=
"
new-note js-quick-submit common-note-form gfm-form js-main-target
-form"
>
<div
class=
"flash-container timeline-content"
></div>
<confidentialIssue
v-if=
"isConfidentialIssue"
/>
<markdown-field
...
...
app/assets/javascripts/notes/mixins/autosave.js
View file @
fdfab012
...
...
@@ -4,7 +4,7 @@ import '../../autosave';
export
default
{
methods
:
{
initAutoSave
()
{
this
.
autosave
=
new
Autosave
(
$
(
this
.
$refs
.
noteForm
.
$refs
.
textarea
),
[
'
Note
'
,
'
Issue
'
,
this
.
note
.
id
]);
this
.
autosave
=
new
Autosave
(
$
(
this
.
$refs
.
noteForm
.
$refs
.
textarea
),
[
'
Note
'
,
'
Issue
'
,
this
.
note
.
id
]
,
'
issue
'
);
},
resetAutoSave
()
{
this
.
autosave
.
reset
();
...
...
app/assets/javascripts/notes/stores/getters.js
View file @
fdfab012
...
...
@@ -19,7 +19,7 @@ export const notesById = state => state.notes.reduce((acc, note) => {
const
reverseNotes
=
array
=>
array
.
slice
(
0
).
reverse
();
const
isLastNote
=
(
note
,
state
)
=>
!
note
.
system
&&
state
.
userData
&&
state
.
userData
!==
undefined
&&
note
.
author
.
id
===
state
.
userData
.
id
;
export
const
getCurrentUserLastNote
=
state
=>
_
.
flatten
(
...
...
app/assets/stylesheets/pages/note_form.scss
View file @
fdfab012
...
...
@@ -20,10 +20,6 @@
}
}
.new-note
{
display
:
none
;
}
.new-note
,
.note-edit-form
{
.note-form-actions
{
...
...
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