<commit_before>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.profile.enterprise?
    end

  end
end

# STI compatibility
Product                = ProductsPlugin::Product
ProductsBlock          = ProductsPlugin::ProductsBlock
ProductCategoriesBlock = ProductsPlugin::ProductCategoriesBlock
ProductCategory        = ProductsPlugin::ProductCategory<commit_msg>products-plugin: do not assume context has a profile<commit_after>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.kind_of?(Enterprise)
    end

  end
end

# STI compatibility
Product                = ProductsPlugin::Product
ProductsBlock          = ProductsPlugin::ProductsBlock
ProductCategoriesBlock = ProductsPlugin::ProductCategoriesBlock
ProductCategory        = ProductsPlugin::ProductCategory
{'fraction_non_alphanumeric': 0.07824803149606299, 'fraction_numerical': 0.0, 'mean_word_length': 2.6963636363636363, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2880282', 'n_tokens_mistral': 575, 'n_tokens_neox': 549, 'n_words': 126}