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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
86fc145c
Commit
86fc145c
authored
Jun 07, 2017
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Order issues by priority
parent
ff7fe2d1
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
18 additions
and
16 deletions
+18
-16
app/models/concerns/milestoneish.rb
app/models/concerns/milestoneish.rb
+7
-5
app/models/issue.rb
app/models/issue.rb
+1
-1
app/views/shared/milestones/_issuables.html.haml
app/views/shared/milestones/_issuables.html.haml
+2
-2
app/views/shared/milestones/_sidebar.html.haml
app/views/shared/milestones/_sidebar.html.haml
+4
-4
app/views/shared/milestones/_tabs.html.haml
app/views/shared/milestones/_tabs.html.haml
+1
-1
changelogs/unreleased/issue_20900.yml
changelogs/unreleased/issue_20900.yml
+1
-1
lib/api/milestones.rb
lib/api/milestones.rb
+2
-2
No files found.
app/models/concerns/milestoneish.rb
View file @
86fc145c
module
Milestoneish
module
Milestoneish
def
closed_items_count
(
user
)
def
closed_items_count
(
user
)
memoize_per_user
(
user
,
:closed_items_count
)
do
memoize_per_user
(
user
,
:closed_items_count
)
do
(
count_issues_by_state
(
user
)[
'closed'
]
||
0
)
+
merge_requests
.
closed_and_merged
.
size
(
count_issues_by_state
(
user
)[
'closed'
]
.
count
||
0
)
+
merge_requests
.
closed_and_merged
.
size
end
end
end
end
...
@@ -12,7 +12,7 @@ module Milestoneish
...
@@ -12,7 +12,7 @@ module Milestoneish
end
end
def
total_issues_count
(
user
)
def
total_issues_count
(
user
)
count_issues_by_state
(
user
).
values
.
sum
issues_visible_to_user
(
user
).
length
end
end
def
complete?
(
user
)
def
complete?
(
user
)
...
@@ -39,8 +39,8 @@ module Milestoneish
...
@@ -39,8 +39,8 @@ module Milestoneish
def
issues_visible_to_user
(
user
)
def
issues_visible_to_user
(
user
)
memoize_per_user
(
user
,
:issues_visible_to_user
)
do
memoize_per_user
(
user
,
:issues_visible_to_user
)
do
IssuesFinder
.
new
(
user
,
issues_finder_params
)
IssuesFinder
.
new
(
user
,
issues_finder_params
.
merge
({
sort:
'priority'
})
)
.
execute
.
includes
(
:assignees
).
where
(
milestone_id:
milestoneish_ids
)
.
execute
.
preload
(
:assignees
).
where
(
milestone_id:
milestoneish_ids
)
end
end
end
end
...
@@ -66,7 +66,9 @@ module Milestoneish
...
@@ -66,7 +66,9 @@ module Milestoneish
def
count_issues_by_state
(
user
)
def
count_issues_by_state
(
user
)
memoize_per_user
(
user
,
:count_issues_by_state
)
do
memoize_per_user
(
user
,
:count_issues_by_state
)
do
issues_visible_to_user
(
user
).
reorder
(
nil
).
group
(
:state
).
count
# Need to group and count using ruby array to not break
# label ordering
issues_visible_to_user
(
user
).
to_a
.
group_by
(
&
:state
)
end
end
end
end
...
...
app/models/issue.rb
View file @
86fc145c
...
@@ -44,7 +44,7 @@ class Issue < ActiveRecord::Base
...
@@ -44,7 +44,7 @@ class Issue < ActiveRecord::Base
scope
:created_after
,
->
(
datetime
)
{
where
(
"created_at >= ?"
,
datetime
)
}
scope
:created_after
,
->
(
datetime
)
{
where
(
"created_at >= ?"
,
datetime
)
}
scope
:
include_associations
,
->
{
includes
(
:labels
,
project: :namespace
)
}
scope
:
preload_associations
,
->
{
preload
(
:labels
,
project: :namespace
)
}
after_save
:expire_etag_cache
after_save
:expire_etag_cache
...
...
app/views/shared/milestones/_issuables.html.haml
View file @
86fc145c
...
@@ -8,11 +8,11 @@
...
@@ -8,11 +8,11 @@
=
title
=
title
-
if
show_counter
-
if
show_counter
.counter
.counter
=
number_with_delimiter
(
issuables
.
size
)
=
number_with_delimiter
(
issuables
.
length
)
-
class_prefix
=
dom_class
(
issuables
).
pluralize
-
class_prefix
=
dom_class
(
issuables
).
pluralize
%ul
{
class:
"well-list milestone-#{class_prefix}-list"
,
id:
"#{class_prefix}-list-#{id}"
}
%ul
{
class:
"well-list milestone-#{class_prefix}-list"
,
id:
"#{class_prefix}-list-#{id}"
}
=
render
partial:
'shared/milestones/issuable'
,
=
render
partial:
'shared/milestones/issuable'
,
collection:
issuables
.
recent
,
collection:
issuables
,
as: :issuable
,
as: :issuable
,
locals:
{
show_project_name:
show_project_name
,
show_full_project_name:
show_full_project_name
}
locals:
{
show_project_name:
show_project_name
,
show_full_project_name:
show_full_project_name
}
app/views/shared/milestones/_sidebar.html.haml
View file @
86fc145c
...
@@ -68,10 +68,10 @@
...
@@ -68,10 +68,10 @@
.sidebar-collapsed-icon
.sidebar-collapsed-icon
%strong
%strong
=
icon
(
'hashtag'
,
'aria-hidden'
:
'true'
)
=
icon
(
'hashtag'
,
'aria-hidden'
:
'true'
)
%span
=
milestone
.
issues_visible_to_user
(
current_user
).
count
%span
=
milestone
.
issues_visible_to_user
(
current_user
).
length
.title.hide-collapsed
.title.hide-collapsed
Issues
Issues
%span
.badge
=
milestone
.
issues_visible_to_user
(
current_user
).
count
%span
.badge
=
milestone
.
issues_visible_to_user
(
current_user
).
length
-
if
project
&&
can?
(
current_user
,
:create_issue
,
project
)
-
if
project
&&
can?
(
current_user
,
:create_issue
,
project
)
=
link_to
new_namespace_project_issue_path
(
project
.
namespace
,
project
,
issue:
{
milestone_id:
milestone
.
id
}),
class:
"pull-right"
,
title:
"New Issue"
do
=
link_to
new_namespace_project_issue_path
(
project
.
namespace
,
project
,
issue:
{
milestone_id:
milestone
.
id
}),
class:
"pull-right"
,
title:
"New Issue"
do
New issue
New issue
...
@@ -79,11 +79,11 @@
...
@@ -79,11 +79,11 @@
%span
.milestone-stat
%span
.milestone-stat
=
link_to
milestones_browse_issuables_path
(
milestone
,
type: :issues
)
do
=
link_to
milestones_browse_issuables_path
(
milestone
,
type: :issues
)
do
Open:
Open:
=
milestone
.
issues_visible_to_user
(
current_user
).
opened
.
count
=
milestone
.
issues_visible_to_user
(
current_user
).
opened
.
length
%span
.milestone-stat
%span
.milestone-stat
=
link_to
milestones_browse_issuables_path
(
milestone
,
type: :issues
,
state:
'closed'
)
do
=
link_to
milestones_browse_issuables_path
(
milestone
,
type: :issues
,
state:
'closed'
)
do
Closed:
Closed:
=
milestone
.
issues_visible_to_user
(
current_user
).
closed
.
count
=
milestone
.
issues_visible_to_user
(
current_user
).
closed
.
length
.block.merge-requests
.block.merge-requests
.sidebar-collapsed-icon
.sidebar-collapsed-icon
...
...
app/views/shared/milestones/_tabs.html.haml
View file @
86fc145c
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
.tab-content.milestone-content
.tab-content.milestone-content
-
if
milestone
.
is_a?
(
GlobalMilestone
)
||
can?
(
current_user
,
:read_issue
,
@project
)
-
if
milestone
.
is_a?
(
GlobalMilestone
)
||
can?
(
current_user
,
:read_issue
,
@project
)
.tab-pane.active
#tab-issues
{
data:
{
sort_endpoint:
(
sort_issues_namespace_project_milestone_path
(
@project
.
namespace
,
@project
,
@milestone
)
if
@project
&&
current_user
)
}
}
.tab-pane.active
#tab-issues
{
data:
{
sort_endpoint:
(
sort_issues_namespace_project_milestone_path
(
@project
.
namespace
,
@project
,
@milestone
)
if
@project
&&
current_user
)
}
}
=
render
'shared/milestones/issues_tab'
,
issues:
milestone
.
issues_visible_to_user
(
current_user
).
include
_associations
,
show_project_name:
show_project_name
,
show_full_project_name:
show_full_project_name
=
render
'shared/milestones/issues_tab'
,
issues:
milestone
.
issues_visible_to_user
(
current_user
).
preload
_associations
,
show_project_name:
show_project_name
,
show_full_project_name:
show_full_project_name
.tab-pane
#tab-merge-requests
{
data:
{
sort_endpoint:
(
sort_merge_requests_namespace_project_milestone_path
(
@project
.
namespace
,
@project
,
@milestone
)
if
@project
&&
current_user
)
}
}
.tab-pane
#tab-merge-requests
{
data:
{
sort_endpoint:
(
sort_merge_requests_namespace_project_milestone_path
(
@project
.
namespace
,
@project
,
@milestone
)
if
@project
&&
current_user
)
}
}
-# loaded async
-# loaded async
=
render
"shared/milestones/tab_loading"
=
render
"shared/milestones/tab_loading"
...
...
changelogs/unreleased/issue_20900.yml
View file @
86fc145c
---
---
title
:
Remove
Drag and
drop and sorting from milestone view
title
:
Remove
issues/merge requests drag n
drop and sorting from milestone view
merge_request
:
merge_request
:
author
:
author
:
lib/api/milestones.rb
View file @
86fc145c
...
@@ -117,7 +117,7 @@ module API
...
@@ -117,7 +117,7 @@ module API
finder_params
=
{
finder_params
=
{
project_id:
user_project
.
id
,
project_id:
user_project
.
id
,
milestone_title:
milestone
.
title
,
milestone_title:
milestone
.
title
,
sort:
'
created_desc
'
sort:
'
label_priority
'
}
}
issues
=
IssuesFinder
.
new
(
current_user
,
finder_params
).
execute
issues
=
IssuesFinder
.
new
(
current_user
,
finder_params
).
execute
...
@@ -140,7 +140,7 @@ module API
...
@@ -140,7 +140,7 @@ module API
finder_params
=
{
finder_params
=
{
project_id:
user_project
.
id
,
project_id:
user_project
.
id
,
milestone_title:
milestone
.
title
,
milestone_title:
milestone
.
title
,
sort:
'
created_desc
'
sort:
'
label_priority
'
}
}
merge_requests
=
MergeRequestsFinder
.
new
(
current_user
,
finder_params
).
execute
merge_requests
=
MergeRequestsFinder
.
new
(
current_user
,
finder_params
).
execute
...
...
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