cirandas.net

ref: master

plugins/products/lib/products_plugin/base.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
57
module ProductsPlugin
  class Base < Noosfero::Plugin

    def stylesheet?
      true
    end

    def js_files
      %w[products].map{ |j| "javascripts/#{j}" }
    end

    def self.extra_blocks
      {
        ProductsBlock => {type: [Enterprise] },
      }
    end

    def control_panel_buttons
      {
        title: _('Manage Products/Services'),
        icon:  'suppliers-manage-suppliers',
        url:   {controller: 'products_plugin/page'},
      } if profile.enterprise?
    end

    def profile_info_extra_contents
      lambda do
        render 'profile_editor/products_profile_info_contents'
      end
    end

    def content_types
      [EnterpriseHomepage] if context.respond_to?(:enterprise?) && context.enterprise?
    end

  end
end

# STI compatibility
Product                = ProductsPlugin::Product
ProductsBlock          = ProductsPlugin::ProductsBlock
ProductCategoriesBlock = ProductsPlugin::ProductCategoriesBlock
ProductCategory        = ProductsPlugin::ProductCategory
FeaturedProductsBlock  = ProductsPlugin::FeaturedProductsBlock

# compatibility
Unit               = ProductsPlugin::Unit
Input              = ProductsPlugin::Input
Qualifier          = ProductsPlugin::Qualifier
Certifier          = ProductsPlugin::Certifier
QualifierCertifier = ProductsPlugin::QualifierCertifier
ProductQualifier   = ProductsPlugin::ProductQualifier
ProductionCost     = ProductsPlugin::ProductionCost
PriceDetail        = ProductsPlugin::PriceDetail

EnterpriseHomepage = ProductsPlugin::EnterpriseHomepage