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
ef59be4d
Commit
ef59be4d
authored
Apr 19, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ee into ce-upstream
parents
c8765c31
90cb7c64
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
10 deletions
+74
-10
app/assets/javascripts/weight_select.js.coffee
app/assets/javascripts/weight_select.js.coffee
+41
-3
app/views/shared/issuable/_sidebar.html.haml
app/views/shared/issuable/_sidebar.html.haml
+12
-7
spec/features/issues_spec.rb
spec/features/issues_spec.rb
+21
-0
No files found.
app/assets/javascripts/weight_select.js.coffee
View file @
ef59be4d
class
@
WeightSelect
constructor
:
->
$
(
'.js-weight-select'
).
each
(
i
,
dropdown
)
->
$
(
dropdown
).
glDropdown
(
$dropdown
=
$
(
dropdown
)
updateUrl
=
$dropdown
.
data
(
'issueUpdate'
)
$selectbox
=
$dropdown
.
closest
(
'.selectbox'
)
$block
=
$selectbox
.
closest
(
'.block'
)
$sidebarCollapsedValue
=
$block
.
find
(
'.sidebar-collapsed-icon span'
)
$value
=
$block
.
find
(
'.value'
)
abilityName
=
$dropdown
.
data
(
'ability-name'
)
$loading
=
$block
.
find
(
'.block-loading'
).
fadeOut
()
updateWeight
=
(
selected
)
->
data
=
{}
data
[
abilityName
]
=
{}
data
[
abilityName
].
weight
=
selected
$loading
.
fadeIn
()
$dropdown
.
trigger
(
'loading.gl.dropdown'
)
$
.
ajax
(
type
:
'PUT'
dataType
:
'json'
url
:
updateUrl
data
:
data
).
done
(
data
)
->
$dropdown
.
trigger
(
'loaded.gl.dropdown'
)
$loading
.
fadeOut
()
$selectbox
.
hide
()
$value
.
html
(
data
.
weight
)
$sidebarCollapsedValue
.
html
(
data
.
weight
)
$dropdown
.
glDropdown
(
selectable
:
true
fieldName
:
$
(
dropdown
).
data
(
"field-name"
)
fieldName
:
$dropdown
.
data
(
"field-name"
)
hidden
:
(
e
)
->
$selectbox
.
hide
()
# display:block overrides the hide-collapse rule
$value
.
removeAttr
(
'style'
)
id
:
(
obj
,
el
)
->
$
(
el
).
data
"id"
clicked
:
->
clicked
:
(
selected
)
->
if
$
(
dropdown
).
is
".js-filter-submit"
$
(
dropdown
).
parents
(
'form'
).
submit
()
else
selected
=
$dropdown
.
closest
(
'.selectbox'
)
.
find
(
"input[name='
#{
$dropdown
.
data
(
'field-name'
)
}
']"
).
val
()
updateWeight
(
selected
)
)
app/views/shared/issuable/_sidebar.html.haml
View file @
ef59be4d
...
...
@@ -129,19 +129,23 @@
-
else
No
.title.hide-collapsed
%label
Weight
Weight
=
icon
(
'spinner spin'
,
class:
'block-loading'
)
-
if
can?
(
current_user
,
:"admin_
#{
issuable
.
to_ability_name
}
"
,
@project
)
.pull-right
=
link_to
'Edit'
,
'#'
,
class:
'edit-link'
.value.hide-collapsed
=
link_to
'Edit'
,
'#'
,
class:
'edit-link pull-right'
.value.bold.hide-collapsed
-
if
issuable
.
weight
=
icon
(
'balance-scale'
)
=
issuable
.
weight
-
else
.light
None
.selectbox.hide-collapsed
=
f
.
select
:weight
,
issues_weight_options
(
issuable
.
weight
,
edit:
true
),
{
include_blank:
true
},
{
class:
'select2 js-select2'
,
data:
{
placeholder:
"Select weight"
}}
=
dropdown_tag
(
"Weight"
,
options:
{
title:
"Change weight"
,
toggle_class:
'js-weight-select'
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search weight"
,
data:
{
field_name:
"weight"
,
issue_update:
"
#{
issuable_json_path
(
issuable
)
}
"
,
ability_name:
"
#{
issuable
.
to_ability_name
}
"
}
})
do
%ul
-
Issue
.
weight_options
.
select
{
|
weight
|
weight
!=
"Everything"
&&
weight
!=
"Any Weight"
}.
each
do
|
weight
|
%li
%a
{
href:
"#"
,
data:
{
id:
weight
},
class:
(
"is-active"
if
params
[
:weight
]
==
weight
.
to_s
)}
=
weight
=
render
"shared/issuable/participants"
,
participants:
issuable
.
participants
(
current_user
)
-
if
current_user
...
...
@@ -174,6 +178,7 @@
:javascript
new
MilestoneSelect
(
'
{"namespace":"
#{
@project
.
namespace
.
path
}
","path":"
#{
@project
.
path
}
"}
'
);
new
LabelsSelect
();
new
WeightSelect
();
new
IssuableContext
(
'
#{
current_user
.
to_json
(
only:
[
:username
,
:id
,
:name
])
}
'
);
new
Subscription
(
'
.subscription
'
)
new
Sidebar
();
spec/features/issues_spec.rb
View file @
ef59be4d
...
...
@@ -238,6 +238,27 @@ describe 'Issues', feature: true do
end
end
describe
'update weight from issue#show'
,
js:
true
do
let!
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
before
do
visit
namespace_project_issue_path
(
project
.
namespace
,
project
,
issue
)
end
it
'should allow user to update to a weight'
do
page
.
within
(
'.weight'
)
do
expect
(
page
).
to
have_content
"None"
click_link
'Edit'
find
(
'.dropdown-content a'
,
text:
'1'
).
click
page
.
within
(
'.value'
)
do
expect
(
page
).
to
have_content
"1"
end
end
end
end
describe
'update milestone from issue#show'
do
let!
(
:issue
)
{
create
(
:issue
,
project:
project
,
author:
@user
)
}
let!
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
...
...
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