paloma 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Changelog.md +19 -0
- data/README.md +31 -1
- data/paloma.gemspec +1 -1
- data/vendor/assets/javascripts/paloma_core.js +2 -2
- metadata +2 -2
data/Changelog.md
CHANGED
@@ -1,6 +1,25 @@
|
|
1
1
|
Changelog
|
2
2
|
=
|
3
3
|
|
4
|
+
Version 2.0.1
|
5
|
+
-
|
6
|
+
* Bug Fix: `params` is not passed when calling filters.
|
7
|
+
|
8
|
+
Version 2.0.0
|
9
|
+
-
|
10
|
+
* Change `js_callback` to `js` only.
|
11
|
+
* Request and Callback details are automatically included on `params` (example: controller, action, namespace, controller_path, etc...)
|
12
|
+
* Hooks for Rails controller and scaffold generators.
|
13
|
+
* Change `Paloma.callbacks['namespace/controller/action']` to `Paloma.callbacks['namespace/controller']['action']`.
|
14
|
+
* `paloma.js` file removed.
|
15
|
+
* `_callbacks.js` renamed to `_manifest.js`.
|
16
|
+
* `_local.js` renamed to `_locals.js`.
|
17
|
+
* Filters are now available (before_filter, after_filter, and around_filter).
|
18
|
+
* Skip filters are now available (skip_before_filter, skip_after_filter, skip_around_filter).
|
19
|
+
* Locals can now be easily accessible using the `_l` object.
|
20
|
+
* Issue javascript warning instead of javascript error when Paloma is not included on `application.js`.
|
21
|
+
* Codes are now inside closures, to prevent variable clashes.
|
22
|
+
|
4
23
|
Version 1.2.0
|
5
24
|
-
|
6
25
|
* AddGenerator with multiple actions: `rails g paloma:add namespace/controller action1 action2 action3`
|
data/README.md
CHANGED
@@ -239,6 +239,25 @@ Paloma.callbacks['users']['destroy'] = function(params){
|
|
239
239
|
};
|
240
240
|
```
|
241
241
|
|
242
|
+
|
243
|
+
Default Parameters
|
244
|
+
-
|
245
|
+
`params['controller']` - controller name without its namespace.
|
246
|
+
|
247
|
+
`params['namespace']` - controller's namespace name.
|
248
|
+
|
249
|
+
`params['action']` - controller's action that triggers the filter or callback.
|
250
|
+
|
251
|
+
`params['controller_path']` - controller name with its namespace.
|
252
|
+
|
253
|
+
`params['callback_controller']` - callback's controller name without its namespace.
|
254
|
+
|
255
|
+
`params['callback_namespace']` - callback's namespace name.
|
256
|
+
|
257
|
+
`params['callback_action']` - callback's action name.
|
258
|
+
|
259
|
+
`params['callback_controller_path']` - callback's controller with its namespace.
|
260
|
+
|
242
261
|
## Filters
|
243
262
|
|
244
263
|
This is almost similar to Rails controller filters. These are functions executed either `before`, `after`,
|
@@ -253,7 +272,7 @@ filter.as('filter name').before_all().perform(function(params){
|
|
253
272
|
alert("I'm a before filter!");
|
254
273
|
});
|
255
274
|
|
256
|
-
filter.as('another filter').after_all().perform(function(params{
|
275
|
+
filter.as('another filter').after_all().perform(function(params){
|
257
276
|
alert("I'm an after filter");
|
258
277
|
});
|
259
278
|
```
|
@@ -323,6 +342,17 @@ Paloma.callbacks['controller']['new'] = function(params){
|
|
323
342
|
});
|
324
343
|
```
|
325
344
|
|
345
|
+
### Skipping Filters
|
346
|
+
|
347
|
+
You can skip filters using the `skip_*_filter` or `skip_*_filters` command.
|
348
|
+
You can also specify which action or actions the filter skip is applicable using `only` or `except` command.
|
349
|
+
|
350
|
+
```javascript
|
351
|
+
filter.skip_before_filter('filter A'); // skip 'filter A' for all actions
|
352
|
+
filter.skip_after_filters('filter A', 'filter B').only('new', 'edit'); // skip 'filter A' and 'filter B' for 'new' and 'edit' actions.
|
353
|
+
filter.skip_around_filter('filter A').except('destroy'); // skip 'filter A' for all actions except for 'destroy'.
|
354
|
+
```
|
355
|
+
|
326
356
|
##Locals
|
327
357
|
|
328
358
|
Locals are variables or methods which can be made locally available within a controller or a namespace. Locals can also be made available throughout the whole Paloma files (globally).
|
data/paloma.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'paloma'
|
3
|
-
s.version = '2.0.
|
3
|
+
s.version = '2.0.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", "Bia Esmero"]
|
@@ -231,9 +231,9 @@ Paloma.execute = function(controller, action, params){
|
|
231
231
|
action);
|
232
232
|
|
233
233
|
// Start filter and callback executions
|
234
|
-
performFilters(beforeFilters);
|
234
|
+
performFilters(beforeFilters, params);
|
235
235
|
if (callbackFound){ callback(params); }
|
236
|
-
performFilters(afterFilters);
|
236
|
+
performFilters(afterFilters, params);
|
237
237
|
|
238
238
|
// variableContainer is used to share variable between filters and callbacks.
|
239
239
|
// It will be cleared after it is used.
|
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: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-03-
|
13
|
+
date: 2013-03-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: jquery-rails
|