Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usage of general jQueryUI Plugins #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

jdittrich
Copy link

Enable the use of jQueryUI Plugins that are created by the "widget factory" utility of jQUI (http://api.jqueryui.com/jQuery.widget/) Before, just the widgets that jQueryUI brings with it were supported.

Changes include:

  • a possible uiNamespace setting on the ember view object. It makes it possible to use plugins that use other namespaces than the jQUeryUI native "ui" one. The "ui" namespace is default, so it's specification is not needed if only native jQUI Widgets are used
  • The retrieval of the ui property of the mixin has been changed in order to be able to retrieve not only the native jQueryUI widget instances. Native ones are defined as properties on the jQuery UI object itself, which was previously used. All plugins created by the widget factory are saved using a data-property (http://api.jqueryui.com/jQuery.widget/ Heading: widget). Now the widget is first created on the jQuery-Object of the views DOM-Element, than the reference to the widget itself is created and saved like before.

… using the "widget factory" utility from jQuery UI. Changes include: a possible uiNamespace setting on the ember view object. It makes it possible to use plugins that use other namespaces than the jQUeryUI native "ui" one. The "ui" namespace it default, so it's specification is not needed if only native jQUI Widgets are used -- The retrieval of the ui property of the mixin has been changed in order to be able to retrieve not only the native jQueryUI widget instances. Native ones are defined as properties on the jQuery UI object itself, which was previously used. Now the widget is first created on the jQuery-Object of the views DOM-Element, than the reference to the widget itself is created and saved like before.
var ui = jQuery.ui[this.get('uiType')](options, this.get('element'));


var namespace = this.get('uiNamespace') || 'ui'; //the included jQuery UI widgets use the 'ui' namespace, ohter jQuery UI plugins may (or rather should) use their own namespace
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like this variable is ever used. Is there something missing?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes.
var ui = jQuery(this.get('element')).data(namespace+"-"+this.get('uiType')) ;//save instance
..."namespace"+"-" in that line

@lukemelia
Copy link
Owner

Thanks @jdittrich. I would like to update this to support other jQuery plugins. I think this PR needs some work. Can you make some changes per my comments?

…nal widgets; leftover debug message (console.log)
@jdittrich
Copy link
Author

Thanks for your comments and apologies for some stupid stuff I oversaw. I fixed the code according to your comments.

@lukemelia
Copy link
Owner

@jdittrich Thanks. That makes more sense.

In order to make sure that I'm able to keep this working reliably as new versions of Ember and jQuery UI are released, it would be good to exercise the support you are adding. What do you think about adding a widget factory style plugin to the app so that people can see an example of this support in use, and we can more easily make sure it keeps working?

@jdittrich
Copy link
Author

absolutely – I was already thinking of that but I did not have a good idea what the widget should do. We could possibly reimplement a simple native widget, like button, which actually would enough for even demonstrating custom events – how is that?
I have to say that I still try to fully wrap my head around Ember.js (the magic it does makes understanding hard sometimes) so it may need help on this side; Implementing jQUI Widgets should be without major problems for me.

@lukemelia
Copy link
Owner

A custom button sounds like a decent choice. Happy to help with any of the Ember bits you need.

…to external widgets; leftover debug message (console.log)"

This reverts commit 0a0f979.
…ibility to external widgets; leftover debug message (console.log)""

This reverts commit 5ab84ba.
…ion helper not totally succesful; classes missing.
@jdittrich
Copy link
Author

Hi Luke, I implemented a very simple working example that demonstrates use of own jQueryUI namespaces and custom events. Reading through your code I tried to get to understand the {{collection}} helper in the template and noticed that it is deprecated: I tried to fix it but was not successful. (my attempt is inserted as comment in my master-branches index.html)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants