Class: Phlexi::Display::Builder

Inherits:
Field::Builder
  • Object
show all
Includes:
Options::InferredTypes
Defined in:
lib/phlexi/display/builder.rb

Overview

Builder class is responsible for building display fields with various options and components.

Direct Known Subclasses

Phlexi::Display::Base::Builder

Instance Method Summary collapse

Instance Method Details

#association_tagComponents::Association

Creates an association display tag for the field.

Parameters:

  • attributes (Hash)

    Additional attributes for the association display.

Returns:



144
145
146
# File 'lib/phlexi/display/builder.rb', line 144

def association_tag(**, &)
  create_component(Components::Association, :association, **, &)
end

#color_tagComponents::Color

Creates a color display tag for the field.

Parameters:

  • attributes (Hash)

    Additional attributes for the color display.

Returns:



96
97
98
# File 'lib/phlexi/display/builder.rb', line 96

def color_tag(**, &)
  create_component(Components::Color, :color, **, &)
end

#date_tagObject



76
77
78
# File 'lib/phlexi/display/builder.rb', line 76

def date_tag(**, &)
  create_component(Components::DateTime, :date, **, &)
end

#datetime_tagComponents::DateTime

Creates a datetime display for the field.

Parameters:

  • attributes (Hash)

    Additional attributes for the datetime display.

Returns:



72
73
74
# File 'lib/phlexi/display/builder.rb', line 72

def datetime_tag(**, &)
  create_component(Components::DateTime, :datetime, **, &)
end

#description_tagComponents::Description

Creates a Description tag for the field.

Parameters:

  • attributes (Hash)

    Additional attributes for the description.

Returns:



31
32
33
# File 'lib/phlexi/display/builder.rb', line 31

def description_tag(**, &)
  create_component(Components::Description, :description, **, &)
end

#email_tagComponents::Email

Creates a email display tag for the field.

Parameters:

  • attributes (Hash)

    Additional attributes for the email display.

Returns:



120
121
122
# File 'lib/phlexi/display/builder.rb', line 120

def email_tag(**, &)
  create_component(Components::Email, :email, **, &)
end

#enum_tagComponents::Enum

Creates a enum display tag for the field.

Parameters:

  • attributes (Hash)

    Additional attributes for the enum display.

Returns:



112
113
114
# File 'lib/phlexi/display/builder.rb', line 112

def enum_tag(**, &)
  create_component(Components::Enum, :enum, **, &)
end

#hstore_tagObject



64
65
66
# File 'lib/phlexi/display/builder.rb', line 64

def hstore_tag(**, &)
  create_component(Components::JSON, :hstore, **, &)
end

#integer_tagObject



56
57
58
# File 'lib/phlexi/display/builder.rb', line 56

def integer_tag(**, &)
  create_component(Components::Integer, :integer, **, &)
end

#json_tagObject



60
61
62
# File 'lib/phlexi/display/builder.rb', line 60

def json_tag(**, &)
  create_component(Components::JSON, :json, **, &)
end

#label_tagComponents::Label

Creates a label tag for the field.

Parameters:

  • attributes (Hash)

    Additional attributes for the label.

Returns:



15
16
17
# File 'lib/phlexi/display/builder.rb', line 15

def label_tag(**, &)
  create_component(Components::Label, :label, **, &)
end

#number_tagComponents::Number

Creates a number display tag for the field.

Parameters:

  • attributes (Hash)

    Additional attributes for the number display.

Returns:



52
53
54
# File 'lib/phlexi/display/builder.rb', line 52

def number_tag(**, &)
  create_component(Components::Number, :number, **, &)
end

#password_tagComponents::Password

Creates a password display tag for the field.

Parameters:

  • attributes (Hash)

    Additional attributes for the password display.

Returns:



104
105
106
# File 'lib/phlexi/display/builder.rb', line 104

def password_tag(**, &)
  create_component(Components::Password, :password, **, &)
end

#phone_tagComponents::Email

Creates a email display tag for the field.

Parameters:

  • attributes (Hash)

    Additional attributes for the phone display.

Returns:



128
129
130
# File 'lib/phlexi/display/builder.rb', line 128

def phone_tag(**, &)
  create_component(Components::Phone, :phone, **, &)
end

#placeholder_tagComponents::Placeholder

Creates a Placeholder tag for the field.

Parameters:

  • attributes (Hash)

    Additional attributes for the placeholder.

Returns:



23
24
25
# File 'lib/phlexi/display/builder.rb', line 23

def placeholder_tag(**, &)
  create_component(Components::Placeholder, :placeholder, **, &)
end

#string_tagComponents::String Also known as: search_tag

Creates a string display tag for the field.

Parameters:

  • attributes (Hash)

    Additional attributes for the string display.

Returns:



39
40
41
# File 'lib/phlexi/display/builder.rb', line 39

def string_tag(**, &)
  create_component(Components::String, :string, **, &)
end

#text_tagObject



44
45
46
# File 'lib/phlexi/display/builder.rb', line 44

def text_tag(**, &)
  create_component(Components::String, :text, **, &)
end

#time_tagObject



80
81
82
# File 'lib/phlexi/display/builder.rb', line 80

def time_tag(**, &)
  create_component(Components::Time, :time, **, &)
end

#url_tagComponents::Url

Creates a url display tag for the field.

Parameters:

  • attributes (Hash)

    Additional attributes for the url display.

Returns:



136
137
138
# File 'lib/phlexi/display/builder.rb', line 136

def url_tag(**, &)
  create_component(Components::Url, :url, **, &)
end

#wrapped {|block| ... } ⇒ Components::Wrapper

Wraps the field with additional markup.

Parameters:

  • attributes (Hash)

    Additional attributes for the wrapper.

Yields:

  • (block)

    The block to be executed within the wrapper.

Returns:



161
162
163
# File 'lib/phlexi/display/builder.rb', line 161

def wrapped(**, &)
  create_component(Components::Wrapper, :wrapper, **, &)
end