2

Trying to implement Paella Player in Apostrophe, I've found an error applying the assets to my project.

The Javascript file that fails is jquery.js.

https://github.com/polimediaupv/paella/tree/develop/javascript

And this is my error.

Uncaught TypeError: $.cookie is not a function
    at always.js:140
    at Function.<anonymous> (jquery.js:4)
    at Function.each (jquery.js:2)
    at g (jquery.js:4)
    at wb (jquery.js:4)
    at Function.ajax (jquery.js:4)
    at Function.n.(anonymous function) [as post] (http://localhost:3000/modules/paella-player-widgets/js/jquery.js:4:12281)
    at Object.self.getTemplates (user.js:94)
    at getTemplates (user.js:6)
    at async.js:718

And finally that's the code for pushing the js assets.

module.exports = {
  extend: 'apostrophe-widgets',
  label: 'Paella player',

  construct: function(self, options) {

    self.pushAsset('script', 'swfobject');
    self.pushAsset('script', 'traceur-compiler');
    self.pushAsset('script', 'base');
    self.pushAsset('script', 'jquery');
    self.pushAsset('script', 'lunr.min');
    self.pushAsset('script', 'require');
    self.pushAsset('script', 'paella_player');
  }
};
Jose García
  • 125
  • 8

2 Answers2

2

I find solution, I didn't have to apply the Paella's JQuery file because it's enough with the JQuery file that Apostrophe provides to us.

Jose García
  • 125
  • 8
1

Given that apostrophe CMS already includes jQuery and jquery-cookie, unless you are using the apostrophe-lean-frontend module, the problem might be that you are including again jQuery as an asset in your module and the new declaration of jQuery is overriding the original one that included the cookie plugin, as explained here.

priethor
  • 93
  • 2
  • 7