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

hierarchy.rb « widgets « work_items « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9d90a56d59ef3297a82641e8a0115e78ac8816d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true

module WorkItems
  module Widgets
    class Hierarchy < Base
      def parent
        work_item.work_item_parent
      end

      def children
        work_item.work_item_children_by_relative_position
      end

      def self.quick_action_commands
        [:set_parent, :add_child]
      end

      def self.quick_action_params
        [:set_parent, :add_child]
      end

      def self.process_quick_action_param(param_name, value)
        return super unless param_name.in?(quick_action_params) && value.present?

        return { parent: value } if param_name == :set_parent

        return { children: value } if param_name == :add_child
      end
    end
  end
end