module JRails

Constants

JQUERY_VAR

Public Class Methods

compressed?() click to toggle source
# File lib/jrails.rb, line 33
def self.compressed?   ; @@config[:compressed] ; end
config() click to toggle source
# File lib/jrails.rb, line 31
def self.config        ; @@config              ; end
google?() click to toggle source
# File lib/jrails.rb, line 32
def self.google?       ; @@config[:google]     ; end
jquery_path() click to toggle source
# File lib/jrails.rb, line 34
def self.jquery_path   ; @@jquery_path         ; end
jqueryui_i18n_path() click to toggle source
# File lib/jrails.rb, line 36
def self.jqueryui_i18n_path ; @@jqueryui_i18n_path  ; end
jqueryui_path() click to toggle source
# File lib/jrails.rb, line 35
def self.jqueryui_path ; @@jqueryui_path       ; end
load_config() click to toggle source
# File lib/jrails.rb, line 14
def self.load_config
  config_file = File.join("./", "config", "jrails.yml")
  if File.exist? config_file
    loaded_config = YAML.load_file(config_file)
    if loaded_config and loaded_config.key? Rails.env
      @@config.merge!(loaded_config[Rails.env].symbolize_keys)
      if google?
        @@jquery_path   = "http://ajax.googleapis.com/ajax/libs/jquery/#{@@config[:jquery_version]}/jquery#{".min" if compressed?}.js"
        @@jqueryui_path = "http://ajax.googleapis.com/ajax/libs/jqueryui/#{@@config[:jqueryui_version]}/jquery-ui#{".min" if compressed?}.js"
        @@jqueryui_i18n_path = "http://ajax.googleapis.com/ajax/libs/jqueryui/#{@@config[:jqueryui_version]}/i18n/jquery-ui-i18n#{".min" if compressed?}.js"
      end
    else
      raise Exception.new "Failed finding '#{Rails.env}' environment in config. check your 'config/jrails.yml' or delete that file "
    end
  end
end