Commit 3f50d33c authored by James Lopez's avatar James Lopez

refactored project weight options method to fix issue when editing (should...

refactored project weight options method to fix issue when editing (should ignore ANY). Also renamed to issue as it is not a project!
parent 761e950c
......@@ -139,11 +139,18 @@ module IssuesHelper
end.to_h
end
def projects_weight_options(selected = nil)
options = Issue.weight_options.map {|op| [op] * 2}
options_for_select(options, selected || params[:weight])
def issues_weight_options(selected = nil)
options_for_select(issue_weights, selected || params[:weight])
end
def issues_weight_options_for_edit(selected = nil)
weights = issue_weights - [[Issue::WEIGHT_ANY] * 2]
options_for_select(weights, selected || params[:weight])
end
def issue_weights
Issue.weight_options.map {|op| [op] * 2}
end
# Required for Banzai::Filter::IssueReferenceFilter
module_function :url_for_issue
end
......@@ -53,7 +53,7 @@
- if controller.controller_name == 'issues'
.filter-item.inline.weight-filter
= select_tag('weight', projects_weight_options,
= select_tag('weight', issues_weight_options,
class: 'select2 trigger-submit', include_blank: true,
data: {placeholder: 'Weight'})
......
......@@ -59,7 +59,7 @@
= f.label :label_ids, class: 'control-label' do
Weight
.col-sm-10
= f.select :weight, projects_weight_options(issuable.weight), { include_blank: true },
= f.select :weight, issues_weight_options_for_edit(issuable.weight), { include_blank: true },
{ class: 'select2 js-select2', data: { placeholder: "Select weight" }}
.form-group
......
......@@ -71,7 +71,7 @@
- else
.light None
.selectbox
= f.select :weight, projects_weight_options(issuable.weight), { include_blank: true },
= f.select :weight, issues_weight_options_for_edit(issuable.weight), { include_blank: true },
{ class: 'select2 js-select2', data: { placeholder: "Select weight" }}
= render "shared/issuable/participants", participants: issuable.participants(current_user)
......
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