2016-04-06 17:31:34 -04:00
|
|
|
- if controller.controller_path =~ /^groups/ && @group.persisted?
|
2016-03-21 17:00:53 -04:00
|
|
|
- label = 'This group'
|
2016-04-06 17:31:34 -04:00
|
|
|
- if controller.controller_path =~ /^projects/ && @project.persisted?
|
2016-03-21 17:00:53 -04:00
|
|
|
- label = 'This project'
|
|
|
|
|
|
|
|
.search.search-form{class: "#{'has-location-badge' if label.present?}"}
|
2016-03-08 19:39:14 -05:00
|
|
|
= form_tag search_path, method: :get, class: 'navbar-form' do |f|
|
|
|
|
.search-input-container
|
2016-05-24 11:57:26 -04:00
|
|
|
- if label.present?
|
|
|
|
.location-badge= label
|
2016-03-08 19:39:14 -05:00
|
|
|
.search-input-wrap
|
2016-03-14 17:14:29 -04:00
|
|
|
.dropdown{ data: {url: search_autocomplete_path } }
|
|
|
|
= search_field_tag "search", nil, placeholder: 'Search', class: "search-input dropdown-menu-toggle", spellcheck: false, tabindex: "1", autocomplete: 'off', data: { toggle: 'dropdown' }
|
|
|
|
.dropdown-menu.dropdown-select
|
2016-03-23 15:12:33 -04:00
|
|
|
= dropdown_content do
|
2016-03-25 02:02:22 -04:00
|
|
|
%ul
|
|
|
|
%li
|
|
|
|
%a.is-focused.dropdown-menu-empty-link
|
|
|
|
Loading...
|
2016-03-14 17:14:29 -04:00
|
|
|
= dropdown_loading
|
2016-04-05 20:19:00 -04:00
|
|
|
%i.search-icon
|
|
|
|
%i.clear-icon.js-clear-input
|
2014-12-02 15:38:45 -05:00
|
|
|
|
2016-03-08 19:39:14 -05:00
|
|
|
= hidden_field_tag :group_id, @group.try(:id)
|
2016-03-09 12:45:43 -05:00
|
|
|
= hidden_field_tag :project_id, @project && @project.persisted? ? @project.id : '', id: 'search_project_id'
|
2016-03-08 02:56:43 -05:00
|
|
|
|
|
|
|
- if @project && @project.persisted?
|
2014-12-02 15:38:45 -05:00
|
|
|
- if current_controller?(:issues)
|
|
|
|
= hidden_field_tag :scope, 'issues'
|
|
|
|
- elsif current_controller?(:merge_requests)
|
|
|
|
= hidden_field_tag :scope, 'merge_requests'
|
|
|
|
- elsif current_controller?(:wikis)
|
|
|
|
= hidden_field_tag :scope, 'wiki_blobs'
|
2015-06-14 18:04:20 -04:00
|
|
|
- elsif current_controller?(:commits)
|
|
|
|
= hidden_field_tag :scope, 'commits'
|
2014-12-02 15:38:45 -05:00
|
|
|
- else
|
|
|
|
= hidden_field_tag :search_code, true
|
|
|
|
|
2016-06-06 21:11:23 -04:00
|
|
|
:javascript
|
|
|
|
gl.projectOptions = gl.projectOptions || {};
|
2016-06-13 17:07:18 -04:00
|
|
|
gl.projectOptions["#{j(@project.path)}"] = {
|
2016-06-06 21:11:23 -04:00
|
|
|
issuesPath: "#{namespace_project_issues_path(@project.namespace, @project)}",
|
|
|
|
mrPath: "#{namespace_project_merge_requests_path(@project.namespace, @project)}",
|
2016-06-13 17:07:18 -04:00
|
|
|
name: "#{j(@project.name)}"
|
2016-06-06 21:11:23 -04:00
|
|
|
};
|
|
|
|
|
2016-07-12 15:40:05 -04:00
|
|
|
- if @group && @group.persisted? && @group.path
|
2016-06-08 21:21:35 -04:00
|
|
|
:javascript
|
|
|
|
gl.groupOptions = gl.groupOptions || {};
|
2016-06-13 17:07:18 -04:00
|
|
|
gl.groupOptions["#{j(@group.path)}"] = {
|
|
|
|
name: "#{j(@group.name)}",
|
|
|
|
issuesPath: "#{issues_group_path(j(@group.path))}",
|
|
|
|
mrPath: "#{merge_requests_group_path(j(@group.path))}"
|
2016-06-08 21:21:35 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-06-06 21:11:23 -04:00
|
|
|
:javascript
|
|
|
|
gl.dashboardOptions = {
|
|
|
|
issuesPath: "#{issues_dashboard_url}",
|
|
|
|
mrPath: "#{merge_requests_dashboard_url}"
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-08-29 15:22:45 -04:00
|
|
|
- if @snippet || @snippets
|
|
|
|
= hidden_field_tag :snippets, true
|
2013-05-09 04:27:14 -04:00
|
|
|
= hidden_field_tag :repository_ref, @ref
|
2014-09-26 10:57:36 -04:00
|
|
|
= button_tag 'Go' if ENV['RAILS_ENV'] == 'test'
|
2014-01-18 07:16:46 -05:00
|
|
|
.search-autocomplete-opts.hide{:'data-autocomplete-path' => search_autocomplete_path, :'data-autocomplete-project-id' => @project.try(:id), :'data-autocomplete-project-ref' => @ref }
|