Merge pull request #3196 from Undev/feature/broken-projects-search-23049

Broken projects search on dashboard
This commit is contained in:
Dmitriy Zaporozhets 2013-03-12 04:31:57 -07:00
commit 6755d9908f
6 changed files with 34 additions and 5 deletions

View file

@ -34,6 +34,7 @@ class DashboardController < ApplicationController
@projects
end
@projects = @projects.search(params[:search]) if params[:search].present?
@projects = @projects.page(params[:page]).per(30)
end

View file

@ -1,6 +1,6 @@
= form_tag dashboard_filter_path(entity), method: 'get' do
%fieldset.dashboard-search-filter
= search_field_tag "search", params[:search], { placeholder: 'Search', class: 'search-text-input' }
= search_field_tag "search", params[:search], { id: 'filter_search', placeholder: 'Search', class: 'search-text-input' }
= button_tag type: 'submit', class: 'btn' do
%i.icon-search

View file

@ -24,7 +24,7 @@
= form_tag projects_dashboard_path, method: 'get' do
%fieldset.dashboard-search-filter
= hidden_field_tag "scope", params[:scope]
= search_field_tag "search", params[:search], { placeholder: 'Search', class: 'left input-xxlarge' }
= search_field_tag "search", params[:search], { id: 'dashboard_projects_search', placeholder: 'Search', class: 'left input-xxlarge'}
= button_tag type: 'submit', class: 'btn' do
%i.icon-search

View file

@ -1,8 +1,12 @@
Feature: Dashboard
Feature: Dashboard projects
Background:
Given I sign in as a user
And I own project "Shop"
And I visit dashboard projects page
Scenario: I should see issues list
Scenario: I should see projects list
Then I should see projects list
Scenario: I should see project I am looking for
Given I search for "Sho"
Then I should see "Shop" project link

View file

@ -0,0 +1,23 @@
class Dashboard < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedProject
Then 'I should see projects list' do
@user.authorized_projects.all.each do |project|
page.should have_link project.name_with_namespace
end
end
Given 'I search for "Sho"' do
fill_in "dashboard_projects_search", with: "Sho"
within ".dashboard-search-filter" do
find('button').click
end
end
Then 'I should see "Shop" project link' do
page.should have_link "Shop"
end
end

View file

@ -9,7 +9,8 @@ module SharedProject
# Create a specific project called "Shop"
And 'I own project "Shop"' do
@project = create(:project, name: "Shop")
@project = Project.find_by_name "Shop"
@project ||= create(:project, name: "Shop")
@project.team << [@user, :master]
end