1
0
mirror of synced 2024-11-22 21:16:10 +03:00
Commit Graph

106 Commits

Author SHA1 Message Date
Kevin Brown
d3c887286d Update CDN version numbers 2015-03-01 22:09:37 -05:00
Kevin Brown
9d6752e3ea Bumping version numbers for rc.1 release 2015-03-01 21:30:37 -05:00
Kevin Brown
5c9dc0e509 Added example for hiding search
This also fixes a possible issue where the `< 0` fallback would
not be used because the `minimumResultsForSearch` check would
always return false and never load in the module.

This closes https://github.com/select2/select2/pull/3077.
2015-02-27 20:37:48 -05:00
Kevin Brown
5ec852e18c Added documentation for <input type="text" />
This adds basic documentation explaining that there are compatibility
decorators for `<input type="text" />` support. This is not fully
compatible with all features and requires the use of an external
adapter like the `ArrayAdapter` or `AjaxAdapter` to provide a
reasonable way to query results.

This also triggers a warning if the adapter is used with a hidden
input, as the degraded functionality when there is no JavaScript
support should be discouraged.
2015-02-27 18:38:16 -05:00
Kevin Brown
5b95c0e834 Clarified the documentation README [ci skip]
The documentation README was previously intended to be read from
the documentation repository, not from the source repository.
This had the potential to give off the impression that documentation
pull requests were not allowed, when exactly the opposite is the
case.  The README has been improved to make it more clear how to
contribute pull requests to update the documentation.

Thanks to Brent Connor [1] for pointing out this issue over at
Stack Overflow [2].

[1]: https://stackoverflow.com/users/3954106/brent-connor
[2]: http://stackoverflow.com/q/28705192/359284
2015-02-24 17:27:16 -05:00
Kevin Brown
dc2f6d451a Fix example code for the old matcher 2015-02-24 14:18:07 -05:00
Kevin Brown
4271b10531 Add docs for three more options
This adds documentation for the follow options

- `minimumInputLength`
- `maximumInputLength`
- `minimumResultsForSearch`

This closes https://github.com/select2/select2/issues/3035.
2015-02-14 16:53:17 -05:00
Stephan Groß
a5532ee8a8 Fix typos 2015-02-13 11:36:21 +01:00
Kevin Brown
9d4ec4f85b Add templating documentation
This adds documentation for the `templateResult` and
`templateSelection` options.  The fact that placeholders and
custom messages are templated was noted, although most people
should be using the standard `text` property that they provide
anyway.  This fixes the templating link provided in the release
announcement to link to the correct location in the documentation.

This also adds support for the `templateSelection` function to
return a DocumentFragment or jQuery compatible object to be
passed back and rendered.

This closes https://github.com/select2/select2/issues/3005.
This closes https://github.com/select2/select2/issues/3019.
2015-02-09 19:27:10 -05:00
Kevin Brown
c9a8508a39 Add back closeOnSelect option
The `closeOnSelect` option was previously used to control whether
or not the dropdown was closed when an option was selected.  This
could be simulated by triggering the `open` event after the `close`
event was received, but it makes sense to abstract it out into a
decorator.

This also adds support for not closing the dropdown when the control
key is being held.  This is useful when multiple options need to be
selected in quick succession, so the dropdown does not have to be
reopened.

This also adds documentation that covers both changes.

This closes https://github.com/select2/select2/pull/2735.
This closes https://github.com/select2/select2/issues/3017.
2015-02-09 18:54:19 -05:00
Kevin Brown
caeb0ec9b7 Add jQuery 1.x data attribute note
This adds a note about how nested data attributes do not work in
jQuery 1.x due to a bug with the `$.fn.data` method.

This is for https://github.com/select2/select2/issues/2969.
2015-02-09 17:43:16 -05:00
Kevin Brown
8aca7a4085 Added templating example
This also fixes the case where `templateResult` does not return a
string, where it will fall back to jQuery to set the value of the
option.  This allows for the `templateResult` function to return a
jQuery or DOM element that contains the templated data.

Just like with the translation methods, only strings returned from
`templateResult` will be escaped.

The old flag icons have been transferred from the old repository to
the documentation, for use in the templates.  Unfortunately I cannot
find a license for them, but I suspect a license isn't actually
needed considering the state flags are public.

This closes https://github.com/select2/select2/issues/3005.
This closes https://github.com/select2/select2/issues/818.
2015-02-09 17:35:40 -05:00
Kevin Brown
bcc43139fd Merge pull request #3006 from WouterSioen/patch-1
Add rel=stylesheet to the cdn link.

Closes https://github.com/select2/select2/issues/3020.
2015-02-07 12:51:43 -05:00
Kevin Brown
7155adc718 Split out formatRepo and formatRepoSelection
This splits out the two templating functions that are referenced in
the documentation. The two functions were previously available in
the source code, but they were not named with the method names that
the documentation referred to.

