Commit 8fbb0907 authored by Robert Speicher's avatar Robert Speicher

Merge branch '6145-unify-issuable-search-bar-ee' into 'master'

Unify app/views/shared/issuable/_search_bar.html.haml

Closes #6145

See merge request gitlab-org/gitlab-ee!6327
parents 7f79eb86 8799567c
......@@ -28,4 +28,8 @@ class Board < ActiveRecord::Base
def closed_list
lists.merge(List.closed).take
end
def scoped?
false
end
end
......@@ -11,7 +11,7 @@
-# haml-lint:disable InlineJavaScript
%script#js-board-template{ type: "text/x-template" }= render "shared/boards/components/board"
%script#js-board-modal-filter{ type: "text/x-template" }= render "shared/issuable/search_bar", type: :boards_modal
%script#js-board-promotion{ type: "text/x-template" }= render "shared/promotions/promote_issue_board"
%script#js-board-promotion{ type: "text/x-template" }= render_if_exists "shared/promotions/promote_issue_board"
#board-app.boards-app{ "v-cloak" => true, data: board_data, ":class" => "{ 'is-compact': detailIssueVisible }" }
.d-none.d-sm-none.d-md-block
......
......@@ -2,12 +2,13 @@
- board = local_assigns.fetch(:board, nil)
- block_css_class = type != :boards_modal ? 'row-content-block second-block' : ''
- full_path = @project.present? ? @project.full_path : @group.full_path
- user_can_admin_list = board && can?(current_user, :admin_list, board.parent)
.issues-filters
.issues-details-filters.filtered-search-block{ class: block_css_class, "v-pre" => type == :boards_modal }
- if type == :boards && board
- if type == :boards
#js-multiple-boards-switcher.inline.boards-switcher{ "v-cloak" => true }
= render "shared/boards/switcher", board: board
= render_if_exists "shared/boards/switcher", board: board
= form_tag page_filter_path(without: [:assignee_id, :author_id, :milestone_title, :label_name, :search]), method: :get, class: 'filter-form js-filter-form' do
- if params[:search].present?
= hidden_field_tag :search, params[:search]
......@@ -104,31 +105,17 @@
%span.js-data-value.prepend-left-10
{{name}}
- if type == :issues || type == :boards || type == :boards_modal
#js-dropdown-weight.filtered-search-input-dropdown-menu.dropdown-menu
%ul{ 'data-dropdown' => true }
%li.filter-dropdown-item{ 'data-value' => 'None' }
%button.btn.btn-link
None
%li.filter-dropdown-item{ 'data-value' => 'Any' }
%button.btn.btn-link
Any
%li.divider.droplab-item-ignore
%ul.filter-dropdown{ data: { dropdown: true, dynamic: true } }
%li.filter-dropdown-item{ data: { value: '{{id}}' } }
%button.btn.btn-link {{title}}
= render_if_exists 'shared/issuable/filter_weight', type: type
%button.clear-search.hidden{ type: 'button' }
= icon('times')
.filter-dropdown-container
- if type == :boards
- user_can_admin_list = can?(current_user, :admin_list, board.parent)
.js-board-config{ data: { can_admin_list: user_can_admin_list, has_scope: board.scoped? } }
- if user_can_admin_list
= render_if_exists 'shared/issuable/board_create_list_dropdown', board: board
= render 'shared/issuable/board_create_list_dropdown', board: board
- if @project
#js-add-issues-btn.prepend-left-10{ data: { can_admin_list: can?(current_user, :admin_list, @project) } }
#js-toggle-focus-btn.prepend-left-10
#js-toggle-focus-btn
- elsif type != :boards_modal
= render 'shared/sort_dropdown'
module EE
module Board
extend ActiveSupport::Concern
extend ::Gitlab::Utils::Override
# Empty state for milestones and weights.
EMPTY_SCOPE_STATE = [nil, -1].freeze
......@@ -21,6 +22,16 @@ module EE
validates :name, presence: true
end
override :scoped?
def scoped?
return super unless parent.feature_available?(:scoped_issue_board)
EMPTY_SCOPE_STATE.exclude?(milestone_id) ||
EMPTY_SCOPE_STATE.exclude?(weight) ||
labels.any? ||
assignee.present?
end
def milestone
return nil unless parent.feature_available?(:scoped_issue_board)
......@@ -34,15 +45,6 @@ module EE
end
end
def scoped?
return false unless parent.feature_available?(:scoped_issue_board)
EMPTY_SCOPE_STATE.exclude?(milestone_id) ||
EMPTY_SCOPE_STATE.exclude?(weight) ||
labels.any? ||
assignee.present?
end
def as_json(options = {})
milestone_attrs = options.fetch(:include, {})
.extract!(:milestone)
......
- type = local_assigns.fetch(:type)
- return unless type == :issues || type == :boards || type == :boards_modal
#js-dropdown-weight.filtered-search-input-dropdown-menu.dropdown-menu
%ul{ 'data-dropdown' => true }
%li.filter-dropdown-item{ 'data-value' => 'None' }
%button.btn.btn-link
None
%li.filter-dropdown-item{ 'data-value' => 'Any' }
%button.btn.btn-link
Any
%li.divider.droplab-item-ignore
%ul.filter-dropdown{ data: { dropdown: true, dynamic: true } }
%li.filter-dropdown-item{ data: { value: '{{id}}' } }
%button.btn.btn-link {{title}}
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