Sha256: ddc9c7940b825fa41479bf88c68cfe4085cd14c3a7439cc5027a80e22ab46de9

Contents?: true

Size: 726 Bytes

Versions: 4

Compression:

Stored size: 726 Bytes

Contents

# frozen_string_literal: true

module Primer
  module OpenProject
    class DangerConfirmationDialog
      # Utility component for wrapping DangerConfirmationDialog in a form
      class FormWrapper < Primer::Component
        status :open_project

        def initialize(builder: nil, action: nil, **form_arguments)
          raise ArgumentError, "Pass in either a :builder or :action argument, not both." if builder && action

          @builder = builder
          @action = action
          @form_arguments = deny_tag_argument(**form_arguments)
        end

        def renders_form?
          !@builder && @action
        end

        def shows_form?
          @builder || @action
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
openproject-primer_view_components-0.52.4 app/components/primer/open_project/danger_confirmation_dialog/form_wrapper.rb
openproject-primer_view_components-0.52.3 app/components/primer/open_project/danger_confirmation_dialog/form_wrapper.rb
openproject-primer_view_components-0.52.2 app/components/primer/open_project/danger_confirmation_dialog/form_wrapper.rb
openproject-primer_view_components-0.52.1 app/components/primer/open_project/danger_confirmation_dialog/form_wrapper.rb