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
d9b5245f
Commit
d9b5245f
authored
Feb 24, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated code based on feedback
parent
e044bff7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
11 deletions
+13
-11
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+8
-6
app/views/shared/issuable/_filter.html.haml
app/views/shared/issuable/_filter.html.haml
+1
-1
app/views/shared/issuable/_form.html.haml
app/views/shared/issuable/_form.html.haml
+1
-1
app/views/shared/issuable/_sidebar.html.haml
app/views/shared/issuable/_sidebar.html.haml
+1
-1
spec/features/issues/filter_by_weight_spec.rb
spec/features/issues/filter_by_weight_spec.rb
+2
-2
No files found.
app/helpers/issues_helper.rb
View file @
d9b5245f
...
@@ -139,18 +139,20 @@ module IssuesHelper
...
@@ -139,18 +139,20 @@ module IssuesHelper
end
.
to_h
end
.
to_h
end
end
def
issues_weight_options
(
selected
=
nil
)
def
issues_weight_options
(
selected
=
nil
,
edit:
false
)
options_for_select
(
issue_weights
,
selected
||
params
[
:weight
])
weights
=
edit
?
edit_weights
:
issue_weights
end
def
issues_weight_options_for_edit
(
selected
=
nil
)
weights
=
[[
Issue
::
WEIGHT_NONE
,
nil
]]
+
issue_weights
(
Issue
::
WEIGHT_RANGE
.
to_a
)
options_for_select
(
weights
,
selected
||
params
[
:weight
])
options_for_select
(
weights
,
selected
||
params
[
:weight
])
end
end
def
issue_weights
(
weight_array
=
Issue
.
weight_options
)
def
issue_weights
(
weight_array
=
Issue
.
weight_options
)
weight_array
.
map
{
|
op
|
[
op
]
*
2
}
weight_array
.
zip
(
weight_array
)
end
def
edit_weights
issue_weights
([
Issue
::
WEIGHT_NONE
]
+
Issue
::
WEIGHT_RANGE
.
to_a
)
end
end
# Required for Banzai::Filter::IssueReferenceFilter
# Required for Banzai::Filter::IssueReferenceFilter
module_function
:url_for_issue
module_function
:url_for_issue
end
end
app/views/shared/issuable/_filter.html.haml
View file @
d9b5245f
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
-
if
controller
.
controller_name
==
'issues'
-
if
controller
.
controller_name
==
'issues'
.filter-item.inline.weight-filter
.filter-item.inline.weight-filter
=
select_tag
(
'weight'
,
issues_weight_options
,
=
select_tag
(
'weight'
,
issues_weight_options
(
edit:
false
)
,
class:
'select2 trigger-submit'
,
include_blank:
true
,
class:
'select2 trigger-submit'
,
include_blank:
true
,
data:
{
placeholder:
'Weight'
})
data:
{
placeholder:
'Weight'
})
...
...
app/views/shared/issuable/_form.html.haml
View file @
d9b5245f
...
@@ -59,7 +59,7 @@
...
@@ -59,7 +59,7 @@
=
f
.
label
:label_ids
,
class:
'control-label'
do
=
f
.
label
:label_ids
,
class:
'control-label'
do
Weight
Weight
.col-sm-10
.col-sm-10
=
f
.
select
:weight
,
issues_weight_options
_for_edit
(
issuable
.
weight
),
{
include_blank:
true
},
=
f
.
select
:weight
,
issues_weight_options
(
issuable
.
weight
,
edit:
true
),
{
include_blank:
true
},
{
class:
'select2 js-select2'
,
data:
{
placeholder:
"Select weight"
}}
{
class:
'select2 js-select2'
,
data:
{
placeholder:
"Select weight"
}}
.form-group
.form-group
...
...
app/views/shared/issuable/_sidebar.html.haml
View file @
d9b5245f
...
@@ -115,7 +115,7 @@
...
@@ -115,7 +115,7 @@
-
else
-
else
.light
None
.light
None
.selectbox
.selectbox
=
f
.
select
:weight
,
issues_weight_options
_for_edit
(
issuable
.
weight
),
{
include_blank:
true
},
=
f
.
select
:weight
,
issues_weight_options
(
issuable
.
weight
,
edit:
true
),
{
include_blank:
true
},
{
class:
'select2 js-select2'
,
data:
{
placeholder:
"Select weight"
}}
{
class:
'select2 js-select2'
,
data:
{
placeholder:
"Select weight"
}}
=
render
"shared/issuable/participants"
,
participants:
issuable
.
participants
(
current_user
)
=
render
"shared/issuable/participants"
,
participants:
issuable
.
participants
(
current_user
)
...
...
spec/features/issues/filter_by_weight_spec.rb
View file @
d9b5245f
...
@@ -3,8 +3,8 @@ require 'rails_helper'
...
@@ -3,8 +3,8 @@ require 'rails_helper'
feature
'Issue filtering by Weight'
,
feature:
true
do
feature
'Issue filtering by Weight'
,
feature:
true
do
include
Select2Helper
include
Select2Helper
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:weight_num
)
{
random_weight
}
let
(
:weight_num
)
{
random_weight
}
before
(
:each
)
do
before
(
:each
)
do
create
(
:issue
,
project:
project
,
weight:
nil
)
create
(
:issue
,
project:
project
,
weight:
nil
)
...
...
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