Add ability to filter by namespace. #2406
This commit is contained in:
parent
55707f9589
commit
f0b7dcba30
2 changed files with 20 additions and 12 deletions
|
@ -9,11 +9,13 @@ class @ProjectsList
|
|||
$(".projects-list-filter").keyup ->
|
||||
terms = $(this).val()
|
||||
uiBox = $('div.projects-list-holder')
|
||||
filterSelector = $(this).data('filter-selector') || 'span.filter-title'
|
||||
|
||||
if terms == "" || terms == undefined
|
||||
uiBox.find("ul.projects-list li").show()
|
||||
else
|
||||
uiBox.find("ul.projects-list li").each (index) ->
|
||||
name = $(this).find("span.filter-title").text()
|
||||
name = $(this).find(filterSelector).text()
|
||||
|
||||
if name.toLowerCase().search(terms.toLowerCase()) == -1
|
||||
$(this).hide()
|
||||
|
|
|
@ -1,4 +1,15 @@
|
|||
.gray-content-block.top-block.white
|
||||
.gray-content-block.top-block.clearfix.white
|
||||
.pull-left
|
||||
- public_count = @public_forks.size
|
||||
- protected_count = @protected_forks.size
|
||||
- full_count_title = ["#{public_count} public", "#{protected_count} protected"].join(' and ')
|
||||
== #{pluralize(@all_forks.size, 'fork')}: #{full_count_title}
|
||||
|
||||
.pull-right
|
||||
.projects-search-form
|
||||
= search_field_tag :filter_projects, nil, placeholder: 'Search forks', class: 'projects-list-filter form-control',
|
||||
spellcheck: false, data: { 'filter-selector' => 'span.namespace-name' }
|
||||
|
||||
- if current_user.already_forked?(@project) && current_user.manageable_namespaces.size < 2
|
||||
= link_to namespace_project_path(current_user, current_user.fork_of(@project)), title: 'Go to your fork', class: 'pull-right btn btn-new' do
|
||||
= icon('code-fork fw')
|
||||
|
@ -8,11 +19,6 @@
|
|||
= icon('code-fork fw')
|
||||
Fork
|
||||
|
||||
.oneline
|
||||
- public_count = @public_forks.size
|
||||
- protected_count = @protected_forks.size
|
||||
- full_count_title = ["#{public_count} public", "#{protected_count} protected"].join(' and ')
|
||||
== #{pluralize(@all_forks.size, 'fork')}: #{full_count_title}
|
||||
|
||||
.projects-list-holder
|
||||
= render 'shared/projects/list', projects: @public_forks, use_creator_avatar: true,
|
||||
|
|
Loading…
Reference in a new issue