Globalize.js API changes and jQuery UI - jquery-ui

I'm trying to play with the examples from jQuery UI, such as this one. I would like to use the globalization functions (for a currency field, for example), but it seems that Globalize.js has gone through a major API change, so that the code used in the UI examples doesn't work with the Globalize version I downloaded. For example, the jQuery UI depends on a Globalize.parseFloat function that doesn't exist in that version.
So apparently jQuery UI uses a legacy version of Globalize.js, but how should I download it? I couldn't find any information on that, neither on the API changes. I could download the JS files that are included by jQuery UI, obviously, but I was hoping for a "more official" solution.

I can confirm that the Globalize 1.0.0-alpha releases are incompatible with the current jQuery UI 1.11.x releases. I have successfully used Globalize 0.1.1 with jQuery UI 1.11.x.
This blog post from jQuery UI indicates that they are "...working on a full rewrite of the datepicker widget. The rewrite will feature a far simpler API that will make customizations a lot easier. The rewrite builds on top of the rewritten Globalize library, which builds on top of CLDR, a comprehensive source for globalization data.". Hopefully, this rewrite will include more than just datepicker!

It's 2016 already, two years later, but jQuery 1.11.x is still current (v1.12 in BETA). And I ran into this same issue for a brown-field project I'm doing. I managed to solve this thanks to the OP's analysis that jQuery UI indeed assumes the legacy Globalize version, and the solution of #wedgef5 to switch back to v0.1.1 of Globalize.
The OP did ask for an official answer. I guess there is none, but current best practice is to use a package manager. I use Bower which downloads the current version (now v1.1) by default. Assuming you did the same, you fix this in Bower as follows:
bower uninstall globalize --save
bower install globalize#0.1.1 --save
If you use a different package manager, something similar applies. After this code similar to this example works :). Your bower.json should be changed:
{
"name": "yourpackage",
...
"dependencies": {
...
"globalize": "0.1.1" // Used to be: "globalize": "^1.1.1"
...
}
...
}

Have you tried going to the releases tab in the globalize github project? You can cross-reference the release dates of globalize and jQueryUI and make your best guess from there.

Related

Ruby on Rails Gem or Bower for CSS and Javascript?

In Ruby on Rails, which is better for CSS and Javascript dependencies?
To install them as Gem or as Bower dependency? Such as jQuery and or Bootstrap?
It is better to install CSS frameworks like Bootstrap as a Gem. Here is my favorite Bootstrap installation guide: https://launchschool.com/blog/integrating-rails-and-bootstrap-part-1
jQuery is already included in the default Rails setup.
This is very much a personal preference. There are schools of thought that go both ways.
I haven't looked in a long time, but oftentimes the gems are usually behind the current release of front-end libraries.
UI portability is greater if you keep the frontend/backend logic completely separate. If you wanted to switch to another backend tomorrow, how long would it take?
Using gems is faster, and you have a single tool (bundler) to handle the depedencies.
I have avoided providing my personal preference in favor of a neutral post.
AS my opinion ....
rather than gem/bower, you should download files and integrate to project
like for bootstrap download bootstrap files

does scriptaculous still have Javascript hacking vulnerability?

Scriptaculous is listed with the Javascript Hacking vulnerability in the following site:
[http://nvd.nist.gov/view/vuln/detail?vulnId=CVE-2007-2384]
Does any know if this has been resolved since the article was posted in 2008?
I think the vulnerability of Scriptaculous was due to Prototype js 1.6.
https://security-tracker.debian.org/tracker/CVE-2007-2383
If u want to use scriptaculous without vulnerability u have to replace the prototype js file in the scriptaculos with the latest prototype js version. The latest today I think is 1.7.3

what's the point of having a jquery-rails

So I installed Ruby on Rails(first time) and got down to starting a new project and a server. So as expected there was an error on running the Rails server command. Some gems needed to be installed, apparently. The bundle install command didn't work for some wierd ssl issue. So I decided to do it all
manually.
What strikes me as odd is that there's a gem for jQuery: jquery-rails. I don't understand the point of this, really. Why not simply download the jquery file and put it in public.
What's the point of having a gem here.
Is it simply convinience or is there another important reason behind it?
Jquery-rails does 2 things. First of all it bundles the appropriate version of jquery. I consider this only a convenience for jquery itself. For something like jquery-ui, jquery-ui-rails does a lot more: since jquery-ui is modular, that gem will serve to clients only the bits of jquery-ui you are using.
The other thing in jquery-rails is jquery-ujs. This is javascript that makes things such as passing the :remote => true option to form_for work. It used to be that rails itself contained a version of this for prototype, but with rails 3 this was extracted from rails to make it easier to use other javascript libraries than rails' previous default of prototype
I think this is a good idea, because it makes JQuery available as a versioned dependency.
If you need to update JQuery, you just have to change the version at one place in your app, and every page that needs it will use the new version.
And based on its homepage, there's also a test helper that you can use in your tests.

JQuery UI with Primefaces

I have some old code that uses Primefaces 2.2.1 but I now that I need to upgrade the version to 3.1.1 to use some of the new features, some of my javascript functionality is breaking.
I tracked down the issue and realized that in 2.2.1, the jQuery UI plugin was included out of the box but for some reason it is missing in 3.1.1.
Does anyone know why this happened and how can I get my javascript to function correctly without changing it?
I have fixed the original problem posed by this question by downloading the jQuery UI plugin and including manually.

Is there a definitive solution for auto_complete in Rails?

I'm using DHH's auto_complete plugin, but am in the process of updating my dependencies on plugins to gems where feasible. Is there a newer, gemified version of this library, or has another solution emerged as the de facto standard?
I switched to jQuery autocomplete a long time ago, leaving outdated plugins in favor of unobtrusive custom javascript code.

Resources