Commit f0b7dcba authored by Rubén Dávila's avatar Rubén Dávila

Add ability to filter by namespace. #2406

parent 55707f95
...@@ -9,11 +9,13 @@ class @ProjectsList ...@@ -9,11 +9,13 @@ class @ProjectsList
$(".projects-list-filter").keyup -> $(".projects-list-filter").keyup ->
terms = $(this).val() terms = $(this).val()
uiBox = $('div.projects-list-holder') uiBox = $('div.projects-list-holder')
filterSelector = $(this).data('filter-selector') || 'span.filter-title'
if terms == "" || terms == undefined if terms == "" || terms == undefined
uiBox.find("ul.projects-list li").show() uiBox.find("ul.projects-list li").show()
else else
uiBox.find("ul.projects-list li").each (index) -> 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 if name.toLowerCase().search(terms.toLowerCase()) == -1
$(this).hide() $(this).hide()
......
.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 - 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 = 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') = icon('code-fork fw')
...@@ -8,11 +19,6 @@ ...@@ -8,11 +19,6 @@
= icon('code-fork fw') = icon('code-fork fw')
Fork 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 .projects-list-holder
= render 'shared/projects/list', projects: @public_forks, use_creator_avatar: true, = render 'shared/projects/list', projects: @public_forks, use_creator_avatar: true,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment