1
0
Fork 0
mirror of https://github.com/kbparagua/paloma synced 2023-03-27 23:21:17 -04:00

Update README.md

This commit is contained in:
Karl Bryan Paragua 2012-12-19 16:20:52 +08:00
parent 21da73c853
commit 38964439e0

View file

@ -52,13 +52,12 @@ gem paloma
```
Setup
-----
On setup, the __paloma__ folder will be generated in __app/assets/javascripts/__. Inside this folder, __paloma.js__ and __index.js__ will also be created.
-
On setup, the `paloma` folder will be generated in `app/assets/javascripts/` containing its required files. Run:
```
rails g paloma:setup
```
Execute the following command in the terminal:
rails g paloma:setup
Usage
-----
@ -69,40 +68,3 @@ Execute the following command to generate a folder, named as __\<controller_name
The next command allows the user to create the file __\<action_name\>.js__ under the __\<controller_name\> folder__.
rails g paloma:add <controller_name>/<action_name>
Generated Files
---------------
###paloma.js
Declaration of namespace used in all callbacks
# app/assets/javascripts/paloma/paloma.js
window.Paloma = {callbacks:{}};
###index.js
Contains code for requiring all callbacks of all folders and is automatically updated when new folders and callback.js files are created
# app/assets/javascripts/paloma/index.js
//= require ./paloma
//= require ./<controller_name>/callbacks
###callbacks.js
Contains code for requiring all callbacks under the same folder <controller_name>
# app/assets/javascripts/paloma/<controller_name>/callbacks.js
//= require_tree .
###\<action_name\>.js
Actual code to be executed when callback is called
# app/assets/javascripts/paloma/<controller_name>/<action_name>.js
Paloma.callbacks['<controller_name>/<action_name>'] = function(params){
...
//put your code here
...
};