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

85 Commits

Author SHA1 Message Date
Florian Kissling
5fd72d2052 Set "width" to "100%" as default for all Select2s on the "Examples" page. 2015-05-06 09:28:48 +02:00
Florian Kissling
20b64cfe15 Group single and multiple select box examples under "The basics". 2015-05-06 03:20:44 +02:00
Florian Kissling
45d8486dbb Remove p.lead from .jumbotrons. 2015-05-06 03:04:48 +02:00
Florian Kissling
b74a0ae6e0 Move all examples to partials. 2015-05-06 01:19:05 +02:00
Florian Kissling
f54993050e This h1 should be an h2. 2015-05-04 04:28:28 +02:00
Florian Kissling
a728044fa9 More grouping on the "Examples" page.
* "Loading array data" and "Loading remote data" now go together under "Other data sources",
* "Events" and "Programmatic access" under "Programmatic control",
* "Theme support", "Responsive design" and "Templating" under "Themes, templating and responsive design"
2015-05-04 03:04:09 +02:00
Florian Kissling
ba61678358 Group diacritics, RTL and l10n examples.
Just an example – very unsure what goes with what.
2015-05-02 20:53:51 +02:00
Florian Kissling
bf7d273f89 Add sidebar anchor navigation to the "Examples" page. 2015-05-02 14:10:31 +02:00
Florian Kissling
3ed07a6fda Stop anchorjs from suffixing its links for "Placeholders" and "Templating" headlines.
Cosmetic changes for the homepage 3.x docs notice.
2015-05-01 04:30:52 +02:00
Florian Kissling
4b34dc7063 Calmer "Example Code" headlines. 2015-04-28 02:42:18 +02:00
Florian Kissling
c57a6fea90 Change "Loading remote data" formatRepo() markup.
Now fits the styles in docs/_sass/_s2-result-repository.
2015-04-28 02:41:52 +02:00
Florian Kissling
0474e69e6e Add .s2-docs-container to enable anchor.js. 2015-04-24 03:37:20 +02:00
Florian Kissling
f8ecee7783 Add .jumbotron with headline and dummy .lead. 2015-04-24 02:56:28 +02:00
Florian Kissling
439e834b38 Group buttons for "Programmatic access" and "Disabled mode" demos.
This also gets rid of the colored buttons in favor of `.btn-default`, prevents wrapping of the "Destroy" button of the first button group of the "Programmatic access" demos to a second line and consistently places buttons below the Select2 widgets they apply to.

Ref. http://getbootstrap.com/components/#btn-groups.
2015-04-22 18:05:59 +02:00
Kevin Brown
878de20d44 Fix typo in documentation
This closes https://github.com/select2/select2/issues/3213.
2015-04-02 11:29:44 -04:00
Tyler Pearson
c0dadf44a1 Fix misspelling 2015-03-19 20:58:57 -07:00
Kevin Brown
a06379ce8d Normalize ids to string for remote data
This also fixes an issue where we were using the `full_name` for
the value instead of the `id` in the example, which technically
wasn't correct.

This closes https://github.com/select2/select2/issues/3148.
2015-03-14 20:36:06 -04: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
dc2f6d451a Fix example code for the old matcher 2015-02-24 14:18:07 -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
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
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
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
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
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
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
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
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
Kevin Brown
e7c2c70d1a Added RTL support to Select2
This works in the same way as the `lang` option, which pulls
directly from the `dir` property on DOM nodes.
2014-12-17 22:08:58 -05:00
Kevin Brown
ea41b627dc IE fixes and alt-arrow support
alt-down/up is the standard way of opening a select when using a
screen reader. This also fixes the gradient in IE, so now it
displays the right colors. Also added a note about Placeholders.js,
so the placeholders on multi-select boxes will work in IE 9 and
below.
2014-12-17 19:06:13 -05:00
Kevin Brown
358306ac8c Respect the disabled attribute
Added a disabled state for Select2. This will correctly listen to
property changes (so when the disabled property is changed) and
update the state of Select2 to reflect it.

Added a utility function to find a method to a different context.
2014-12-16 22:44:11 -05:00
Kevin Brown
e23b8b5483 More work on the announcement 2014-12-11 18:11:03 -05:00
Kevin Brown
100015b205 Added back select2('val')
With the recent changes to how Select2 works internally, this really
isn't needed. This has been added to make the migration path
easier, and it just internally calls `val` on the underlying select
element. The only difference is that the `val` function will now
convert any non-string elements to strings.

The second argument (`triggerChange`) has not been migrated, as
Select2 now internally relies on the `change` event.

**Note:** As the old `initSelection` method has not been migrated,
it is not possible to set the `val` on remote data sources where
the value has not previously been selected.
2014-12-11 17:11:38 -05:00
Kevin Brown
caf4ad73d7 Allow for custom sorting functions
This adds the `sorter` function, which works in the same way as the
old `sortResults` function.
2014-12-10 18:22:25 -05:00
Kevin Brown
f7d75b62fa Added more documentation
This adds documentation for a `dropdownParent` option which has
not yet been created, but will come in the next commit.
2014-12-09 22:02:16 -05:00
Kevin Brown
4cdda7e156 Finish off the incomplete options documentation
The documentation is not completely finished, but now we have no
placeholders waiting to be completed.
2014-12-09 20:30:57 -05:00
Kevin Brown
d9e254ed27 Fixed the theme example 2014-11-24 21:37:29 -05:00
Kevin Brown
ffed37013d Added back the allowClear option 2014-11-24 20:43:15 -05:00
Kevin Brown
dafa99bf40 Working on the classic theme 2014-11-24 20:08:24 -05:00