Module: Spree::EmailTemplateIdentity

Extended by:
ActiveSupport::Concern
Included in:
EmailTemplate, EmailTemplateDraft
Defined in:
app/models/concerns/spree/email_template_identity.rb

Overview

What a store's published email template and its draft share: which editable template they are, in which language, and the default they started from.

Constant Summary collapse

ANY_LOCALE =

The version every language uses. Never NULL, so the unique index on store, key and locale holds for it too.

'any'.freeze
LOCALE_FORMAT =
/\A(any|[a-z]{2,3}(-[A-Za-z0-9]{2,8})*)\z/

Instance Method Summary collapse

Instance Method Details

#default_changed?(default) ⇒ Boolean

Returns whether Spree's default changed since this version started from it.

Parameters:

Returns:

  • (Boolean) —

    whether Spree's default changed since this version started from it



34
35
36
37
38
# File 'app/models/concerns/spree/email_template_identity.rb', line 34

def default_changed?(default)
  return false unless default

  default.body != base_body || default.subject.to_s != base_subject.to_s
end

#definition ⇒ Spree::Emails::EditableTemplates::Definition?



28
29
30
# File 'app/models/concerns/spree/email_template_identity.rb', line 28

def definition
  Spree.editable_email_templates[key]
end