Commit 26554cd2 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch 'no-weight-fix' into 'master'

Fixed issue when assigning no weight

![weight](/uploads/a61ce995c86f4b7fde30389b2b5eee1a/weight.gif)

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/18374

See merge request !458
parents e3a3242a 3a38cdda
......@@ -13,7 +13,7 @@ class @WeightSelect
updateWeight = (selected) ->
data = {}
data[abilityName] = {}
data[abilityName].weight = selected
data[abilityName].weight = if selected? then selected else null
$loading
.fadeIn()
$dropdown.trigger('loading.gl.dropdown')
......@@ -27,7 +27,10 @@ class @WeightSelect
$loading.fadeOut()
$selectbox.hide()
$value.html(data.weight)
if data.weight?
$value.html(data.weight)
else
$value.html('None')
$sidebarCollapsedValue.html(data.weight)
$dropdown.glDropdown(
......@@ -38,7 +41,8 @@ class @WeightSelect
# display:block overrides the hide-collapse rule
$value.css('display', '')
id: (obj, el) ->
$(el).data "id"
if not $(el).data("none")?
$(el).data "id"
clicked: (selected) ->
if $(dropdown).is ".js-filter-submit"
$(dropdown).parents('form').submit()
......
......@@ -163,7 +163,7 @@
%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)}
%a{href: "#", data: { id: weight, none: ("true" if weight == Issue::WEIGHT_NONE) }, class: ("is-active" if params[:weight] == weight.to_s)}
= weight
= render "shared/issuable/participants", participants: issuable.participants(current_user)
......
......@@ -73,6 +73,35 @@ feature 'Issue Sidebar', feature: true do
end
end
context 'updating weight', js: true do
before do
project.team << [user, :master]
visit_issue(project, issue)
end
it 'should update weight in sidebar to 1' do
page.within '.weight' do
click_link 'Edit'
click_link '1'
page.within '.value' do
expect(page).to have_content '1'
end
end
end
it 'should update weight in sidebar to no weight' do
page.within '.weight' do
click_link 'Edit'
click_link 'No Weight'
page.within '.value' do
expect(page).to have_content 'None'
end
end
end
end
def visit_issue(project, issue)
visit namespace_project_issue_path(project.namespace, project, issue)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment