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
8e744605
Commit
8e744605
authored
Dec 29, 2015
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds ajax to bottom discussion buttons. Now submits issue and closes via ajax.
parent
3a227b5a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
19 deletions
+15
-19
app/assets/javascripts/issue.js.coffee
app/assets/javascripts/issue.js.coffee
+11
-1
app/assets/javascripts/notes.js.coffee
app/assets/javascripts/notes.js.coffee
+2
-14
app/views/projects/issues/_discussion.html.haml
app/views/projects/issues/_discussion.html.haml
+2
-4
No files found.
app/assets/javascripts/issue.js.coffee
View file @
8e744605
...
@@ -16,12 +16,16 @@ class @Issue
...
@@ -16,12 +16,16 @@ class @Issue
$
(
document
).
on
'tasklist:changed'
,
'.detail-page-description .js-task-list-container'
,
@
updateTaskList
$
(
document
).
on
'tasklist:changed'
,
'.detail-page-description .js-task-list-container'
,
@
updateTaskList
initIssueBtnEventListeners
:
->
initIssueBtnEventListeners
:
->
_this
=
@
issueFailMessage
=
'Unable to update this issue at this time.'
issueFailMessage
=
'Unable to update this issue at this time.'
$
(
'a.btn-close, a.btn-reopen'
).
on
'click'
,
(
e
)
->
$
(
'a.btn-close, a.btn-reopen'
).
on
'click'
,
(
e
)
->
e
.
preventDefault
()
e
.
preventDefault
()
e
.
stopImmediatePropagation
()
e
.
stopImmediatePropagation
()
$this
=
$
(
this
)
$this
=
$
(
this
)
isClose
=
$this
.
hasClass
(
'btn-close'
)
isClose
=
$this
.
hasClass
(
'btn-close'
)
shouldSubmit
=
$this
.
hasClass
(
'btn-comment'
)
if
shouldSubmit
_this
.
submitNoteForm
(
$this
.
closest
(
'form'
))
$this
.
prop
(
'disabled'
,
true
)
$this
.
prop
(
'disabled'
,
true
)
url
=
$this
.
attr
(
'href'
)
url
=
$this
.
attr
(
'href'
)
$
.
ajax
$
.
ajax
...
@@ -32,12 +36,13 @@ class @Issue
...
@@ -32,12 +36,13 @@ class @Issue
new
Flash
(
issueFailMessage
,
'alert'
)
new
Flash
(
issueFailMessage
,
'alert'
)
success
:
(
data
,
textStatus
,
jqXHR
)
->
success
:
(
data
,
textStatus
,
jqXHR
)
->
if
data
.
saved
if
data
.
saved
$this
.
addClass
(
'hidden'
)
if
isClose
if
isClose
$
(
'a.btn-close'
).
addClass
(
'hidden'
)
$
(
'a.btn-reopen'
).
removeClass
(
'hidden'
)
$
(
'a.btn-reopen'
).
removeClass
(
'hidden'
)
$
(
'div.status-box-closed'
).
removeClass
(
'hidden'
)
$
(
'div.status-box-closed'
).
removeClass
(
'hidden'
)
$
(
'div.status-box-open'
).
addClass
(
'hidden'
)
$
(
'div.status-box-open'
).
addClass
(
'hidden'
)
else
else
$
(
'a.btn-reopen'
).
addClass
(
'hidden'
)
$
(
'a.btn-close'
).
removeClass
(
'hidden'
)
$
(
'a.btn-close'
).
removeClass
(
'hidden'
)
$
(
'div.status-box-closed'
).
addClass
(
'hidden'
)
$
(
'div.status-box-closed'
).
addClass
(
'hidden'
)
$
(
'div.status-box-open'
).
removeClass
(
'hidden'
)
$
(
'div.status-box-open'
).
removeClass
(
'hidden'
)
...
@@ -45,6 +50,11 @@ class @Issue
...
@@ -45,6 +50,11 @@ class @Issue
new
Flash
(
issueFailMessage
,
'alert'
)
new
Flash
(
issueFailMessage
,
'alert'
)
$this
.
prop
(
'disabled'
,
false
)
$this
.
prop
(
'disabled'
,
false
)
submitNoteForm
:
(
form
)
=>
noteText
=
form
.
find
(
"textarea.js-note-text"
).
val
()
if
noteText
.
trim
().
length
>
0
form
.
submit
()
disableTaskList
:
->
disableTaskList
:
->
$
(
'.detail-page-description .js-task-list-container'
).
taskList
(
'disable'
)
$
(
'.detail-page-description .js-task-list-container'
).
taskList
(
'disable'
)
$
(
document
).
off
'tasklist:changed'
,
'.detail-page-description .js-task-list-container'
$
(
document
).
off
'tasklist:changed'
,
'.detail-page-description .js-task-list-container'
...
...
app/assets/javascripts/notes.js.coffee
View file @
8e744605
...
@@ -19,6 +19,8 @@ class @Notes
...
@@ -19,6 +19,8 @@ class @Notes
@
cleanBinding
()
@
cleanBinding
()
@
addBinding
()
@
addBinding
()
@
initTaskList
()
@
initTaskList
()
# for updating the comment disscussion buttons once that issue #5534 is approved.
# @updateTargetButtons({target:$("#note_note")})
addBinding
:
->
addBinding
:
->
# add note to UI after creation
# add note to UI after creation
...
@@ -33,8 +35,6 @@ class @Notes
...
@@ -33,8 +35,6 @@ class @Notes
$
(
document
).
on
"click"
,
".note-edit-cancel"
,
@
cancelEdit
$
(
document
).
on
"click"
,
".note-edit-cancel"
,
@
cancelEdit
# Reopen and close actions for Issue/MR combined with note form submit
# Reopen and close actions for Issue/MR combined with note form submit
$
(
document
).
on
"click"
,
".js-note-target-reopen"
,
@
targetReopen
$
(
document
).
on
"click"
,
".js-note-target-close"
,
@
targetClose
$
(
document
).
on
"click"
,
".js-comment-button"
,
@
updateCloseButton
$
(
document
).
on
"click"
,
".js-comment-button"
,
@
updateCloseButton
$
(
document
).
on
"keyup"
,
".js-note-text"
,
@
updateTargetButtons
$
(
document
).
on
"keyup"
,
".js-note-text"
,
@
updateTargetButtons
...
@@ -512,17 +512,6 @@ class @Notes
...
@@ -512,17 +512,6 @@ class @Notes
visibilityChange
:
=>
visibilityChange
:
=>
@
refresh
()
@
refresh
()
targetReopen
:
(
e
)
=>
@
submitNoteForm
(
$
(
e
.
target
).
parents
(
'form'
))
targetClose
:
(
e
)
=>
@
submitNoteForm
(
$
(
e
.
target
).
parents
(
'form'
))
submitNoteForm
:
(
form
)
=>
noteText
=
form
.
find
(
".js-note-text"
).
val
()
if
noteText
.
trim
().
length
>
0
form
.
submit
()
updateCloseButton
:
(
e
)
=>
updateCloseButton
:
(
e
)
=>
textarea
=
$
(
e
.
target
)
textarea
=
$
(
e
.
target
)
form
=
textarea
.
parents
(
'form'
)
form
=
textarea
.
parents
(
'form'
)
...
@@ -531,7 +520,6 @@ class @Notes
...
@@ -531,7 +520,6 @@ class @Notes
updateTargetButtons
:
(
e
)
=>
updateTargetButtons
:
(
e
)
=>
textarea
=
$
(
e
.
target
)
textarea
=
$
(
e
.
target
)
form
=
textarea
.
parents
(
'form'
)
form
=
textarea
.
parents
(
'form'
)
if
textarea
.
val
().
trim
().
length
>
0
if
textarea
.
val
().
trim
().
length
>
0
form
.
find
(
'.js-note-target-reopen'
).
text
(
'Comment & reopen'
)
form
.
find
(
'.js-note-target-reopen'
).
text
(
'Comment & reopen'
)
form
.
find
(
'.js-note-target-close'
).
text
(
'Comment & close'
)
form
.
find
(
'.js-note-target-close'
).
text
(
'Comment & close'
)
...
...
app/views/projects/issues/_discussion.html.haml
View file @
8e744605
-
content_for
:note_actions
do
-
content_for
:note_actions
do
-
if
can?
(
current_user
,
:update_issue
,
@issue
)
-
if
can?
(
current_user
,
:update_issue
,
@issue
)
-
if
@issue
.
closed?
=
link_to
'Reopen Issue'
,
issue_path
(
@issue
,
issue:
{
state_event: :reopen
},
status_only:
true
,
format:
'json'
),
data:
{
no_turbolink:
true
},
class:
"btn btn-nr btn-grouped btn-reopen btn-comment js-note-target-reopen
#{
issue_button_visibility
(
@issue
,
false
)
}
"
,
title:
'Reopen Issue'
=
link_to
'Reopen Issue'
,
issue_path
(
@issue
,
issue:
{
state_event: :reopen
},
status_only:
true
),
method: :put
,
class:
'btn btn-nr btn-grouped btn-reopen js-note-target-reopen'
,
title:
'Reopen Issue'
=
link_to
'Close Issue'
,
issue_path
(
@issue
,
issue:
{
state_event: :close
},
status_only:
true
,
format:
'json'
),
data:
{
no_turbolink:
true
},
class:
"btn btn-nr btn-grouped btn-close btn-comment js-note-target-close
#{
issue_button_visibility
(
@issue
,
true
)
}
"
,
title:
'Close Issue'
-
else
=
link_to
'Close Issue'
,
issue_path
(
@issue
,
issue:
{
state_event: :close
},
status_only:
true
),
method: :put
,
class:
'btn btn-nr btn-grouped btn-close js-note-target-close'
,
title:
'Close Issue'
#notes
#notes
=
render
'projects/notes/notes_with_form'
=
render
'projects/notes/notes_with_form'
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