This closes https://github.com/select2/select2/issues/2993.
2015-02-06 20:08:28 -05:00
Kevin Brown
631ae06c8d Fix broken Placeholder.js links
It appears as though GitHub has stopped serving the Placeholder.js
GitHub Pages site.  This broke placeholder support on older versions
of IE in the documentation and broke the link we had to the
polyfill.  Since the repository is still online, and the
documentation should work without an internet connection, the
JavaScript files have been pulled into the documentation folder.
2015-02-06 19:34:48 -05:00
Wouter Sioen
fabbb734e4 Add rel=stylesheet to the cdn link
Without specifying the rel="stylesheet" in your link tag, some browsers don't interpret the file as css.
2015-02-05 17:34:54 +01:00
Teoh Han Hui
34000de9f8 Fix typo in docs/options.html 2015-02-05 17:50:26 +08:00
Kevin Brown
4c563a3d06 Add back ajax.transport support
This adds back the `ajax.transport` option, which allows anyone to
use their own AJAX backend. By default, `jQuery.ajax` is used as the
default transport backend.

**Breaking change:** Instead of taking `params` that contains a
`success` and `error` keys for the callback, two new callback
parameters are passed alongside of `params` that should be called
when the request succeeds or fails.

This closes https://github.com/select2/select2/issues/2987.
2015-01-29 09:15:02 -05:00
Kevin Brown
5a0f7f5518 Added back escapeMarkup
This is needed to escape any bad markup that is passed through
user-entered data. Users can prevent their markup from being
escaped by using a no-op `escapeMarkup` function.

This closes https://github.com/select2/select2/issues/2990.
2015-01-29 09:15:02 -05:00
Kevin Brown
a4448d3d00 Preparing for the 4.0.0-beta.3 release 2015-01-27 20:11:38 -05:00
Kevin Brown
15c827b60f Added documentation for matcher
This adds documentation for the revised `matcher` function, as well
as the compatibility `oldMatcher` function for those who are
upgrading.

This closes https://github.com/select2/select2/issues/2971.
2015-01-27 19:36:54 -05:00
Kevin Brown
9906b2f434 Fixed dropdown for responsive widths
When we re-implemented support for responsive widths, through the
use of percentages, we never moved the support over to the dropdowns.
So the dropdowns generally were not large enough, and when resized
they never re-adjusted, and they didn't fully work as intended.

This fixes the issue by automatically resizing the dropdown whenever
it is repositioned, mainly to handle new scrollbars, which will
ensure that it is always the same width as the container.

This also adds a section to the examples for responsive design,
just like in the old documentation.

This closes https://github.com/select2/select2/issues/2949.
2015-01-27 14:07:44 -05:00
Kevin Brown
bca4e1f6d8 Add information about build types 2015-01-22 17:01:50 -05:00
Kevin Brown
80bda0ad55 Fixed the selectOnClose option
The `selectOnClose` option did not work in production because we
were decorating the `dropdownAdapter` instead of the `resultsAdpater`
when automatically generating the adapters. This has now been fixed,
and the option should work without errors in production.

This also adds documentation for the `selectOnClose` option.

This closes https://github.com/select2/select2/issues/2953.
2015-01-22 15:19:45 -05:00
Kevin Brown
686f846fa5 Changed how the builds are done
This adds a check that triggers an error if Select2 was not able
to detect a copy of jQuery on the page. This should help users when
they are setting up Select2.

**Breaking change:** The full build no longer includes jQuery.
Previously, the full build included all requirements for Select2,
including jQuery, which meant that anyone looking for the optional
requirements had to possibly include multiple versions of jQuery
on their page. This means that anyone requiring Select2 to also
bundle jQuery will now need to include jQuery on their pages
alongside Select2. A copy of jQuery is included in the repository.

**Breaking change:** The AMD build of Select2 will now correctly
wrap the code in a `define` block. It will still create the named
blocks inside of the code, which should be valid in most AMD build
systems, so now Select2 is compatible with cases where the file
does not have the same name as the Select2 module name.

**Breaking change:** Select2 will re-use the AMD methods if they
are available on the page, but it will not longer leak the included
AMD loader to the global scope. The AMD methods will still be
available on the `jQuery.fn.select2.amd` namespace.

The `mock.js` test file has been renamed to `helpers.js` and will
handle the escalation of the `require` and `define` variables to
the global scope. It should be included in all test files, or the
tests will fail.

This closes https://github.com/select2/select2/issues/2946.
2015-01-22 14:49:39 -05:00
Kevin Brown
850816ee77 Update docs links for the CDN
Now that cdnjs is mirroring the beta files, we know what the final
locations are going to be. These identifiers will need to be updated
during the release process, just like all of the others.

This closes https://github.com/select2/select2/issues/2955.
2015-01-21 16:20:15 -05:00
Kevin Brown
f427451853 Expose the defaults
This exposes the default options for Select2 as
`$.fn.select2.defaults`. A default option can be set using the
`set(key, val)` option which is available. The key should use the
same formatting as the HTML data attributes.

