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
c4ef0461
Commit
c4ef0461
authored
Apr 07, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use new dropdown for weight in sidebar
Closes #453
parent
e3d66bd0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
11 deletions
+54
-11
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
+13
-8
No files found.
app/assets/javascripts/weight_select.js.coffee
View file @
c4ef0461
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 @
c4ef0461
...
...
@@ -127,19 +127,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
.
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
...
...
@@ -172,6 +176,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
();
\ No newline at end of file
new
Sidebar
();
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