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
10d74f0a
Commit
10d74f0a
authored
Apr 27, 2017
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[skip ci] refactor store to use one ssot for assignees
parent
bde67068
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
19 deletions
+25
-19
app/assets/javascripts/boards/components/board_sidebar.js
app/assets/javascripts/boards/components/board_sidebar.js
+5
-5
app/assets/javascripts/boards/models/issue.js
app/assets/javascripts/boards/models/issue.js
+14
-10
app/assets/javascripts/users_select.js
app/assets/javascripts/users_select.js
+5
-3
app/views/projects/boards/components/sidebar/_assignee.html.haml
...ws/projects/boards/components/sidebar/_assignee.html.haml
+1
-1
No files found.
app/assets/javascripts/boards/components/board_sidebar.js
View file @
10d74f0a
...
@@ -73,14 +73,14 @@ require('./sidebar/remove_issue');
...
@@ -73,14 +73,14 @@ require('./sidebar/remove_issue');
this
.
addUser
(
this
.
currentUser
.
id
);
this
.
addUser
(
this
.
currentUser
.
id
);
this
.
saveUsers
();
this
.
saveUsers
();
},
},
removeUser
(
id
)
{
removeUser
(
u
)
{
gl
.
issueBoards
.
BoardsStore
.
detail
.
issue
.
removeUser
Id
(
id
);
gl
.
issueBoards
.
BoardsStore
.
detail
.
issue
.
removeUser
(
u
);
},
},
addUser
(
id
)
{
addUser
(
u
)
{
gl
.
issueBoards
.
BoardsStore
.
detail
.
issue
.
addUser
Id
(
id
);
gl
.
issueBoards
.
BoardsStore
.
detail
.
issue
.
addUser
(
u
);
},
},
removeAllUsers
()
{
removeAllUsers
()
{
gl
.
issueBoards
.
BoardsStore
.
detail
.
issue
.
removeAllUser
Id
s
();
gl
.
issueBoards
.
BoardsStore
.
detail
.
issue
.
removeAllUsers
();
},
},
saveUsers
()
{
saveUsers
()
{
this
.
loadingAssignees
=
true
;
this
.
loadingAssignees
=
true
;
...
...
app/assets/javascripts/boards/models/issue.js
View file @
10d74f0a
...
@@ -15,7 +15,6 @@ class ListIssue {
...
@@ -15,7 +15,6 @@ class ListIssue {
this
.
subscribed
=
obj
.
subscribed
;
this
.
subscribed
=
obj
.
subscribed
;
this
.
labels
=
[];
this
.
labels
=
[];
this
.
assignees
=
[];
this
.
assignees
=
[];
this
.
selectedAssigneeIds
=
[];
this
.
selected
=
false
;
this
.
selected
=
false
;
this
.
position
=
obj
.
relative_position
||
Infinity
;
this
.
position
=
obj
.
relative_position
||
Infinity
;
this
.
milestone_id
=
obj
.
milestone_id
;
this
.
milestone_id
=
obj
.
milestone_id
;
...
@@ -33,7 +32,6 @@ class ListIssue {
...
@@ -33,7 +32,6 @@ class ListIssue {
processAssignees
(
assignees
)
{
processAssignees
(
assignees
)
{
this
.
assignees
=
assignees
.
map
(
a
=>
new
ListUser
(
a
));
this
.
assignees
=
assignees
.
map
(
a
=>
new
ListUser
(
a
));
this
.
selectedAssigneeIds
=
this
.
assignees
.
map
(
a
=>
a
.
id
);
}
}
addLabel
(
label
)
{
addLabel
(
label
)
{
...
@@ -56,18 +54,24 @@ class ListIssue {
...
@@ -56,18 +54,24 @@ class ListIssue {
labels
.
forEach
(
this
.
removeLabel
.
bind
(
this
));
labels
.
forEach
(
this
.
removeLabel
.
bind
(
this
));
}
}
addUser
Id
(
id
)
{
addUser
(
user
)
{
if
(
this
.
selectedAssigneeIds
.
indexOf
(
id
)
===
-
1
)
{
if
(
!
this
.
findUser
(
user
)
)
{
this
.
selectedAssigneeIds
.
push
(
id
);
this
.
assignees
.
push
(
new
ListUser
(
user
)
);
}
}
}
}
removeUserId
(
id
)
{
findUser
(
user
)
{
this
.
selectedAssigneeIds
=
this
.
selectedAssigneeIds
.
filter
(
uid
=>
uid
!==
id
)
;
return
this
.
assignees
.
filter
(
assignee
=>
assignee
.
id
===
user
.
id
)[
0
]
;
}
}
removeAllUserIds
()
{
removeUser
(
user
)
{
this
.
selectedAssigneeIds
=
[];
if
(
user
)
{
this
.
assignees
=
this
.
assignees
.
filter
(
assignee
=>
assignee
.
id
!==
user
.
id
);
}
}
removeAllUsers
()
{
this
.
assignees
=
[];
}
}
getLists
()
{
getLists
()
{
...
@@ -79,7 +83,7 @@ class ListIssue {
...
@@ -79,7 +83,7 @@ class ListIssue {
issue
:
{
issue
:
{
milestone_id
:
this
.
milestone
?
this
.
milestone
.
id
:
null
,
milestone_id
:
this
.
milestone
?
this
.
milestone
.
id
:
null
,
due_date
:
this
.
dueDate
,
due_date
:
this
.
dueDate
,
assignee_ids
:
this
.
selectedAssigneeIds
.
length
>
0
?
this
.
selectedAssigneeIds
:
[
0
],
assignee_ids
:
this
.
assignees
.
length
>
0
?
this
.
assignees
.
map
((
u
)
=>
u
.
id
)
:
[
0
],
label_ids
:
this
.
labels
.
map
((
label
)
=>
label
.
id
)
label_ids
:
this
.
labels
.
map
((
label
)
=>
label
.
id
)
}
}
};
};
...
...
app/assets/javascripts/users_select.js
View file @
10d74f0a
...
@@ -290,7 +290,9 @@ import eventHub from './sidebar/event_hub';
...
@@ -290,7 +290,9 @@ import eventHub from './sidebar/event_hub';
.
find
(
`input[name='
${
$dropdown
.
data
(
'
field-name
'
)}
'][value=
${
firstSelectedId
}
]`
);
.
find
(
`input[name='
${
$dropdown
.
data
(
'
field-name
'
)}
'][value=
${
firstSelectedId
}
]`
);
firstSelected
.
remove
();
firstSelected
.
remove
();
eventHub
.
$emit
(
'
sidebar.removeUser
'
,
firstSelectedId
);
eventHub
.
$emit
(
'
sidebar.removeUser
'
,
{
id
:
firstSelectedId
,
});
}
}
}
}
...
@@ -303,7 +305,7 @@ import eventHub from './sidebar/event_hub';
...
@@ -303,7 +305,7 @@ import eventHub from './sidebar/event_hub';
eventHub
.
$emit
(
'
sidebar.removeAllUsers
'
);
eventHub
.
$emit
(
'
sidebar.removeAllUsers
'
);
}
else
if
(
isActive
)
{
}
else
if
(
isActive
)
{
// user selected
// user selected
eventHub
.
$emit
(
'
sidebar.addUser
'
,
user
.
id
);
eventHub
.
$emit
(
'
sidebar.addUser
'
,
user
);
// Remove unassigned selection (if it was previously selected)
// Remove unassigned selection (if it was previously selected)
const
unassignedSelected
=
$dropdown
.
closest
(
'
.selectbox
'
)
const
unassignedSelected
=
$dropdown
.
closest
(
'
.selectbox
'
)
...
@@ -319,7 +321,7 @@ import eventHub from './sidebar/event_hub';
...
@@ -319,7 +321,7 @@ import eventHub from './sidebar/event_hub';
}
}
// User unselected
// User unselected
eventHub
.
$emit
(
'
sidebar.removeUser
'
,
user
.
id
);
eventHub
.
$emit
(
'
sidebar.removeUser
'
,
user
);
}
}
}
}
...
...
app/views/projects/boards/components/sidebar/_assignee.html.haml
View file @
10d74f0a
.block.assignee
{
ref:
"assigneeBlock"
}
.block.assignee
{
ref:
"assigneeBlock"
}
%template
{
"v-if"
=>
"issue.assignees"
}
%template
{
"v-if"
=>
"issue.assignees"
}
%assignee-title
{
":number-of-assignees"
=>
"issue.
selectedAssigneeId
s.length"
,
%assignee-title
{
":number-of-assignees"
=>
"issue.
assignee
s.length"
,
":loading"
=>
"loadingAssignees"
,
":loading"
=>
"loadingAssignees"
,
":editable"
=>
can?
(
current_user
,
:admin_issue
,
@project
)
}
":editable"
=>
can?
(
current_user
,
:admin_issue
,
@project
)
}
%assignees
{
class:
"value"
,
"root-path"
=>
"#{root_url}"
,
%assignees
{
class:
"value"
,
"root-path"
=>
"#{root_url}"
,
...
...
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