This also adds some documentation about it.
2015-01-17 21:27:53 -05:00
Kevin Brown
c5a3f34012 Added notes on the AMD-specific options 2015-01-17 20:59:05 -05:00
Kevin Brown
d6a83ea026 Pull query and initSelection out to compat modules
This also adds more documentation and corrects the release notes
for these breaking changes. These modules will now only be included
in the full builds of Select2, which has been noted in a few places.
2015-01-17 20:47:52 -05:00
Kevin Brown
286b83898f Documented the removal of initSelection and query
This adds detailed docs explaining how you can convert the old
implementations of `query` and `initSelection` into a custom data
adapter using the `current` and `query` methods provided there.
Examples are included that should make it considerably easier to
handle.
2015-01-14 21:24:08 -05:00
Kevin Brown
911966be78 Update version identifiers for 4.0.0-beta.2 2015-01-13 19:18:33 -05:00
Kevin Brown
8d35d5e416 Fixed opening issue
This fixes an issue where the data set would not be queried when
the dropdown was opened.
2015-01-13 19:09:04 -05:00
Kevin Brown
28f9cae5d7 Added some more jQuery events
This adds the `select` and `unselect` events so users can still
hook into them from their jQuery plugins.

This also modifies the core `trigger` to fire pre-events that can
be canceled for the `open`, `close`, `select`, and `unselect`
events. Users implementing these events who need to handle cases
where the event has been prevented should check `args.prevented`,
where `args` is the object that was included for arguments when
triggering the internal event.
2015-01-13 18:28:21 -05:00
Zubair
bc71ad4880 fix spacing of examples. 2015-01-13 13:49:27 -05:00
Zubair
160abdc54e cleanup example and move examle based on PR comments. 2015-01-13 13:00:17 -05:00
Zubair
e18fa1b5b8 fix callback using this.current.
add example.
2015-01-13 13:00:16 -05:00
Kevin Brown
766d9f05e0 Automatically set up docs symlink
This also adds some docs about building the documentation.
[ci skip]
2015-01-12 19:56:25 -05:00
Kevin Brown
af1f35176b Added back the width option
In past versions of Select2, the `width` option could be used to
tell Select2 how to determine the width of the container generated
by Select2.

**Breaking change:** The default value for the `width` option has
been changed from `copy` to `resolve.`

**Breaking change:** The old option called `copy` has been renamed
to `style` to better reflect what the width is generated from.

This fixes https://github.com/select2/select2/pull/2090.
This fixes https://github.com/select2/select2/issues/2911.
2015-01-11 18:00:48 -05:00
Eric Dahl
e9455e1a84 Docs: typos 2015-01-10 12:39:53 -08:00
Kevin Brown
27c5eebcf9 Hide the event demo 2015-01-08 11:57:56 -05:00
Kevin Brown
1fe8de3ad5 Fix tagging example
Tagging should be demonstrated using the multiple select, as that
is where it really shines. It's also how we used to demonstrate it.

This closes https://github.com/select2/select2/issues/2901.
2015-01-08 11:53:31 -05:00
Kevin Brown
64cb528f62 Set up a public event relay
Now Select2 can fire jQuery events that will match the corresponding
internal events. The `open` and `close` events are now publicly
accessible.

The selection adapter was chosen because it is the least likely to
be moved, but handles the most common events. This `EventRelay`
decorator should theoretically be able to decorate any of the
adapters, as they all have the `bind` method that it needs.
2015-01-08 11:44:09 -05:00
Kevin Brown
bba967ba21 Use the star event for internal binding
The star event will allow us to relay any custom events as well as
the ones used internally by Select2. This also makes it much
easier to start triggering events in general, as we don't need to
relay it in the core anymore.

A module has been created for the jQuery-facing events, and the
release announcement has been updated to mention the event name
changes.

This also adds some documentation about the public events.
2015-01-08 10:40:13 -05:00
Kevin Brown
df40e22586 Finish off the initial release notes and prepare for beta 2015-01-07 23:03:30 -05:00
Kevin Brown
05cbaf7bf7 Universally use the object query return
There was a plan to universally use an array as the return from
query methods, but now that we've realized pagination and extra
things are impossible without it, we're going back to the return
object. Anyone looking to migrate their data should be returning
an object with the key `results` containing what they previously
returned.

This should fix https://github.com/select2/select2/issues/2898
2015-01-07 21:11:32 -05:00
Kevin Brown
f8fdcb6fa5 Added support for tokenization
This brings up both the `tokenizer` and `tokenSeparators` options.
2015-01-06 20:03:12 -05:00
Kevin Brown
dcfaa5f628 Added Google Analytics 2015-01-05 19:30:15 -05:00
Kevin Brown
562669064b Called out 3.5.2 dodcs
Also migrated all of the links to the new location in the GitHub
organization.
2015-01-05 18:22:27 -05:00
Kevin Brown
ed24a51ea3 Updated docs to use the Select2 GitHub organization
Documentation will now be at https://select2.github.io
2015-01-02 21:12:41 -05:00
Kevin Brown
09e3a76bf9 Added pagination support for AJAX results
I'm still not quite sure how this should be handled for the general
case, but for the special case we have this for infinite scrolling,
only on AJAX data.
2015-01-02 19:58:09 -05:00