Sha256: db7220fed6c4bab763bb250fe7113ca157091be381c3abae408a9db69e8a0a6e

Contents?: true

Size: 611 Bytes

Versions: 176

Compression:

Stored size: 611 Bytes

Contents

# frozen_string_literal: true

module Primer
  module Forms
    # :nodoc:
    class Caption < BaseComponent
      def initialize(input:)
        @input = input
      end

      def caption_template?
        @input.caption_template?
      end

      def render_caption_template
        @input.render_caption_template
      end

      def before_render
        return unless @input.caption? && caption_template?

        raise <<~MESSAGE
          Please provide either a caption: argument or caption template for the
          '#{@input.name}' input; both were found.
        MESSAGE
      end
    end
  end
end

Version data entries

176 entries across 176 versions & 2 rubygems

Version Path
openproject-primer_view_components-0.33.0 lib/primer/forms/caption.rb
primer_view_components-0.25.1 lib/primer/forms/caption.rb
openproject-primer_view_components-0.32.1 lib/primer/forms/caption.rb
openproject-primer_view_components-0.32.0 lib/primer/forms/caption.rb
openproject-primer_view_components-0.29.1 lib/primer/forms/caption.rb
openproject-primer_view_components-0.29.0 lib/primer/forms/caption.rb
primer_view_components-0.23.0 lib/primer/forms/caption.rb
openproject-primer_view_components-0.28.1 lib/primer/forms/caption.rb
openproject-primer_view_components-0.28.0 lib/primer/forms/caption.rb
openproject-primer_view_components-0.27.0 lib/primer/forms/caption.rb
openproject-primer_view_components-0.26.0 lib/primer/forms/caption.rb
openproject-primer_view_components-0.25.1 lib/primer/forms/caption.rb
primer_view_components-0.22.0 lib/primer/forms/caption.rb
primer_view_components-0.21.1 lib/primer/forms/caption.rb
openproject-primer_view_components-0.25.0 lib/primer/forms/caption.rb
openproject-primer_view_components-0.24.0 lib/primer/forms/caption.rb
primer_view_components-0.21.0 lib/primer/forms/caption.rb
primer_view_components-0.20.1 lib/primer/forms/caption.rb
primer_view_components-0.20.0 lib/primer/forms/caption.rb
openproject-primer_view_components-0.23.0 lib/primer/forms/caption.rb