Commit dd72822b authored by Phil Hughes's avatar Phil Hughes

Merge branch '2978-promote-advanced-global-search' into 'master'

Resolve "Promote Advanced Global Search"

Closes #2978

See merge request !2822
parents 4dce42cc e8dd62d0
......@@ -531,6 +531,7 @@ import initGroupAnalytics from './init_group_analytics';
break;
case 'search:show':
new Search();
new UserCallout();
break;
case 'projects:mirrors:show':
case 'projects:mirrors:update':
......
......@@ -46,6 +46,30 @@
margin-top: 56px;
}
.user-callout.promotion-callout.promotion-advanced-search {
margin: 0;
border-bottom: solid 1px $border-color;
h5 {
margin-top: 0;
}
.bordered-box.content-block {
border: none;
padding: 20px 0;
justify-content: left;
svg {
height: auto;
}
}
.user-callout-copy {
margin-left: 0;
}
}
.promotion-modal {
.modal-dialog {
......
......@@ -91,5 +91,9 @@ module LicenseHelper
!@project.feature_available?(project_feature) && show_promotions? && (callout_id.nil? || show_callout?(callout_id))
end
def show_advanced_search_promotion?
!current_application_settings.should_check_namespace_plan? && show_promotions? && show_callout?('promote_advanced_search_dismissed') && !License.feature_available?(:elastic_search)
end
extend self
end
- if @search_objects.empty?
= render partial: "search/results/empty"
= render 'shared/promotions/promote_advanced_search'
- else
.row-content-block
= search_entries_info(@search_objects, @scope, @search_term)
......@@ -8,7 +9,7 @@
in project #{link_to @project.name_with_namespace, [@project.namespace.becomes(Namespace), @project]}
- elsif @group
in group #{link_to @group.name, @group}
= render 'shared/promotions/promote_advanced_search'
.results.prepend-top-10
- if @scope == 'commits'
%ul.content-list.commit-list
......
<svg xmlns="http://www.w3.org/2000/svg" width="42" height="42" viewBox="0 0 42 42"><g fill="none" fill-rule="evenodd"><path fill="#E5E5E5" fill-rule="nonzero" d="M21 41.5C9.678 41.5.5 32.322.5 21S9.678.5 21 .5 41.5 9.678 41.5 21 32.322 41.5 21 41.5zm0-1c10.77 0 19.5-8.73 19.5-19.5S31.77 1.5 21 1.5 1.5 10.23 1.5 21 10.23 40.5 21 40.5z"/><path fill="#E1DBF2" d="M20.396 22.846a4 4 0 1 0-2.07-7.727l2.07 7.727z"/><path fill="#6B4FBB" fill-rule="nonzero" d="M23.6 26.43a8.5 8.5 0 1 1 2.828-2.828l3.35 3.348a2 2 0 1 1-2.828 2.828L23.6 26.43zm-.54-3.37a5.5 5.5 0 1 0-7.778-7.777 5.5 5.5 0 0 0 7.779 7.778z"/></g></svg>
\ No newline at end of file
- if show_advanced_search_promotion?
.user-callout.promotion-callout.promotion-advanced-search.js-mr-approval-callout#promote_advanced_search{ data: { uid: 'promote_advanced_search_dismissed' } }
.bordered-box.content-block
%button.btn.btn-default.close.js-close-callout{ type: 'button', 'aria-label' => _('Dismiss Merge Request promotion') }
= icon('times', class: 'dismiss-icon', 'aria-hidden' => 'true')
.svg-container
= custom_icon('icon_search_avatar')
.user-callout-copy
%h5
- if current_application_settings.should_check_namespace_plan?
= _('Upgrade your plan to activate Advanced Global Search.')
- else
= _('Improve search with Advanced Global Search and GitLab Enterprise Edition.')
%p
= _('The Advanced Global Search in GitLab is a powerful search service that saves you time. Instead of creating duplicate code and wasting time, you can now search for code within other teams that can help your own project.')
= link_to _('Read more'), help_page_path('user/search/advanced_global_search.html'), target: '_blank'
= render 'shared/promotions/promotion_link_project'
......@@ -308,4 +308,40 @@ describe 'Promotions', js: true do
expect(find('.user-callout-copy')).to have_content 'Add Group Webhooks'
end
end
describe 'for advanced search', js: true do
before do
allow(License).to receive(:current).and_return(nil)
stub_application_setting(check_namespace_plan: false)
sign_in(user)
end
it 'should appear on seearch page' do
visit search_path
fill_in 'search', with: 'chosen'
find('.btn-search').trigger('click')
expect(find('#promote_advanced_search')).to have_content 'Improve search with Advanced Global Search and GitLab Enterprise Edition.'
end
it 'does not show when cookie is set' do
visit search_path
fill_in 'search', with: 'chosen'
find('.btn-search').trigger('click')
within('#promote_advanced_search') do
find('.close').trigger('click')
end
visit search_path
fill_in 'search', with: 'chosen'
find('.btn-search').trigger('click')
expect(page).not_to have_selector('#promote_advanced_search')
end
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