Commit 627f494a authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Update IssuableCollections overrides

parent 5695ec95
...@@ -86,14 +86,15 @@ module IssuableCollections ...@@ -86,14 +86,15 @@ module IssuableCollections
# rubocop:disable Gitlab/ModuleWithInstanceVariables # rubocop:disable Gitlab/ModuleWithInstanceVariables
def finder_options def finder_options
params[:state] = default_state if params[:state].blank?
options = { options = {
scope: params[:scope], scope: params[:scope],
state: params[:state].presence || 'opened', state: params[:state],
sort: set_sort_order_from_cookie || default_sort_order sort: set_sort_order_from_cookie || default_sort_order
} }
# Used by view to highlight active option # Used by view to highlight active option
params[:state] = options[:state]
@sort = options[:sort] @sort = options[:sort]
if @project if @project
...@@ -108,6 +109,10 @@ module IssuableCollections ...@@ -108,6 +109,10 @@ module IssuableCollections
end end
# rubocop:enable Gitlab/ModuleWithInstanceVariables # rubocop:enable Gitlab/ModuleWithInstanceVariables
def default_state
'opened'
end
def set_sort_order_from_cookie def set_sort_order_from_cookie
sort_param = params[:sort] if params[:sort].present? sort_param = params[:sort] if params[:sort].present?
# fallback to legacy cookie value for backward compatibility # fallback to legacy cookie value for backward compatibility
......
...@@ -36,7 +36,7 @@ module EE ...@@ -36,7 +36,7 @@ module EE
end end
def export_csv def export_csv
ExportCsvWorker.perform_async(current_user.id, project.id, filter_params.to_h) ExportCsvWorker.perform_async(current_user.id, project.id, finder_options.to_h)
index_path = project_issues_path(project) index_path = project_issues_path(project)
redirect_to(index_path, notice: "Your CSV export has started. It will be emailed to #{current_user.notification_email} when complete.") redirect_to(index_path, notice: "Your CSV export has started. It will be emailed to #{current_user.notification_email} when complete.")
...@@ -51,16 +51,16 @@ module EE ...@@ -51,16 +51,16 @@ module EE
attrs attrs
end end
def filter_params def finder_options
params = super options = super
params.reject! { |key| key == 'weight' } unless project.feature_available?(:issue_weights) options.reject! { |key| key == 'weight' } unless project.feature_available?(:issue_weights)
if service_desk? if service_desk?
params.reject! { |key| key == 'author_username' || key == 'author_id' } options.reject! { |key| key == 'author_username' || key == 'author_id' }
params[:author_id] = ::User.support_bot options[:author_id] = ::User.support_bot
end end
params options
end end
def service_desk? def service_desk?
......
...@@ -15,7 +15,6 @@ class Groups::EpicsController < Groups::ApplicationController ...@@ -15,7 +15,6 @@ class Groups::EpicsController < Groups::ApplicationController
skip_before_action :labels skip_before_action :labels
def index def index
set_default_state
@epics = @issuables @epics = @issuables
respond_to do |format| respond_to do |format|
...@@ -98,18 +97,7 @@ class Groups::EpicsController < Groups::ApplicationController ...@@ -98,18 +97,7 @@ class Groups::EpicsController < Groups::ApplicationController
@preload_for_collection ||= [:group, :author] @preload_for_collection ||= [:group, :author]
end end
# we need to override the default state which is opened for now because we don't have
# states for epics and need all as default for navigation to work correctly (#4017)
def set_default_state
params[:state] = 'opened' if params[:state].blank?
end
def authorize_create_epic! def authorize_create_epic!
return render_404 unless can?(current_user, :create_epic, group) return render_404 unless can?(current_user, :create_epic, group)
end end
def filter_params
set_sort_order_from_cookie
super.merge(start_date: params[:start_date], end_date: params[:end_date])
end
end end
...@@ -33,8 +33,8 @@ class Groups::IssuesAnalyticsController < Groups::ApplicationController ...@@ -33,8 +33,8 @@ class Groups::IssuesAnalyticsController < Groups::ApplicationController
IssuesFinder IssuesFinder
end end
def set_default_state def default_state
params[:state] = 'all' if params[:state].blank? 'all'
end end
def preload_for_collection def preload_for_collection
......
...@@ -9,8 +9,7 @@ module Groups ...@@ -9,8 +9,7 @@ module Groups
def show def show
# show roadmap for a group # show roadmap for a group
set_sort_order_from_cookie @sort = set_sort_order_from_cookie || default_sort_order
@sort = params[:sort] || default_sort_order
@epics_count = EpicsFinder.new(current_user, group_id: @group.id).execute.count @epics_count = EpicsFinder.new(current_user, group_id: @group.id).execute.count
end end
......
class EpicsFinder < IssuableFinder class EpicsFinder < IssuableFinder
def self.scalar_params
@scalar_params ||= %i[
author_id
author_username
label_name
start_date
end_date
search
]
end
def self.array_params
@array_params ||= { label_name: [] }
end
def klass def klass
Epic Epic
end end
......
- type = local_assigns.fetch(:type) - type = local_assigns.fetch(:type)
- hide_sort_dropdown = local_assigns.fetch(:hide_sort_dropdown, false) - hide_sort_dropdown = local_assigns.fetch(:hide_sort_dropdown, false)
- show_roadmap_presets = local_assigns.fetch(:show_roadmap_presets, false) - show_roadmap_presets = local_assigns.fetch(:show_roadmap_presets, false)
- full_path = @project.present? ? @project.full_path : @group.full_path
- preset_layout = roadmap_layout - preset_layout = roadmap_layout
- is_quarters = preset_layout == "QUARTERS" - is_quarters = preset_layout == "QUARTERS"
- is_months = preset_layout == "MONTHS" - is_months = preset_layout == "MONTHS"
...@@ -31,7 +30,7 @@ ...@@ -31,7 +30,7 @@
dropdown_class: "filtered-search-history-dropdown", dropdown_class: "filtered-search-history-dropdown",
content_class: "filtered-search-history-dropdown-content", content_class: "filtered-search-history-dropdown-content",
title: "Recent searches" }) do title: "Recent searches" }) do
.js-filtered-search-history-dropdown{ data: { full_path: full_path } } .js-filtered-search-history-dropdown{ data: { full_path: search_history_storage_prefix } }
.filtered-search-box-input-container.droplab-dropdown .filtered-search-box-input-container.droplab-dropdown
.scroll-container .scroll-container
%ul.tokens-container.list-unstyled %ul.tokens-container.list-unstyled
......
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