You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+6-14
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,6 @@ RailsScript is a Rails-centric, object oriented, featherweight framework for wri
4
4
5
5
## Installation
6
6
7
-
NOTE: RailsScript is not currently compatible with Turbolinks 5 (the Rails 5 default). This is becase inline JS is ignored. A future release will fix this issue.
8
-
9
7
Add this line to your application's Gemfile:
10
8
11
9
gem 'rails_script', '~> 0.6.1'
@@ -38,7 +36,6 @@ Your JavaScript class is named after your Controller and there is a method for e
38
36
```coffeescript
39
37
# app/assets/javascripts/users.js.coffee
40
38
41
-
window.App||= {}
42
39
classApp.UsersextendsApp.Base
43
40
44
41
show:=>
@@ -53,7 +50,7 @@ Executing some JavaScript to run on all controller actions is just a matter of a
53
50
54
51
```coffeescript
55
52
# app/assets/javascripts/users.js.coffee
56
-
window.App||= {}
53
+
57
54
classApp.UsersextendsApp.Base
58
55
59
56
beforeAction: (action) =>
@@ -70,7 +67,8 @@ Running some JavaScript on every page of an Application is a common need. For e
70
67
71
68
```coffeescript
72
69
# app/assets/javascripts/base.js.coffee
73
-
window.App||= {}
70
+
71
+
...
74
72
classApp.Base
75
73
76
74
constructor:->
@@ -84,6 +82,7 @@ class App.Base
84
82
out:->
85
83
$(".site-credit a").html("SITE CREDIT")
86
84
)
85
+
...
87
86
```
88
87
89
88
In this example we extracted the rollover action into a new function. Doing so will make the class cleaner and easier to maintain as the application grows. Once again note the ```return this``` in the constructor.
@@ -96,7 +95,6 @@ Any functions that need to be accessible in the global scope should be defined i
96
95
97
96
```coffeescript
98
97
# app/assets/javascripts/global.js.coffee
99
-
window.App||= {}
100
98
101
99
App.remoteSubmission= ($form) ->
102
100
return$.ajax
@@ -122,7 +120,7 @@ This will create the following in ```/app/assets/javascripts/utilities/modal.js.
Copy file name to clipboardexpand all lines: rails_script.gemspec
+2-2
Original file line number
Diff line number
Diff line change
@@ -7,10 +7,10 @@ Gem::Specification.new do |spec|
7
7
spec.name='rails_script'
8
8
spec.version=RailsScript::VERSION
9
9
spec.authors=['Kevin Pheasey']
10
-
spec.email=['kevin.pheasey@gmail.com']
10
+
spec.email=['kevin@kpheasey.com']
11
11
spec.summary=%q{A Rails-centric, object oriented, featherweight framework for writting CoffeeScript}
12
12
spec.description=%q{Rails Script is a Rails-centric, object oriented, featherweight framework for writting CoffeeScript. It is optomized for the Rails Asset Pipeline and is compatible with TurboLinks. Using Rails controller names and actions to call JavaScript, it has never been easier to write clean, concise, and maintanable page specific JavaScript.}
0 commit comments