Sha256: dd717354f59b73858f7fd1f7dc2f16c194ea22e7972a79ccee4d8c88d8d1d188

Contents?: true

Size: 1.08 KB

Versions: 8

Compression:

Stored size: 1.08 KB

Contents

class Inkling::HomeController < Inkling::BaseController

  layout 'inkling/manage'
  helper_method :dashboard_partials
    
  # protected
  #these methods would be better in a helper, but it seems helpers have issues loading from engines.
  def render_dashboard_partials
    for file in dashboard_partials
    	render(:file => file)
  	end
  end
  
  
  def dashboard_partials
    partials = []

    for engine in Rails.application.railties.engines
      dashboard_partials = scan_path_for_dashboard_partial(engine)
      partials += dashboard_partials if dashboard_partials.any?
    end
    
    partials += scan_path_for_dashboard_partial(Rails.application)
    
    partials
  end
  
  def scan_path_for_dashboard_partial(application)
    partials = []
    for path in application.paths.app.views
      if path =~ /views/
  	    if File.exist?("#{path}/inkling/home/")
  		    for entry in Dir.entries("#{path}/inkling/home/")
  			    if entry =~ /_dashboard\./
  				    partials << "#{path}/inkling/home/#{entry}"		
  			    end
  		    end
  	    end
      end    
    end
    
    partials
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
inkling-0.1.0 app/controllers/inkling/home_controller.rb
inkling-0.0.9 app/controllers/inkling/home_controller.rb
inkling-0.0.8 app/controllers/inkling/home_controller.rb
inkling-0.0.7 app/controllers/inkling/home_controller.rb
inkling-0.0.5 app/controllers/inkling/home_controller.rb
inkling-0.0.4 app/controllers/inkling/home_controller.rb
inkling-0.0.3a app/controllers/inkling/home_controller.rb
inkling-0.0.3 app/controllers/inkling/home_controller.rb