BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
56509d22
Commit
56509d22
authored
Sep 08, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'backport-issues-controller-changes' into 'master'
Move issues index variable setting to a method See merge request !14048
parents
8db9d8ff
3d9b6bc2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
58 additions
and
18 deletions
+58
-18
filtered_search_manager.js
...ts/javascripts/filtered_search/filtered_search_manager.js
+15
-2
issuable_collections.rb
app/controllers/concerns/issuable_collections.rb
+16
-0
issues_controller.rb
app/controllers/projects/issues_controller.rb
+1
-14
_project.html.haml
app/views/layouts/nav/sidebar/_project.html.haml
+1
-1
_issues.html.haml
app/views/projects/issues/_issues.html.haml
+3
-1
filtered_search_manager_spec.js
...vascripts/filtered_search/filtered_search_manager_spec.js
+22
-0
No files found.
app/assets/javascripts/filtered_search/filtered_search_manager.js
View file @
56509d22
...
...
@@ -332,7 +332,14 @@ class FilteredSearchManager {
const
removeElements
=
[];
[].
forEach
.
call
(
this
.
tokensContainer
.
children
,
(
t
)
=>
{
if
(
t
.
classList
.
contains
(
'js-visual-token'
))
{
let
canClearToken
=
t
.
classList
.
contains
(
'js-visual-token'
);
if
(
canClearToken
)
{
const
tokenKey
=
t
.
querySelector
(
'.name'
).
textContent
.
trim
();
canClearToken
=
this
.
canEdit
&&
this
.
canEdit
(
tokenKey
);
}
if
(
canClearToken
)
{
removeElements
.
push
(
t
);
}
});
...
...
@@ -411,8 +418,14 @@ class FilteredSearchManager {
});
}
// allows for modifying params array when a param can't be included in the URL (e.g. Service Desk)
getAllParams
(
urlParams
)
{
return
this
.
modifyUrlParams
?
this
.
modifyUrlParams
(
urlParams
)
:
urlParams
;
}
loadSearchParamsFromURL
()
{
const
params
=
gl
.
utils
.
getUrlParamsArray
();
const
urlParams
=
gl
.
utils
.
getUrlParamsArray
();
const
params
=
this
.
getAllParams
(
urlParams
);
const
usernameParams
=
this
.
getUsernameParams
();
let
hasFilteredSearch
=
false
;
...
...
app/controllers/concerns/issuable_collections.rb
View file @
56509d22
...
...
@@ -10,6 +10,22 @@ module IssuableCollections
private
def
set_issues_index
@collection_type
=
"Issue"
@issues
=
issues_collection
@issues
=
@issues
.
page
(
params
[
:page
])
@issuable_meta_data
=
issuable_meta_data
(
@issues
,
@collection_type
)
@total_pages
=
issues_page_count
(
@issues
)
return
if
redirect_out_of_range
(
@issues
,
@total_pages
)
if
params
[
:label_name
].
present?
@labels
=
LabelsFinder
.
new
(
current_user
,
project_id:
@project
.
id
,
title:
params
[
:label_name
]).
execute
end
@users
=
[]
end
def
issues_collection
issues_finder
.
execute
.
preload
(
:project
,
:author
,
:assignees
,
:labels
,
:milestone
,
project: :namespace
)
end
...
...
app/controllers/projects/issues_controller.rb
View file @
56509d22
...
...
@@ -10,6 +10,7 @@ class Projects::IssuesController < Projects::ApplicationController
before_action
:check_issues_available!
before_action
:issue
,
except:
[
:index
,
:new
,
:create
,
:bulk_update
]
before_action
:set_issues_index
,
only:
[
:index
]
# Allow write(create) issue
before_action
:authorize_create_issue!
,
only:
[
:new
,
:create
]
...
...
@@ -23,20 +24,6 @@ class Projects::IssuesController < Projects::ApplicationController
respond_to
:html
def
index
@collection_type
=
"Issue"
@issues
=
issues_collection
@issues
=
@issues
.
page
(
params
[
:page
])
@issuable_meta_data
=
issuable_meta_data
(
@issues
,
@collection_type
)
@total_pages
=
issues_page_count
(
@issues
)
return
if
redirect_out_of_range
(
@issues
,
@total_pages
)
if
params
[
:label_name
].
present?
@labels
=
LabelsFinder
.
new
(
current_user
,
project_id:
@project
.
id
,
title:
params
[
:label_name
]).
execute
end
@users
=
[]
if
params
[
:assignee_id
].
present?
assignee
=
User
.
find_by_id
(
params
[
:assignee_id
])
@users
.
push
(
assignee
)
if
assignee
...
...
app/views/layouts/nav/sidebar/_project.html.haml
View file @
56509d22
...
...
@@ -108,7 +108,7 @@
%span
.badge.count.issue_counter.fly-out-badge
=
number_with_delimiter
(
@project
.
open_issues_count
)
%li
.divider.fly-out-top-item
=
nav_link
(
controller: :issues
)
do
=
nav_link
(
controller: :issues
,
action: :index
)
do
=
link_to
project_issues_path
(
@project
),
title:
'Issues'
do
%span
List
...
...
app/views/projects/issues/_issues.html.haml
View file @
56509d22
-
empty_state_path
=
local_assigns
.
fetch
(
:empty_state_path
,
'shared/empty_states/issues'
)
%ul
.content-list.issues-list.issuable-list
=
render
partial:
"projects/issues/issue"
,
collection:
@issues
-
if
@issues
.
blank?
=
render
'shared/empty_states/issues'
=
render
empty_state_path
-
if
@issues
.
present?
=
paginate
@issues
,
theme:
"gitlab"
,
total_pages:
@total_pages
spec/javascripts/filtered_search/filtered_search_manager_spec.js
View file @
56509d22
...
...
@@ -411,4 +411,26 @@ describe('Filtered Search Manager', () => {
expect
(
document
.
querySelector
(
'.filtered-search-box'
).
classList
.
contains
(
'focus'
)).
toEqual
(
false
);
});
});
describe
(
'getAllParams'
,
()
=>
{
beforeEach
(()
=>
{
this
.
paramsArr
=
[
'key=value'
,
'otherkey=othervalue'
];
initializeManager
();
});
it
(
'correctly modifies params when custom modifier is passed'
,
()
=>
{
const
modifedParams
=
manager
.
getAllParams
.
call
({
modifyUrlParams
:
paramsArr
=>
paramsArr
.
reverse
(),
},
[].
concat
(
this
.
paramsArr
));
expect
(
modifedParams
[
0
]).
toBe
(
this
.
paramsArr
[
1
]);
});
it
(
'does not modify params when no custom modifier is passed'
,
()
=>
{
const
modifedParams
=
manager
.
getAllParams
.
call
({},
this
.
paramsArr
);
expect
(
modifedParams
[
1
]).
toBe
(
this
.
paramsArr
[
1
]);
});
});
});
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