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
50b1b777
Commit
50b1b777
authored
Jul 03, 2018
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor `handleToggleTodo` to be DRY
parent
b2aac5ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
13 deletions
+19
-13
ee/app/assets/javascripts/epics/sidebar/components/sidebar_app.vue
...sets/javascripts/epics/sidebar/components/sidebar_app.vue
+17
-11
spec/javascripts/epics/sidebar/components/sidebar_app_spec.js
.../javascripts/epics/sidebar/components/sidebar_app_spec.js
+2
-2
No files found.
ee/app/assets/javascripts/epics/sidebar/components/sidebar_app.vue
View file @
50b1b777
...
@@ -178,6 +178,14 @@ export default {
...
@@ -178,6 +178,14 @@ export default {
saveEndDate
(
date
)
{
saveEndDate
(
date
)
{
return
this
.
saveDate
(
'
end
'
,
date
);
return
this
.
saveDate
(
'
end
'
,
date
);
},
},
saveTodoState
({
count
,
deletePath
})
{
this
.
savingTodoAction
=
false
;
this
.
store
.
setTodoExists
(
!
this
.
store
.
todoExists
);
if
(
deletePath
)
{
this
.
store
.
setTodoDeletePath
(
deletePath
);
}
$
(
document
).
trigger
(
'
todo:toggle
'
,
count
);
},
handleLabelClick
(
label
)
{
handleLabelClick
(
label
)
{
if
(
label
.
isAny
)
{
if
(
label
.
isAny
)
{
this
.
epicContext
.
labels
=
[];
this
.
epicContext
.
labels
=
[];
...
@@ -223,12 +231,11 @@ export default {
...
@@ -223,12 +231,11 @@ export default {
if
(
!
this
.
store
.
todoExists
)
{
if
(
!
this
.
store
.
todoExists
)
{
this
.
service
this
.
service
.
addTodo
(
this
.
epicId
)
.
addTodo
(
this
.
epicId
)
.
then
(
res
=>
res
.
data
)
.
then
(({
data
})
=>
{
.
then
(
data
=>
{
this
.
saveTodoState
({
this
.
savingTodoAction
=
false
;
count
:
data
.
count
,
this
.
store
.
setTodoDeletePath
(
data
.
delete_path
);
deletePath
:
data
.
delete_path
,
this
.
store
.
setTodoExists
(
!
this
.
store
.
todoExists
);
});
$
(
document
).
trigger
(
'
todo:toggle
'
,
data
.
count
);
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
this
.
savingTodoAction
=
false
;
this
.
savingTodoAction
=
false
;
...
@@ -237,11 +244,10 @@ export default {
...
@@ -237,11 +244,10 @@ export default {
}
else
{
}
else
{
this
.
service
this
.
service
.
deleteTodo
(
this
.
store
.
todoDeletePath
)
.
deleteTodo
(
this
.
store
.
todoDeletePath
)
.
then
(
res
=>
res
.
data
)
.
then
(({
data
})
=>
{
.
then
(
data
=>
{
this
.
saveTodoState
({
this
.
savingTodoAction
=
false
;
count
:
data
.
count
,
this
.
store
.
setTodoExists
(
!
this
.
store
.
todoExists
);
});
$
(
document
).
trigger
(
'
todo:toggle
'
,
data
.
count
);
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
this
.
savingTodoAction
=
false
;
this
.
savingTodoAction
=
false
;
...
...
spec/javascripts/epics/sidebar/components/sidebar_app_spec.js
View file @
50b1b777
...
@@ -99,7 +99,7 @@ describe('epicSidebar', () => {
...
@@ -99,7 +99,7 @@ describe('epicSidebar', () => {
});
});
it
(
'
should render collapsed grouped date picker
'
,
()
=>
{
it
(
'
should render collapsed grouped date picker
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.sidebar-collapsed-icon span
'
).
innerText
.
trim
()).
toEqual
(
'
From Jan 1 2017
'
);
expect
(
vm
.
$el
.
querySelector
(
'
.sidebar-
grouped-item .sidebar-
collapsed-icon span
'
).
innerText
.
trim
()).
toEqual
(
'
From Jan 1 2017
'
);
});
});
it
(
'
should render collapsed labels picker
'
,
()
=>
{
it
(
'
should render collapsed labels picker
'
,
()
=>
{
...
@@ -225,7 +225,7 @@ describe('epicSidebar', () => {
...
@@ -225,7 +225,7 @@ describe('epicSidebar', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
mock
=
new
MockAdapter
(
axios
);
mock
=
new
MockAdapter
(
axios
);
document
.
body
.
innerHTML
+=
'
<div class="flash-container"></div>
'
;
setFixtures
(
'
<div class="flash-container"></div>
'
)
;
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
...
...
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