Class: Studio::EmailCatalog::Entry
- Inherits:
-
Struct
- Object
- Struct
- Studio::EmailCatalog::Entry
- Defined in:
- app/services/studio/email_catalog.rb
Overview
A registered email. default_asset — logical asset path inside the gem (resolved through the host's pipeline); nil means no inherited artwork. type — :transactional or :marketing. preview — callable returning a Mail, or nil.
Instance Attribute Summary collapse
-
#aspect_ratio ⇒ Object
Returns the value of attribute aspect_ratio.
-
#background ⇒ Object
Returns the value of attribute background.
-
#background_origin ⇒ Object
Returns the value of attribute background_origin.
-
#body ⇒ Object
Returns the value of attribute body.
-
#cta_color ⇒ Object
Returns the value of attribute cta_color.
-
#cta_enabled ⇒ Object
Returns the value of attribute cta_enabled.
-
#cta_text ⇒ Object
Returns the value of attribute cta_text.
-
#default_asset ⇒ Object
Returns the value of attribute default_asset.
-
#default_origin ⇒ Object
Returns the value of attribute default_origin.
-
#description ⇒ Object
Returns the value of attribute description.
-
#header ⇒ Object
Returns the value of attribute header.
-
#header_fallback ⇒ Object
Returns the value of attribute header_fallback.
-
#key ⇒ Object
Returns the value of attribute key.
-
#label ⇒ Object
Returns the value of attribute label.
-
#logo ⇒ Object
Returns the value of attribute logo.
-
#preview ⇒ Object
Returns the value of attribute preview.
-
#scrim ⇒ Object
Returns the value of attribute scrim.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#subtext ⇒ Object
Returns the value of attribute subtext.
-
#supports_cta ⇒ Object
Returns the value of attribute supports_cta.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#engine_artwork? ⇒ Boolean
WHOSE artwork default_asset names.
-
#layered? ⇒ Boolean
Does THIS APP's artwork layer?.
-
#marketing? ⇒ Boolean
nil-safe: an Entry built directly (the STANDARD seed) may carry no type.
- #previewable? ⇒ Boolean
-
#ratio ⇒ Object
The shape of THIS email's banner — the box the page draws and the ratio the upload cropper enforces.
-
#supports_cta? ⇒ Boolean
Can this email render a button AT ALL? An email's view has to have somewhere to send the reader — the sign-in link has a token URL, a "you're subscribed" note has nothing.
- #to_s ⇒ Object
Instance Attribute Details
#aspect_ratio ⇒ Object
Returns the value of attribute aspect_ratio
82 83 84 |
# File 'app/services/studio/email_catalog.rb', line 82 def aspect_ratio @aspect_ratio end |
#background ⇒ Object
Returns the value of attribute background
82 83 84 |
# File 'app/services/studio/email_catalog.rb', line 82 def background @background end |
#background_origin ⇒ Object
Returns the value of attribute background_origin
82 83 84 |
# File 'app/services/studio/email_catalog.rb', line 82 def background_origin @background_origin end |
#body ⇒ Object
Returns the value of attribute body
82 83 84 |
# File 'app/services/studio/email_catalog.rb', line 82 def body @body end |
#cta_color ⇒ Object
Returns the value of attribute cta_color
82 83 84 |
# File 'app/services/studio/email_catalog.rb', line 82 def cta_color @cta_color end |
#cta_enabled ⇒ Object
Returns the value of attribute cta_enabled
82 83 84 |
# File 'app/services/studio/email_catalog.rb', line 82 def cta_enabled @cta_enabled end |
#cta_text ⇒ Object
Returns the value of attribute cta_text
82 83 84 |
# File 'app/services/studio/email_catalog.rb', line 82 def cta_text @cta_text end |
#default_asset ⇒ Object
Returns the value of attribute default_asset
82 83 84 |
# File 'app/services/studio/email_catalog.rb', line 82 def default_asset @default_asset end |
#default_origin ⇒ Object
Returns the value of attribute default_origin
82 83 84 |
# File 'app/services/studio/email_catalog.rb', line 82 def default_origin @default_origin end |
#description ⇒ Object
Returns the value of attribute description
82 83 84 |
# File 'app/services/studio/email_catalog.rb', line 82 def description @description end |
#header ⇒ Object
Returns the value of attribute header
82 83 84 |
# File 'app/services/studio/email_catalog.rb', line 82 def header @header end |
#header_fallback ⇒ Object
Returns the value of attribute header_fallback
82 83 84 |
# File 'app/services/studio/email_catalog.rb', line 82 def header_fallback @header_fallback end |
#key ⇒ Object
Returns the value of attribute key
82 83 84 |
# File 'app/services/studio/email_catalog.rb', line 82 def key @key end |
#label ⇒ Object
Returns the value of attribute label
82 83 84 |
# File 'app/services/studio/email_catalog.rb', line 82 def label @label end |
#logo ⇒ Object
Returns the value of attribute logo
82 83 84 |
# File 'app/services/studio/email_catalog.rb', line 82 def logo @logo end |
#preview ⇒ Object
Returns the value of attribute preview
82 83 84 |
# File 'app/services/studio/email_catalog.rb', line 82 def preview @preview end |
#scrim ⇒ Object
Returns the value of attribute scrim
82 83 84 |
# File 'app/services/studio/email_catalog.rb', line 82 def scrim @scrim end |
#subject ⇒ Object
Returns the value of attribute subject
82 83 84 |
# File 'app/services/studio/email_catalog.rb', line 82 def subject @subject end |
#subtext ⇒ Object
Returns the value of attribute subtext
82 83 84 |
# File 'app/services/studio/email_catalog.rb', line 82 def subtext @subtext end |
#supports_cta ⇒ Object
Returns the value of attribute supports_cta
82 83 84 |
# File 'app/services/studio/email_catalog.rb', line 82 def supports_cta @supports_cta end |
#type ⇒ Object
Returns the value of attribute type
82 83 84 |
# File 'app/services/studio/email_catalog.rb', line 82 def type @type end |
Instance Method Details
#engine_artwork? ⇒ Boolean
WHOSE artwork default_asset names. Recorded at registration rather than inferred later: by the time the page asks, a resolved asset path looks identical whether the file came from the gem or from the host, and guessing from the path is exactly the wrong-answer machine this exists to remove. The engine seeds its own two as :engine; anything a host passes default_asset for is that host's own.
105 |
# File 'app/services/studio/email_catalog.rb', line 105 def engine_artwork? = default_origin.to_s != "app" |
#layered? ⇒ Boolean
Does THIS APP's artwork layer?
True when the app registered a background itself — that is the host saying "layer this email", whatever else it registered. Also true when the app has registered no artwork at all, so an app that touches nothing keeps the engine's layered banner.
False only in the case this exists for: the app registered its OWN flat asset and merely INHERITED a background it never asked for. turf-monster is exactly that — its magic_link carries a baked-in .jpg and inherits the engine's island art — and drawing live text over a picture it never sends is the failure this whole feature exists to prevent.
119 120 121 122 123 |
# File 'app/services/studio/email_catalog.rb', line 119 def layered? return true if background_origin.to_s == "app" engine_artwork? end |
#marketing? ⇒ Boolean
nil-safe: an Entry built directly (the STANDARD seed) may carry no type.
89 |
# File 'app/services/studio/email_catalog.rb', line 89 def marketing? = type.to_s == "marketing" |
#previewable? ⇒ Boolean
87 88 |
# File 'app/services/studio/email_catalog.rb', line 87 def previewable? = preview.respond_to?(:call) # nil-safe: an Entry built directly (the STANDARD seed) may carry no type. |
#ratio ⇒ Object
The shape of THIS email's banner — the box the page draws and the ratio the upload cropper enforces. Per-entry because the engine's own artwork is 3:1 while turf-monster's eight banners are 2:1; one global constant would letterbox one app's art and crop the other's on every upload.
129 |
# File 'app/services/studio/email_catalog.rb', line 129 def ratio = (aspect_ratio || ASPECT_RATIO).to_f |
#supports_cta? ⇒ Boolean
Can this email render a button AT ALL? An email's view has to have somewhere to send the reader — the sign-in link has a token URL, a "you're subscribed" note has nothing. OPT-IN, because an entry that has not said yes cannot be assumed to have a destination, and a Call-to-action card offered for an email whose template ignores it is a dead control: the operator ticks the box, saves, and no button ever appears.
97 |
# File 'app/services/studio/email_catalog.rb', line 97 def supports_cta? = supports_cta == true |
#to_s ⇒ Object
86 |
# File 'app/services/studio/email_catalog.rb', line 86 def to_s = key |