debian-mirror-gitlab/app/views/layouts/_search.html.haml

56 lines
3.1 KiB
Text
Raw Normal View History

2016-06-02 11:05:42 +05:30
- if controller.controller_path =~ /^groups/ && @group.persisted?
- label = 'This group'
- if controller.controller_path =~ /^projects/ && @project.persisted?
- label = 'This project'
2016-11-03 12:29:30 +05:30
- if @group && @group.persisted? && @group.path
- group_data_attrs = { group_path: j(@group.path), name: @group.name, issues_path: issues_group_path(j(@group.path)), mr_path: merge_requests_group_path(j(@group.path)) }
- if @project && @project.persisted?
2018-03-17 18:26:18 +05:30
- project_data_attrs = { project_path: j(@project.path), name: j(@project.name), issues_path: project_issues_path(@project), mr_path: project_merge_requests_path(@project), issues_disabled: !@project.issues_enabled? }
2017-08-17 22:00:37 +05:30
.search.search-form{ class: "#{'has-location-badge' if label.present?}" }
2016-06-02 11:05:42 +05:30
= form_tag search_path, method: :get, class: 'navbar-form' do |f|
.search-input-container
- if label.present?
.location-badge= label
2016-06-02 11:05:42 +05:30
.search-input-wrap
2016-11-03 12:29:30 +05:30
.dropdown{ data: { url: search_autocomplete_path } }
2018-03-17 18:26:18 +05:30
= search_field_tag 'search', nil, placeholder: 'Search',
class: 'search-input dropdown-menu-toggle no-outline js-search-dashboard-options',
spellcheck: false,
tabindex: '1',
autocomplete: 'off',
data: { issues_path: issues_dashboard_path,
mr_path: merge_requests_dashboard_path },
aria: { label: 'Search' }
%button.hidden.js-dropdown-search-toggle{ type: 'button', data: { toggle: 'dropdown' } }
2016-06-02 11:05:42 +05:30
.dropdown-menu.dropdown-select
= dropdown_content do
%ul
2018-03-17 18:26:18 +05:30
%li.dropdown-menu-empty-item
%a
2016-06-02 11:05:42 +05:30
Loading...
= dropdown_loading
2018-03-17 18:26:18 +05:30
= sprite_icon('search', size: 16, css_class: 'search-icon')
= sprite_icon('close', size: 16, css_class: 'clear-icon js-clear-input')
2016-06-02 11:05:42 +05:30
2016-11-03 12:29:30 +05:30
= hidden_field_tag :group_id, @group.try(:id), class: 'js-search-group-options', data: group_data_attrs
= hidden_field_tag :project_id, @project && @project.persisted? ? @project.id : '', id: 'search_project_id', class: 'js-search-project-options', data: project_data_attrs
2015-04-26 12:48:37 +05:30
2016-06-02 11:05:42 +05:30
- if @project && @project.persisted?
2015-04-26 12:48:37 +05:30
- 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-11-26 14:37:03 +05:30
- elsif current_controller?(:commits)
= hidden_field_tag :scope, 'commits'
2015-04-26 12:48:37 +05:30
- else
= hidden_field_tag :search_code, true
- if @snippet || @snippets
= hidden_field_tag :snippets, true
2014-09-02 18:07:02 +05:30
= hidden_field_tag :repository_ref, @ref
2015-04-26 12:48:37 +05:30
= button_tag 'Go' if ENV['RAILS_ENV'] == 'test'
2017-08-17 22:00:37 +05:30
.search-autocomplete-opts.hide{ :'data-autocomplete-path' => search_autocomplete_path, :'data-autocomplete-project-id' => @project.try(:id), :'data-autocomplete-project-ref' => @ref }