Sha256: cd61198278e39971da1ca89756d568b5eae17120bf79699df9d34539d4bd52d1

Contents?: true

Size: 1.04 KB

Versions: 25

Compression:

Stored size: 1.04 KB

Contents

require 'action_view'

module ErpApp
  module ApplicationResourceLoader
		class SharedLoader < ErpApp::ApplicationResourceLoader::BaseLoader
      
		  def locate_shared_files(resource_type, folder='shared')
  		  engine_dirs = Rails::Application::Railties.engines.map{|p| p.config.root.to_s}
        root_and_engines_dirs = ([Rails.root] | engine_dirs)

				# get shared resources (global js and css)
  			shared_files = []
  			root_and_engines_dirs.each do |engine_dir|
    			if File.exists? File.join(engine_dir,"public/#{resource_type.to_s}/erp_app", folder)
    		    shared_path = File.join(engine_dir,"public/#{resource_type.to_s}/erp_app", folder,"**/*.#{(resource_type == :javascripts) ? 'js' : 'css'}")
    		    paths = Dir.glob(shared_path)
            shared_files = (shared_files | paths.collect{|path| path.gsub(File.join(engine_dir,'public',resource_type.to_s,'/'),'')}).flatten
    		  end
        end

		    shared_files = sort_files(shared_files)
		  end

		end#SharedLoader
  end#ApplicationResourceLoader
end#ErpApp

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
erp_app-3.1.9 lib/erp_app/application_resource_loader/shared_loader.rb
erp_app-3.1.8 lib/erp_app/application_resource_loader/shared_loader.rb
erp_app-3.1.7 lib/erp_app/application_resource_loader/shared_loader.rb
erp_app-3.1.6 lib/erp_app/application_resource_loader/shared_loader.rb
erp_app-3.1.5 lib/erp_app/application_resource_loader/shared_loader.rb
erp_app-3.1.4 lib/erp_app/application_resource_loader/shared_loader.rb
erp_app-3.1.3 lib/erp_app/application_resource_loader/shared_loader.rb
erp_app-3.1.2 lib/erp_app/application_resource_loader/shared_loader.rb
erp_app-3.0.16 lib/erp_app/application_resource_loader/shared_loader.rb
erp_app-3.0.15 lib/erp_app/application_resource_loader/shared_loader.rb
erp_app-3.1.1 lib/erp_app/application_resource_loader/shared_loader.rb
erp_app-3.1.0 lib/erp_app/application_resource_loader/shared_loader.rb
erp_app-3.0.14 lib/erp_app/application_resource_loader/shared_loader.rb
erp_app-3.0.13 lib/erp_app/application_resource_loader/shared_loader.rb
erp_app-3.0.12 lib/erp_app/application_resource_loader/shared_loader.rb
erp_app-3.0.10 lib/erp_app/application_resource_loader/shared_loader.rb
erp_app-3.0.9 lib/erp_app/application_resource_loader/shared_loader.rb
erp_app-3.0.8 lib/erp_app/application_resource_loader/shared_loader.rb
erp_app-3.0.7 lib/erp_app/application_resource_loader/shared_loader.rb
erp_app-3.0.6 lib/erp_app/application_resource_loader/shared_loader.rb