mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-18 00:00:12 +01:00
Installing jrails
This commit is contained in:
parent
66de0f9fd8
commit
be43b3ded8
20 changed files with 1269 additions and 0 deletions
188
public/javascripts/jquery-ui.js
vendored
Normal file
188
public/javascripts/jquery-ui.js
vendored
Normal file
File diff suppressed because one or more lines are too long
19
public/javascripts/jquery.js
vendored
Normal file
19
public/javascripts/jquery.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
public/javascripts/jrails.js
Normal file
1
public/javascripts/jrails.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
(function($){$.ajaxSettings.accepts._default="text/javascript, text/html, application/xml, text/xml, */*"})(jQuery);(function($){$.fn.reset=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()}})};$.fn.enable=function(){return this.each(function(){this.disabled=false})};$.fn.disable=function(){return this.each(function(){this.disabled=true})}})(jQuery);(function($){$.extend({fieldEvent:function(el,obs){var field=el[0]||el,e="change";if(field.type=="radio"||field.type=="checkbox"){e="click"}else{if(obs&&(field.type=="text"||field.type=="textarea"||field.type=="password")){e="keyup"}}return e}});$.fn.extend({delayedObserver:function(delay,callback){var el=$(this);if(typeof window.delayedObserverStack=="undefined"){window.delayedObserverStack=[]}if(typeof window.delayedObserverCallback=="undefined"){window.delayedObserverCallback=function(stackPos){var observed=window.delayedObserverStack[stackPos];if(observed.timer){clearTimeout(observed.timer)}observed.timer=setTimeout(function(){observed.timer=null;observed.callback(observed.obj,observed.obj.formVal())},observed.delay*1000);observed.oldVal=observed.obj.formVal()}}window.delayedObserverStack.push({obj:el,timer:null,delay:delay,oldVal:el.formVal(),callback:callback});var stackPos=window.delayedObserverStack.length-1;if(el[0].tagName=="FORM"){$(":input",el).each(function(){var field=$(this);field.bind($.fieldEvent(field,delay),function(){var observed=window.delayedObserverStack[stackPos];if(observed.obj.formVal()==observed.oldVal){return}else{window.delayedObserverCallback(stackPos)}})})}else{el.bind($.fieldEvent(el,delay),function(){var observed=window.delayedObserverStack[stackPos];if(observed.obj.formVal()==observed.oldVal){return}else{window.delayedObserverCallback(stackPos)}})}},formVal:function(){var el=this[0];if(el.tagName=="FORM"){return this.serialize()}if(el.type=="checkbox"||el.type=="radio"){return this.filter("input:checked").val()||""}else{return this.val()}}})})(jQuery);(function($){$.fn.extend({visualEffect:function(o,options){if(options){speed=options.duration*1000}else{speed=null}e=o.replace(/\_(.)/g,function(m,l){return l.toUpperCase()});return eval("$(this)."+e+"("+speed+")")},appear:function(speed,callback){return this.fadeIn(speed,callback)},blindDown:function(speed,callback){return this.show("blind",{direction:"vertical"},speed,callback)},blindUp:function(speed,callback){return this.hide("blind",{direction:"vertical"},speed,callback)},blindRight:function(speed,callback){return this.show("blind",{direction:"horizontal"},speed,callback)},blindLeft:function(speed,callback){this.hide("blind",{direction:"horizontal"},speed,callback);return this},dropOut:function(speed,callback){return this.hide("drop",{direction:"down"},speed,callback)},dropIn:function(speed,callback){return this.show("drop",{direction:"up"},speed,callback)},fade:function(speed,callback){return this.fadeOut(speed,callback)},fadeToggle:function(speed,callback){return this.animate({opacity:"toggle"},speed,callback)},fold:function(speed,callback){return this.hide("fold",{},speed,callback)},foldOut:function(speed,callback){return this.show("fold",{},speed,callback)},grow:function(speed,callback){return this.show("scale",{},speed,callback)},highlight:function(speed,callback){return this.show("highlight",{},speed,callback)},puff:function(speed,callback){return this.hide("puff",{},speed,callback)},pulsate:function(speed,callback){return this.show("pulsate",{},speed,callback)},shake:function(speed,callback){return this.show("shake",{},speed,callback)},shrink:function(speed,callback){return this.hide("scale",{},speed,callback)},squish:function(speed,callback){return this.hide("scale",{origin:["top","left"]},speed,callback)},slideUp:function(speed,callback){return this.hide("slide",{direction:"up"},speed,callback)},slideDown:function(speed,callback){return this.show("slide",{direction:"up"},speed,callback)},switchOff:function(speed,callback){return this.hide("clip",{},speed,callback)},switchOn:function(speed,callback){return this.show("clip",{},speed,callback)}})})(jQuery);
|
||||
1
vendor/plugins/jrails/.gitignore
vendored
Normal file
1
vendor/plugins/jrails/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
pkg/*
|
||||
43
vendor/plugins/jrails/CHANGELOG
vendored
Normal file
43
vendor/plugins/jrails/CHANGELOG
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
0.5.0 (31 July 2009)
|
||||
* Gemification
|
||||
* Support for Ruby 1.9.X
|
||||
* Updated to jQuery 1.3.2
|
||||
* Updated to jQuery UI 1.7.2
|
||||
* Created a jrails binary (runs rake tasks) because rails does not (yet?) pickup
|
||||
tasks from gem plugins
|
||||
* Changed default to use jQuery compatibility name (not $)
|
||||
* Created a scrub task that will remove the prototype / script.aculo.us
|
||||
javascript files
|
||||
* better approximate scriptaculous effect names
|
||||
* add support for page[:element_id].visual_effect(:effect) as well as page.visual_effect(:effect, :element_id)
|
||||
* added a reset form function to jrails.js (stolen from jquery form)
|
||||
* can now use jquery selectors in all functions
|
||||
* added javascript_function helper to render inline rjs helpers
|
||||
* better support for sortable_element
|
||||
|
||||
0.4.0 (16 June 2008)
|
||||
* updated to jquery-ui 1.5 & merged js into single file
|
||||
* Added jQuery.noConflict support
|
||||
* support for value/val
|
||||
* additional support for update/delete methods
|
||||
* support for success/failure hash
|
||||
* setRequestHeader now gets called globally
|
||||
* Better support for droppables, sortables
|
||||
* Add support for prototype AJAX callbacks
|
||||
* better support for AJAX form calls
|
||||
|
||||
0.3.0 (22 Feb 2008)
|
||||
* updated to jquery-fx 1.0b and jquery-ui 1.5b
|
||||
* Add text/javascript request header to fix format.js
|
||||
* Added Tasks (thanks ggarside)
|
||||
* Improve visual_effects methods
|
||||
* Fixed some RJS calls
|
||||
* Fixed observer code for ie
|
||||
|
||||
0.2.0 (26 Nov 2007)
|
||||
* Vastly Improved FX
|
||||
* Improved Form Observers
|
||||
* Fixed Rails <= 1.2.6 Compatibility
|
||||
|
||||
0.1.0 (15 Nov 2007)
|
||||
* Initial release
|
||||
18
vendor/plugins/jrails/LICENSE
vendored
Normal file
18
vendor/plugins/jrails/LICENSE
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
Copyright (c) 2008 Aaron Eisenberger
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
21
vendor/plugins/jrails/README.rdoc
vendored
Normal file
21
vendor/plugins/jrails/README.rdoc
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
= jRails
|
||||
|
||||
jRails is a drop-in jQuery replacement for the Rails Prototype/script.aculo.us helpers.
|
||||
|
||||
== Resources
|
||||
|
||||
Install
|
||||
|
||||
* .script/plugin install git://github.com/aaronchi/jrails.git
|
||||
|
||||
Project Site
|
||||
|
||||
* http://code.google.com/p/ennerchi
|
||||
|
||||
Web Site
|
||||
|
||||
* http://www.ennerchi.com/projects/jrails
|
||||
|
||||
Group Site
|
||||
|
||||
* http://groups.google.com/group/jrails
|
||||
18
vendor/plugins/jrails/Rakefile
vendored
Normal file
18
vendor/plugins/jrails/Rakefile
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
require 'rubygems'
|
||||
require 'rake'
|
||||
|
||||
begin
|
||||
require 'jeweler'
|
||||
Jeweler::Tasks.new do |gem|
|
||||
gem.name = "jrails"
|
||||
gem.summary = "jRails is a drop-in jQuery replacement for the Rails Prototype/script.aculo.us helpers."
|
||||
gem.description = "Using jRails, you can get all of the same default Rails helpers for javascript functionality using the lighter jQuery library."
|
||||
gem.email = "aaronchi@gmail.com"
|
||||
gem.homepage = "http://ennerchi.com/projects/jrails"
|
||||
gem.authors = ["Aaron Eisenberger", "Patrick Hurley"]
|
||||
gem.rubyforge_project = "jrails"
|
||||
gem.files = FileList["[A-Z]*.rb","{bin,javascripts,lib,rails,tasks}/**/*"]
|
||||
end
|
||||
rescue LoadError
|
||||
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
||||
end
|
||||
4
vendor/plugins/jrails/VERSION.yml
vendored
Normal file
4
vendor/plugins/jrails/VERSION.yml
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
:patch: 1
|
||||
:major: 0
|
||||
:minor: 5
|
||||
30
vendor/plugins/jrails/bin/jrails
vendored
Executable file
30
vendor/plugins/jrails/bin/jrails
vendored
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require 'rubygems'
|
||||
require 'rake'
|
||||
|
||||
RAILS_ROOT = Dir.pwd
|
||||
rakeapp = Rake.application
|
||||
fname =File.join(File.dirname(__FILE__), '..', 'tasks', 'jrails.rake')
|
||||
load fname
|
||||
|
||||
task :help do
|
||||
puts "jrails [command]\n\n"
|
||||
rakeapp.options.show_task_pattern = Regexp.new('^[hius]')
|
||||
rakeapp.display_tasks_and_comments
|
||||
end
|
||||
|
||||
desc 'Installs the jQuery and jRails javascripts to public/javascripts'
|
||||
task :install do
|
||||
Rake::Task['jrails:js:install'].invoke
|
||||
end
|
||||
|
||||
desc 'Remove the prototype / script.aculo.us javascript files'
|
||||
task :scrub do
|
||||
Rake::Task['jrails:js:scrub'].invoke
|
||||
end
|
||||
|
||||
rakeapp.init("jrails")
|
||||
task :default => [:help]
|
||||
|
||||
rakeapp.top_level
|
||||
1
vendor/plugins/jrails/init.rb
vendored
Normal file
1
vendor/plugins/jrails/init.rb
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
require 'rails/init.rb'
|
||||
9
vendor/plugins/jrails/install.rb
vendored
Normal file
9
vendor/plugins/jrails/install.rb
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# Install hook code here
|
||||
puts "Copying files..."
|
||||
dir = "javascripts"
|
||||
["jquery-ui.js", "jquery.js", "jrails.js"].each do |js_file|
|
||||
dest_file = File.join(RAILS_ROOT, "public", dir, js_file)
|
||||
src_file = File.join(File.dirname(__FILE__) , dir, js_file)
|
||||
FileUtils.cp_r(src_file, dest_file)
|
||||
end
|
||||
puts "Files copied - Installation complete!"
|
||||
188
vendor/plugins/jrails/javascripts/jquery-ui.js
vendored
Normal file
188
vendor/plugins/jrails/javascripts/jquery-ui.js
vendored
Normal file
File diff suppressed because one or more lines are too long
19
vendor/plugins/jrails/javascripts/jquery.js
vendored
Normal file
19
vendor/plugins/jrails/javascripts/jquery.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
vendor/plugins/jrails/javascripts/jrails.js
vendored
Normal file
1
vendor/plugins/jrails/javascripts/jrails.js
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
(function($){$.ajaxSettings.accepts._default="text/javascript, text/html, application/xml, text/xml, */*"})(jQuery);(function($){$.fn.reset=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()}})};$.fn.enable=function(){return this.each(function(){this.disabled=false})};$.fn.disable=function(){return this.each(function(){this.disabled=true})}})(jQuery);(function($){$.extend({fieldEvent:function(el,obs){var field=el[0]||el,e="change";if(field.type=="radio"||field.type=="checkbox"){e="click"}else{if(obs&&(field.type=="text"||field.type=="textarea"||field.type=="password")){e="keyup"}}return e}});$.fn.extend({delayedObserver:function(delay,callback){var el=$(this);if(typeof window.delayedObserverStack=="undefined"){window.delayedObserverStack=[]}if(typeof window.delayedObserverCallback=="undefined"){window.delayedObserverCallback=function(stackPos){var observed=window.delayedObserverStack[stackPos];if(observed.timer){clearTimeout(observed.timer)}observed.timer=setTimeout(function(){observed.timer=null;observed.callback(observed.obj,observed.obj.formVal())},observed.delay*1000);observed.oldVal=observed.obj.formVal()}}window.delayedObserverStack.push({obj:el,timer:null,delay:delay,oldVal:el.formVal(),callback:callback});var stackPos=window.delayedObserverStack.length-1;if(el[0].tagName=="FORM"){$(":input",el).each(function(){var field=$(this);field.bind($.fieldEvent(field,delay),function(){var observed=window.delayedObserverStack[stackPos];if(observed.obj.formVal()==observed.oldVal){return}else{window.delayedObserverCallback(stackPos)}})})}else{el.bind($.fieldEvent(el,delay),function(){var observed=window.delayedObserverStack[stackPos];if(observed.obj.formVal()==observed.oldVal){return}else{window.delayedObserverCallback(stackPos)}})}},formVal:function(){var el=this[0];if(el.tagName=="FORM"){return this.serialize()}if(el.type=="checkbox"||el.type=="radio"){return this.filter("input:checked").val()||""}else{return this.val()}}})})(jQuery);(function($){$.fn.extend({visualEffect:function(o,options){if(options){speed=options.duration*1000}else{speed=null}e=o.replace(/\_(.)/g,function(m,l){return l.toUpperCase()});return eval("$(this)."+e+"("+speed+")")},appear:function(speed,callback){return this.fadeIn(speed,callback)},blindDown:function(speed,callback){return this.show("blind",{direction:"vertical"},speed,callback)},blindUp:function(speed,callback){return this.hide("blind",{direction:"vertical"},speed,callback)},blindRight:function(speed,callback){return this.show("blind",{direction:"horizontal"},speed,callback)},blindLeft:function(speed,callback){this.hide("blind",{direction:"horizontal"},speed,callback);return this},dropOut:function(speed,callback){return this.hide("drop",{direction:"down"},speed,callback)},dropIn:function(speed,callback){return this.show("drop",{direction:"up"},speed,callback)},fade:function(speed,callback){return this.fadeOut(speed,callback)},fadeToggle:function(speed,callback){return this.animate({opacity:"toggle"},speed,callback)},fold:function(speed,callback){return this.hide("fold",{},speed,callback)},foldOut:function(speed,callback){return this.show("fold",{},speed,callback)},grow:function(speed,callback){return this.show("scale",{},speed,callback)},highlight:function(speed,callback){return this.show("highlight",{},speed,callback)},puff:function(speed,callback){return this.hide("puff",{},speed,callback)},pulsate:function(speed,callback){return this.show("pulsate",{},speed,callback)},shake:function(speed,callback){return this.show("shake",{},speed,callback)},shrink:function(speed,callback){return this.hide("scale",{},speed,callback)},squish:function(speed,callback){return this.hide("scale",{origin:["top","left"]},speed,callback)},slideUp:function(speed,callback){return this.hide("slide",{direction:"up"},speed,callback)},slideDown:function(speed,callback){return this.show("slide",{direction:"up"},speed,callback)},switchOff:function(speed,callback){return this.hide("clip",{},speed,callback)},switchOn:function(speed,callback){return this.show("clip",{},speed,callback)}})})(jQuery);
|
||||
197
vendor/plugins/jrails/javascripts/sources/jrails.js
vendored
Normal file
197
vendor/plugins/jrails/javascripts/sources/jrails.js
vendored
Normal file
|
|
@ -0,0 +1,197 @@
|
|||
/*
|
||||
*
|
||||
* jRails ajax extras
|
||||
* version 0.1
|
||||
* <aaron@ennerchi.com> | http://www.ennerchi.com
|
||||
*
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
$.ajaxSettings.accepts._default = "text/javascript, text/html, application/xml, text/xml, */*";
|
||||
})(jQuery);
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* jRails form extras
|
||||
* <aaron@ennerchi.com> | http://www.ennerchi.com
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
(function($) {
|
||||
// reset a form
|
||||
$.fn.reset = function() {
|
||||
return this.each(function() {
|
||||
// guard against an input with the name of 'reset'
|
||||
// note that IE reports the reset function as an 'object'
|
||||
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
|
||||
this.reset();
|
||||
});
|
||||
};
|
||||
// enable a form element
|
||||
$.fn.enable = function() {
|
||||
return this.each(function() {
|
||||
this.disabled = false;
|
||||
});
|
||||
};
|
||||
// disable a form element
|
||||
$.fn.disable = function() {
|
||||
return this.each(function() {
|
||||
this.disabled = true;
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
/*
|
||||
*
|
||||
* jRails form observer plugin
|
||||
* version 0.2
|
||||
* <aaron@ennerchi.com> | http://www.ennerchi.com
|
||||
*
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
$.extend({ // Translate field to event
|
||||
fieldEvent: function(el, obs) {
|
||||
var field = el[0] || el, e = 'change';
|
||||
if (field.type == 'radio' || field.type == 'checkbox') e = 'click';
|
||||
else if (obs && (field.type == 'text' || field.type == 'textarea' || field.type == 'password')) e = 'keyup';
|
||||
return e;
|
||||
}
|
||||
});
|
||||
$.fn.extend({ // Delayed observer for fields and forms
|
||||
delayedObserver: function(delay, callback){
|
||||
var el = $(this);
|
||||
if (typeof window.delayedObserverStack == 'undefined') window.delayedObserverStack = [];
|
||||
if (typeof window.delayedObserverCallback == 'undefined') {
|
||||
window.delayedObserverCallback = function(stackPos) {
|
||||
var observed = window.delayedObserverStack[stackPos];
|
||||
if (observed.timer) clearTimeout(observed.timer);
|
||||
observed.timer = setTimeout(function(){
|
||||
observed.timer = null;
|
||||
observed.callback(observed.obj, observed.obj.formVal());
|
||||
}, observed.delay * 1000);
|
||||
observed.oldVal = observed.obj.formVal();
|
||||
};
|
||||
}
|
||||
window.delayedObserverStack.push({
|
||||
obj: el, timer: null, delay: delay,
|
||||
oldVal: el.formVal(), callback: callback
|
||||
});
|
||||
var stackPos = window.delayedObserverStack.length-1;
|
||||
if (el[0].tagName == 'FORM') {
|
||||
$(':input', el).each(function(){
|
||||
var field = $(this);
|
||||
field.bind($.fieldEvent(field, delay), function(){
|
||||
var observed = window.delayedObserverStack[stackPos];
|
||||
if (observed.obj.formVal() == observed.oldVal) return;
|
||||
else window.delayedObserverCallback(stackPos);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
el.bind($.fieldEvent(el, delay), function(){
|
||||
var observed = window.delayedObserverStack[stackPos];
|
||||
if (observed.obj.formVal() == observed.oldVal) return;
|
||||
else window.delayedObserverCallback(stackPos);
|
||||
});
|
||||
};
|
||||
},
|
||||
formVal: function() { // Gets form values
|
||||
var el = this[0];
|
||||
if(el.tagName == 'FORM') return this.serialize();
|
||||
if(el.type == 'checkbox' || el.type == 'radio') return this.filter('input:checked').val() || '';
|
||||
else return this.val();
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
/*
|
||||
*
|
||||
* jRails visual effects stubs
|
||||
* version 0.2
|
||||
* <aaron@ennerchi.com> | http://www.ennerchi.com
|
||||
*
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
$.fn.extend({
|
||||
visualEffect : function(o, options) {
|
||||
if (options) {
|
||||
speed = options.duration * 1000;
|
||||
} else {
|
||||
speed = null;
|
||||
}
|
||||
e = o.replace(/\_(.)/g, function(m, l){return l.toUpperCase()});
|
||||
return eval('$(this).'+e+'('+ speed + ')');
|
||||
},
|
||||
appear : function(speed, callback) {
|
||||
return this.fadeIn(speed, callback);
|
||||
},
|
||||
blindDown : function(speed, callback) {
|
||||
return this.show('blind', { direction: 'vertical' }, speed, callback);
|
||||
},
|
||||
blindUp : function(speed, callback) {
|
||||
return this.hide('blind', { direction: 'vertical' }, speed, callback);
|
||||
},
|
||||
blindRight : function(speed, callback) {
|
||||
return this.show('blind', { direction: 'horizontal' }, speed, callback);
|
||||
},
|
||||
blindLeft : function(speed, callback) {
|
||||
this.hide('blind', { direction: 'horizontal' }, speed, callback);
|
||||
return this;
|
||||
},
|
||||
dropOut : function(speed, callback) {
|
||||
return this.hide('drop', {direction: 'down' }, speed, callback);
|
||||
},
|
||||
dropIn : function(speed, callback) {
|
||||
return this.show('drop', { direction: 'up' }, speed, callback);
|
||||
},
|
||||
fade : function(speed, callback) {
|
||||
return this.fadeOut(speed, callback);
|
||||
},
|
||||
fadeToggle : function(speed, callback) {
|
||||
return this.animate({opacity: 'toggle'}, speed, callback);
|
||||
},
|
||||
fold : function(speed, callback) {
|
||||
return this.hide('fold', {}, speed, callback);
|
||||
},
|
||||
foldOut : function(speed, callback) {
|
||||
return this.show('fold', {}, speed, callback);
|
||||
},
|
||||
grow : function(speed, callback) {
|
||||
return this.show('scale', {}, speed, callback);
|
||||
},
|
||||
highlight : function(speed, callback) {
|
||||
return this.show('highlight', {}, speed, callback);
|
||||
},
|
||||
puff : function(speed, callback) {
|
||||
return this.hide('puff', {}, speed, callback);
|
||||
},
|
||||
pulsate : function(speed, callback) {
|
||||
return this.show('pulsate', {}, speed, callback);
|
||||
},
|
||||
shake : function(speed, callback) {
|
||||
return this.show('shake', {}, speed, callback);
|
||||
},
|
||||
shrink : function(speed, callback) {
|
||||
return this.hide('scale', {}, speed, callback);
|
||||
},
|
||||
squish : function(speed, callback) {
|
||||
return this.hide('scale', { origin: ['top', 'left'] }, speed, callback);
|
||||
},
|
||||
slideUp : function(speed, callback) {
|
||||
return this.hide('slide', { direction: 'up'}, speed, callback);
|
||||
},
|
||||
slideDown : function(speed, callback) {
|
||||
return this.show('slide', { direction: 'up'}, speed, callback);
|
||||
},
|
||||
switchOff : function(speed, callback) {
|
||||
return this.hide('clip', {}, speed, callback);
|
||||
},
|
||||
switchOn : function(speed, callback) {
|
||||
return this.show('clip', {}, speed, callback);
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
50
vendor/plugins/jrails/jrails.gemspec
vendored
Normal file
50
vendor/plugins/jrails/jrails.gemspec
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# Generated by jeweler
|
||||
# DO NOT EDIT THIS FILE
|
||||
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = %q{jrails}
|
||||
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-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}
|
||||
s.executables = ["jrails"]
|
||||
s.extra_rdoc_files = [
|
||||
"CHANGELOG",
|
||||
"LICENSE",
|
||||
"README.rdoc"
|
||||
]
|
||||
s.files = [
|
||||
"bin/jrails",
|
||||
"init.rb",
|
||||
"install.rb",
|
||||
"javascripts/jquery-ui.js",
|
||||
"javascripts/jquery.js",
|
||||
"javascripts/jrails.js",
|
||||
"javascripts/sources/jrails.js",
|
||||
"lib/jrails.rb",
|
||||
"rails/init.rb",
|
||||
"tasks/jrails.rake"
|
||||
]
|
||||
s.homepage = %q{http://ennerchi.com/projects/jrails}
|
||||
s.rdoc_options = ["--charset=UTF-8"]
|
||||
s.require_paths = ["lib"]
|
||||
s.rubyforge_project = %q{jrails}
|
||||
s.rubygems_version = %q{1.3.5}
|
||||
s.summary = %q{jRails is a drop-in jQuery replacement for the Rails Prototype/script.aculo.us helpers.}
|
||||
|
||||
if s.respond_to? :specification_version then
|
||||
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
||||
s.specification_version = 3
|
||||
|
||||
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
||||
else
|
||||
end
|
||||
else
|
||||
end
|
||||
end
|
||||
421
vendor/plugins/jrails/lib/jrails.rb
vendored
Normal file
421
vendor/plugins/jrails/lib/jrails.rb
vendored
Normal file
|
|
@ -0,0 +1,421 @@
|
|||
module ActionView
|
||||
module Helpers
|
||||
|
||||
module JavaScriptHelper
|
||||
|
||||
# This function can be used to render rjs inline
|
||||
#
|
||||
# <%= javascript_function do |page|
|
||||
# page.replace_html :list, :partial => 'list', :object => @list
|
||||
# end %>
|
||||
#
|
||||
def javascript_function(*args, &block)
|
||||
html_options = args.extract_options!
|
||||
function = args[0] || ''
|
||||
|
||||
html_options.symbolize_keys!
|
||||
function = update_page(&block) if block_given?
|
||||
javascript_tag(function)
|
||||
end
|
||||
|
||||
def jquery_id(id)
|
||||
id.to_s.count('#.*,>+~:[/ ') == 0 ? "##{id}" : id
|
||||
end
|
||||
|
||||
def jquery_ids(ids)
|
||||
Array(ids).map{|id| jquery_id(id)}.join(',')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
module PrototypeHelper
|
||||
|
||||
USE_PROTECTION = const_defined?(:DISABLE_JQUERY_FORGERY_PROTECTION) ? !DISABLE_JQUERY_FORGERY_PROTECTION : true
|
||||
|
||||
unless const_defined? :JQUERY_VAR
|
||||
JQUERY_VAR = 'jQuery'
|
||||
end
|
||||
|
||||
unless const_defined? :JQCALLBACKS
|
||||
JQCALLBACKS = Set.new([ :beforeSend, :complete, :error, :success ] + (100..599).to_a)
|
||||
#instance_eval { remove_const :AJAX_OPTIONS }
|
||||
remove_const(:AJAX_OPTIONS) if const_defined?(:AJAX_OPTIONS)
|
||||
AJAX_OPTIONS = Set.new([ :before, :after, :condition, :url,
|
||||
:asynchronous, :method, :insertion, :position,
|
||||
:form, :with, :update, :script ]).merge(JQCALLBACKS)
|
||||
end
|
||||
|
||||
def periodically_call_remote(options = {})
|
||||
frequency = options[:frequency] || 10 # every ten seconds by default
|
||||
code = "setInterval(function() {#{remote_function(options)}}, #{frequency} * 1000)"
|
||||
javascript_tag(code)
|
||||
end
|
||||
|
||||
def remote_function(options)
|
||||
javascript_options = options_for_ajax(options)
|
||||
|
||||
update = ''
|
||||
if options[:update] && options[:update].is_a?(Hash)
|
||||
update = []
|
||||
update << "success:'#{options[:update][:success]}'" if options[:update][:success]
|
||||
update << "failure:'#{options[:update][:failure]}'" if options[:update][:failure]
|
||||
update = '{' + update.join(',') + '}'
|
||||
elsif options[:update]
|
||||
update << "'#{options[:update]}'"
|
||||
end
|
||||
|
||||
function = "#{JQUERY_VAR}.ajax(#{javascript_options})"
|
||||
|
||||
function = "#{options[:before]}; #{function}" if options[:before]
|
||||
function = "#{function}; #{options[:after]}" if options[:after]
|
||||
function = "if (#{options[:condition]}) { #{function}; }" if options[:condition]
|
||||
function = "if (confirm('#{escape_javascript(options[:confirm])}')) { #{function}; }" if options[:confirm]
|
||||
return function
|
||||
end
|
||||
|
||||
class JavaScriptGenerator
|
||||
module GeneratorMethods
|
||||
|
||||
def insert_html(position, id, *options_for_render)
|
||||
insertion = position.to_s.downcase
|
||||
insertion = 'append' if insertion == 'bottom'
|
||||
insertion = 'prepend' if insertion == 'top'
|
||||
call "#{JQUERY_VAR}(\"#{jquery_id(id)}\").#{insertion}", render(*options_for_render)
|
||||
end
|
||||
|
||||
def replace_html(id, *options_for_render)
|
||||
insert_html(:html, id, *options_for_render)
|
||||
end
|
||||
|
||||
def replace(id, *options_for_render)
|
||||
call "#{JQUERY_VAR}(\"#{jquery_id(id)}\").replaceWith", render(*options_for_render)
|
||||
end
|
||||
|
||||
def remove(*ids)
|
||||
call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").remove"
|
||||
end
|
||||
|
||||
def show(*ids)
|
||||
call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").show"
|
||||
end
|
||||
|
||||
def hide(*ids)
|
||||
call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").hide"
|
||||
end
|
||||
|
||||
def toggle(*ids)
|
||||
call "#{JQUERY_VAR}(\"#{jquery_ids(ids)}\").toggle"
|
||||
end
|
||||
|
||||
def jquery_id(id)
|
||||
id.to_s.count('#.*,>+~:[/ ') == 0 ? "##{id}" : id
|
||||
end
|
||||
|
||||
def jquery_ids(ids)
|
||||
Array(ids).map{|id| jquery_id(id)}.join(',')
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
def options_for_ajax(options)
|
||||
js_options = build_callbacks(options)
|
||||
|
||||
url_options = options[:url]
|
||||
url_options = url_options.merge(:escape => false) if url_options.is_a?(Hash)
|
||||
js_options['url'] = "'#{url_for(url_options)}'"
|
||||
js_options['async'] = false if options[:type] == :synchronous
|
||||
js_options['type'] = options[:method] ? method_option_to_s(options[:method]) : ( options[:form] ? "'post'" : nil )
|
||||
js_options['dataType'] = options[:datatype] ? "'#{options[:datatype]}'" : (options[:update] ? nil : "'script'")
|
||||
|
||||
if options[:form]
|
||||
js_options['data'] = "#{JQUERY_VAR}.param(#{JQUERY_VAR}(this).serializeArray())"
|
||||
elsif options[:submit]
|
||||
js_options['data'] = "#{JQUERY_VAR}(\"##{options[:submit]} :input\").serialize()"
|
||||
elsif options[:with]
|
||||
js_options['data'] = options[:with].gsub("Form.serialize(this.form)","#{JQUERY_VAR}.param(#{JQUERY_VAR}(this.form).serializeArray())")
|
||||
end
|
||||
|
||||
js_options['type'] ||= "'post'"
|
||||
if options[:method]
|
||||
if method_option_to_s(options[:method]) == "'put'" || method_option_to_s(options[:method]) == "'delete'"
|
||||
js_options['type'] = "'post'"
|
||||
if js_options['data']
|
||||
js_options['data'] << " + '&"
|
||||
else
|
||||
js_options['data'] = "'"
|
||||
end
|
||||
js_options['data'] << "_method=#{options[:method]}'"
|
||||
end
|
||||
end
|
||||
|
||||
if USE_PROTECTION && respond_to?('protect_against_forgery?') && protect_against_forgery?
|
||||
if js_options['data']
|
||||
js_options['data'] << " + '&"
|
||||
else
|
||||
js_options['data'] = "'"
|
||||
end
|
||||
js_options['data'] << "#{request_forgery_protection_token}=' + encodeURIComponent('#{escape_javascript form_authenticity_token}')"
|
||||
end
|
||||
js_options['data'] = "''" if js_options['type'] == "'post'" && js_options['data'].nil?
|
||||
options_for_javascript(js_options.reject {|key, value| value.nil?})
|
||||
end
|
||||
|
||||
def build_update_for_success(html_id, insertion=nil)
|
||||
insertion = build_insertion(insertion)
|
||||
"#{JQUERY_VAR}('#{jquery_id(html_id)}').#{insertion}(request);"
|
||||
end
|
||||
|
||||
def build_update_for_error(html_id, insertion=nil)
|
||||
insertion = build_insertion(insertion)
|
||||
"#{JQUERY_VAR}('#{jquery_id(html_id)}').#{insertion}(request.responseText);"
|
||||
end
|
||||
|
||||
def build_insertion(insertion)
|
||||
insertion = insertion ? insertion.to_s.downcase : 'html'
|
||||
insertion = 'append' if insertion == 'bottom'
|
||||
insertion = 'prepend' if insertion == 'top'
|
||||
insertion
|
||||
end
|
||||
|
||||
def build_observer(klass, name, options = {})
|
||||
if options[:with] && (options[:with] !~ /[\{=(.]/)
|
||||
options[:with] = "'#{options[:with]}=' + value"
|
||||
else
|
||||
options[:with] ||= 'value' unless options[:function]
|
||||
end
|
||||
|
||||
callback = options[:function] || remote_function(options)
|
||||
javascript = "#{JQUERY_VAR}('#{jquery_id(name)}').delayedObserver("
|
||||
javascript << "#{options[:frequency] || 0}, "
|
||||
javascript << "function(element, value) {"
|
||||
javascript << "#{callback}}"
|
||||
#javascript << ", '#{options[:on]}'" if options[:on]
|
||||
javascript << ")"
|
||||
javascript_tag(javascript)
|
||||
end
|
||||
|
||||
def build_callbacks(options)
|
||||
callbacks = {}
|
||||
options[:beforeSend] = '';
|
||||
[:uninitialized,:loading].each do |key|
|
||||
options[:beforeSend] << (options[key].last == ';' ? options.delete(key) : options.delete(key) << ';') if options[key]
|
||||
end
|
||||
options.delete(:beforeSend) if options[:beforeSend].blank?
|
||||
options[:complete] = options.delete(:loaded) if options[:loaded]
|
||||
options[:error] = options.delete(:failure) if options[:failure]
|
||||
if options[:update]
|
||||
if options[:update].is_a?(Hash)
|
||||
options[:update][:error] = options[:update].delete(:failure) if options[:update][:failure]
|
||||
if options[:update][:success]
|
||||
options[:success] = build_update_for_success(options[:update][:success], options[:position]) << (options[:success] ? options[:success] : '')
|
||||
end
|
||||
if options[:update][:error]
|
||||
options[:error] = build_update_for_error(options[:update][:error], options[:position]) << (options[:error] ? options[:error] : '')
|
||||
end
|
||||
else
|
||||
options[:success] = build_update_for_success(options[:update], options[:position]) << (options[:success] ? options[:success] : '')
|
||||
end
|
||||
end
|
||||
options.each do |callback, code|
|
||||
if JQCALLBACKS.include?(callback)
|
||||
callbacks[callback] = "function(request){#{code}}"
|
||||
end
|
||||
end
|
||||
callbacks
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class JavaScriptElementProxy < JavaScriptProxy #:nodoc:
|
||||
|
||||
unless const_defined? :JQUERY_VAR
|
||||
JQUERY_VAR = PrototypeHelper::JQUERY_VAR
|
||||
end
|
||||
|
||||
def initialize(generator, id)
|
||||
id = id.to_s.count('#.*,>+~:[/ ') == 0 ? "##{id}" : id
|
||||
@id = id
|
||||
super(generator, "#{JQUERY_VAR}(\"#{id}\")")
|
||||
end
|
||||
|
||||
def replace_html(*options_for_render)
|
||||
call 'html', @generator.send(:render, *options_for_render)
|
||||
end
|
||||
|
||||
def replace(*options_for_render)
|
||||
call 'replaceWith', @generator.send(:render, *options_for_render)
|
||||
end
|
||||
|
||||
def reload(options_for_replace={})
|
||||
replace(options_for_replace.merge({ :partial => @id.to_s.sub(/^#/,'') }))
|
||||
end
|
||||
|
||||
def value()
|
||||
call 'val()'
|
||||
end
|
||||
|
||||
def value=(value)
|
||||
call 'val', value
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class JavaScriptElementCollectionProxy < JavaScriptCollectionProxy #:nodoc:\
|
||||
|
||||
unless const_defined? :JQUERY_VAR
|
||||
JQUERY_VAR = PrototypeHelper::JQUERY_VAR
|
||||
end
|
||||
|
||||
def initialize(generator, pattern)
|
||||
super(generator, "#{JQUERY_VAR}(#{pattern.to_json})")
|
||||
end
|
||||
end
|
||||
|
||||
module ScriptaculousHelper
|
||||
|
||||
unless const_defined? :JQUERY_VAR
|
||||
JQUERY_VAR = PrototypeHelper::JQUERY_VAR
|
||||
end
|
||||
|
||||
unless const_defined? :SCRIPTACULOUS_EFFECTS
|
||||
SCRIPTACULOUS_EFFECTS = {
|
||||
:appear => {:method => 'fadeIn'},
|
||||
:blind_down => {:method => 'blind', :mode => 'show', :options => {:direction => 'vertical'}},
|
||||
:blind_up => {:method => 'blind', :mode => 'hide', :options => {:direction => 'vertical'}},
|
||||
:blind_right => {:method => 'blind', :mode => 'show', :options => {:direction => 'horizontal'}},
|
||||
:blind_left => {:method => 'blind', :mode => 'hide', :options => {:direction => 'horizontal'}},
|
||||
:bounce_in => {:method => 'bounce', :mode => 'show', :options => {:direction => 'up'}},
|
||||
:bounce_out => {:method => 'bounce', :mode => 'hide', :options => {:direction => 'up'}},
|
||||
:drop_in => {:method => 'drop', :mode => 'show', :options => {:direction => 'up'}},
|
||||
:drop_out => {:method => 'drop', :mode => 'hide', :options => {:direction => 'down'}},
|
||||
:fade => {:method => 'fadeOut'},
|
||||
:fold_in => {:method => 'fold', :mode => 'hide'},
|
||||
:fold_out => {:method => 'fold', :mode => 'show'},
|
||||
:grow => {:method => 'scale', :mode => 'show'},
|
||||
:shrink => {:method => 'scale', :mode => 'hide'},
|
||||
:slide_down => {:method => 'slide', :mode => 'show', :options => {:direction => 'up'}},
|
||||
:slide_up => {:method => 'slide', :mode => 'hide', :options => {:direction => 'up'}},
|
||||
:slide_right => {:method => 'slide', :mode => 'show', :options => {:direction => 'left'}},
|
||||
:slide_left => {:method => 'slide', :mode => 'hide', :options => {:direction => 'left'}},
|
||||
:squish => {:method => 'scale', :mode => 'hide', :options => {:origin => "['top','left']"}},
|
||||
:switch_on => {:method => 'clip', :mode => 'show', :options => {:direction => 'vertical'}},
|
||||
:switch_off => {:method => 'clip', :mode => 'hide', :options => {:direction => 'vertical'}},
|
||||
:toggle_appear => {:method => 'fadeToggle'},
|
||||
:toggle_slide => {:method => 'slide', :mode => 'toggle', :options => {:direction => 'up'}},
|
||||
:toggle_blind => {:method => 'blind', :mode => 'toggle', :options => {:direction => 'vertical'}},
|
||||
}
|
||||
end
|
||||
|
||||
def visual_effect(name, element_id = false, js_options = {})
|
||||
element = element_id ? element_id : "this"
|
||||
|
||||
if SCRIPTACULOUS_EFFECTS.has_key? name.to_sym
|
||||
effect = SCRIPTACULOUS_EFFECTS[name.to_sym]
|
||||
name = effect[:method]
|
||||
mode = effect[:mode]
|
||||
js_options = js_options.merge(effect[:options]) if effect[:options]
|
||||
end
|
||||
|
||||
[:color, :direction, :startcolor, :endcolor].each do |option|
|
||||
js_options[option] = "'#{js_options[option]}'" if js_options[option]
|
||||
end
|
||||
|
||||
if js_options.has_key? :duration
|
||||
speed = js_options.delete :duration
|
||||
speed = (speed * 1000).to_i unless speed.nil?
|
||||
else
|
||||
speed = js_options.delete :speed
|
||||
end
|
||||
|
||||
if ['fadeIn','fadeOut','fadeToggle'].include?(name)
|
||||
javascript = "#{JQUERY_VAR}('#{jquery_id(element_id)}').#{name}("
|
||||
javascript << "#{speed}" unless speed.nil?
|
||||
javascript << ");"
|
||||
else
|
||||
javascript = "#{JQUERY_VAR}('#{jquery_id(element_id)}').#{mode || 'effect'}('#{name}'"
|
||||
javascript << ",#{options_for_javascript(js_options)}" unless speed.nil? && js_options.empty?
|
||||
javascript << ",#{speed}" unless speed.nil?
|
||||
javascript << ");"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def sortable_element_js(element_id, options = {}) #:nodoc:
|
||||
#convert similar attributes
|
||||
options[:handle] = ".#{options[:handle]}" if options[:handle]
|
||||
if options[:tag] || options[:only]
|
||||
options[:items] = "> "
|
||||
options[:items] << options.delete(:tag) if options[:tag]
|
||||
options[:items] << ".#{options.delete(:only)}" if options[:only]
|
||||
end
|
||||
options[:connectWith] = options.delete(:containment).map {|x| "##{x}"} if options[:containment]
|
||||
options[:containment] = options.delete(:container) if options[:container]
|
||||
options[:dropOnEmpty] = false unless options[:dropOnEmpty]
|
||||
options[:helper] = "'clone'" if options[:ghosting] == true
|
||||
options[:axis] = case options.delete(:constraint)
|
||||
when "vertical", :vertical
|
||||
"y"
|
||||
when "horizontal", :horizontal
|
||||
"x"
|
||||
when false
|
||||
nil
|
||||
when nil
|
||||
"y"
|
||||
end
|
||||
options.delete(:axis) if options[:axis].nil?
|
||||
options.delete(:overlap)
|
||||
options.delete(:ghosting)
|
||||
|
||||
if options[:onUpdate] || options[:url]
|
||||
if options[:format]
|
||||
options[:with] ||= "#{JQUERY_VAR}(this).sortable('serialize',{key:'#{element_id}[]', expression:#{options[:format]}})"
|
||||
options.delete(:format)
|
||||
else
|
||||
options[:with] ||= "#{JQUERY_VAR}(this).sortable('serialize',{key:'#{element_id}[]'})"
|
||||
end
|
||||
|
||||
options[:onUpdate] ||= "function(){" + remote_function(options) + "}"
|
||||
end
|
||||
|
||||
options.delete_if { |key, value| PrototypeHelper::AJAX_OPTIONS.include?(key) }
|
||||
options[:update] = options.delete(:onUpdate) if options[:onUpdate]
|
||||
|
||||
[:axis, :cancel, :containment, :cursor, :handle, :tolerance, :items, :placeholder].each do |option|
|
||||
options[option] = "'#{options[option]}'" if options[option]
|
||||
end
|
||||
|
||||
options[:connectWith] = array_or_string_for_javascript(options[:connectWith]) if options[:connectWith]
|
||||
|
||||
%(#{JQUERY_VAR}('#{jquery_id(element_id)}').sortable(#{options_for_javascript(options)});)
|
||||
end
|
||||
|
||||
def draggable_element_js(element_id, options = {})
|
||||
%(#{JQUERY_VAR}("#{jquery_id(element_id)}").draggable(#{options_for_javascript(options)});)
|
||||
end
|
||||
|
||||
def drop_receiving_element_js(element_id, options = {})
|
||||
#convert similar options
|
||||
options[:hoverClass] = options.delete(:hoverclass) if options[:hoverclass]
|
||||
options[:drop] = options.delete(:onDrop) if options[:onDrop]
|
||||
|
||||
if options[:drop] || options[:url]
|
||||
options[:with] ||= "'id=' + encodeURIComponent(#{JQUERY_VAR}(ui.draggable).attr('id'))"
|
||||
options[:drop] ||= "function(ev, ui){" + remote_function(options) + "}"
|
||||
end
|
||||
|
||||
options.delete_if { |key, value| PrototypeHelper::AJAX_OPTIONS.include?(key) }
|
||||
|
||||
options[:accept] = array_or_string_for_javascript(options[:accept]) if options[:accept]
|
||||
[:activeClass, :hoverClass, :tolerance].each do |option|
|
||||
options[option] = "'#{options[option]}'" if options[option]
|
||||
end
|
||||
|
||||
%(#{JQUERY_VAR}('#{jquery_id(element_id)}').droppable(#{options_for_javascript(options)});)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
15
vendor/plugins/jrails/rails/init.rb
vendored
Normal file
15
vendor/plugins/jrails/rails/init.rb
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# The following options can be changed by creating an initializer in config/initializers/jrails.rb
|
||||
|
||||
# jRails uses jQuery.noConflict() by default
|
||||
# to use the default jQuery varibale, use:
|
||||
# ActionView::Helpers::PrototypeHelper::JQUERY_VAR = '$'
|
||||
|
||||
# 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
|
||||
require 'jrails'
|
||||
25
vendor/plugins/jrails/tasks/jrails.rake
vendored
Normal file
25
vendor/plugins/jrails/tasks/jrails.rake
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
namespace :jrails do
|
||||
|
||||
namespace :js do
|
||||
desc "Copies the jQuery and jRails javascripts to public/javascripts"
|
||||
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
|
||||
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue