Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/work_items/type.rb')
-rw-r--r--app/models/work_items/type.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/models/work_items/type.rb b/app/models/work_items/type.rb
index 0d390fa131d..bf251a3ade5 100644
--- a/app/models/work_items/type.rb
+++ b/app/models/work_items/type.rb
@@ -20,6 +20,14 @@ module WorkItems
task: { name: 'Task', icon_name: 'issue-type-task', enum_value: 4 }
}.freeze
+ WIDGETS_FOR_TYPE = {
+ issue: [Widgets::Description, Widgets::Hierarchy],
+ incident: [Widgets::Description],
+ test_case: [Widgets::Description],
+ requirement: [Widgets::Description],
+ task: [Widgets::Description, Widgets::Hierarchy]
+ }.freeze
+
cache_markdown_field :description, pipeline: :single_line
enum base_type: BASE_TYPES.transform_values { |value| value[:enum_value] }
@@ -40,6 +48,10 @@ module WorkItems
scope :order_by_name_asc, -> { order(arel_table[:name].lower.asc) }
scope :by_type, ->(base_type) { where(base_type: base_type) }
+ def self.available_widgets
+ WIDGETS_FOR_TYPE.values.flatten.uniq
+ end
+
def self.default_by_type(type)
found_type = find_by(namespace_id: nil, base_type: type)
return found_type if found_type
@@ -60,6 +72,10 @@ module WorkItems
namespace.blank?
end
+ def widgets
+ WIDGETS_FOR_TYPE[base_type.to_sym]
+ end
+
private
def strip_whitespace