OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add typeahead filter for principals and projects
Oliver Günther8f26b2462202
diff --git a/app/models/queries/filters/shared/any_user_name_attribute_filter.rb b/app/models/queries/filters/shared/any_user_name_attribute_filter.rbindex 40092397ea1..b80d83b4b19 100644--- a/app/models/queries/filters/shared/any_user_name_attribute_filter.rb+++ b/app/models/queries/filters/shared/any_user_name_attribute_filter.rb@@ -41,6 +41,7 @@ module Queries::Filters::Shared::AnyUserNameAttributeFilterdef available_operators[Queries::Operators::Contains,+ Queries::Operators::Everywhere,Queries::Operators::NotContains]enddiff --git a/app/models/queries/principals.rb b/app/models/queries/principals.rbindex 5323df6ea00..830ef614ca6 100644--- a/app/models/queries/principals.rb+++ b/app/models/queries/principals.rb@@ -39,6 +39,7 @@ module Queries::Principalsregister.filter query, filters::StatusFilterregister.filter query, filters::NameFilterregister.filter query, filters::AnyNameAttributeFilter+ register.filter query, filters::TypeaheadFilterregister.filter query, filters::IdFilterregister.order query, orders::NameOrderdiff --git a/app/models/queries/principals/filters/typeahead_filter.rb b/app/models/queries/principals/filters/typeahead_filter.rbnew file mode 100644index 00000000000..e8eba86b0ca--- /dev/null+++ b/app/models/queries/principals/filters/typeahead_filter.rb@@ -0,0 +1,43 @@+#-- encoding: UTF-8++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2021 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++class Queries::Principals::Filters::TypeaheadFilter < Queries::Principals::Filters::AnyNameAttributeFilter+ def self.key+ :typeahead+ end++ def type+ :search+ end++ def human_name+ I18n.t('label_search')+ end+enddiff --git a/app/models/queries/projects.rb b/app/models/queries/projects.rbindex 6e3bde4f5b4..7682fb849b7 100644--- a/app/models/queries/projects.rb+++ b/app/models/queries/projects.rb@@ -40,6 +40,7 @@ module Queries::Projectsfilter query, filters::TemplatedFilterfilter query, filters::PublicFilterfilter query, filters::NameAndIdentifierFilter+ filter query, filters::TypeaheadFilterfilter query, filters::CustomFieldFilterfilter query, filters::CreatedAtFilterfilter query, filters::LatestActivityAtFilterdiff --git a/app/models/queries/projects/filters/name_and_identifier_filter.rb b/app/models/queries/projects/filters/name_and_identifier_filter.rbindex ff4ca55641c..11e948eacd7 100644--- a/app/models/queries/projects/filters/name_and_identifier_filter.rb+++ b/app/models/queries/projects/filters/name_and_identifier_filter.rb@@ -39,7 +39,7 @@ class Queries::Projects::Filters::NameAndIdentifierFilter < Queries::Projects::Fwhere_equalwhen '!'where_not_equal- when '~'+ when '~', '**'where_containswhen '!~'where_not_containsdiff --git a/app/models/queries/projects/filters/typeahead_filter.rb b/app/models/queries/projects/filters/typeahead_filter.rbnew file mode 100644index 00000000000..8b6f7993f53--- /dev/null+++ b/app/models/queries/projects/filters/typeahead_filter.rb@@ -0,0 +1,43 @@+#-- encoding: UTF-8++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2021 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++class Queries::Projects::Filters::TypeaheadFilter < Queries::Projects::Filters::NameAndIdentifierFilter+ def self.key+ :typeahead+ end++ def type+ :search+ end++ def human_name+ I18n.t('label_search')+ end+end