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
iv
gitlab-ce
Commits
30e022a2
Commit
30e022a2
authored
Feb 05, 2016
by
Josh Frye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Starred, All, and Trending on explore are paged also group projects. Need ajax filter.
parent
0dc64a8c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
14 deletions
+55
-14
app/assets/javascripts/dashboard.js.coffee
app/assets/javascripts/dashboard.js.coffee
+2
-2
app/assets/javascripts/dispatcher.js.coffee
app/assets/javascripts/dispatcher.js.coffee
+2
-0
app/assets/javascripts/projects_list.js.coffee
app/assets/javascripts/projects_list.js.coffee
+2
-2
app/controllers/explore/projects_controller.rb
app/controllers/explore/projects_controller.rb
+30
-0
app/controllers/groups_controller.rb
app/controllers/groups_controller.rb
+9
-2
app/views/groups/_projects.html.haml
app/views/groups/_projects.html.haml
+9
-8
app/views/shared/projects/_list.html.haml
app/views/shared/projects/_list.html.haml
+1
-0
No files found.
app/assets/javascripts/dashboard.js.coffee
View file @
30e022a2
...
...
@@ -5,7 +5,7 @@
initSearch
:
->
@
timer
=
null
$
(
"#project-filter-form-field"
).
on
(
'keyup'
,
->
$
(
"#project-filter-form-field
,.projects-list-filter
"
).
on
(
'keyup'
,
->
clearTimeout
(
@
timer
)
@
timer
=
setTimeout
(
Dashboard
.
filterResults
,
500
)
)
...
...
@@ -25,7 +25,7 @@
complete
:
->
$
(
'.projects-list-holder'
).
fadeTo
(
250
,
1
)
success
:
(
data
)
->
$
(
'
div.projects-list-holder
'
).
replaceWith
(
data
.
html
)
$
(
'
.projects-list-holder,.public-projects
'
).
replaceWith
(
data
.
html
)
# Change url so if user reload a page - search results are saved
history
.
replaceState
{
page
:
project_filter_url
},
document
.
title
,
project_filter_url
dataType
:
"json"
app/assets/javascripts/dispatcher.js.coffee
View file @
30e022a2
...
...
@@ -16,6 +16,8 @@ class Dispatcher
shortcut_handler
=
null
switch
page
when
'explore:projects:index'
,
'explore:projects:starred'
,
'explore:projects:trending'
Dashboard
.
init
()
when
'projects:issues:index'
Issues
.
init
()
shortcut_handler
=
new
ShortcutsNavigation
()
...
...
app/assets/javascripts/projects_list.js.coffee
View file @
30e022a2
...
...
@@ -11,8 +11,8 @@ class @ProjectsList
ProjectsList
.
filter_results
(
$
(
"#project-filter-form-field"
))
@
filter_results
:
(
$element
)
->
terms
=
$
(
$element
)
.
val
()
filterSelector
=
$
(
$element
)
.
data
(
'filter-selector'
)
||
'span.filter-title'
terms
=
$
element
.
val
()
filterSelector
=
$
element
.
data
(
'filter-selector'
)
||
'span.filter-title'
if
not
terms
$
(
"ul.projects-list li"
).
show
()
...
...
app/controllers/explore/projects_controller.rb
View file @
30e022a2
...
...
@@ -6,19 +6,49 @@ class Explore::ProjectsController < Explore::ApplicationController
@projects
=
@projects
.
where
(
visibility_level:
params
[
:visibility_level
])
if
params
[
:visibility_level
].
present?
@projects
=
@projects
.
non_archived
@projects
=
@projects
.
search
(
params
[
:search
])
if
params
[
:search
].
present?
@projects
=
@projects
.
search
(
params
[
:filter_projects
])
if
params
[
:filter_projects
].
present?
@projects
=
@projects
.
sort
(
@sort
=
params
[
:sort
])
@projects
=
@projects
.
includes
(
:namespace
).
page
(
params
[
:page
]).
per
(
PER_PAGE
)
respond_to
do
|
format
|
format
.
html
format
.
json
do
render
json:
{
html:
view_to_html_string
(
"dashboard/projects/_projects"
,
locals:
{
projects:
@projects
})
}
end
end
end
def
trending
@projects
=
TrendingProjectsFinder
.
new
.
execute
(
current_user
)
@projects
=
@projects
.
non_archived
@projects
=
@projects
.
search
(
params
[
:filter_projects
])
if
params
[
:filter_projects
].
present?
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
respond_to
do
|
format
|
format
.
html
format
.
json
do
render
json:
{
html:
view_to_html_string
(
"dashboard/projects/_projects"
,
locals:
{
projects:
@projects
})
}
end
end
end
def
starred
@projects
=
ProjectsFinder
.
new
.
execute
(
current_user
)
@projects
=
@projects
.
search
(
params
[
:filter_projects
])
if
params
[
:filter_projects
].
present?
@projects
=
@projects
.
reorder
(
'star_count DESC'
)
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
respond_to
do
|
format
|
format
.
html
format
.
json
do
render
json:
{
html:
view_to_html_string
(
"dashboard/projects/_projects"
,
locals:
{
projects:
@projects
})
}
end
end
end
end
app/controllers/groups_controller.rb
View file @
30e022a2
...
...
@@ -41,14 +41,21 @@ class GroupsController < Groups::ApplicationController
def
show
@last_push
=
current_user
.
recent_push
if
current_user
@projects
=
@projects
.
includes
(
:namespace
)
@projects
=
@projects
.
search
(
params
[
:filter_projects
])
if
params
[
:filter_projects
].
present?
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
respond_to
do
|
format
|
format
.
html
format
.
json
do
load_events
pager_json
(
"events/_events"
,
@events
.
count
)
if
params
[
:filter_projects
]
render
json:
{
html:
view_to_html_string
(
"dashboard/projects/_projects"
,
locals:
{
projects:
@projects
})
}
else
load_events
pager_json
(
"events/_events"
,
@events
.
count
)
end
end
format
.
atom
do
...
...
app/views/groups/_projects.html.haml
View file @
30e022a2
.
projects-list-holder.prepend-top-default
.
input-group
=
search_field_tag
:filter_projects
,
nil
,
placeholder:
'Filter by name'
,
class:
'projects-list-filter form-control'
,
spellcheck:
false
-
if
can?
current_user
,
:create_projects
,
@group
%span
.input-group-btn
=
link_to
new_project_path
(
namespace_id:
@group
.
id
)
,
class:
'btn btn-new'
do
=
icon
(
'plus'
)
New Project
.
top-area
.
nav-controls
=
form_tag
request
.
original_url
,
method: :get
,
class:
'project-filter-form'
,
id:
'project-filter-form'
do
|
f
|
=
search_field_tag
:filter_projects
,
params
[
:filter_projects
],
placeholder:
'Filter by name...'
,
class:
'input-short project-filter-form-field form-control'
,
spellcheck:
false
,
id:
'project-filter-form-field'
-
if
current_user
&&
current_user
.
can_create_project?
=
link_to
new_project_path
,
class:
'btn btn-new'
do
=
icon
(
'plus'
)
New Project
.projects-list-holder
=
render
'shared/projects/list'
,
projects:
@projects
,
projects_limit:
20
,
stars:
false
,
skip_namespace:
true
app/views/shared/projects/_list.html.haml
View file @
30e022a2
...
...
@@ -27,3 +27,4 @@
:javascript
new
ProjectsList
();
Dashboard
.
init
();
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