-
Notifications
You must be signed in to change notification settings - Fork 481
[UI 1.12] jQuery UI: Article on the classes option #574
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
Conversation
|
||
*Note: To get a full list of the class names you can use with `classes`, you can log the default values stored at `$.namespace.wigetName.prototype.options.classes`. For instance the dialog widget's default values are available at `$.ui.dialog.prototype.options.classes`. Additionally, the API documentation for all jQuery UI widgets list the class names they use; here are dialog's: <http://api.jqueryui.com/dialog/#theming>.* | ||
|
||
The `classes` option works any other widget factory option, which means all the mechanisms around options still apply. For instance the following code uses the [`option()` method](http://api.jqueryui.com/jquery.widget/#method-option) to remove all class names currently associated with `ui-dialog`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First sentence, "...works on any other..." need the word 'on' in that sentence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not "on", but "like".
This is an awesome start! |
}); | ||
``` | ||
|
||
For more examples of this approach, checkout [Alexander Schmitz's repo](https://github.com/arschmitz/jqueryui-bootstrap-adapter) that adapts jQuery UI to work with Boostrap using the `classes` option. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checkout -> check out, unless you actually want them to clone and checkout the code.
@tjvantoll Wanne update the PR a little? |
@arthurvr I'm waiting for the |
I think the API is now final, could update this. |
I addressed all comments and finished the section on custom widgets. This is ready for a review (although note that this shouldn't go live until jQuery UI 1.12 does). |
|
||
## Syntax overview | ||
|
||
The `classes` option is used to map structural class names to custom class names that you define. To see what this means let's look at an example. The code below uses the `classes` option to create a red dialog: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not entirely true it maps structural class names to theme class's ( both custom and built in ). You are also doing more then just making the dialog red here you are also removing the rounded corners.
Just as a general comment on the last half of this article on custom widgets. I think that if we are going to get into the use of the new methods in your own widgets we should get into more detail and fully explain their use ( and probably mention some common pitfalls people will run into ). Otherwise i think we should stick to explaining how to use the option and leave custom widgets for another more in depth article or just to the api site. |
WIP. I need to make another pass at this after we decide if we're moving forward with
_addClass()
and_removeClass()
.