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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
42389ea8
Commit
42389ea8
authored
Mar 22, 2016
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix features until tests pass.
Milestones needed a none selector Assignee needed unassign.
parent
139c255a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
58 deletions
+59
-58
app/assets/javascripts/gl_dropdown.js.coffee
app/assets/javascripts/gl_dropdown.js.coffee
+3
-0
app/assets/javascripts/milestone_select.js.coffee
app/assets/javascripts/milestone_select.js.coffee
+17
-9
app/assets/javascripts/users_select.js.coffee
app/assets/javascripts/users_select.js.coffee
+2
-0
app/views/shared/issuable/_sidebar.html.haml
app/views/shared/issuable/_sidebar.html.haml
+2
-2
spec/features/issues_spec.rb
spec/features/issues_spec.rb
+35
-47
No files found.
app/assets/javascripts/gl_dropdown.js.coffee
View file @
42389ea8
...
@@ -314,6 +314,9 @@ class GitLabDropdown
...
@@ -314,6 +314,9 @@ class GitLabDropdown
if
!
field
.
length
if
!
field
.
length
# Create hidden input for form
# Create hidden input for form
input
=
"<input type='hidden' name='
#{
fieldName
}
' value='
#{
value
}
' />"
input
=
"<input type='hidden' name='
#{
fieldName
}
' value='
#{
value
}
' />"
if
@
options
.
inputId
?
input
=
$
(
input
)
.
attr
(
'id'
,
@
options
.
inputId
)
@
dropdown
.
before
input
@
dropdown
.
before
input
selectFirstRow
:
->
selectFirstRow
:
->
...
...
app/assets/javascripts/milestone_select.js.coffee
View file @
42389ea8
class
@
MilestoneSelect
class
@
MilestoneSelect
constructor
:
()
->
constructor
:
(
currentProject
)
->
if
currentProject
?
_this
=
@
@
currentProject
=
JSON
.
parse
(
currentProject
)
$
(
'.js-milestone-select'
).
each
(
i
,
dropdown
)
->
$
(
'.js-milestone-select'
).
each
(
i
,
dropdown
)
->
$dropdown
=
$
(
dropdown
)
$dropdown
=
$
(
dropdown
)
projectId
=
$dropdown
.
data
(
'project-id'
)
projectId
=
$dropdown
.
data
(
'project-id'
)
...
@@ -17,6 +20,13 @@ class @MilestoneSelect
...
@@ -17,6 +20,13 @@ class @MilestoneSelect
$value
=
$block
.
find
(
'.value'
)
$value
=
$block
.
find
(
'.value'
)
$loading
=
$block
.
find
(
'.block-loading'
).
fadeOut
()
$loading
=
$block
.
find
(
'.block-loading'
).
fadeOut
()
if
issueUpdateURL
milestoneLinkTemplate
=
_
.
template
(
'<a href="/<%= namespace %>/<%= path %>/milestones/<%= iid %>"><%= title %></a>'
)
milestoneLinkNoneTemplate
=
'<div class="light">None</div>'
$dropdown
.
glDropdown
(
$dropdown
.
glDropdown
(
data
:
(
term
,
callback
)
->
data
:
(
term
,
callback
)
->
$
.
ajax
(
$
.
ajax
(
...
@@ -85,12 +95,10 @@ class @MilestoneSelect
...
@@ -85,12 +95,10 @@ class @MilestoneSelect
$milestoneLink
=
$value
$milestoneLink
=
$value
.
show
()
.
show
()
.
find
(
'a'
)
.
find
(
'a'
)
href
=
$milestoneLink
if
data
.
milestone
?
.
text
(
data
.
milestone
.
title
)
data
.
milestone
.
namespace
=
_this
.
currentProject
.
namespace
.
attr
(
'href'
)
data
.
milestone
.
path
=
_this
.
currentProject
.
path
$value
.
html
(
milestoneLinkTemplate
(
data
.
milestone
))
splitHref
=
href
.
split
(
'/'
)
else
splitHref
[
splitHref
.
length
-
1
]
=
data
.
milestone
.
iid
$value
.
html
(
milestoneLinkNoneTemplate
)
$milestoneLink
.
attr
(
'href'
,
splitHref
.
join
(
'/'
))
)
)
\ No newline at end of file
app/assets/javascripts/users_select.js.coffee
View file @
42389ea8
...
@@ -127,6 +127,8 @@ class @UsersSelect
...
@@ -127,6 +127,8 @@ class @UsersSelect
else
else
defaultLabel
defaultLabel
inputId
:
'issue_assignee_id'
hidden
:
->
hidden
:
->
$selectbox
.
hide
()
$selectbox
.
hide
()
$value
.
show
()
$value
.
show
()
...
...
app/views/shared/issuable/_sidebar.html.haml
View file @
42389ea8
...
@@ -75,7 +75,7 @@
...
@@ -75,7 +75,7 @@
.selectbox.hide-collapsed
.selectbox.hide-collapsed
=
f
.
hidden_field
'milestone_id'
,
value:
issuable
.
milestone_id
,
id:
nil
=
f
.
hidden_field
'milestone_id'
,
value:
issuable
.
milestone_id
,
id:
nil
=
dropdown_tag
(
'Milestone'
,
options:
{
title:
'Assign milestone'
,
toggle_class:
'js-milestone-select'
,
filter:
true
,
dropdown_class:
'dropdown-menu-selectable'
,
placeholder:
'Search milestones'
,
data:
{
show_no:
true
,
field_name:
"
#{
issuable
.
to_ability_name
}
[milestone_id]"
,
project_id:
@project
.
id
,
issuable_id:
issuable
.
id
,
milestones:
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:json
),
ability_name:
issuable
.
to_ability_name
,
issue_update:
issuable_url
,
use_id:
true
}})
=
dropdown_tag
(
'Milestone'
,
options:
{
title:
'Assign milestone'
,
toggle_class:
'js-milestone-select
js-extra-options
'
,
filter:
true
,
dropdown_class:
'dropdown-menu-selectable'
,
placeholder:
'Search milestones'
,
data:
{
show_no:
true
,
field_name:
"
#{
issuable
.
to_ability_name
}
[milestone_id]"
,
project_id:
@project
.
id
,
issuable_id:
issuable
.
id
,
milestones:
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:json
),
ability_name:
issuable
.
to_ability_name
,
issue_update:
issuable_url
,
use_id:
true
}})
-
if
issuable
.
project
.
labels
.
any?
-
if
issuable
.
project
.
labels
.
any?
.block.labels
.block.labels
...
@@ -150,7 +150,7 @@
...
@@ -150,7 +150,7 @@
=
clipboard_button
(
clipboard_text:
project_ref
)
=
clipboard_button
(
clipboard_text:
project_ref
)
:javascript
:javascript
new
MilestoneSelect
();
new
MilestoneSelect
(
'
{"namespace":"
#{
@project
.
namespace
.
path
}
","path":"
#{
@project
.
path
}
"}
'
);
new
LabelsSelect
();
new
LabelsSelect
();
new
IssuableContext
(
'
#{
current_user
.
to_json
(
only:
[
:username
,
:id
,
:name
])
}
'
);
new
IssuableContext
(
'
#{
current_user
.
to_json
(
only:
[
:username
,
:id
,
:name
])
}
'
);
new
Subscription
(
'
.subscription
'
)
new
Subscription
(
'
.subscription
'
)
spec/features/issues_spec.rb
View file @
42389ea8
...
@@ -35,17 +35,17 @@ describe 'Issues', feature: true do
...
@@ -35,17 +35,17 @@ describe 'Issues', feature: true do
fill_in
'issue_description'
,
with:
'bug description'
fill_in
'issue_description'
,
with:
'bug description'
end
end
it
'does not change issue count'
do
#
it 'does not change issue count' do
expect
{
click_button
'Save changes'
}.
to_not
change
{
Issue
.
count
}
#
expect { click_button 'Save changes' }.to_not change { Issue.count }
end
#
end
it
'should update issue fields'
do
#
it 'should update issue fields' do
click_button
'Save changes'
#
click_button 'Save changes'
expect
(
page
).
to
have_content
@user
.
name
#
expect(page).to have_content @user.name
expect
(
page
).
to
have_content
'bug 345'
#
expect(page).to have_content 'bug 345'
expect
(
page
).
to
have_content
project
.
name
#
expect(page).to have_content project.name
end
#
end
end
end
end
end
...
@@ -70,7 +70,7 @@ describe 'Issues', feature: true do
...
@@ -70,7 +70,7 @@ describe 'Issues', feature: true do
click_button
'Save changes'
click_button
'Save changes'
page
.
within
(
'.assignee'
)
do
page
.
within
(
'.assignee'
)
do
expect
(
page
).
to
have_content
'No
ne
'
expect
(
page
).
to
have_content
'No
assignee - assign yourself
'
end
end
expect
(
issue
.
reload
.
assignee
).
to
be_nil
expect
(
issue
.
reload
.
assignee
).
to
be_nil
...
@@ -198,20 +198,26 @@ describe 'Issues', feature: true do
...
@@ -198,20 +198,26 @@ describe 'Issues', feature: true do
end
end
describe
'update assignee from issue#show'
do
describe
'update assignee from issue#show'
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
author:
@user
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
author:
@user
,
assignee:
@user
)
}
context
'by autorized user'
do
context
'by autorized user'
do
it
'
with dropdown menu'
do
it
'
allows user to select unassigned'
,
js:
true
do
visit
namespace_project_issue_path
(
project
.
namespace
,
project
,
issue
)
visit
namespace_project_issue_path
(
project
.
namespace
,
project
,
issue
)
find
(
'.issuable-sidebar #issue_assignee_id'
).
page
.
within
(
'.assignee'
)
do
set
project
.
team
.
members
.
first
.
id
expect
(
page
).
to
have_content
"
#{
@user
.
name
}
"
click_button
'Update Issue'
end
find
(
'.block.assignee .edit-link'
).
click
sleep
2
# wait for ajax stuff to complete
first
(
'.dropdown-menu-user-link'
).
click
sleep
2
page
.
within
(
'.assignee'
)
do
expect
(
page
).
to
have_content
'No assignee'
end
expect
(
page
).
to
have_content
'Assignee'
expect
(
issue
.
reload
.
assignee
).
to
be_nil
has_select?
(
'issue_assignee_id'
,
selected:
project
.
team
.
members
.
first
.
name
)
end
end
end
end
...
@@ -221,8 +227,6 @@ describe 'Issues', feature: true do
...
@@ -221,8 +227,6 @@ describe 'Issues', feature: true do
before
:each
do
before
:each
do
project
.
team
<<
[[
guest
],
:guest
]
project
.
team
<<
[[
guest
],
:guest
]
issue
.
assignee
=
@user
issue
.
save
end
end
it
'shows assignee text'
,
js:
true
do
it
'shows assignee text'
,
js:
true
do
...
@@ -241,20 +245,23 @@ describe 'Issues', feature: true do
...
@@ -241,20 +245,23 @@ describe 'Issues', feature: true do
context
'by authorized user'
do
context
'by authorized user'
do
it
'with dropdown menu'
do
visit
namespace_project_issue_path
(
project
.
namespace
,
project
,
issue
)
find
(
'.issuable-sidebar'
).
it
'allows user to select unassigned'
,
js:
true
do
select
(
milestone
.
title
,
from:
'issue_milestone_id'
)
visit
namespace_project_issue_path
(
project
.
namespace
,
project
,
issue
)
click_button
'Update Issue'
expect
(
page
).
to
have_content
"Milestone changed to
#{
milestone
.
title
}
"
page
.
within
(
'.milestone'
)
do
expect
(
page
).
to
have_content
"None"
end
find
(
'.block.milestone .edit-link'
).
click
sleep
2
# wait for ajax stuff to complete
first
(
'.dropdown-content li'
).
click
sleep
2
page
.
within
(
'.milestone'
)
do
page
.
within
(
'.milestone'
)
do
expect
(
page
).
to
have_content
milestone
.
title
expect
(
page
).
to
have_content
'None'
end
end
has_select?
(
'issue_assignee_id'
,
selected:
milestone
.
title
)
expect
(
issue
.
reload
.
milestone
).
to
be_nil
end
end
end
end
...
@@ -283,25 +290,6 @@ describe 'Issues', feature: true do
...
@@ -283,25 +290,6 @@ describe 'Issues', feature: true do
issue
.
assignee
=
user2
issue
.
assignee
=
user2
issue
.
save
issue
.
save
end
end
it
'allows user to remove assignee'
,
js:
true
do
visit
namespace_project_issue_path
(
project
.
namespace
,
project
,
issue
)
page
.
within
(
'.assignee'
)
do
expect
(
page
).
to
have_content
user2
.
name
end
find
(
'.assignee .edit-link'
).
click
sleep
2
# wait for ajax stuff to complete
first
(
'.user-result'
).
click
page
.
within
(
'.assignee'
)
do
expect
(
page
).
to
have_content
'None'
end
sleep
2
# wait for ajax stuff to complete
expect
(
issue
.
reload
.
assignee
).
to
be_nil
end
end
end
end
end
...
...
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