Commit a23526c

mo khan <mo@mokhan.ca>
2017-03-05 20:20:48
convert autoviews as behaviours.
1 parent 08622e5
Changed files (3)
app/assets/javascripts/lib/behaviours/autoview.js.coffee
@@ -0,0 +1,6 @@
+class Autoview extends Stronglifters.Behaviour
+  @on "turbolinks:load"
+
+  execute: ->
+    for element in $("[data-autoview-name]")
+      Stronglifters.Autoview.install(element)
app/assets/javascripts/lib/behaviours/autovue.js.coffee
@@ -0,0 +1,8 @@
+class Autovue extends Stronglifters.Behaviour
+  @on "turbolinks:load"
+
+  execute: ->
+    for element in $("[data-autovue]")
+      window.vue = new Vue
+        el: element
+        data: gon
app/assets/javascripts/application.js.coffee
@@ -32,9 +32,3 @@ window.Stronglifters ?= {}
 $(document).on 'turbolinks:load', () =>
   new Stronglifters.Startup().start()
   Stronglifters.Behaviour.install()
-  for element in $("[data-autovue]")
-    window.app = new Vue
-      el: element
-      data: gon
-  for element in $("[data-autoview-name]")
-    Stronglifters.Autoview.install(element)