From f0b7dcba30c9041c5d004ee8fa4bbd7652125ed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20D=C3=A1vila?= Date: Mon, 11 Jan 2016 21:38:31 -0500 Subject: [PATCH] Add ability to filter by namespace. #2406 --- .../javascripts/projects_list.js.coffee | 4 ++- app/views/projects/forks/index.html.haml | 28 +++++++++++-------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/app/assets/javascripts/projects_list.js.coffee b/app/assets/javascripts/projects_list.js.coffee index f2887af190b..b71509dbc5a 100644 --- a/app/assets/javascripts/projects_list.js.coffee +++ b/app/assets/javascripts/projects_list.js.coffee @@ -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() diff --git a/app/views/projects/forks/index.html.haml b/app/views/projects/forks/index.html.haml index 46ec7a5d22a..2150e2e42fb 100644 --- a/app/views/projects/forks/index.html.haml +++ b/app/views/projects/forks/index.html.haml @@ -1,19 +1,25 @@ -.gray-content-block.top-block.white - - 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') - Fork - - else - = link_to new_namespace_project_fork_path(@project.namespace, @project), title: "Fork project", class: 'pull-right btn btn-new' do - = icon('code-fork fw') - Fork - - .oneline +.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') + Fork + - else + = link_to new_namespace_project_fork_path(@project.namespace, @project), title: "Fork project", class: 'pull-right btn btn-new' do + = icon('code-fork fw') + Fork + + .projects-list-holder = render 'shared/projects/list', projects: @public_forks, use_creator_avatar: true, forks: true