ifad / data-confirm-modal

Makes Rails' link_to confirm: 'foo' build a Bootstrap Modal instead of calling the browser's confirm() API.
MIT License
271 stars 115 forks source link

Add package.json #53

Closed guilleiguaran closed 7 years ago

guilleiguaran commented 7 years ago

New Rails projects can use Webpacker so is good to support them adding a package.json

rylnd commented 7 years ago

👍 I too am using webpacker; having this library published to NPM would be really great!

vjt commented 7 years ago

Thanks @guilleiguaran.

@rylnd - I am not an expert in NPM, but I have published the package on npmjs: https://www.npmjs.com/package/data-confirm-modal. Can you check it works? Unfortunately the README is shared at the moment, and mentions Ruby/Rails installation instructions. A pull to have separate READMEs for the NPM is welcome!

Cheers,

rylnd commented 7 years ago

@guilleiguaran @vjt thanks for the work and the quick turnaround! Unfortunately the default behavior does not work for me as I do not have jQuery defined globally when the function is executed. I'm thinking that the basic behavior should modified to the following: if module is defined, then export a function that takes jQuery as an argument; if module is not defined, then simply invoke the function in the current context (as it currently does). If that sounds good to you, I can have a PR ready in a little while.

vjt commented 7 years ago

@rylnd looks good, I will review the PR gladly. We should also split the code in multiple files for better composability - but that's a successive refactoring PR :)

Thanks!