Commit c5feabde2d8cd023215af4d2ceeb7a64839fc428
1 parent
50d44202
Exists in
master
and in
4 other branches
Add simple search to projects in public area
Showing
2 changed files
with
14 additions
and
3 deletions
Show diff stats
app/controllers/public/projects_controller.rb
... | ... | @@ -7,6 +7,7 @@ class Public::ProjectsController < ApplicationController |
7 | 7 | |
8 | 8 | def index |
9 | 9 | @projects = Project.public_only |
10 | + @projects = @projects.search(params[:search]) if params[:search].present? | |
10 | 11 | @projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]).per(20) |
11 | 12 | end |
12 | 13 | end | ... | ... |
app/views/public/projects/index.html.haml
1 | -%h3.page_title | |
2 | - Projects (#{@projects.total_count}) | |
3 | - %small with read-only access | |
1 | +.row | |
2 | + .span6 | |
3 | + %h3.page_title | |
4 | + Projects (#{@projects.total_count}) | |
5 | + %small with read-only access | |
6 | + .span6 | |
7 | + .pull-right | |
8 | + = form_tag public_projects_path, method: :get, class: 'form-inline' do |f| | |
9 | + .search-holder | |
10 | + .input | |
11 | + = search_field_tag :search, params[:search], placeholder: "gitlab-ci", class: "span3 search-text-input", id: "projects_search" | |
12 | + = submit_tag 'Search', class: "btn btn-primary wide" | |
13 | + | |
4 | 14 | %hr |
5 | 15 | |
6 | 16 | .public-projects | ... | ... |