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
310db449
Commit
310db449
authored
Dec 10, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add weight field to the issue
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
63cfe86e
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
55 additions
and
3 deletions
+55
-3
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+1
-1
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+9
-0
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+9
-0
app/models/issue.rb
app/models/issue.rb
+1
-0
app/views/projects/issues/_issue.html.haml
app/views/projects/issues/_issue.html.haml
+5
-0
app/views/shared/issuable/_filter.html.haml
app/views/shared/issuable/_filter.html.haml
+6
-0
app/views/shared/issuable/_form.html.haml
app/views/shared/issuable/_form.html.haml
+10
-2
app/views/shared/issuable/_sidebar.html.haml
app/views/shared/issuable/_sidebar.html.haml
+8
-0
db/migrate/20151209222208_add_weight_to_issue.rb
db/migrate/20151209222208_add_weight_to_issue.rb
+5
-0
db/schema.rb
db/schema.rb
+1
-0
No files found.
app/controllers/projects/issues_controller.rb
View file @
310db449
...
...
@@ -165,7 +165,7 @@ class Projects::IssuesController < Projects::ApplicationController
def
issue_params
params
.
require
(
:issue
).
permit
(
:title
,
:assignee_id
,
:position
,
:description
,
:title
,
:assignee_id
,
:position
,
:description
,
:weight
,
:milestone_id
,
:state_event
,
:task_num
,
label_ids:
[]
)
end
...
...
app/finders/issuable_finder.rb
View file @
310db449
...
...
@@ -39,6 +39,7 @@ class IssuableFinder
items
=
by_assignee
(
items
)
items
=
by_author
(
items
)
items
=
by_label
(
items
)
items
=
by_weight
(
items
)
sort
(
items
)
end
...
...
@@ -265,6 +266,14 @@ class IssuableFinder
items
end
def
by_weight
(
items
)
if
params
[
:weight
].
present?
items
=
items
.
where
(
weight:
params
[
:weight
])
end
items
end
def
current_user_related?
params
[
:scope
]
==
'created-by-me'
||
params
[
:scope
]
==
'authored'
||
params
[
:scope
]
==
'assigned-to-me'
end
...
...
app/helpers/issues_helper.rb
View file @
310db449
...
...
@@ -121,6 +121,15 @@ module IssuesHelper
end
end
def
projects_weight_options
options
=
(
Issue
::
WEIGHT_RANGE
).
map
do
|
i
|
[
i
,
i
]
end
options
.
unshift
([
'Any'
,
nil
])
options_for_select
(
options
,
params
[
:weight
])
end
# Required for Banzai::Filter::IssueReferenceFilter
module_function
:url_for_issue
end
app/models/issue.rb
View file @
310db449
...
...
@@ -27,6 +27,7 @@ class Issue < ActiveRecord::Base
include
Referable
include
Sortable
include
Taskable
WEIGHT_RANGE
=
1
..
9
ActsAsTaggableOn
.
strict_case_match
=
true
...
...
app/views/projects/issues/_issue.html.haml
View file @
310db449
...
...
@@ -44,6 +44,11 @@
%span
.task-status
=
issue
.
task_status
-
if
issue
.
weight
%span
=
icon
(
'magnet'
)
=
issue
.
weight
.pull-right.issue-updated-at
%span
updated
#{
time_ago_with_tooltip
(
issue
.
updated_at
,
placement:
'bottom'
,
html_class:
'issue_update_ago'
)
}
app/views/shared/issuable/_filter.html.haml
View file @
310db449
...
...
@@ -47,6 +47,12 @@
class:
'select2 trigger-submit'
,
include_blank:
true
,
data:
{
placeholder:
'Label'
})
-
if
controller
.
controller_name
==
'issues'
.filter-item.inline.weight-filter
=
select_tag
(
'weight'
,
projects_weight_options
,
class:
'select2 trigger-submit'
,
include_blank:
true
,
data:
{
placeholder:
'Weight'
})
.pull-right
=
render
'shared/sort_dropdown'
...
...
app/views/shared/issuable/_form.html.haml
View file @
310db449
...
...
@@ -54,6 +54,14 @@
-
if
can?
current_user
,
:admin_milestone
,
issuable
.
project
=
link_to
'Create new milestone'
,
new_namespace_project_milestone_path
(
issuable
.
project
.
namespace
,
issuable
.
project
),
target: :blank
-
if
issuable
.
respond_to?
(
:weight
)
.form-group
=
f
.
label
:label_ids
,
class:
'control-label'
do
=
icon
(
'magnet'
)
Weight
.col-sm-10
=
f
.
number_field
:weight
,
in:
Issue
::
WEIGHT_RANGE
,
class:
'form-control'
.form-group
=
f
.
label
:label_ids
,
"Labels"
,
class:
'control-label'
.col-sm-10
...
...
@@ -75,7 +83,7 @@
.col-sm-10
=
users_select_tag
(
"merge_request[approver_ids]"
,
multiple:
true
,
class:
'input-large'
,
scope: :all
,
email_user:
true
)
.help-block
Merge Request should be approved by these users.
Merge Request should be approved by these users.
You can override the project settings by setting your own list of approvers.
.panel.panel-default.prepend-top-10
...
...
@@ -104,7 +112,7 @@
%li
.no-approvers
There are no approvers
.help-block.suggested-approvers
-
if
@suggested_approvers
.
any?
Suggested approvers:
Suggested approvers:
=
raw
@suggested_approvers
.
map
{
|
approver
|
link_to
sanitize
(
approver
.
name
),
"#"
,
id:
dom_id
(
approver
)
}.
join
(
", "
)
%hr
...
...
app/views/shared/issuable/_sidebar.html.haml
View file @
310db449
...
...
@@ -54,6 +54,14 @@
=
f
.
collection_select
:label_ids
,
issuable
.
project
.
labels
.
all
,
:id
,
:name
,
{
selected:
issuable
.
label_ids
},
multiple:
true
,
class:
'select2 js-select2'
,
data:
{
placeholder:
"Select labels"
}
-
if
issuable
.
respond_to?
(
:weight
)
&&
issuable
.
weight
.block
.title
%label
Weight
.value
=
icon
(
'magnet'
)
=
issuable
.
weight
.block
.title
Cross-project reference
...
...
db/migrate/20151209222208_add_weight_to_issue.rb
0 → 100644
View file @
310db449
class
AddWeightToIssue
<
ActiveRecord
::
Migration
def
change
add_column
:issues
,
:weight
,
:integer
end
end
db/schema.rb
View file @
310db449
...
...
@@ -434,6 +434,7 @@ ActiveRecord::Schema.define(version: 20151210125932) do
t
.
string
"state"
t
.
integer
"iid"
t
.
integer
"updated_by_id"
t
.
integer
"weight"
end
add_index
"issues"
,
[
"assignee_id"
],
name:
"index_issues_on_assignee_id"
,
using: :btree
...
...
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