Sha256: d9f5b0c0dd42065c24e13644f66ba052352f91f8674ef8fb44b869f00b5cccd8

Contents?: true

Size: 646 Bytes

Versions: 11

Compression:

Stored size: 646 Bytes

Contents

window.controllers = {}

let handler = function(){
  var $body = $("body");
  var controller = $body.data("controller").replace(/\//g, "_");
  var action = $body.data("action");

  var activeController = window.controllers[controller];

  if (activeController !== undefined) {
    if (window.env == "development") {
      console.log("[Controllers] " + controller + "." + action + "()");
    }

    if ($.isFunction(activeController.init)) {
      activeController.init();
    }

    if ($.isFunction(activeController[action])) {
      activeController[action]();
    }
  }
}

// $(handler);
document.addEventListener("turbolinks:load", handler)

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mvpkit-2.0.0 assets/js/init/controllers.js
mvpkit-1.1.2 assets/js/init/controllers.js
mvpkit-1.1.1 assets/js/init/controllers.js
mvpkit-1.1.0 assets/js/init/controllers.js
mvpkit-1.0.4 assets/js/init/controllers.js
mvpkit-1.0.3 assets/js/init/controllers.js
mvpkit-1.0.2 assets/js/init/controllers.js
mvpkit-1.0.1 assets/js/init/controllers.js
mvpkit-1.0.0 assets/js/init/controllers.js
mvpkit-0.8.1 assets/js/init/controllers.js
mvpkit-0.8.0 assets/js/init/controllers.js