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
9b4589cf
Commit
9b4589cf
authored
Jul 13, 2021
by
Florie Guibert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate Add To Do button to widget
Review feedback
parent
6cfa6b8e
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
33 additions
and
21 deletions
+33
-21
app/assets/javascripts/design_management/components/design_todo_button.vue
...ripts/design_management/components/design_todo_button.vue
+1
-1
app/assets/javascripts/sidebar/components/todo_toggle/sidebar_todo_widget.vue
...ts/sidebar/components/todo_toggle/sidebar_todo_widget.vue
+14
-7
app/assets/javascripts/sidebar/mount_sidebar.js
app/assets/javascripts/sidebar/mount_sidebar.js
+6
-2
app/assets/javascripts/sidebar/utils.js
app/assets/javascripts/sidebar/utils.js
+0
-4
app/assets/javascripts/vue_shared/components/sidebar/todo_toggle/todo_button.stories.js
...red/components/sidebar/todo_toggle/todo_button.stories.js
+1
-1
app/assets/javascripts/vue_shared/components/sidebar/todo_toggle/todo_button.vue
...vue_shared/components/sidebar/todo_toggle/todo_button.vue
+2
-2
app/assets/javascripts/vue_shared/components/sidebar/todo_toggle/utils.js
...cripts/vue_shared/components/sidebar/todo_toggle/utils.js
+5
-0
doc/development/fe_guide/storybook.md
doc/development/fe_guide/storybook.md
+1
-1
spec/frontend/design_management/components/design_todo_button_spec.js
...d/design_management/components/design_todo_button_spec.js
+1
-1
spec/frontend/sidebar/components/todo_toggle/sidebar_todo_widget_spec.js
...idebar/components/todo_toggle/sidebar_todo_widget_spec.js
+1
-1
spec/frontend/vue_shared/components/sidebar/todo_button_spec.js
...rontend/vue_shared/components/sidebar/todo_button_spec.js
+1
-1
No files found.
app/assets/javascripts/design_management/components/design_todo_button.vue
View file @
9b4589cf
<
script
>
import
todoMarkDoneMutation
from
'
~/graphql_shared/mutations/todo_mark_done.mutation.graphql
'
;
import
TodoButton
from
'
~/vue_shared/components/sidebar/todo_button.vue
'
;
import
TodoButton
from
'
~/vue_shared/components/sidebar/todo_
toggle/todo_
button.vue
'
;
import
createDesignTodoMutation
from
'
../graphql/mutations/create_design_todo.mutation.graphql
'
;
import
getDesignQuery
from
'
../graphql/queries/get_design.query.graphql
'
;
import
allVersionsMixin
from
'
../mixins/all_versions
'
;
...
...
app/assets/javascripts/sidebar/components/todo_toggle/sidebar_todo_widget.vue
View file @
9b4589cf
<
script
>
import
{
GlIcon
,
GlTooltipDirective
}
from
'
@gitlab/ui
'
;
import
{
Gl
Button
,
Gl
Icon
,
GlTooltipDirective
}
from
'
@gitlab/ui
'
;
import
{
produce
}
from
'
immer
'
;
import
createFlash
from
'
~/flash
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
import
{
todoQueries
,
TodoMutationTypes
,
todoMutations
}
from
'
~/sidebar/constants
'
;
import
TodoButton
from
'
~/vue_shared/components/sidebar/todo_button.vue
'
;
import
{
todoLabel
}
from
'
~/vue_shared/components/sidebar/todo_toggle//utils
'
;
import
TodoButton
from
'
~/vue_shared/components/sidebar/todo_toggle/todo_button.vue
'
;
export
default
{
components
:
{
GlButton
,
GlIcon
,
TodoButton
,
},
...
...
@@ -96,7 +98,7 @@ export default {
return
this
.
hasTodo
?
'
todo-done
'
:
'
todo-add
'
;
},
tootltipTitle
()
{
return
t
his
.
hasTodo
?
__
(
'
Mark as done
'
)
:
__
(
'
Add a to do
'
);
return
t
odoLabel
(
this
.
hasTodo
);
},
},
methods
:
{
...
...
@@ -173,16 +175,21 @@ export default {
class=
"hide-collapsed"
@
click.stop.prevent=
"toggleTodo"
/>
<div
v-if=
"isClassicSidebar"
class=
"sidebar-collapsed-icon sidebar-collapsed-container"
>
<gl-button
v-if=
"isClassicSidebar"
category=
"tertiary"
type=
"reset"
class=
"sidebar-collapsed-icon sidebar-collapsed-container gl-rounded-0! gl-shadow-none!"
@
click.stop.prevent=
"toggleTodo"
>
<gl-icon
v-gl-tooltip
v-gl-tooltip
.
left
.
viewport
:title=
"tootltipTitle"
:size=
"16"
:class=
"
{ 'todo-undone': hasTodo }"
:name="collapsedButtonIcon"
:aria-label="collapsedButtonIcon"
@click.stop.prevent="toggleTodo"
/>
</
div
>
</
gl-button
>
</div>
</
template
>
app/assets/javascripts/sidebar/mount_sidebar.js
View file @
9b4589cf
...
...
@@ -2,6 +2,8 @@ import $ from 'jquery';
import
Vue
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
createFlash
from
'
~/flash
'
;
import
{
TYPE_ISSUE
,
TYPE_MERGE_REQUEST
}
from
'
~/graphql_shared/constants
'
;
import
{
convertToGraphQLId
}
from
'
~/graphql_shared/utils
'
;
import
initInviteMembersModal
from
'
~/invite_members/init_invite_members_modal
'
;
import
initInviteMembersTrigger
from
'
~/invite_members/init_invite_members_trigger
'
;
import
{
IssuableType
}
from
'
~/issue_show/constants
'
;
...
...
@@ -22,7 +24,6 @@ import SidebarDropdownWidget from '~/sidebar/components/sidebar_dropdown_widget.
import
SidebarTodoWidget
from
'
~/sidebar/components/todo_toggle/sidebar_todo_widget.vue
'
;
import
{
apolloProvider
}
from
'
~/sidebar/graphql
'
;
import
trackShowInviteMemberLink
from
'
~/sidebar/track_invite_members
'
;
import
{
toIssueGid
,
toMergeRequestGid
}
from
'
~/sidebar/utils
'
;
import
Translate
from
'
../vue_shared/translate
'
;
import
SidebarAssignees
from
'
./components/assignees/sidebar_assignees.vue
'
;
import
CopyEmailToClipboard
from
'
./components/copy_email_to_clipboard.vue
'
;
...
...
@@ -64,7 +65,10 @@ function mountSidebarToDoWidget() {
createElement
(
'
sidebar-todo-widget
'
,
{
props
:
{
fullPath
:
projectPath
,
issuableId
:
isInIssuePage
()
||
isInDesignPage
()
?
toIssueGid
(
id
)
:
toMergeRequestGid
(
id
),
issuableId
:
isInIssuePage
()
||
isInDesignPage
()
?
convertToGraphQLId
(
TYPE_ISSUE
,
id
)
:
convertToGraphQLId
(
TYPE_MERGE_REQUEST
,
id
),
issuableIid
:
iid
,
issuableType
:
isInIssuePage
()
||
isInDesignPage
()
?
IssuableType
.
Issue
:
IssuableType
.
MergeRequest
,
...
...
app/assets/javascripts/sidebar/utils.js
View file @
9b4589cf
export
const
toLabelGid
=
(
id
)
=>
`gid://gitlab/Label/
${
id
}
`
;
export
const
toIssueGid
=
(
id
)
=>
`gid://gitlab/Issue/
${
id
}
`
;
export
const
toMergeRequestGid
=
(
id
)
=>
`gid://gitlab/MergeRequest/
${
id
}
`
;
app/assets/javascripts/vue_shared/components/sidebar/todo_button.stories.js
→
app/assets/javascripts/vue_shared/components/sidebar/todo_
toggle/todo_
button.stories.js
View file @
9b4589cf
...
...
@@ -4,7 +4,7 @@ import TodoButton from './todo_button.vue';
export
default
{
component
:
TodoButton
,
title
:
'
vue_shared/components/todo_button
'
,
title
:
'
vue_shared/components/todo_
toggle/todo_
button
'
,
};
const
Template
=
(
args
,
{
argTypes
})
=>
({
...
...
app/assets/javascripts/vue_shared/components/sidebar/todo_button.vue
→
app/assets/javascripts/vue_shared/components/sidebar/todo_
toggle/todo_
button.vue
View file @
9b4589cf
<
script
>
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
todoLabel
}
from
'
./utils
'
;
export
default
{
components
:
{
...
...
@@ -15,7 +15,7 @@ export default {
},
computed
:
{
buttonLabel
()
{
return
t
his
.
isTodo
?
__
(
'
Mark as done
'
)
:
__
(
'
Add a to do
'
);
return
t
odoLabel
(
this
.
isTodo
);
},
},
methods
:
{
...
...
app/assets/javascripts/vue_shared/components/sidebar/todo_toggle/utils.js
0 → 100644
View file @
9b4589cf
import
{
__
}
from
'
~/locale
'
;
export
const
todoLabel
=
(
hasTodo
)
=>
{
return
hasTodo
?
__
(
'
Mark as done
'
)
:
__
(
'
Add a to do
'
);
};
doc/development/fe_guide/storybook.md
View file @
9b4589cf
...
...
@@ -47,5 +47,5 @@ To add a story:
Notes:
-
Specify the
`title`
field of the story as the component's file path from the
`javascripts/`
directory,
e.g. if the component is located at
`app/assets/javascripts/vue_shared/components/sidebar/todo_button.vue`
, specify the
`title`
as
e.g. if the component is located at
`app/assets/javascripts/vue_shared/components/sidebar/todo_
toggle/todo_
button.vue`
, specify the
`title`
as
`vue_shared/components/To-do Button`
. This will ensure the Storybook navigation maps closely to our internal directory structure.
spec/frontend/design_management/components/design_todo_button_spec.js
View file @
9b4589cf
...
...
@@ -2,7 +2,7 @@ import { shallowMount, mount } from '@vue/test-utils';
import
DesignTodoButton
from
'
~/design_management/components/design_todo_button.vue
'
;
import
createDesignTodoMutation
from
'
~/design_management/graphql/mutations/create_design_todo.mutation.graphql
'
;
import
todoMarkDoneMutation
from
'
~/graphql_shared/mutations/todo_mark_done.mutation.graphql
'
;
import
TodoButton
from
'
~/vue_shared/components/sidebar/todo_button.vue
'
;
import
TodoButton
from
'
~/vue_shared/components/sidebar/todo_
toggle/todo_
button.vue
'
;
import
mockDesign
from
'
../mock_data/design
'
;
const
mockDesignWithPendingTodos
=
{
...
...
spec/frontend/sidebar/components/todo_toggle/sidebar_todo_widget_spec.js
View file @
9b4589cf
...
...
@@ -7,7 +7,7 @@ import waitForPromises from 'helpers/wait_for_promises';
import
createFlash
from
'
~/flash
'
;
import
SidebarTodoWidget
from
'
~/sidebar/components/todo_toggle/sidebar_todo_widget.vue
'
;
import
epicTodoQuery
from
'
~/sidebar/queries/epic_todo.query.graphql
'
;
import
TodoButton
from
'
~/vue_shared/components/sidebar/todo_button.vue
'
;
import
TodoButton
from
'
~/vue_shared/components/sidebar/todo_
toggle/todo_
button.vue
'
;
import
{
todosResponse
,
noTodosResponse
}
from
'
../../mock_data
'
;
jest
.
mock
(
'
~/flash
'
);
...
...
spec/frontend/vue_shared/components/sidebar/todo_button_spec.js
View file @
9b4589cf
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
mount
}
from
'
@vue/test-utils
'
;
import
TodoButton
from
'
~/vue_shared/components/sidebar/todo_button.vue
'
;
import
TodoButton
from
'
~/vue_shared/components/sidebar/todo_
toggle/todo_
button.vue
'
;
describe
(
'
Todo Button
'
,
()
=>
{
let
wrapper
;
...
...
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