Skip to content

Commit c97922b

Browse files
author
Kevin Pheasey
committed
Initialize Base from base.js
1 parent 8c0eaab commit c97922b

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

lib/generators/rails_script/element/templates/javascript.js.coffee

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
window.Element ||= {}
21
class Element.<%= element_name.gsub('::', '') %> <%= "extends Utility.#{utility.gsub('::', '')}" unless utility.blank? %>
32

43
constructor: ->

lib/generators/rails_script/install/templates/base.js.coffee

+6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
window.<%= RailsScript.app_namespace %> ||= {}
2+
window.Element ||= {}
3+
window.Utility ||= {}
4+
5+
$(document).on "turbolinks:load.rails_script", ->
6+
window.$this = new (<%= RailsScript.app_namespace %>["#{$('#rails-script').data('controller')}"] || <%= RailsScript.app_namespace %>.Base)()
7+
28
class <%= RailsScript.app_namespace %>.Base
39

410
constructor: ->

lib/generators/rails_script/utility/templates/javascript.js.coffee

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
window.Utility ||= {}
21
class Utility.<%= utility_name.gsub('::', '') %>
32

43
constructor: ->

0 commit comments

Comments
 (0)