From 15eeae5fa8f10442617d2edd8fc3d8f5b3f334db Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 11 Sep 2015 19:59:39 +0200 Subject: [PATCH] Fix 500 when search for gitlab projects --- app/assets/javascripts/ci/pager.js.coffee | 6 +++--- app/controllers/ci/projects_controller.rb | 2 +- app/views/ci/projects/index.html.haml | 9 ++------- app/views/layouts/ci/application.html.haml | 2 +- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/app/assets/javascripts/ci/pager.js.coffee b/app/assets/javascripts/ci/pager.js.coffee index b57e7c736e9..226fbd654ab 100644 --- a/app/assets/javascripts/ci/pager.js.coffee +++ b/app/assets/javascripts/ci/pager.js.coffee @@ -16,7 +16,7 @@ complete: => $(".loading").hide() success: (data) => - Pager.append(data.count, data.html) + CiPager.append(data.count, data.html) dataType: "json" append: (count, html) -> @@ -34,9 +34,9 @@ fireDelay: 1000 fireOnce: true ceaseFire: -> - Pager.disable + CiPager.disable callback: (i) => unless $(".loading").is(':visible') $(".loading").show() - Pager.getItems() + CiPager.getItems() diff --git a/app/controllers/ci/projects_controller.rb b/app/controllers/ci/projects_controller.rb index 9074972e94a..454810ca01f 100644 --- a/app/controllers/ci/projects_controller.rb +++ b/app/controllers/ci/projects_controller.rb @@ -22,7 +22,7 @@ module Ci @page = @offset == 0 ? 1 : (@offset / @limit + 1) @gl_projects = current_user.authorized_projects - @gl_projects = @gl_projects.where("name LIKE %?%", params[:search]) if params[:search] + @gl_projects = @gl_projects.where("name LIKE ?", "%#{params[:search]}%") if params[:search] @gl_projects = @gl_projects.page(@page).per(@limit) @projects = Ci::Project.where(gitlab_id: @gl_projects.map(&:id)).ordered_by_last_commit_date diff --git a/app/views/ci/projects/index.html.haml b/app/views/ci/projects/index.html.haml index 99d07329af0..4c74610a575 100644 --- a/app/views/ci/projects/index.html.haml +++ b/app/views/ci/projects/index.html.haml @@ -1,10 +1,5 @@ - if current_user - = content_for :title do - %h3.project-title - Dashboard - .pull-right - = render "search" - + = render "search" .projects %p.fetch-status.light %i.fa.fa-refresh.fa-spin @@ -12,6 +7,6 @@ $.get '#{gitlab_ci_projects_path}', (data) -> $(".projects").html data.html CiPager.init "#{gitlab_ci_projects_path}", #{Ci::ProjectsController::PROJECTS_BATCH}, false - + - else = render 'public' diff --git a/app/views/layouts/ci/application.html.haml b/app/views/layouts/ci/application.html.haml index 7fb1a0097b2..b9f871d5447 100644 --- a/app/views/layouts/ci/application.html.haml +++ b/app/views/layouts/ci/application.html.haml @@ -2,7 +2,7 @@ %html{ lang: "en"} = render 'layouts/head' %body{class: "ci-body #{user_application_theme}", 'data-page' => body_data_page} - - header_title = "Projects" + - header_title = "CI Projects" - if current_user = render "layouts/header/default", title: header_title - else