Class: AdminEmailTemplateSerializer
Instance Method Summary
collapse
expire_cache_fragment!, fragment_cache
#include!
Instance Method Details
#body ⇒ Object
26
27
28
|
# File 'app/serializers/admin_email_template_serializer.rb', line 26
def body
@body ||= I18n.t("#{object}.text_body_template")
end
|
#can_revert? ⇒ Boolean
30
31
32
33
34
35
36
37
38
39
|
# File 'app/serializers/admin_email_template_serializer.rb', line 30
def can_revert?
subject_key = "#{object}.subject_template"
body_key = "#{object}.text_body_template"
keys = [subject_key, body_key]
if options[:overridden_keys]
keys.any? { |k| options[:overridden_keys].include?(k) }
else
TranslationOverride.exists?(locale: I18n.locale, translation_key: keys)
end
end
|
#id ⇒ Object
6
7
8
|
# File 'app/serializers/admin_email_template_serializer.rb', line 6
def id
object
end
|
#subject ⇒ Object
18
19
20
21
22
23
24
|
# File 'app/serializers/admin_email_template_serializer.rb', line 18
def subject
if I18n.exists?("#{object}.subject_template.other")
@subject = nil
else
@subject ||= I18n.t("#{object}.subject_template")
end
end
|
#title ⇒ Object
10
11
12
13
14
15
16
|
# File 'app/serializers/admin_email_template_serializer.rb', line 10
def title
if I18n.exists?("#{object}.title")
I18n.t("#{object}.title")
else
object.gsub(/.*\./, "").titleize
end
end
|