Sha256: b5bfd6fe126a7694b1fadc44e0514c17f05fc603353d4e991e8a5933bec049b5

Contents?: true

Size: 1.23 KB

Versions: 30

Compression:

Stored size: 1.23 KB

Contents

# Used by assets.js.erb to reference
# images from Asset pipeline
module MnoEnterprise
  module Frontend
    module AssetsUtil
      def self.assets_url
        self.config["environments"][Rails.env]["assets"]
      end

      def self.server_host
        self.config["environments"][Rails.env]["host"]
      end

      def self.config
        @@config ||= YAML.load_file(File.join(Rails.root, 'config', 'assets.yml'))

        @@config
      end

      # Return the application root path
      def self.root_path
        Rails.root
      end

      # Return the engine root path
      def self.engine_root_path
        MnoEnterprise::Frontend::Engine.root
      end

      def self.images
        [self.root_path, self.engine_root_path].map do |base_path|
          Dir.glob(base_path.join("app/assets/images/**/*.*")).map do |path|
            path.gsub(base_path.join("app/assets/images/").to_s, "")
          end
        end.flatten.uniq
      end

      def self.templates
        [self.root_path, self.engine_root_path].map do |base_path|
          Dir.glob(base_path.join("app/assets/templates/**/*.*")).map do |path|
            path.gsub(base_path.join("app/assets/templates/").to_s, "")
          end
        end.flatten.uniq
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
mno-enterprise-frontend-3.4.0 lib/mno_enterprise/frontend/assets_util.rb
mno-enterprise-frontend-3.3.3 lib/mno_enterprise/frontend/assets_util.rb
mno-enterprise-frontend-3.3.2 lib/mno_enterprise/frontend/assets_util.rb
mno-enterprise-frontend-3.2.1 lib/mno_enterprise/frontend/assets_util.rb
mno-enterprise-frontend-3.3.1 lib/mno_enterprise/frontend/assets_util.rb
mno-enterprise-frontend-3.3.0 lib/mno_enterprise/frontend/assets_util.rb
mno-enterprise-frontend-3.2.0 lib/mno_enterprise/frontend/assets_util.rb
mno-enterprise-frontend-3.1.4 lib/mno_enterprise/frontend/assets_util.rb
mno-enterprise-frontend-3.0.7 lib/mno_enterprise/frontend/assets_util.rb
mno-enterprise-frontend-2.0.9 lib/mno_enterprise/frontend/assets_util.rb
mno-enterprise-frontend-3.1.3 lib/mno_enterprise/frontend/assets_util.rb
mno-enterprise-frontend-3.0.6 lib/mno_enterprise/frontend/assets_util.rb
mno-enterprise-frontend-2.0.8 lib/mno_enterprise/frontend/assets_util.rb
mno-enterprise-frontend-3.1.2 lib/mno_enterprise/frontend/assets_util.rb
mno-enterprise-frontend-3.0.5 lib/mno_enterprise/frontend/assets_util.rb
mno-enterprise-frontend-2.0.7 lib/mno_enterprise/frontend/assets_util.rb
mno-enterprise-frontend-2.0.6 lib/mno_enterprise/frontend/assets_util.rb
mno-enterprise-frontend-2.0.5 lib/mno_enterprise/frontend/assets_util.rb
mno-enterprise-frontend-3.1.1 lib/mno_enterprise/frontend/assets_util.rb
mno-enterprise-frontend-3.0.4 lib/mno_enterprise/frontend/assets_util.rb