paloma 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -13,6 +13,7 @@ capybara-*.html
13
13
  /spec/tmp/*
14
14
  *.gem
15
15
  /spec/sample_app/log
16
+ /spec/sample_app/paloma_test
16
17
  **.orig
17
18
  rerun.txt
18
19
  pickle-email-*.html
data/README.md CHANGED
@@ -11,7 +11,7 @@ Advantages
11
11
 
12
12
  Quick Example
13
13
  -
14
- The javascript callback file `paloma/users/new.js`:
14
+ The javascript callback file `app/assets/javascripts/paloma/users/new.js`:
15
15
 
16
16
  ```javascript
17
17
  Paloma.callbacks['users/new'] = function(params){
@@ -48,7 +48,7 @@ sudo gem install paloma
48
48
 
49
49
  With bundler, add this to your Gemfile:
50
50
  ```
51
- gem paloma
51
+ gem 'paloma'
52
52
  ```
53
53
 
54
54
  Setup
@@ -58,6 +58,11 @@ On setup, the `paloma` folder will be generated in `app/assets/javascripts/` con
58
58
  rails g paloma:setup
59
59
  ```
60
60
 
61
+ Require `paloma` in your `application.js`:
62
+ ```
63
+ //= require paloma
64
+ ```
65
+
61
66
  Directory Structure
62
67
  -
63
68
  `paloma` folder contains the javascript callbacks.
@@ -136,7 +141,7 @@ You can manipulate callback behavior by using the `js_callback` command before t
136
141
  end
137
142
  ```
138
143
 
139
- This will execute `[controller]/new` callback instead of `[controller]/edit`.
144
+ This will execute `[controllers]/new` callback instead of `[controllers]/edit`.
140
145
 
141
146
  3. Using other action's callback from other controller.
142
147
 
@@ -147,7 +152,7 @@ You can manipulate callback behavior by using the `js_callback` command before t
147
152
  end
148
153
  ```
149
154
 
150
- This will execute `clients/index` callback instead of `[controller]/index`.
155
+ This will execute `clients/index` callback instead of `[controllers]/index`.
151
156
 
152
157
  Passing Parameters
153
158
  -
@@ -231,7 +236,7 @@ end
231
236
 
232
237
  A request for `first_action` will lead to 2 redirects until it reaches the `third_action` and renders a result on the browser. When the `third_action` renders its response, Paloma will execute the callbacks for all the 3 actions.
233
238
 
234
- The order of execution will be `[controller]/first_action` first, then `[controller]/second_action`, and finally `[controller]/third_action`.
239
+ The order of execution will be `[controllers]/first_action` first, then `[controllers]/second_action`, and finally `[controllers]/third_action`.
235
240
 
236
241
 
237
242
  Gotchas
@@ -24,7 +24,7 @@
24
24
  callbackFunction = Paloma.callbacks[callback.name];
25
25
 
26
26
  console.log("Paloma: Fetching [" + callback.name + "]");
27
- if (callback != undefined){
27
+ if (callbackFunction != undefined){
28
28
  console.log("Paloma: Calling [" + callback.name + "]");
29
29
  callbackFunction(callback.params);
30
30
  }
@@ -71,9 +71,10 @@ module Paloma
71
71
  #_callbacks.js per folder(controller)
72
72
  has_callbacks = File.exists? callbacks
73
73
  unless has_callbacks
74
+ Dir.mkdir(PARENT + "#{controller}")
74
75
  content = File.read(templates + '_callbacks.js').gsub('controller', "#{controller}")
75
76
  File.open(callbacks, 'w'){ |f| f.write(content) }
76
- File.open(INDEX, 'a+'){|f| f << "\n//= require ./" + controller + '/_callbacks' }
77
+ File.open(INDEX, 'a+'){ |f| f << "\n//= require ./" + controller + '/_callbacks' }
77
78
  end
78
79
 
79
80
  #_local.js per folder(controller)
@@ -1,9 +1,9 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'paloma'
3
- s.version = '0.0.2'
3
+ s.version = '0.0.4'
4
4
  s.date = '2012-12-17'
5
- s.summary = "Javascript Callback Manager for Rails"
6
- s.description = "Javascript Callback Manager for Rails"
5
+ s.summary = "a sexy way to organize javascript files using Rails` asset pipeline"
6
+ s.description = "a sexy way to organize javascript files using Rails` asset pipeline"
7
7
  s.authors = ["Karl Paragua", "Bia Esmero"]
8
8
  s.email = 'kb.paragua@gmail.com'
9
9
  s.files = `git ls-files`.split("\n")
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: 0.0.2
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -172,7 +172,7 @@ dependencies:
172
172
  - - ! '>='
173
173
  - !ruby/object:Gem::Version
174
174
  version: '0'
175
- description: Javascript Callback Manager for Rails
175
+ description: a sexy way to organize javascript files using Rails` asset pipeline
176
176
  email: kb.paragua@gmail.com
177
177
  executables: []
178
178
  extensions: []
@@ -213,7 +213,6 @@ files:
213
213
  - spec/sample_app/controllers.rb
214
214
  - spec/sample_app/init.rb
215
215
  - spec/sample_app/model.rb
216
- - spec/sample_app/paloma_test
217
216
  - spec/spec_helper.rb
218
217
  homepage: https://github.com/kbparagua/paloma
219
218
  licenses: []
@@ -235,8 +234,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
235
234
  version: '0'
236
235
  requirements: []
237
236
  rubyforge_project:
238
- rubygems_version: 1.8.24
237
+ rubygems_version: 1.8.21
239
238
  signing_key:
240
239
  specification_version: 3
241
- summary: Javascript Callback Manager for Rails
240
+ summary: a sexy way to organize javascript files using Rails` asset pipeline
242
241
  test_files: []
Binary file