Class: ViewRenderScope

Inherits:
Object
  • Object
show all
Defined in:
lib/wdk-view-toolkit/js_partial/js.rb,
lib/wdk-view-toolkit/view_render.rb

Overview

js

Instance Method Summary collapse

Instance Method Details

#base_js(file) ⇒ Object



3
4
5
6
# File 'lib/wdk-view-toolkit/js_partial/js.rb', line 3

def base_js(file)
  is_base_file = file.include?( "application.js" ) || file.include?("routes.js")
  is_base_file
end

#include_jsObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/wdk-view-toolkit/js_partial/js.rb', line 8

def include_js
  template_path = File.expand_path('../', __FILE__)
  template = ""
  js_files = File.join("js","**", "*.js")
  Dir.glob js_files do |file|
    if ! base_js file
      template += Tilt.new("#{template_path}/_js_script_tag.haml").render self,  {:js_file_path => file}
    end
  end
  template += Tilt.new("#{template_path}/_js_script_tag.haml").render self,  {:js_file_path => "js/application.js"}
  template += Tilt.new("#{template_path}/_js_script_tag.haml").render self,  {:js_file_path => "js/routes.js"}
  template
end