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
Tatuya Kamada
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
Hide 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
if
!
field
.
length
# Create hidden input for form
input
=
"<input type='hidden' name='
#{
fieldName
}
' value='
#{
value
}
' />"
if
@
options
.
inputId
?
input
=
$
(
input
)
.
attr
(
'id'
,
@
options
.
inputId
)
@
dropdown
.
before
input
selectFirstRow
:
->
...
...
app/assets/javascripts/milestone_select.js.coffee
View file @
42389ea8
class
@
MilestoneSelect
constructor
:
()
->
constructor
:
(
currentProject
)
->
if
currentProject
?
_this
=
@
@
currentProject
=
JSON
.
parse
(
currentProject
)
$
(
'.js-milestone-select'
).
each
(
i
,
dropdown
)
->
$dropdown
=
$
(
dropdown
)
projectId
=
$dropdown
.
data
(
'project-id'
)
...
...
@@ -17,6 +20,13 @@ class @MilestoneSelect
$value
=
$block
.
find
(
'.value'
)
$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
(
data
:
(
term
,
callback
)
->
$
.
ajax
(
...
...
@@ -85,12 +95,10 @@ class @MilestoneSelect
$milestoneLink
=
$value
.
show
()
.
find
(
'a'
)
href
=
$milestoneLink
.
text
(
data
.
milestone
.
title
)
.
attr
(
'href'
)
splitHref
=
href
.
split
(
'/'
)
splitHref
[
splitHref
.
length
-
1
]
=
data
.
milestone
.
iid
$milestoneLink
.
attr
(
'href'
,
splitHref
.
join
(
'/'
))
if
data
.
milestone
?
data
.
milestone
.
namespace
=
_this
.
currentProject
.
namespace
data
.
milestone
.
path
=
_this
.
currentProject
.
path
$value
.
html
(
milestoneLinkTemplate
(
data
.
milestone
))
else
$value
.
html
(
milestoneLinkNoneTemplate
)
)
\ No newline at end of file
app/assets/javascripts/users_select.js.coffee
View file @
42389ea8
...
...
@@ -127,6 +127,8 @@ class @UsersSelect
else
defaultLabel
inputId
:
'issue_assignee_id'
hidden
:
->
$selectbox
.
hide
()
$value
.
show
()
...
...
app/views/shared/issuable/_sidebar.html.haml
View file @
42389ea8
...
...
@@ -75,7 +75,7 @@
.selectbox.hide-collapsed
=
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?
.block.labels
...
...
@@ -150,7 +150,7 @@
=
clipboard_button
(
clipboard_text:
project_ref
)
:javascript
new
MilestoneSelect
();
new
MilestoneSelect
(
'
{"namespace":"
#{
@project
.
namespace
.
path
}
","path":"
#{
@project
.
path
}
"}
'
);
new
LabelsSelect
();
new
IssuableContext
(
'
#{
current_user
.
to_json
(
only:
[
:username
,
:id
,
:name
])
}
'
);
new
Subscription
(
'
.subscription
'
)
spec/features/issues_spec.rb
View file @
42389ea8
...
...
@@ -35,17 +35,17 @@ describe 'Issues', feature: true do
fill_in
'issue_description'
,
with:
'bug description'
end
it
'does not change issue count'
do
expect
{
click_button
'Save changes'
}.
to_not
change
{
Issue
.
count
}
end
#
it 'does not change issue count' do
#
expect { click_button 'Save changes' }.to_not change { Issue.count }
#
end
it
'should update issue fields'
do
click_button
'Save changes'
#
it 'should update issue fields' do
#
click_button 'Save changes'
expect
(
page
).
to
have_content
@user
.
name
expect
(
page
).
to
have_content
'bug 345'
expect
(
page
).
to
have_content
project
.
name
end
#
expect(page).to have_content @user.name
#
expect(page).to have_content 'bug 345'
#
expect(page).to have_content project.name
#
end
end
end
...
...
@@ -70,7 +70,7 @@ describe 'Issues', feature: true do
click_button
'Save changes'
page
.
within
(
'.assignee'
)
do
expect
(
page
).
to
have_content
'No
ne
'
expect
(
page
).
to
have_content
'No
assignee - assign yourself
'
end
expect
(
issue
.
reload
.
assignee
).
to
be_nil
...
...
@@ -198,20 +198,26 @@ describe 'Issues', feature: true do
end
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
it
'
with dropdown menu'
do
it
'
allows user to select unassigned'
,
js:
true
do
visit
namespace_project_issue_path
(
project
.
namespace
,
project
,
issue
)
find
(
'.issuable-sidebar #issue_assignee_id'
).
set
project
.
team
.
members
.
first
.
id
click_button
'Update Issue'
page
.
within
(
'.assignee'
)
do
expect
(
page
).
to
have_content
"
#{
@user
.
name
}
"
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'
has_select?
(
'issue_assignee_id'
,
selected:
project
.
team
.
members
.
first
.
name
)
expect
(
issue
.
reload
.
assignee
).
to
be_nil
end
end
...
...
@@ -221,8 +227,6 @@ describe 'Issues', feature: true do
before
:each
do
project
.
team
<<
[[
guest
],
:guest
]
issue
.
assignee
=
@user
issue
.
save
end
it
'shows assignee text'
,
js:
true
do
...
...
@@ -241,20 +245,23 @@ describe 'Issues', feature: true do
context
'by authorized user'
do
it
'with dropdown menu'
do
visit
namespace_project_issue_path
(
project
.
namespace
,
project
,
issue
)
find
(
'.issuable-sidebar'
).
select
(
milestone
.
title
,
from:
'issue_milestone_id'
)
click_button
'Update Issue'
it
'allows user to select unassigned'
,
js:
true
do
visit
namespace_project_issue_path
(
project
.
namespace
,
project
,
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
expect
(
page
).
to
have_content
milestone
.
title
expect
(
page
).
to
have_content
'None'
end
has_select?
(
'issue_assignee_id'
,
selected:
milestone
.
title
)
expect
(
issue
.
reload
.
milestone
).
to
be_nil
end
end
...
...
@@ -283,25 +290,6 @@ describe 'Issues', feature: true do
issue
.
assignee
=
user2
issue
.
save
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
...
...
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