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
ee9d5ffc
Commit
ee9d5ffc
authored
Mar 26, 2021
by
Tom Quirk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use CopyableField in Issue Sidebar email address
- remove associated styles (no longer needed) - update specs
parent
c3228bff
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
58 deletions
+37
-58
app/assets/javascripts/sidebar/components/copy_email_to_clipboard.vue
...avascripts/sidebar/components/copy_email_to_clipboard.vue
+8
-27
app/assets/javascripts/sidebar/mount_sidebar.js
app/assets/javascripts/sidebar/mount_sidebar.js
+1
-1
app/assets/javascripts/vue_shared/components/sidebar/copyable_field.vue
...ascripts/vue_shared/components/sidebar/copyable_field.vue
+8
-1
app/assets/stylesheets/framework/sidebar.scss
app/assets/stylesheets/framework/sidebar.scss
+0
-13
locale/gitlab.pot
locale/gitlab.pot
+4
-4
spec/frontend/sidebar/components/copy_email_to_clipboard_spec.js
...ontend/sidebar/components/copy_email_to_clipboard_spec.js
+7
-12
spec/frontend/vue_shared/components/sidebar/copyable_field_spec.js
...tend/vue_shared/components/sidebar/copyable_field_spec.js
+9
-0
No files found.
app/assets/javascripts/sidebar/components/copy_email_to_clipboard.vue
View file @
ee9d5ffc
<
script
>
import
{
s__
,
__
,
sprintf
}
from
'
~/locale
'
;
import
ClipboardButton
from
'
~/vue_shared/components/clipboard_button.vue
'
;
import
CopyableField
from
'
../../vue_shared/components/sidebar/copyable_field.vue
'
;
export
default
{
i18n
:
{
copyEmail
:
__
(
'
Copy email address
'
),
},
components
:
{
C
lipboardButton
,
C
opyableField
,
},
props
:
{
copyText
:
{
issueEmailAddress
:
{
type
:
String
,
required
:
true
,
},
},
computed
:
{
emailText
()
{
return
sprintf
(
s__
(
'
RightSidebar|Issue email: %{copyText}
'
),
{
copyText
:
this
.
copyText
});
},
},
};
</
script
>
<
template
>
<
div
<
copyable-field
data-qa-selector=
"copy-forward-email"
class=
"copy-email-address gl-display-flex gl-align-items-center gl-justify-content-space-between"
>
<span
class=
"gl-overflow-hidden gl-text-overflow-ellipsis gl-white-space-nowrap hide-collapsed gl-w-85p"
>
{{
emailText
}}
</span
>
<clipboard-button
class=
"copy-email-button gl-bg-none!"
category=
"tertiary"
:title=
"$options.i18n.copyEmail"
:text=
"copyText"
tooltip-placement=
"left"
:name=
"s__('RightSidebar|Issue email')"
:clipboard-tooltip-text=
"s__('RightSidebar|Copy email address')"
:value=
"issueEmailAddress"
/>
</div>
</
template
>
app/assets/javascripts/sidebar/mount_sidebar.js
View file @
ee9d5ffc
...
...
@@ -337,7 +337,7 @@ function mountCopyEmailComponent() {
new
Vue
({
el
,
render
:
(
createElement
)
=>
createElement
(
CopyEmailToClipboard
,
{
props
:
{
copyText
:
createNoteEmail
}
}),
createElement
(
CopyEmailToClipboard
,
{
props
:
{
issueEmailAddress
:
createNoteEmail
}
}),
});
}
...
...
app/assets/javascripts/vue_shared/components/sidebar/copyable_field.vue
View file @
ee9d5ffc
...
...
@@ -27,6 +27,11 @@ export default {
required
:
false
,
default
:
false
,
},
clipboardTooltipText
:
{
type
:
String
,
required
:
false
,
default
:
undefined
,
},
},
computed
:
{
clipboardProps
()
{
...
...
@@ -35,7 +40,9 @@ export default {
tooltipBoundary
:
'
viewport
'
,
tooltipPlacement
:
'
left
'
,
text
:
this
.
value
,
title
:
sprintf
(
this
.
$options
.
i18n
.
clipboardTooltip
,
{
name
:
this
.
name
}),
title
:
this
.
clipboardTooltipText
||
sprintf
(
this
.
$options
.
i18n
.
clipboardTooltip
,
{
name
:
this
.
name
}),
};
},
loadingIconLabel
()
{
...
...
app/assets/stylesheets/framework/sidebar.scss
View file @
ee9d5ffc
...
...
@@ -58,19 +58,6 @@
height
:
$gl-padding
;
}
}
.copy-email-button
{
// TODO: replace with utility
@include
gl-w-full
;
@include
gl-h-full
;
}
.copy-email-address
{
height
:
60px
;
&
:hover
{
background
:
$gray-100
;
}
}
}
.right-sidebar-expanded
{
...
...
locale/gitlab.pot
View file @
ee9d5ffc
...
...
@@ -8590,9 +8590,6 @@ msgstr ""
msgid "Copy commit SHA"
msgstr ""
msgid "Copy email address"
msgstr ""
msgid "Copy environment"
msgstr ""
...
...
@@ -26376,7 +26373,10 @@ msgstr ""
msgid "Revoked project access token %{project_access_token_name}!"
msgstr ""
msgid "RightSidebar|Issue email: %{copyText}"
msgid "RightSidebar|Copy email address"
msgstr ""
msgid "RightSidebar|Issue email"
msgstr ""
msgid "RightSidebar|adding a"
...
...
spec/frontend/sidebar/components/copy_email_to_clipboard_spec.js
View file @
ee9d5ffc
import
{
getByText
}
from
'
@testing-library/dom
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
CopyEmailToClipboard
from
'
~/sidebar/components/copy_email_to_clipboard.vue
'
;
import
C
lipboardButton
from
'
~/vue_shared/components/clipboard_button
.vue
'
;
import
C
opyableField
from
'
~/vue_shared/components/sidebar/copyable_field
.vue
'
;
describe
(
'
CopyEmailToClipboard component
'
,
()
=>
{
const
sampleEmail
=
'
sample+email@test.com
'
;
const
mockIssueEmailAddress
=
'
sample+email@test.com
'
;
const
wrapper
=
m
ount
(
CopyEmailToClipboard
,
{
const
wrapper
=
shallowM
ount
(
CopyEmailToClipboard
,
{
propsData
:
{
copyText
:
sampleEmail
,
issueEmailAddress
:
mockIssueEmailAddress
,
},
});
it
(
'
renders the Issue email text with the forwardable email
'
,
()
=>
{
expect
(
getByText
(
wrapper
.
element
,
`Issue email:
${
sampleEmail
}
`
)).
not
.
toBeNull
();
});
it
(
'
finds ClipboardButton with the correct props
'
,
()
=>
{
expect
(
wrapper
.
find
(
ClipboardButton
).
props
(
'
text
'
)).
toBe
(
sampleEmail
);
it
(
'
sets CopyableField `value` prop to issueEmailAddress
'
,
()
=>
{
expect
(
wrapper
.
find
(
CopyableField
).
props
(
'
value
'
)).
toBe
(
mockIssueEmailAddress
);
});
});
spec/frontend/vue_shared/components/sidebar/copyable_field_spec.js
View file @
ee9d5ffc
...
...
@@ -61,5 +61,14 @@ describe('SidebarCopyableField', () => {
expect
(
findClipboardButton
().
exists
()).
toBe
(
false
);
});
});
describe
(
'
with `clipboardTooltipText` prop
'
,
()
=>
{
it
(
'
sets ClipboardButton `title` prop to `clipboardTooltipText` value
'
,
()
=>
{
const
mockClipboardTooltipText
=
'
Copy my custom value
'
;
createComponent
({
...
defaultProps
,
clipboardTooltipText
:
mockClipboardTooltipText
});
expect
(
findClipboardButton
().
props
(
'
title
'
)).
toBe
(
mockClipboardTooltipText
);
});
});
});
});
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