Sha256: 05f09ae1a182300884f0bab31ed0fff45cdf6ce2cea15e9f9aa9628f8c12cf9a

Contents?: true

Size: 696 Bytes

Versions: 2

Compression:

Stored size: 696 Bytes

Contents

# frozen_string_literal: true

module Primer
  module OpenProject
    class DangerConfirmationDialog
      # Utility component for wrapping DangerConfirmationDialog in a form
      class FormWrapper < Primer::Component
        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

2 entries across 2 versions & 1 rubygems

Version Path
openproject-primer_view_components-0.52.0 app/components/primer/open_project/danger_confirmation_dialog/form_wrapper.rb
openproject-primer_view_components-0.51.0 app/components/primer/open_project/danger_confirmation_dialog/form_wrapper.rb