paloma 4.1.0 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog.md +8 -6
- data/README.md +14 -0
- data/app/views/paloma/_hook.html.erb +0 -8
- data/lib/paloma/action_controller_extension.rb +9 -4
- data/paloma.gemspec +1 -1
- data/test_app/Gemfile +1 -0
- data/test_app/app/assets/javascripts/application.js +4 -1
- data/vendor/assets/javascripts/paloma/init.js +17 -3
- metadata +2 -2
data/Changelog.md
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
-
|
1
|
+
## 4.1.1
|
2
|
+
* https://github.com/kbparagua/paloma/pull/57 - Fix Turbolinks Issues.
|
3
|
+
* https://github.com/kbparagua/paloma/pull/55 - Fix issues when Paloma hook is not found.
|
2
4
|
|
3
|
-
##
|
5
|
+
## 4.1.0
|
4
6
|
* Support for Turbolinks.
|
5
7
|
* `Paloma.executeHook()` to manually run the hook from the DOM.
|
6
8
|
* Paloma hook will be appended using all `render` calls, except for calls that has the following keys `[:json, :js, :xml, :file]`.
|
7
9
|
* Restore `Paloma.engine.start()` to start processing queued request.
|
8
10
|
|
9
11
|
|
10
|
-
##
|
12
|
+
## 4.0.0
|
11
13
|
* https://github.com/kbparagua/paloma/issues/26 - Paloma requests are not saved on `session`.
|
12
14
|
* https://github.com/kbparagua/paloma/issues/26 - Chaining with redirect is removed.
|
13
15
|
* Routing from javascript is removed.
|
@@ -16,15 +18,15 @@
|
|
16
18
|
* https://github.com/kbparagua/paloma/issues/29 - Disable `console.log` and `console.warn` for non-development environments.
|
17
19
|
|
18
20
|
|
19
|
-
##
|
21
|
+
## 3.0.2
|
20
22
|
* Bug Fix: Converting Rails controller name to singular form.
|
21
23
|
|
22
24
|
|
23
|
-
##
|
25
|
+
## 3.0.1
|
24
26
|
* Bug Fix: Can't handle Rails controller with Multi-word name.
|
25
27
|
* Bug Fix: Paloma Engine is halting when a warning is encountered.
|
26
28
|
* Don't create Paloma request if rendering js, json, xml, or file.
|
27
29
|
|
28
30
|
|
29
|
-
##
|
31
|
+
## 3.0.0
|
30
32
|
* Rewrite Initial Release
|
data/README.md
CHANGED
@@ -292,6 +292,20 @@ $(document).on('page:restore', function(){
|
|
292
292
|
});
|
293
293
|
```
|
294
294
|
|
295
|
+
### Turbolinks without `jquery.turbolinks` gem
|
296
|
+
|
297
|
+
You need to manually run Paloma every page load if you are not using `jquery.turbolinks` gem.
|
298
|
+
|
299
|
+
In your `application.js`
|
300
|
+
|
301
|
+
```js
|
302
|
+
$(document).on('page:load', function(){
|
303
|
+
Paloma.executeHook();
|
304
|
+
Paloma.engine.start();
|
305
|
+
});
|
306
|
+
```
|
307
|
+
|
308
|
+
|
295
309
|
## Gotchas
|
296
310
|
|
297
311
|
* Paloma will execute on all `render` calls, except for calls with the following formats: `js`, `json`, `xml`, and `file`.
|
@@ -3,12 +3,6 @@
|
|
3
3
|
<div class="js-paloma-hook" data-id="<%= id %>">
|
4
4
|
<script type="text/javascript">
|
5
5
|
(function(){
|
6
|
-
// Do not continue if Paloma not found.
|
7
|
-
if (window['Paloma'] === undefined && window['console'] !== undefined){
|
8
|
-
console.warn("Paloma not found. Require it in your application.js.");
|
9
|
-
return true;
|
10
|
-
}
|
11
|
-
|
12
6
|
Paloma.env = '<%= Rails.env %>';
|
13
7
|
|
14
8
|
// Remove any callback details if any
|
@@ -20,8 +14,6 @@
|
|
20
14
|
request['resource'],
|
21
15
|
request['action'],
|
22
16
|
request['params']);
|
23
|
-
|
24
|
-
$(document).ready(function(){ Paloma.engine.start(); });
|
25
17
|
})();
|
26
18
|
</script>
|
27
19
|
</div>
|
@@ -115,10 +115,15 @@ module Paloma
|
|
115
115
|
#
|
116
116
|
def append_paloma_hook
|
117
117
|
return true if self.paloma.has_no_request?
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
118
|
+
|
119
|
+
# Render the partial if it is present, otherwise do nothing.
|
120
|
+
begin
|
121
|
+
hook = view_context.render(
|
122
|
+
:partial => 'paloma/hook',
|
123
|
+
:locals => {:request => self.paloma.request})
|
124
|
+
rescue ActionView::MissingTemplate
|
125
|
+
return true
|
126
|
+
end
|
122
127
|
|
123
128
|
before_body_end_index = response_body[0].rindex('</body>')
|
124
129
|
|
data/paloma.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'paloma'
|
3
|
-
s.version = '4.1.
|
3
|
+
s.version = '4.1.1'
|
4
4
|
s.summary = "Provides an easy way to execute page-specific javascript for Rails."
|
5
5
|
s.description = "Page-specific javascript for Rails done right"
|
6
6
|
s.authors = ['Karl Paragua']
|
data/test_app/Gemfile
CHANGED
@@ -11,14 +11,17 @@
|
|
11
11
|
// GO AFTER THE REQUIRES BELOW.
|
12
12
|
//
|
13
13
|
//= require jquery
|
14
|
+
//= require jquery.turbolinks
|
14
15
|
//= require jquery_ujs
|
15
16
|
//= require turbolinks
|
16
17
|
//= require paloma
|
17
18
|
//= require_tree .
|
18
19
|
|
19
20
|
|
20
|
-
//
|
21
|
+
// Uncomment if jquery.turbolinks is not used.
|
22
|
+
// $(document).on('page:load', function(){
|
21
23
|
// Paloma.executeHook();
|
24
|
+
// Paloma.engine.start();
|
22
25
|
// });
|
23
26
|
|
24
27
|
|
@@ -3,15 +3,29 @@ window.Paloma = window.Paloma || {};
|
|
3
3
|
//
|
4
4
|
// Do nothing if there is no available console.
|
5
5
|
//
|
6
|
-
if (!window['console']
|
6
|
+
if ( !window['console'] ){
|
7
|
+
Paloma.log = Paloma.warn = function(msg){};
|
8
|
+
}
|
7
9
|
else {
|
8
10
|
Paloma.warn = function(msg){
|
9
|
-
if(Paloma.env != 'development') return;
|
11
|
+
if (Paloma.env != 'development'){ return; }
|
10
12
|
console.warn(msg);
|
11
13
|
};
|
12
14
|
|
13
15
|
Paloma.log = function(msg){
|
14
|
-
if(Paloma.env != 'development') return;
|
16
|
+
if (Paloma.env != 'development'){ return; }
|
15
17
|
console.log(msg);
|
16
18
|
};
|
17
19
|
}
|
20
|
+
|
21
|
+
$(document).ready(function(){
|
22
|
+
// Do not continue if Paloma not found.
|
23
|
+
if (window['Paloma'] === undefined) {
|
24
|
+
if (window['console'] !== undefined) {
|
25
|
+
console.warn("Paloma not found. Require it in your application.js.");
|
26
|
+
}
|
27
|
+
return true;
|
28
|
+
}
|
29
|
+
|
30
|
+
Paloma.engine.start();
|
31
|
+
});
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paloma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-09-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jquery-rails
|