Sha256: 35531e6baa4444ed96ac80ee70899f5b6eb53fd54a61e685e6b83c74a97192d2

Contents?: true

Size: 842 Bytes

Versions: 1

Compression:

Stored size: 842 Bytes

Contents

// This object provides dynamically generated Rails routes in Javascript.
// Since Rails does not provide url_helpers in js.erb files, we have to use this little neat hack.
// Found via https://github.com/magiclabs/alchemy_cms

<% self.class.instance_eval { include Spree::Core::Engine.routes.url_helpers } %>

if (typeof(Spree) === 'undefined') {
  var Spree = {};
}

(function($) {

  var routes = {};
  $.extend(Spree, routes);

  Spree.routes = {

    admin_users_path: function(options) {
      if (typeof(options) === 'undefined') options = {format: 'html'};
      return '<%= admin_users_path %>' + '.' + options.format;
    },

    admin_products_path: function(options) {
      if (typeof(options) === 'undefined') options = {format: 'html'};
      return '<%= admin_products_path %>' + '.' + options.format;
    }

  }

})(jQuery);

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_core-1.1.2.rc1 app/assets/javascripts/admin/spree.routes.js.erb