Using multiple jQuery versions problem - multiple-versions

I am building control that uses last version of jstree. Problem is that whole system is build using jQuery 1.3.2, but i need to use jQuery 1.4.2 for jstree, also to prevent errors need "$" still pointing to jQuery 1.3.2 to make system works normally. I tried to solve problem like this
var jq142 = jQuery.noConflict(true);
And it works, but when i added other control to form like "datepicker" that initialized via $("#id").datepicker it throws error $("#id").datepicker is not a function
When i inspect DOM variables through firebug all is ok - $ is pointing to 1.3.2 and datepicker function is registered.
What it can be?
Thanks

in case anyone came to this by looking for unanswered questions, the answer was to simply upgrade to 1.4.*
btw: jQuery 1.7 has just been released... time to upgrade again ;-)

Related

Refactoring Computed Properties on Ember.js 1.13

I was able to upgrade most of my Ember.js project to 1.13 after having some issues along the way, but now I can't wrap my head around the following deprecated code:
filteredPosts: function(){...}.property('var1','var2','var3')
When I enable it, the only notice that I receive is:
Uncaught TypeError: controllerClass.proto is not a function.
Noting that ComputedPropertyPrototype.get is the only useful information coming from the Stack Trace.
After researching around, I only found this concerning the deprecation, so I wanted to know how such code would be refactored into the native array methods or into anything that allows the same behavior.
Also, my apologies as I unfortunately cannot post an extra link to the specific file due to being a new user, so if you want to see the complete project you can head to github.com/Deovandski/Fakktion.
filteredPosts: function(){...}.property('var1','var2','var3')
should become:
filteredPosts: Ember.computed('var1', 'var2', 'var3', function() {
...
});
It's because prototype extensions are discouraged in recent versions of Ember and seems like you've encountered a problem related to prototype extensions. It'd be best if you create a demo of this issue, but Ember.computed should just work.

New rails 4.1 mailer preview action not found error

Rails has 607 open issues...so, rather than plugging that hole even more I though Id try here first. I have upgraded to 4.1 and am implementing rails mailer previews. I tried upgrading my existing mailer and adding tests/mailers/previews directory. When that gave the following error I tried generating a new mailer. Same error.
class NotifierPreview < ActionMailer::Preview
def welcome
Notifier.welcome(User.first)
end
end
results in this error:
The action 'notifier' could not be found for Rails::MailersController
I've tried searching google, the docs, stack overflow, but nothing eludes to this error.
Anyone experience this or have any ideas?
The default preview path is /test/mailers/previews but rspec will override this to be /spec/mailers/previews
You can set the path to be whatever you like with:
config.action_mailer.preview_path = "#{Rails.root}/test/mailers/previews"
This is because you are using UserMailer with NotifierPreview. Change NotifierPreview to UserMailerPreview and it will start working. Check the example implementation https://github.com/RichIsOnRails/ActionMailerPreviewsExample and tutorial.
Cheers!!
If you're using rspec, make sure that the rspec-rails gem is being loaded in the development environment, otherwise Rails will look for the previews under the /test folder, not /spec.
Remove the line(s)
get '/:controller(/:action(/:id))'
get '/:controller(/:action(/:id))(.:format)'
from your routes.rb
As #hellion says in a comment on the previous answer this is the solution to this problem.

Some cookie makes Play! answer with an err_empty_response

I have a JS plugin (getvero.com) that creates a cookie like that
[{"command":["events_track","Visited site",{},{"time":1377020238096}],"job_id":"1377020238097_9041"},{"command":["events_track","Visited Site",{"URL":"http://mywebsite.com/discoveries/","Referrer":"Direct","_n":"Visited Site","_k":"cd4dde369919a1626d13a28d1d54bc11bdc7f48d","_p":"qLipS0SbtoTOfJCUyiyRjoCQFFo=","_t":1377020242},{"time":1377020241741}],"job_id":"1377020241741_235"},{"command":["events_track","Visit all discoveries",{"_n":"Visit all discoveries","_k":"cd4dde369919a1626d13a28d1d54bc11bdc7f48d","_p":"qLipS0SbtoTOfJCUyiyRjoCQFFo=","_t":1377020242},{"time":1377020241752}],"job_id":"1377020241752_8389"}]
which makes play answer an err_empty_response when I ask for a page without removing the cookie.
I was with play 2.0.4, I upgraded to 2.0.6 but didn't make it work.
Seems close to this issue : http://play.lighthouseapp.com/projects/57987/tickets/1618-long-cookies-with-double-quote-values-make-play-fail-before-the-request-is-handled
I'll try 2.1 later.
Otherwise, any idea ?
Upgrading to Play 2.1 made it work.

How do you use precompiled handlebars templates with emberjs 1.0.0-rc.2?

I'm trying to use guard-handlebars to precompile my handlebars templates (to avoid having them all in my index.html, which feels slightly sub-optimal...). The precompilation works well, and Ember accepts the fact that the template accept when I inject it into Ember.TEMPLATES like this:
Ember.TEMPLATES['application'] = Handlebars.templates['application']
However, it doesn't work. I get an exception like this:
Could not find property 'outlet'
...in the Handlebars helperMissing method. It seems like Ember uses some monkey-patching of the default Handlebars stuff, supposedly adding support for the {{outlet}} helper and others. But my template does not seem to use these outlets. How do you work around this?
I'm using the handlebars compiler installed via NPM to compile the templates.
Found a duplicate question with a suggested solution/workaround: How can I consume handlebars command-line generated templates with Ember?
(short summary: yes, precompiling with the handlebars command line program does not work straight away, exactly because of the reason I am suggesting in the original question)
The plugin for you.
(Here's a sample integration: https://github.com/trek/ember-todos-with-build-tools-tests-and-other-modern-conveniences/blob/master/Gruntfile.js)
The guard-handlebars gem is pretty out of date, it was not designed to work with ember.
Today there are a few options.
barber with rake-pipeline
grunt-ember-templates
For example, to compile an ember template with barber try something like this:
compiled_template = Barber::Ember::FilePrecompiler.call(IO.read(file))
# now ruby variable compiled_template is a string like: "Ember.Handlebars.template(function(...));"
result = "Ember.TEMPLATES['#{name}'] = '#{compiled_template}';"
# now result is a JS string that sets Ember.TEMPLATES[name] to precompiled handlebars
When a new version of ember comes out it can take a few days to make it's way thru the ecosystem. When that happens you might find the ember-source gem helpful. See Alex's blog post for more detail:
http://alexmatchneer.com/blog/2013/02/27/gemifying-ember-dot-js-slash-handlebars-dot-js-slash-etc-dot-js/

Router / StateManager - can't make it work

I've been trying to implement a router as specified in this guide, but I can't make it work. Can anyone give a quick code sample using the latest version of Ember to enable a router that supports routing through urls?
Here is a one with ember latest, still prone to changes :)
http://jsfiddle.net/C7LrM/86/ posted by #mediastuttgart
The comments section of this Gist by wycats looks like the place where you can get updated fiddles :) https://gist.github.com/2728699#comments
This example uses:
handlebars-1.0.0.beta.6.js
Ember latest as of now:
// Version: v0.9.8.1-484-g73ac0a4
// Last commit: 73ac0a4 (2012-07-06 11:52:32 -0700)
For documentation of present code under development please go to ember source where they have documentation alongside code,
Eg: https://github.com/emberjs/ember.js/blob/master/packages/ember-routing/lib/router.js
https://github.com/emberjs/ember.js/blob/master/packages/ember-routing/ in general