Skip to content

Commit

Permalink
change default to use jQuery.noConflict
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronchi committed Aug 7, 2009
1 parent b4c2101 commit ea8b56b
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 34 deletions.
2 changes: 1 addition & 1 deletion VERSION.yml
@@ -1,4 +1,4 @@
---
:patch: 0
:patch: 1
:major: 0
:minor: 5
10 changes: 2 additions & 8 deletions bin/jrails
Expand Up @@ -14,22 +14,16 @@ task :help do
rakeapp.display_tasks_and_comments
end

desc "Copies the jQuery and jRails javascripts to public/javascripts"
task :update do
Rake::Task['jrails:update:javascripts'].invoke
end

desc 'Installs the jQuery and jRails javascripts to public/javascripts'
task :install do
Rake::Task['jrails:update:javascripts'].invoke
Rake::Task['jrails:js:install'].invoke
end

desc 'Remove the prototype / script.aculo.us javascript files'
task :scrub do
Rake::Task['jrails:update:scrub'].invoke
Rake::Task['jrails:js:scrub'].invoke
end


rakeapp.init("jrails")
task :default => [:help]

Expand Down
4 changes: 2 additions & 2 deletions jrails.gemspec
Expand Up @@ -5,11 +5,11 @@

Gem::Specification.new do |s|
s.name = %q{jrails}
s.version = "0.5.0"
s.version = "0.5.1"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Aaron Eisenberger", "Patrick Hurley"]
s.date = %q{2009-08-05}
s.date = %q{2009-08-07}
s.default_executable = %q{jrails}
s.description = %q{Using jRails, you can get all of the same default Rails helpers for javascript functionality using the lighter jQuery library.}
s.email = %q{aaronchi@gmail.com}
Expand Down
2 changes: 1 addition & 1 deletion lib/jrails.rb
Expand Up @@ -33,7 +33,7 @@ module PrototypeHelper
USE_PROTECTION = const_defined?(:DISABLE_JQUERY_FORGERY_PROTECTION) ? !DISABLE_JQUERY_FORGERY_PROTECTION : true

unless const_defined? :JQUERY_VAR
JQUERY_VAR = '$'
JQUERY_VAR = 'jQuery'
end

unless const_defined? :JQCALLBACKS
Expand Down
8 changes: 2 additions & 6 deletions rails/init.rb
@@ -1,18 +1,14 @@
# ====
# The following options can be changed by creating an initializer in config/initializers/jrails.rb
# ====
# ActionView::Helpers::PrototypeHelper::JQUERY_VAR

# jRails uses jQuery.noConflict() by default
# to use the regular jQuery syntax, use:
# to use the default jQuery varibale, use:
# ActionView::Helpers::PrototypeHelper::JQUERY_VAR = '$'
ActionView::Helpers::PrototypeHelper::JQUERY_VAR = 'jQuery'

# ActionView::Helpers::PrototypeHelper:: DISABLE_JQUERY_FORGERY_PROTECTION
# Set this to disable forgery protection in ajax calls
# This is handy if you want to use caching with ajax by injecting the forgery token via another means
# for an example, see http://henrik.nyh.se/2008/05/rails-authenticity-token-with-jquery
# ActionView::Helpers::PrototypeHelper::DISABLE_JQUERY_FORGERY_PROTECTION = true
# ====

ActionView::Helpers::AssetTagHelper::JAVASCRIPT_DEFAULT_SOURCES = ['jquery','jquery-ui','jrails']
ActionView::Helpers::AssetTagHelper::reset_javascript_include_default
Expand Down
29 changes: 13 additions & 16 deletions tasks/jrails.rake
@@ -1,28 +1,25 @@
namespace :jrails do
namespace :update do

namespace :js do
desc "Copies the jQuery and jRails javascripts to public/javascripts"
task :javascripts do
task :install do
puts "Copying files..."
project_dir = RAILS_ROOT + '/public/javascripts/'
scripts = Dir[File.join(File.dirname(__FILE__), '..', '/javascripts/', '*.js')]
FileUtils.cp(scripts, project_dir)
puts "files copied successfully."
end
end

namespace :install do
desc "Installs the jQuery and jRails javascripts to public/javascripts"
task :javascripts do
Rake::Task['jrails:update:javascripts'].invoke
end
end

desc 'Remove the prototype / script.aculo.us javascript files'
task :scrub do
files = %W[controls.js dragdrop.js effects.js prototype.js]
project_dir = File.join(RAILS_ROOT, 'public', 'javascripts')
files.each do |fname|
FileUtils.rm File.join(project_dir, fname)
desc 'Remove the prototype / script.aculo.us javascript files'
task :scrub do
puts "Removing files..."
files = %W[controls.js dragdrop.js effects.js prototype.js]
project_dir = File.join(RAILS_ROOT, 'public', 'javascripts')
files.each do |fname|
FileUtils.rm(File.join(project_dir, fname)) if File.exists?(File.join(project_dir, fname))
end
puts "files removed successfully."
end
end

end

0 comments on commit ea8b56b

Please sign in to comment.