Sha256: 3437fc227df04d0b38970b0221d0fbd417e79b0983359e6994e6f47fd24756be

Contents?: true

Size: 1.46 KB

Versions: 44

Compression:

Stored size: 1.46 KB

Contents

# frozen_string_literal: true

require "rails"
require "active_support/all"

require "decidim/core"
require "jquery-rails"
require "sassc-rails"
require "foundation-rails"
require "foundation_rails_helper"
require "autoprefixer-rails"

require "decidim/comments/query_extensions"
require "decidim/comments/mutation_extensions"

module Decidim
  module Comments
    # Decidim's core Rails Engine.
    class Engine < ::Rails::Engine
      isolate_namespace Decidim::Comments

      initializer "decidim_comments.assets" do |app|
        app.config.assets.precompile += %w(decidim_comments_manifest.js)
      end

      initializer "decidim_comments.query_extensions" do
        Comments::QueryExtensions.extend!(Decidim::Api::QueryType)
      end

      initializer "decidim_comments.mutation_extensions" do
        Comments::MutationExtensions.extend!(Decidim::Api::MutationType)
      end

      initializer "decidim.stats" do
        Decidim.stats.register :comments_count, priority: StatsRegistry::MEDIUM_PRIORITY do |features, start_at, end_at|
          Decidim.feature_manifests.sum do |feature|
            feature.stats.filter(tag: :comments).with_context(features, start_at, end_at).map { |_name, value| value }.sum
          end
        end
      end

      initializer "decidim_comments.inject_abilities_to_user" do |_app|
        Decidim.configure do |config|
          config.abilities += ["Decidim::Comments::Abilities::CurrentUserAbility"]
        end
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 2 rubygems

Version Path
decidim-comments-0.4.1 lib/decidim/comments/engine.rb
decidim-0.4.3 decidim-comments/lib/decidim/comments/engine.rb
decidim-0.4.2 decidim-comments/lib/decidim/comments/engine.rb
decidim-0.4.1 decidim-comments/lib/decidim/comments/engine.rb