Class: VendorMemberDecorator

Inherits:
VendorsDecorator show all
Defined in:
app/decorators/vendor_member_decorator.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class VendorsDecorator

Instance Method Details

#as_json(options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/decorators/vendor_member_decorator.rb', line 4

def as_json(options = {})
  {
    :name => model.name,
    :address_1 => model.address_1,
    :address_2 => model.address_2,
    :admin_notes => model.admin_notes,
    :categories => VendorCategoryDecorator.decorate(VendorCategory.widget_visible.ordered),
    :city => model.city,
    :contact_email => model.contact_email,
    :contact_full_name => model.contact_full_name,
    :contact_phone => model.contact_phone,
    :contact_title => model.contact_title,
    :country => model.country,
    :logo => model.logo_url,
    :nickname => model.nickname,
    :state => model.state,
    :vendors => VendorProxyDecorator.decorate(model.vendor_proxies.widget_visible),
    :website => model.website,
    :widget_form_text => config_render(:e9_vendors_widget_form_text),
    :widget_form_title => config_render(:e9_vendors_widget_form_title),
    :widget_title => config_render(:e9_vendors_widget_title),
    :zipcode => model.zipcode
  }
end

#widget_codeObject



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/decorators/vendor_member_decorator.rb', line 29

def widget_code
  <<-CODE
<script type="text/javascript" src="#{script_url}"></script>
<script type="text/javascript">
try {
  new E9.VendorWidget({
    code: "#{model.md5_hash}",
     url: "#{base_url}"
  }).render();
} catch (e) {}
</script>
  CODE
end