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
507b15e7
Commit
507b15e7
authored
Aug 04, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ci skip] Enable submit button on paste
Reset form after response is submitted
parent
9e4164d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
17 deletions
+46
-17
app/assets/javascripts/notes/components/issue_comment_form.vue
...ssets/javascripts/notes/components/issue_comment_form.vue
+45
-14
app/assets/javascripts/notes/components/issue_discussion.vue
app/assets/javascripts/notes/components/issue_discussion.vue
+1
-3
No files found.
app/assets/javascripts/notes/components/issue_comment_form.vue
View file @
507b15e7
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
/* global Flash, Autosave */
/* global Flash, Autosave */
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
_
from
'
underscore
'
;
import
userAvatarLink
from
'
../../vue_shared/components/user_avatar/user_avatar_link.vue
'
;
import
userAvatarLink
from
'
../../vue_shared/components/user_avatar/user_avatar_link.vue
'
;
import
markdownField
from
'
../../vue_shared/components/markdown/field.vue
'
;
import
markdownField
from
'
../../vue_shared/components/markdown/field.vue
'
;
import
issueNoteSignedOutWidget
from
'
./issue_note_signed_out_widget.vue
'
;
import
issueNoteSignedOutWidget
from
'
./issue_note_signed_out_widget.vue
'
;
...
@@ -11,19 +12,14 @@
...
@@ -11,19 +12,14 @@
export
default
{
export
default
{
data
()
{
data
()
{
const
{
getUserData
,
getIssueData
,
getNotesData
}
=
this
.
$store
.
getters
;
return
{
return
{
note
:
''
,
note
:
''
,
markdownDocsUrl
:
getNotesData
.
markdownDocs
,
quickActionsDocsUrl
:
getNotesData
.
quickActionsDocs
,
markdownPreviewUrl
:
getIssueData
.
preview_note_path
,
noteType
:
constants
.
COMMENT
,
noteType
:
constants
.
COMMENT
,
issueState
:
getIssueData
.
state
,
// Can't use mapGetters,
endpoint
:
getIssueData
.
create_note_path
,
// this needs to be in the data object because it belongs to the state
author
:
getUserData
,
issueState
:
this
.
$store
.
getters
.
getIssueData
.
state
,
canUpdateIssue
:
getIssueData
.
current_user
.
can_update
,
isSubmitting
:
false
,
isSubmitting
:
false
,
isSubmitButtonDisabled
:
true
,
};
};
},
},
components
:
{
components
:
{
...
@@ -31,11 +27,28 @@
...
@@ -31,11 +27,28 @@
markdownField
,
markdownField
,
issueNoteSignedOutWidget
,
issueNoteSignedOutWidget
,
},
},
watch
:
{
note
(
newNote
)
{
if
(
!
_
.
isEmpty
(
newNote
)
&&
!
this
.
isSubmitting
)
{
this
.
isSubmitButtonDisabled
=
false
;
}
else
{
this
.
isSubmitButtonDisabled
=
true
;
}
},
isSubmitting
(
newValue
)
{
if
(
!
_
.
isEmpty
(
this
.
note
)
&&
!
newValue
)
{
this
.
isSubmitButtonDisabled
=
false
;
}
else
{
this
.
isSubmitButtonDisabled
=
true
;
}
},
},
computed
:
{
computed
:
{
...
mapGetters
([
...
mapGetters
([
'
getCurrentUserLastNote
'
,
'
getCurrentUserLastNote
'
,
'
getUserData
'
,
'
getUserData
'
,
'
getIssueData
'
,
'
getIssueData
'
,
'
getNotesData
'
,
]),
]),
isLoggedIn
()
{
isLoggedIn
()
{
return
this
.
getUserData
!==
null
;
return
this
.
getUserData
!==
null
;
...
@@ -63,8 +76,23 @@
...
@@ -63,8 +76,23 @@
'
js-note-target-reopen
'
:
!
this
.
isIssueOpen
,
'
js-note-target-reopen
'
:
!
this
.
isIssueOpen
,
};
};
},
},
canSubmit
()
{
markdownDocsUrl
()
{
return
!
this
.
note
.
length
||
this
.
isSubmitting
;
return
this
.
getNotesData
.
markdownDocs
;
},
quickActionsDocsUrl
()
{
return
this
.
getNotesData
.
quickActionsDocs
;
},
markdownPreviewUrl
()
{
return
this
.
getIssueData
.
preview_note_path
;
},
author
()
{
return
this
.
getUserData
;
},
canUpdateIssue
()
{
return
this
.
getIssueData
.
current_user
.
can_update
;
},
endpoint
()
{
return
this
.
getIssueData
.
create_note_path
;
},
},
},
},
methods
:
{
methods
:
{
...
@@ -139,6 +167,9 @@
...
@@ -139,6 +167,9 @@
if
(
shouldClear
)
{
if
(
shouldClear
)
{
this
.
note
=
''
;
this
.
note
=
''
;
}
}
// reset autostave
this
.
autosave
.
reset
();
},
},
setNoteType
(
type
)
{
setNoteType
(
type
)
{
this
.
noteType
=
type
;
this
.
noteType
=
type
;
...
@@ -155,7 +186,7 @@
...
@@ -155,7 +186,7 @@
}
}
},
},
initAutoSave
()
{
initAutoSave
()
{
return
new
Autosave
(
$
(
this
.
$refs
.
textarea
),
[
'
Note
'
,
'
Issue
'
,
this
.
getIssueData
.
id
]);
this
.
autosave
=
new
Autosave
(
$
(
this
.
$refs
.
textarea
),
[
'
Note
'
,
'
Issue
'
,
this
.
getIssueData
.
id
]);
},
},
},
},
mounted
()
{
mounted
()
{
...
@@ -212,13 +243,13 @@
...
@@ -212,13 +243,13 @@
<div
class=
"pull-left btn-group append-right-10 comment-type-dropdown js-comment-type-dropdown droplab-dropdown"
>
<div
class=
"pull-left btn-group append-right-10 comment-type-dropdown js-comment-type-dropdown droplab-dropdown"
>
<button
<button
@
click=
"handleSave()"
@
click=
"handleSave()"
:disabled=
"
canSubmit
"
:disabled=
"
isSubmitButtonDisabled
"
class=
"btn btn-nr btn-create comment-btn js-comment-button js-comment-submit-button"
class=
"btn btn-nr btn-create comment-btn js-comment-button js-comment-submit-button"
type=
"button"
>
type=
"button"
>
{{
commentButtonTitle
}}
{{
commentButtonTitle
}}
</button>
</button>
<button
<button
:disabled=
"
canSubmit
"
:disabled=
"
isSubmitButtonDisabled
"
name=
"button"
name=
"button"
type=
"button"
type=
"button"
class=
"btn btn-nr comment-btn note-type-toggle js-note-new-discussion dropdown-toggle"
class=
"btn btn-nr comment-btn note-type-toggle js-note-new-discussion dropdown-toggle"
...
...
app/assets/javascripts/notes/components/issue_discussion.vue
View file @
507b15e7
...
@@ -79,10 +79,8 @@
...
@@ -79,10 +79,8 @@
},
},
cancelReplyForm
(
shouldConfirm
)
{
cancelReplyForm
(
shouldConfirm
)
{
if
(
shouldConfirm
&&
this
.
$refs
.
noteForm
.
isDirty
)
{
if
(
shouldConfirm
&&
this
.
$refs
.
noteForm
.
isDirty
)
{
const
msg
=
'
Are you sure you want to cancel creating this comment?
'
;
// eslint-disable-next-line no-alert
// eslint-disable-next-line no-alert
const
isConfirmed
=
confirm
(
msg
);
if
(
!
confirm
(
'
Are you sure you want to cancel creating this comment?
'
))
{
if
(
!
isConfirmed
)
{
return
;
return
;
}
}
}
}
...
...
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