Merge pull request #3196 from Undev/feature/broken-projects-search-23049
Broken projects search on dashboard
This commit is contained in:
commit
6755d9908f
6 changed files with 34 additions and 5 deletions
|
@ -34,6 +34,7 @@ class DashboardController < ApplicationController
|
||||||
@projects
|
@projects
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@projects = @projects.search(params[:search]) if params[:search].present?
|
||||||
@projects = @projects.page(params[:page]).per(30)
|
@projects = @projects.page(params[:page]).per(30)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
= form_tag dashboard_filter_path(entity), method: 'get' do
|
= form_tag dashboard_filter_path(entity), method: 'get' do
|
||||||
%fieldset.dashboard-search-filter
|
%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
|
= button_tag type: 'submit', class: 'btn' do
|
||||||
%i.icon-search
|
%i.icon-search
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
= form_tag projects_dashboard_path, method: 'get' do
|
= form_tag projects_dashboard_path, method: 'get' do
|
||||||
%fieldset.dashboard-search-filter
|
%fieldset.dashboard-search-filter
|
||||||
= hidden_field_tag "scope", params[:scope]
|
= 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
|
= button_tag type: 'submit', class: 'btn' do
|
||||||
%i.icon-search
|
%i.icon-search
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
Feature: Dashboard
|
Feature: Dashboard projects
|
||||||
Background:
|
Background:
|
||||||
Given I sign in as a user
|
Given I sign in as a user
|
||||||
And I own project "Shop"
|
And I own project "Shop"
|
||||||
And I visit dashboard projects page
|
And I visit dashboard projects page
|
||||||
|
|
||||||
Scenario: I should see issues list
|
Scenario: I should see projects list
|
||||||
Then 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
|
||||||
|
|
23
features/steps/dashboard/dashboard_projects.rb
Normal file
23
features/steps/dashboard/dashboard_projects.rb
Normal 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
|
|
@ -9,7 +9,8 @@ module SharedProject
|
||||||
|
|
||||||
# Create a specific project called "Shop"
|
# Create a specific project called "Shop"
|
||||||
And 'I own project "Shop"' do
|
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]
|
@project.team << [@user, :master]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue