cirandas.net

ref: master

plugins/products/models/products_plugin/enterprise_homepage.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
module ProductsPlugin

  class EnterpriseHomepage < Article

    ##
    # Keep compatibility with previous core name
    #
    def self.sti_name
      'EnterpriseHomepage'
    end

    def self.type_name
      _('Homepage')
    end

    def self.short_description
      _('Enterprise homepage')
    end

    def self.description
      _('Display the summary of profile.')
    end

    def self.can_display_blocks?
      true
    end

    def can_display_hits?
      false
    end

    def can_display_media_panel?
      true
    end

    def name
      if self['name'].blank? then _('Homepage') else self['name'] end
    end

    def to_html(options = {})
      enterprise_homepage = self
      proc do
        extend EnterpriseHomepageHelper
        extend CatalogHelper
        catalog_load_index page: 1, show_categories: false
        render partial: 'content_viewer/enterprise_homepage', object: enterprise_homepage
      end
    end

    # disable cache because of products
    def cache_key params = {}, the_profile = nil, language = 'en'
      rand
    end

  end
end