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
e786c2b2
Commit
e786c2b2
authored
Jul 26, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Comment & resolve button text is done through VueJS
parent
3e80f464
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
54 additions
and
8 deletions
+54
-8
app/assets/javascripts/diff_notes/components/resolve_comment_btn.js.es6
...ascripts/diff_notes/components/resolve_comment_btn.js.es6
+31
-0
app/assets/javascripts/diff_notes/components/resolve_count.js.es6
...ts/javascripts/diff_notes/components/resolve_count.js.es6
+1
-1
app/assets/javascripts/diff_notes/diff_notes_bundle.js.es6
app/assets/javascripts/diff_notes/diff_notes_bundle.js.es6
+1
-0
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+15
-3
app/helpers/notes_helper.rb
app/helpers/notes_helper.rb
+1
-1
app/views/discussions/_resolve_all.html.haml
app/views/discussions/_resolve_all.html.haml
+1
-1
app/views/projects/merge_requests/_discussion.html.haml
app/views/projects/merge_requests/_discussion.html.haml
+3
-1
app/views/projects/notes/_form.html.haml
app/views/projects/notes/_form.html.haml
+1
-1
No files found.
app/assets/javascripts/diff_notes/components/resolve_comment_btn.js.es6
0 → 100644
View file @
e786c2b2
((w) => {
w.ResolveCommentBtn = Vue.extend({
props: {
discussionId: String
},
computed: {
isDiscussionResolved: function () {
const notes = CommentsStore.notesForDiscussion(this.discussionId),
discussion = CommentsStore.state[this.discussionId];
let allResolved = true;
for (const noteId of notes) {
const note = discussion[noteId];
if (!note.resolved) {
allResolved = false;
}
}
return allResolved;
},
buttonText: function () {
if (this.isDiscussionResolved) {
return "Comment & unresolve discussion";
} else {
return "Comment & resolve discussion";
}
}
}
});
}(window));
app/assets/javascripts/diff_notes/components/resolve_count.js.es6
View file @
e786c2b2
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
let resolved = true;
let resolved = true;
for (const noteId in comments) {
for (const noteId in comments) {
const commentResolved = comments[noteId];
const commentResolved = comments[noteId]
.resolved
;
if (!commentResolved) {
if (!commentResolved) {
resolved = false;
resolved = false;
...
...
app/assets/javascripts/diff_notes/diff_notes_bundle.js.es6
View file @
e786c2b2
...
@@ -11,6 +11,7 @@ $(() => {
...
@@ -11,6 +11,7 @@ $(() => {
components: {
components: {
'resolve-btn': ResolveBtn,
'resolve-btn': ResolveBtn,
'resolve-all-btn': ResolveAllBtn,
'resolve-all-btn': ResolveAllBtn,
'resolve-comment-btn': ResolveCommentBtn,
}
}
});
});
...
...
app/assets/javascripts/notes.js
View file @
e786c2b2
...
@@ -352,7 +352,7 @@
...
@@ -352,7 +352,7 @@
form
.
find
(
"
#note_line_code
"
).
remove
();
form
.
find
(
"
#note_line_code
"
).
remove
();
form
.
find
(
"
#note_position
"
).
remove
();
form
.
find
(
"
#note_position
"
).
remove
();
form
.
find
(
"
#note_type
"
).
remove
();
form
.
find
(
"
#note_type
"
).
remove
();
form
.
find
(
'
.js-comment-resolve-button
'
).
remove
();
form
.
find
(
'
.js-comment-resolve-button
'
).
closest
(
'
resolve-comment-btn
'
).
remove
();
return
this
.
parentTimeline
=
form
.
parents
(
'
.timeline
'
);
return
this
.
parentTimeline
=
form
.
parents
(
'
.timeline
'
);
};
};
...
@@ -397,8 +397,6 @@
...
@@ -397,8 +397,6 @@
Notes
.
prototype
.
addDiscussionNote
=
function
(
xhr
,
note
,
status
)
{
Notes
.
prototype
.
addDiscussionNote
=
function
(
xhr
,
note
,
status
)
{
var
$form
=
$
(
xhr
.
target
);
var
$form
=
$
(
xhr
.
target
);
this
.
renderDiscussionNote
(
note
);
this
.
removeDiscussionNoteForm
(
$form
);
if
(
$form
.
attr
(
'
data-resolve-all
'
)
!=
null
)
{
if
(
$form
.
attr
(
'
data-resolve-all
'
)
!=
null
)
{
var
namespacePath
=
$form
.
attr
(
'
data-namespace-path
'
),
var
namespacePath
=
$form
.
attr
(
'
data-namespace-path
'
),
...
@@ -411,6 +409,9 @@
...
@@ -411,6 +409,9 @@
ResolveService
.
toggleResolveForDiscussion
(
namespace
,
mergeRequestId
,
discussionId
);
ResolveService
.
toggleResolveForDiscussion
(
namespace
,
mergeRequestId
,
discussionId
);
}
}
}
}
this
.
renderDiscussionNote
(
note
);
this
.
removeDiscussionNoteForm
(
$form
);
};
};
...
@@ -588,6 +589,7 @@
...
@@ -588,6 +589,7 @@
*/
*/
Notes
.
prototype
.
setupDiscussionNoteForm
=
function
(
dataHolder
,
form
)
{
Notes
.
prototype
.
setupDiscussionNoteForm
=
function
(
dataHolder
,
form
)
{
var
canResolve
=
dataHolder
.
attr
(
'
data-resolvable
'
);
form
.
attr
(
'
id
'
,
"
new-discussion-note-form-
"
+
(
dataHolder
.
data
(
"
discussionId
"
)));
form
.
attr
(
'
id
'
,
"
new-discussion-note-form-
"
+
(
dataHolder
.
data
(
"
discussionId
"
)));
form
.
attr
(
"
data-line-code
"
,
dataHolder
.
data
(
"
lineCode
"
));
form
.
attr
(
"
data-line-code
"
,
dataHolder
.
data
(
"
lineCode
"
));
form
.
find
(
"
#note_type
"
).
val
(
dataHolder
.
data
(
"
noteType
"
));
form
.
find
(
"
#note_type
"
).
val
(
dataHolder
.
data
(
"
noteType
"
));
...
@@ -598,6 +600,16 @@
...
@@ -598,6 +600,16 @@
form
.
find
(
"
#note_noteable_type
"
).
val
(
dataHolder
.
data
(
"
noteableType
"
));
form
.
find
(
"
#note_noteable_type
"
).
val
(
dataHolder
.
data
(
"
noteableType
"
));
form
.
find
(
"
#note_noteable_id
"
).
val
(
dataHolder
.
data
(
"
noteableId
"
));
form
.
find
(
"
#note_noteable_id
"
).
val
(
dataHolder
.
data
(
"
noteableId
"
));
form
.
find
(
'
.js-note-discard
'
).
show
().
removeClass
(
'
js-note-discard
'
).
addClass
(
'
js-close-discussion-note-form
'
).
text
(
form
.
find
(
'
.js-close-discussion-note-form
'
).
data
(
'
cancel-text
'
));
form
.
find
(
'
.js-note-discard
'
).
show
().
removeClass
(
'
js-note-discard
'
).
addClass
(
'
js-close-discussion-note-form
'
).
text
(
form
.
find
(
'
.js-close-discussion-note-form
'
).
data
(
'
cancel-text
'
));
if
(
canResolve
===
'
false
'
)
{
form
.
find
(
'
resolve-comment-btn
'
).
remove
();
}
else
if
(
DiffNotesApp
)
{
var
$commentBtn
=
form
.
find
(
'
resolve-comment-btn
'
);
$commentBtn
.
attr
(
'
:discussion-id
'
,
`'
${
dataHolder
.
data
(
"
discussionId
"
)}
'`
);
DiffNotesApp
.
$compile
(
$commentBtn
.
get
(
0
));
}
this
.
setupNoteForm
(
form
);
this
.
setupNoteForm
(
form
);
form
.
find
(
"
.js-note-text
"
).
focus
();
form
.
find
(
"
.js-note-text
"
).
focus
();
form
form
...
...
app/helpers/notes_helper.rb
View file @
e786c2b2
...
@@ -79,7 +79,7 @@ module NotesHelper
...
@@ -79,7 +79,7 @@ module NotesHelper
def
link_to_reply_discussion
(
discussion
,
line_type
=
nil
)
def
link_to_reply_discussion
(
discussion
,
line_type
=
nil
)
return
unless
current_user
return
unless
current_user
data
=
discussion
.
reply_attributes
.
merge
(
line_type:
line_type
)
data
=
discussion
.
reply_attributes
.
merge
(
line_type:
line_type
,
resolvable:
discussion
.
can_resolve?
(
current_user
)
)
button_tag
'Reply...'
,
class:
'btn btn-text-field js-discussion-reply-button'
,
button_tag
'Reply...'
,
class:
'btn btn-text-field js-discussion-reply-button'
,
data:
data
,
title:
'Add a reply'
data:
data
,
title:
'Add a reply'
...
...
app/views/discussions/_resolve_all.html.haml
View file @
e786c2b2
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
%resolve-all-btn
{
":namespace-path"
=>
"'#{discussion.project.namespace.path}'"
,
%resolve-all-btn
{
":namespace-path"
=>
"'#{discussion.project.namespace.path}'"
,
":project-path"
=>
"'#{discussion.project.path}'"
,
":project-path"
=>
"'#{discussion.project.path}'"
,
":discussion-id"
=>
"'#{discussion.id}'"
,
":discussion-id"
=>
"'#{discussion.id}'"
,
":merge-request-id"
=>
"#{discussion.first_note.noteable.
iid
}"
,
":merge-request-id"
=>
"#{discussion.first_note.noteable.
try(:iid)
}"
,
"inline-template"
=>
true
,
"inline-template"
=>
true
,
"v-cloak"
=>
true
}
"v-cloak"
=>
true
}
%button
.btn.btn-default
{
type:
"button"
,
"@click"
=>
"resolve"
,
":disabled"
=>
"loading"
}
%button
.btn.btn-default
{
type:
"button"
,
"@click"
=>
"resolve"
,
":disabled"
=>
"loading"
}
...
...
app/views/projects/merge_requests/_discussion.html.haml
View file @
e786c2b2
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
=
link_to
'Close merge request'
,
merge_request_path
(
@merge_request
,
merge_request:
{
state_event: :close
}),
method: :put
,
class:
"btn btn-nr btn-comment btn-close close-mr-link js-note-target-close"
,
title:
"Close merge request"
,
data:
{
original_text:
"Close merge request"
,
alternative_text:
"Comment & close merge request"
}
=
link_to
'Close merge request'
,
merge_request_path
(
@merge_request
,
merge_request:
{
state_event: :close
}),
method: :put
,
class:
"btn btn-nr btn-comment btn-close close-mr-link js-note-target-close"
,
title:
"Close merge request"
,
data:
{
original_text:
"Close merge request"
,
alternative_text:
"Comment & close merge request"
}
-
if
@merge_request
.
closed?
-
if
@merge_request
.
closed?
=
link_to
'Reopen merge request'
,
merge_request_path
(
@merge_request
,
merge_request:
{
state_event: :reopen
}),
method: :put
,
class:
"btn btn-nr btn-comment btn-reopen reopen-mr-link js-note-target-reopen"
,
title:
"Reopen merge request"
,
data:
{
original_text:
"Reopen merge request"
,
alternative_text:
"Comment & reopen merge request"
}
=
link_to
'Reopen merge request'
,
merge_request_path
(
@merge_request
,
merge_request:
{
state_event: :reopen
}),
method: :put
,
class:
"btn btn-nr btn-comment btn-reopen reopen-mr-link js-note-target-reopen"
,
title:
"Reopen merge request"
,
data:
{
original_text:
"Reopen merge request"
,
alternative_text:
"Comment & reopen merge request"
}
=
submit_tag
'Comment & resolve discussion'
,
class:
"btn btn-nr btn-create append-right-10 comment-btn js-comment-resolve-button"
,
data:
{
namespace_path:
"
#{
@merge_request
.
project
.
namespace
.
path
}
"
,
project_path:
"
#{
@merge_request
.
project
.
path
}
"
}
%resolve-comment-btn
{
"inline-template"
=>
true
,
":discussion-id"
=>
""
}
%button
.btn.btn-nr.btn-default.append-right-10.js-comment-resolve-button
{
type:
"submit"
,
data:
{
namespace_path:
"#{@merge_request.project.namespace.path}"
,
project_path:
"#{@merge_request.project.path}"
}
}
{{ buttonText }}
#notes
=
render
"projects/notes/notes_with_form"
#notes
=
render
"projects/notes/notes_with_form"
app/views/projects/notes/_form.html.haml
View file @
e786c2b2
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
=
f
.
hidden_field
:commit_id
=
f
.
hidden_field
:commit_id
=
f
.
hidden_field
:line_code
=
f
.
hidden_field
:line_code
=
f
.
hidden_field
:noteable_id
=
f
.
hidden_field
:noteable_id
=
hidden_field_tag
:noteable_iid
,
@note
.
noteable
.
iid
=
hidden_field_tag
:noteable_iid
,
@note
.
noteable
.
try
(
:iid
)
=
f
.
hidden_field
:noteable_type
=
f
.
hidden_field
:noteable_type
=
f
.
hidden_field
:type
=
f
.
hidden_field
:type
=
f
.
hidden_field
:position
=
f
.
hidden_field
:position
...
...
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