module Webui::Helper

Public Instance Methods

webui_module_path(source) click to toggle source

@param [String] source

# File lib/webui/helper.rb, line 21
def webui_module_path(source)
  javascript_path(source).sub('.js', '')
end
webui_modules_paths(path, relative_path, arr_name='modules') click to toggle source

@param [Array] path @param [String] arr_name @param [String] relative_path @return [String]

# File lib/webui/helper.rb, line 7
def webui_modules_paths(path, relative_path, arr_name='modules')
  files = Dir.glob(path.join(*%w( ** *.js)))
  files += Dir.glob(path.join(*%w( ** *.js.erb)))
  code = ''
  files.each do |file|
    module_name = file[0, file.index('.')]
    module_filename = javascript_path(module_name.sub(Rails.root.to_s + '/' + relative_path + '/', ''))
    code += arr_name + "['" + module_name.sub(path.to_s + '/', '') + "'] = '" + module_filename.sub('.js', '') + "'\n"
  end

  code
end