BigW Consortium Gitlab

Commit 6755d990 by Dmitriy Zaporozhets

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

Broken projects search on dashboard
parents 147b93ee fce22dfa
...@@ -34,6 +34,7 @@ class DashboardController < ApplicationController ...@@ -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
......
= 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 @@ ...@@ -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
......
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
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 ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment