mirror of
https://github.com/kbparagua/paloma
synced 2023-03-27 23:21:17 -04:00
Remove jQuery dependency
This commit is contained in:
parent
6be685b5e6
commit
e9cf4e9aff
5 changed files with 17 additions and 21 deletions
|
@ -2,4 +2,5 @@ source 'https://rubygems.org'
|
||||||
|
|
||||||
gem 'selenium-webdriver'
|
gem 'selenium-webdriver'
|
||||||
gem 'jquery-turbolinks'
|
gem 'jquery-turbolinks'
|
||||||
gemspec :path => '../'
|
gem 'test-unit'
|
||||||
|
gemspec :path => '../'
|
||||||
|
|
|
@ -56,6 +56,9 @@ NotFoos.prototype.otherAction = function(){};
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
Paloma.engine.start();
|
||||||
|
|
||||||
$('#js-ajax-link').on('click', function(e){
|
$('#js-ajax-link').on('click', function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,6 @@
|
||||||
var createConstructor = function(){
|
var createConstructor = function(){
|
||||||
var constructor = function(params){ this.params = params; }
|
var constructor = function(params){ this.params = params; }
|
||||||
|
|
||||||
$.extend(constructor, Paloma.Controller);
|
|
||||||
$.extend(constructor.prototype, Paloma.Controller.prototype);
|
|
||||||
|
|
||||||
return constructor;
|
return constructor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -52,4 +49,4 @@
|
||||||
|
|
||||||
Paloma.ControllerFactory = ControllerFactory;
|
Paloma.ControllerFactory = ControllerFactory;
|
||||||
|
|
||||||
})(window.Paloma);
|
})(window.Paloma);
|
||||||
|
|
15
vendor/assets/javascripts/paloma/init.js
vendored
15
vendor/assets/javascripts/paloma/init.js
vendored
|
@ -18,14 +18,9 @@ else {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function(){
|
|
||||||
// Do not continue if Paloma not found.
|
|
||||||
if (window['Paloma'] === undefined) {
|
|
||||||
if (window['console'] !== undefined) {
|
|
||||||
console.warn("Paloma not found. Require it in your application.js.");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Paloma.engine.start();
|
if ( !window['Paloma'] ){
|
||||||
});
|
if (window['console'] !== undefined){
|
||||||
|
console.warn("Paloma not found. Require it in your application.js.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
12
vendor/assets/javascripts/paloma/paloma.js
vendored
12
vendor/assets/javascripts/paloma/paloma.js
vendored
|
@ -16,15 +16,15 @@
|
||||||
|
|
||||||
Paloma.engine = new Paloma.Engine({factory: Paloma._controllerFactory});
|
Paloma.engine = new Paloma.Engine({factory: Paloma._controllerFactory});
|
||||||
|
|
||||||
|
|
||||||
Paloma.executeHook = function(){
|
Paloma.executeHook = function(){
|
||||||
var $hook = $('.js-paloma-hook:first script:first');
|
var hook = document.getElementsByClassName('js-paloma-hook')[0];
|
||||||
|
if (!hook) return;
|
||||||
|
|
||||||
if ($hook.length == 0){ return; }
|
var script = hook.getElementsByTagName('script')[0];
|
||||||
|
if (!script) return;
|
||||||
|
|
||||||
var hook = $hook.html();
|
eval(script.innerHTML);
|
||||||
eval(hook);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
})(window.Paloma);
|
})(window.Paloma);
|
||||||
|
|
Loading…
Reference in a new issue