Class: ErpApp::Widgets::Loader
- Inherits:
-
Object
- Object
- ErpApp::Widgets::Loader
- Defined in:
- lib/erp_app/widgets/loader.rb
Class Method Summary collapse
- .load_compass_ae_widgets(config, engine) ⇒ Object
- .load_root_widgets(config) ⇒ Object
- .load_widget_extensions(engine) ⇒ Object
- .require_widgets_and_helpers(path) ⇒ Object
Class Method Details
.load_compass_ae_widgets(config, engine) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/erp_app/widgets/loader.rb', line 5 def (config, engine) ErpBaseErpSvcs.setup_compass_ae_callback(config, engine) do |engine| ::ErpApp::Widgets::Loader.(engine.root) ::ErpApp::Widgets::Loader.(engine) end end |
.load_root_widgets(config) ⇒ Object
12 13 14 15 16 |
# File 'lib/erp_app/widgets/loader.rb', line 12 def (config) ErpBaseErpSvcs.setup_compass_ae_callback(config, nil) do |engine| ::ErpApp::Widgets::Loader.(Rails.root.to_s) end end |
.load_widget_extensions(engine) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/erp_app/widgets/loader.rb', line 49 def (engine) = File.join(engine.root,"lib",engine.railtie_name,"extensions/widgets") = File.directory?() ? Dir.entries() : [] .delete_if{|name| name =~ /^\./} .each do || = Rails.application.config.erp_app..find{|item| item[:name] == } #load any extensions to existing widgets Dir.glob(File.join(,,"*.rb")).each do |file| load file end #add any additional view paths to widgets if File.directory?(File.join(,,'views')) view_path = File.join(,,'views') [:view_paths] << view_path #get all view files for theme generation (, view_path) end #overwrite with any extensions in rails root () end end |
.require_widgets_and_helpers(path) ⇒ Object
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 |
# File 'lib/erp_app/widgets/loader.rb', line 18 def (path) = [] = File.join(path,"/app/widgets/") = Dir.entries() if File.exists? .delete_if{|name| name =~ /^\./} .each do || = Rails.application.config.erp_app..find{|item| item[:name] == } if .nil? = { :name => , :path => File.join(,), :view_paths => [File.join(,,'views')], :view_files => [] } Rails.application.config.erp_app. << end load File.join([:path],'base.rb') #load helpers if File.exists? File.join([:path],'helpers') File.join([:path],'helpers','view') if File.directory? File.join([:path],'helpers','view') (File.join([:path],'helpers','controller'),) if File.directory? File.join([:path],'helpers','controller') end #get all view files for theme generation (, [:view_paths].first) #load root widget extensions that should override this widget () end end |