Feature #36328 » parent-child-filter-inclusive.patch
| app/models/issue_query.rb | ||
|---|---|---|
|
else
|
||
|
"1=0"
|
||
|
end
|
||
|
when "=+"
|
||
|
ids = value.first.to_s.scan(/\d+/).map(&:to_i).uniq
|
||
|
if ids.present?
|
||
|
"(#{Issue.table_name}.parent_id IN (#{ids.join(",")}) OR #{Issue.table_name}.id IN (#{ids.join(",")}))"
|
||
|
else
|
||
|
"1=0"
|
||
|
end
|
||
|
when "~+"
|
||
|
root_id, lft, rgt = Issue.where(:id => value.first.to_i).pluck(:root_id, :lft, :rgt).first
|
||
|
if root_id && lft && rgt
|
||
|
"#{Issue.table_name}.root_id = #{root_id} AND #{Issue.table_name}.lft >= #{lft} AND #{Issue.table_name}.rgt <= #{rgt}"
|
||
|
else
|
||
|
"1=0"
|
||
|
end
|
||
|
when "!*"
|
||
|
"#{Issue.table_name}.parent_id IS NULL"
|
||
|
when "*"
|
||
| ... | ... | |
|
else
|
||
|
"1=0"
|
||
|
end
|
||
|
when "=+"
|
||
|
child_ids = value.first.to_s.scan(/\d+/).map(&:to_i).uniq
|
||
|
ids = Issue.where(:id => child_ids).pluck(:parent_id).compact.uniq
|
||
|
if child_ids.present?
|
||
|
if ids.present?
|
||
|
"(#{Issue.table_name}.id IN (#{ids.join(",")}) OR #{Issue.table_name}.id IN (#{child_ids.join(",")}))"
|
||
|
else
|
||
|
"#{Issue.table_name}.id IN (#{child_ids.join(",")})"
|
||
|
end
|
||
|
else
|
||
|
"1=0"
|
||
|
end
|
||
|
when "~+"
|
||
|
root_id, lft, rgt = Issue.where(:id => value.first.to_i).pluck(:root_id, :lft, :rgt).first
|
||
|
if root_id && lft && rgt
|
||
|
"#{Issue.table_name}.root_id = #{root_id} AND #{Issue.table_name}.lft <= #{lft} AND #{Issue.table_name}.rgt >= #{rgt}"
|
||
|
else
|
||
|
"1=0"
|
||
|
end
|
||
|
when "!*"
|
||
|
"#{Issue.table_name}.rgt - #{Issue.table_name}.lft = 1"
|
||
|
when "*"
|
||
| app/models/query.rb | ||
|---|---|---|
|
"!p" => :label_no_issues_in_project,
|
||
|
"*o" => :label_any_open_issues,
|
||
|
"!o" => :label_no_open_issues,
|
||
|
"=+" => :label_equals_inclusive,
|
||
|
"~+" => :label_contains_inclusive,
|
||
|
}
|
||
|
class_attribute :operators_by_filter_type
|
||
| ... | ... | |
|
:integer => [ "=", ">=", "<=", "><", "!*", "*" ],
|
||
|
:float => [ "=", ">=", "<=", "><", "!*", "*" ],
|
||
|
:relation => ["=", "!", "=p", "=!p", "!p", "*o", "!o", "!*", "*"],
|
||
|
:tree => ["=", "~", "!*", "*"]
|
||
|
:tree => ["=", "~", "!*", "*", "=+", "~+"]
|
||
|
}
|
||
|
class_attribute :available_columns
|
||
| config/locales/en.yml | ||
|---|---|---|
|
label_filter_add: Add filter
|
||
|
label_filter_plural: Filters
|
||
|
label_equals: is
|
||
|
label_equals_inclusive: is (inclusive)
|
||
|
label_not_equals: is not
|
||
|
label_in_less_than: in less than
|
||
|
label_in_more_than: in more than
|
||
| ... | ... | |
|
label_more_than_ago: more than days ago
|
||
|
label_ago: days ago
|
||
|
label_contains: contains
|
||
|
label_contains_inclusive: contains (inclusive)
|
||
|
label_not_contains: doesn't contain
|
||
|
label_starts_with: starts with
|
||
|
label_ends_with: ends with
|
||
| config/locales/it.yml | ||
|---|---|---|
|
label_filter_add: Aggiungi filtro
|
||
|
label_filter_plural: Filtri
|
||
|
label_equals: è
|
||
|
label_equals_inclusive: è (incluso)
|
||
|
label_not_equals: non è
|
||
|
label_in_less_than: è minore di
|
||
|
label_in_more_than: è maggiore di
|
||
| ... | ... | |
|
label_more_than_ago: più di giorni fa
|
||
|
label_ago: giorni fa
|
||
|
label_contains: contiene
|
||
|
label_contains_inclusive: contiene (incluso)
|
||
|
label_not_contains: non contiene
|
||
|
label_day_plural: giorni
|
||
|
label_repository: Repository
|
||