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
ce1a410e
Commit
ce1a410e
authored
Apr 01, 2021
by
Doug Stull
Committed by
Mike Greiling
Apr 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert commit comments button to pajamas
- tooltip wasn't acting properly - align with design
parent
89c97d78
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
110 additions
and
4 deletions
+110
-4
app/assets/javascripts/projects/commit/components/commit_comments_button.vue
...pts/projects/commit/components/commit_comments_button.vue
+42
-0
app/assets/javascripts/projects/commit/index.js
app/assets/javascripts/projects/commit/index.js
+2
-0
app/assets/javascripts/projects/commit/init_commit_comments_button.js
...avascripts/projects/commit/init_commit_comments_button.js
+18
-0
app/views/projects/commit/_commit_box.html.haml
app/views/projects/commit/_commit_box.html.haml
+1
-4
changelogs/unreleased/324803-covert-has-tooltip-on-commit-page-to-pajamas.yml
...d/324803-covert-has-tooltip-on-commit-page-to-pajamas.yml
+5
-0
spec/frontend/projects/commit/components/commit_comments_button_spec.js
...projects/commit/components/commit_comments_button_spec.js
+42
-0
No files found.
app/assets/javascripts/projects/commit/components/commit_comments_button.vue
0 → 100644
View file @
ce1a410e
<
script
>
import
{
GlButton
,
GlTooltipDirective
}
from
'
@gitlab/ui
'
;
import
{
n__
}
from
'
~/locale
'
;
export
default
{
directives
:
{
GlTooltip
:
GlTooltipDirective
,
},
components
:
{
GlButton
,
},
props
:
{
commentsCount
:
{
type
:
Number
,
required
:
true
,
},
},
computed
:
{
tooltipText
()
{
return
n__
(
'
%d comment on this commit
'
,
'
%d comments on this commit
'
,
this
.
commentsCount
);
},
showCommentButton
()
{
return
this
.
commentsCount
>
0
;
},
},
};
</
script
>
<
template
>
<span
v-if=
"showCommentButton"
v-gl-tooltip
class=
"gl-display-none gl-sm-display-inline-block"
tabindex=
"0"
:title=
"tooltipText"
data-testid=
"comment-button-wrapper"
>
<gl-button
icon=
"comment"
class=
"gl-mr-3"
disabled
>
{{
commentsCount
}}
</gl-button>
</span>
</
template
>
app/assets/javascripts/projects/commit/index.js
View file @
ce1a410e
import
initCherryPickCommitModal
from
'
./init_cherry_pick_commit_modal
'
;
import
initCommitCommentsButton
from
'
./init_commit_comments_button
'
;
import
initCommitOptionsDropdown
from
'
./init_commit_options_dropdown
'
;
import
initRevertCommitModal
from
'
./init_revert_commit_modal
'
;
export
default
()
=>
{
initRevertCommitModal
();
initCherryPickCommitModal
();
initCommitCommentsButton
();
initCommitOptionsDropdown
();
};
app/assets/javascripts/projects/commit/init_commit_comments_button.js
0 → 100644
View file @
ce1a410e
import
Vue
from
'
vue
'
;
import
CommitCommentsButton
from
'
./components/commit_comments_button.vue
'
;
export
default
function
initCommitCommentsButton
()
{
const
el
=
document
.
querySelector
(
'
#js-commit-comments-button
'
);
if
(
!
el
)
{
return
false
;
}
const
{
commentsCount
}
=
el
.
dataset
;
return
new
Vue
({
el
,
render
:
(
createElement
)
=>
createElement
(
CommitCommentsButton
,
{
props
:
{
commentsCount
:
Number
(
commentsCount
)
}
}),
});
}
app/views/projects/commit/_commit_box.html.haml
View file @
ce1a410e
...
...
@@ -18,10 +18,7 @@
=
commit_committer_link
(
@commit
,
avatar:
true
,
size:
24
)
#{
time_ago_with_tooltip
(
@commit
.
committed_date
)
}
-
if
defined?
(
@notes_count
)
&&
@notes_count
>
0
%span
.btn.gl-button.btn-default.disabled.gl-button.btn-icon.d-none.d-sm-inline.gl-mr-3.has-tooltip
{
title:
n_
(
"%d comment on this commit"
,
"%d comments on this commit"
,
@notes_count
)
%
@notes_count
}
=
sprite_icon
(
'comment'
)
=
@notes_count
#js-commit-comments-button
{
data:
{
comments_count:
@notes_count
.
to_i
}
}
=
link_to
_
(
'Browse files'
),
project_tree_path
(
@project
,
@commit
),
class:
"btn gl-button btn-default gl-mr-3 gl-xs-w-full gl-xs-mb-3"
#js-commit-options-dropdown
{
data:
commit_options_dropdown_data
(
@project
,
@commit
)
}
...
...
changelogs/unreleased/324803-covert-has-tooltip-on-commit-page-to-pajamas.yml
0 → 100644
View file @
ce1a410e
---
title
:
Covert has-tooltip on commit page to pajamas
merge_request
:
57858
author
:
type
:
fixed
spec/frontend/projects/commit/components/commit_comments_button_spec.js
0 → 100644
View file @
ce1a410e
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
extendedWrapper
}
from
'
helpers/vue_test_utils_helper
'
;
import
CommitCommentsButton
from
'
~/projects/commit/components/commit_comments_button.vue
'
;
describe
(
'
CommitCommentsButton
'
,
()
=>
{
let
wrapper
;
const
createComponent
=
(
props
=
{})
=>
{
wrapper
=
extendedWrapper
(
shallowMount
(
CommitCommentsButton
,
{
propsData
:
{
commentsCount
:
1
,
...
props
,
},
}),
);
};
const
tooltip
=
()
=>
wrapper
.
findByTestId
(
'
comment-button-wrapper
'
);
describe
(
'
Comment Button
'
,
()
=>
{
it
(
'
has proper tooltip and button attributes for 1 comment
'
,
()
=>
{
createComponent
();
expect
(
tooltip
().
attributes
(
'
title
'
)).
toBe
(
'
1 comment on this commit
'
);
expect
(
tooltip
().
text
()).
toBe
(
'
1
'
);
});
it
(
'
has proper tooltip and button attributes for multiple comments
'
,
()
=>
{
createComponent
({
commentsCount
:
2
});
expect
(
tooltip
().
attributes
(
'
title
'
)).
toBe
(
'
2 comments on this commit
'
);
expect
(
tooltip
().
text
()).
toBe
(
'
2
'
);
});
it
(
'
does not show when there are no comments
'
,
()
=>
{
createComponent
({
commentsCount
:
0
});
expect
(
tooltip
().
exists
()).
toBe
(
false
);
});
});
});
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