Class: Workarea::Storefront::ShareViewModel

Inherits:
ApplicationViewModel
  • Object
show all
Defined in:
app/view_models/workarea/storefront/share_view_model.rb

Instance Method Summary collapse

Instance Method Details

#friendly_fromObject



27
28
29
30
31
32
33
# File 'app/view_models/workarea/storefront/share_view_model.rb', line 27

def friendly_from
  if from_name.blank?
    from_email
  else
    from_name
  end
end

#friendly_toObject



35
36
37
38
39
40
41
# File 'app/view_models/workarea/storefront/share_view_model.rb', line 35

def friendly_to
  if to_name.present?
    "#{to_name} (#{to_email})"
  else
    to_email
  end
end

#fromObject



11
12
13
14
15
16
17
# File 'app/view_models/workarea/storefront/share_view_model.rb', line 11

def from
  if from_name.present?
    "#{from_name} <#{from_email}>"
  else
    from_email
  end
end

#from_emailObject



23
24
25
# File 'app/view_models/workarea/storefront/share_view_model.rb', line 23

def from_email
  model.from_email || options[:user].try(:email)
end

#from_nameObject



19
20
21
# File 'app/view_models/workarea/storefront/share_view_model.rb', line 19

def from_name
  model.from_name || options[:user].try(:name)
end

#toObject



3
4
5
6
7
8
9
# File 'app/view_models/workarea/storefront/share_view_model.rb', line 3

def to
  if to_name.present?
    "#{to_name} <#{to_email}>"
  else
    to_email
  end
end