rails_script 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -12
- data/lib/generators/rails_script/element/templates/javascript.js.coffee +2 -3
- data/lib/generators/rails_script/install/install_generator.rb +4 -4
- data/lib/generators/rails_script/utility/templates/javascript.js.coffee +2 -3
- data/lib/rails_script/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b140ec8cf5abca9db947d6906e1fc6596ad463ea
|
4
|
+
data.tar.gz: 3232f9946d02bc6a8127758ec414257a93be4317
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 859959d690d0211b07db596f6633d6ae063a18e12d1ac1ef57d8759a1e34ffac5600c9af98a4beb7e771969ad4b723260c50cda086e8b906f275e5a2bd94f72d
|
7
|
+
data.tar.gz: 722f1fd7fa70c6f3534f2e5b96b9d5bfc48bdec4983783b0ccadc9d507f173b8f25dc938c9d5f85c3c9ae49c4b47c44efcabdac37a61410e2b109ed71696cd5b
|
data/README.md
CHANGED
@@ -117,9 +117,8 @@ This will create the following in ```/app/assets/javascripts/utilities/modal.js.
|
|
117
117
|
|
118
118
|
```
|
119
119
|
# /app/assets/javascripts/utilities/modal.js.coffee
|
120
|
-
window.
|
121
|
-
|
122
|
-
class App.Utility.Modal
|
120
|
+
window.Utility ||= {}
|
121
|
+
class Utility.Modal
|
123
122
|
|
124
123
|
constructor: ->
|
125
124
|
return this
|
@@ -129,9 +128,8 @@ Let's add some basic functionality:
|
|
129
128
|
|
130
129
|
```
|
131
130
|
# /app/assets/javascripts/utilities/modal.js.coffee
|
132
|
-
window.
|
133
|
-
|
134
|
-
class App.Utility.Modal
|
131
|
+
window.Utility ||= {}
|
132
|
+
class Utility.Modal
|
135
133
|
@element
|
136
134
|
@trigger
|
137
135
|
@isOpen = false
|
@@ -167,7 +165,7 @@ window.App ||= {}
|
|
167
165
|
class App.Users extends App.Base
|
168
166
|
|
169
167
|
show: ->
|
170
|
-
@galleryModal = new
|
168
|
+
@galleryModal = new Utility.Modal($('#user-gallery-modal-wrapper'), $('user-gallery-modal-toggle-button'))
|
171
169
|
|
172
170
|
```
|
173
171
|
|
@@ -185,8 +183,8 @@ This will create the following in ```/app/assets/javascripts/elements/main_menu.
|
|
185
183
|
```
|
186
184
|
# /app/assets/javascripts/elements/main_menu.js.coffee```
|
187
185
|
|
188
|
-
window.
|
189
|
-
class
|
186
|
+
window.Element ||= {}
|
187
|
+
class Element.MainMenu
|
190
188
|
|
191
189
|
constructor: ->
|
192
190
|
return this
|
@@ -201,7 +199,7 @@ window.App ||= {}
|
|
201
199
|
class App.Base
|
202
200
|
|
203
201
|
constructor: ->
|
204
|
-
App.mainMenu = new
|
202
|
+
App.mainMenu = new Element.MainMenu()
|
205
203
|
return this
|
206
204
|
```
|
207
205
|
|
@@ -217,8 +215,8 @@ Which generates:
|
|
217
215
|
````
|
218
216
|
# /app/assets/javascripts/elements/main_menu.js.coffee
|
219
217
|
|
220
|
-
window.
|
221
|
-
class
|
218
|
+
window.Element ||= {}
|
219
|
+
class Element.MainMenu extends Utility.Modal
|
222
220
|
|
223
221
|
constructor: ->
|
224
222
|
return this
|
@@ -1,6 +1,5 @@
|
|
1
|
-
window.
|
2
|
-
|
3
|
-
class App.Element.<%= element_name.gsub('::', '') %> <%= "extends App.Utility.#{utility.gsub('::', '')}" unless utility.blank? %>
|
1
|
+
window.Element ||= {}
|
2
|
+
class Element.<%= element_name.gsub('::', '') %> <%= "extends Utility.#{utility.gsub('::', '')}" unless utility.blank? %>
|
4
3
|
|
5
4
|
constructor: ->
|
6
5
|
super
|
@@ -17,17 +17,17 @@ module RailsScript
|
|
17
17
|
if File.exist?('app/assets/javascripts/application.js')
|
18
18
|
|
19
19
|
if File.readlines('app/assets/javascripts/application.js').grep('//= require_tree .').any?
|
20
|
-
inject_into_file 'app/assets/javascripts/application.js', "\n//= require base\n//= require_tree ./utilities", before: "\n//= require_tree ."
|
20
|
+
inject_into_file 'app/assets/javascripts/application.js', "\n//= require base\n//= require_tree ./utilities\n//= require_tree ./elements", before: "\n//= require_tree ."
|
21
21
|
else
|
22
|
-
append_file 'app/assets/javascripts/application.js', "\n//= require base\n//= require_tree ./utilities\n//= require_tree ."
|
22
|
+
append_file 'app/assets/javascripts/application.js', "\n//= require base\n//= require_tree ./utilities\n//= require_tree ./elements\n//= require_tree ."
|
23
23
|
end
|
24
24
|
|
25
25
|
elsif File.exist?('app/assets/javascripts/application.js.coffee')
|
26
26
|
|
27
27
|
if File.readlines('app/assets/javascripts/application.js.coffee').grep('#= require_tree .').any?
|
28
|
-
inject_into_file 'app/assets/javascripts/application.js.coffee', "\n#= require base\n#= require_tree ./utilities", before: "\n#= require_tree ."
|
28
|
+
inject_into_file 'app/assets/javascripts/application.js.coffee', "\n#= require base\n#= require_tree ./utilities\n#= require_tree ./elements", before: "\n#= require_tree ."
|
29
29
|
else
|
30
|
-
append_file 'app/assets/javascripts/application.js.coffee', "\n#= require base\n#= require_tree ./utilities\n#= require_tree ."
|
30
|
+
append_file 'app/assets/javascripts/application.js.coffee', "\n#= require base\n#= require_tree ./utilities\n#= require_tree ./elements\n#= require_tree ."
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
data/lib/rails_script/version.rb
CHANGED