Skip to content

Commit

Permalink
Merge tag 'v1.5.1' into option_adding
Browse files Browse the repository at this point in the history
  • Loading branch information
koenpunt committed Mar 10, 2016
2 parents e3f8d9d + 66ee36d commit b0da2a2
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 27 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
sudo: false

language: node_js

node_js:
- "0.10"

addons:
apt:
sources:
- git-core
packages:
- git

before_install:
- npm install -g grunt-cli
- gem install bundler
- bundle install

before_script: grunt build

after_success: ./bower-publish.sh
Expand Down
1 change: 0 additions & 1 deletion Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ This file is generated by `grunt build`, do not edit it by hand.
bower =
"name": pkg.name
"description": pkg.description
"version": version()
"main": bowerjson.main
"license": pkg.licenses
"ignore": []
Expand Down
12 changes: 8 additions & 4 deletions bower-publish.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#!/bin/sh

set -e

CURRENT_BRANCH=`git name-rev --name-only HEAD`

if [ $CURRENT_BRANCH != 'master' ] ; then
echo "Build not on master. Skipped bower-chosen release"
exit 0
fi

CHOSEN_VERSION=`git tag --sort=v:refname | tail -1`

git config --global user.email "[email protected]"
git config --global user.name "bower-chosen"

Expand All @@ -15,13 +19,13 @@ rm -rf bower-chosen/*
cp public/bower.json public/*.png public/chosen.jquery.js public/chosen.css bower-chosen/
cd bower-chosen

LATEST_VERSION=$(git diff bower.json | grep version | cut -d':' -f2 | cut -d'"' -f2 | tail -1)
LATEST_VERSION=`git tag --sort=v:refname | tail -1`

if [ -z $LATEST_VERSION ] ; then
if [ "$LATEST_VERSION" = "$CHOSEN_VERSION" ] ; then
echo "No Chosen version change. Skipped tagging"
else
echo "Chosen version changed. Tagging version ${LATEST_VERSION}\n"
git tag -a "v${LATEST_VERSION}" -m "Version ${LATEST_VERSION}"
echo "Chosen version changed. Tagging version ${CHOSEN_VERSION}\n"
git tag -a "${CHOSEN_VERSION}" -m "Version ${CHOSEN_VERSION}"
fi

git remote set-url origin https://pfiller:${GH_TOKEN}@github.com/harvesthq/bower-chosen.git
Expand Down
4 changes: 2 additions & 2 deletions chosen.jquery.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "chosen",
"description": "Chosen is a JavaScript plugin that makes long, unwieldy select boxes much more user-friendly. It is currently available in both jQuery and Prototype flavors.",
"version": "1.4.2",
"description": "Chosen is a JavaScript plugin that makes select boxes user-friendly. It is currently available in both jQuery and Prototype flavors.",
"version": "1.5.1",
"licenses": [
{
"type": "MIT",
Expand Down
8 changes: 5 additions & 3 deletions coffee/chosen.jquery.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ $.fn.extend({
this.each (input_field) ->
$this = $ this
chosen = $this.data('chosen')
if options is 'destroy' && chosen instanceof Chosen
chosen.destroy()
else unless chosen instanceof Chosen
if options is 'destroy'
if chosen instanceof Chosen
chosen.destroy()
return
unless chosen instanceof Chosen
$this.data('chosen', new Chosen(this, options))

return
Expand Down
2 changes: 1 addition & 1 deletion coffee/lib/abstract-chosen.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class AbstractChosen
when 27
this.results_hide() if @results_showing
return true
when 9, 38, 40, 16, 91, 17
when 9, 38, 40, 16, 91, 17, 18
# don't do anything on these keys
else this.results_search()

Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"author": "harvest",
"name": "chosen",
"version": "1.4.2",
"version": "1.5.1",
"description": "Chosen is a JavaScript plugin that makes select boxes user-friendly. It is currently available in both jQuery and Prototype flavors.",
"repository": {
"type": "git",
Expand Down Expand Up @@ -38,9 +38,7 @@
"bowerJSON":{
"main": [
"chosen.jquery.js",
"chosen.css",
"[email protected]",
"chosen-sprite.png"
"chosen.css"
]
},
"jqueryJSON": {
Expand Down
13 changes: 9 additions & 4 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div id="container">
<div id="content">
<header>
<h1>Chosen <small>(<span id="latest-version">v1.4.2</span>)</small></h1>
<h1>Chosen <small>(<span id="latest-version">v1.5.1</span>)</small></h1>
</header>
<p>Chosen is a jQuery plugin that makes long, unwieldy select boxes much more user-friendly.</p>

Expand Down Expand Up @@ -1326,19 +1326,24 @@ <h2><a name="right-to-left-support" class="anchor" href="#right-to-left-support"
</div>
</div>

<h2><a name="change-update-events" class="anchor" href="#change-update-events">Change / Update Events</a></h2>
<h2><a name="change-update-events" class="anchor" href="#change-update-events">Observing, Updating, and Destroying Chosen</a></h2>
<div class="side-by-side clearfix">
<ul>
<li>
<h3>Form Field Change</h3>
<p>When working with form fields, you often want to perform some behavior after a value has been selected or deselected. Whenever a user selects a field in Chosen, it triggers a "change" event on the original form field. That let's you do something like this:</p>
<h3>Observing Form Field Changes</h3>
<p>When working with form fields, you often want to perform some behavior after a value has been selected or deselected. Whenever a user selects a field in Chosen, it triggers a "change" event on the original form field. That lets you do something like this:</p>
<pre><code class="language-javascript">$("#form_field").chosen().change( &hellip; );</code></pre>
</li>
<li>
<h3>Updating Chosen Dynamically</h3>
<p>If you need to update the options in your select field and want Chosen to pick up the changes, you'll need to trigger the "chosen:updated" event on the field. Chosen will re-build itself based on the updated content.</p>
<pre><code class="language-javascript">$("#form_field").trigger("chosen:updated");</code></pre>
</li>
<li>
<h3>Destroying Chosen</h3>
<p>To destroy Chosen and revert back to the native select:</p>
<pre><code class="language-javascript">$("#form_field").chosen("destroy");</code></pre>
</li>
</ul>
</div>

Expand Down
16 changes: 12 additions & 4 deletions public/index.proto.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<div id="container">
<div id="content">
<header>
<h1>Chosen - Prototype Version <small>(<span id="latest-version">v1.4.2</span>)</small></h1>
<h1>Chosen - Prototype Version <small>(<span id="latest-version">v1.5.1</span>)</small></h1>
</header>
<p>Chosen is a Prototype plugin that makes long, unwieldy select boxes much more user-friendly.</p>

Expand Down Expand Up @@ -1327,12 +1327,12 @@ <h2><a name="right-to-left-support" class="anchor" href="#right-to-left-support"
</div>
</div>

<h2><a name="change-update-events" class="anchor" href="#change-update-events">Change / Update Events</a></h2>
<h2><a name="change-update-events" class="anchor" href="#change-update-events">Observing, Updating, and Destroying Chosen</a></h2>
<div class="side-by-side clearfix">
<ul>
<li>
<h3>Form Field Change</h3>
<p>When working with form fields, you often want to perform some behavior after a value has been selected or deselected. Whenever a user selects a field in Chosen, it triggers a "change" event on the original form field. That let's you do something like this:</p>
<h3>Observing Form Field Changes</h3>
<p>When working with form fields, you often want to perform some behavior after a value has been selected or deselected. Whenever a user selects a field in Chosen, it triggers a "change" event on the original form field. That lets you do something like this:</p>
<pre><code class="language-javascript">$("#form_field").chosen().change( &hellip; );</code></pre>
<p><strong>Note:</strong> Prototype doesn't offer support for triggering standard browser events. <a href="https://github.com/kangax/protolicious/blob/5b56fdafcd7d7662c9d648534225039b2e78e371/event.simulate.js">Event.simulate</a> is required to trigger the change event when using the Prototype version.</p>
</li>
Expand All @@ -1341,6 +1341,14 @@ <h3>Updating Chosen Dynamically</h3>
<p>If you need to update the options in your select field and want Chosen to pick up the changes, you'll need to trigger the "chosen:updated" event on the field. Chosen will re-build itself based on the updated content.</p>
<pre><code class="language-javascript">Event.fire($("form_field"), "chosen:updated");</code></pre>
</li>
<li>
<h3>Destroying Chosen</h3>
<p>To destroy Chosen and revert back to the native select, call <code class="language-javascript">destroy</code> on the Chosen instance:</p>
<pre><code class="language-javascript">chosen = new Chosen($("form_field"));

// ...later
chosen.destroy();</code></pre>
</li>
</ul>
</div>

Expand Down
4 changes: 2 additions & 2 deletions public/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<div id="container">
<div id="content">
<header>
<h1>Chosen <small>(<span id="latest-version">v1.4.2</span>)</small></h1>
<h1>Chosen <small>(<span id="latest-version">v1.5.1</span>)</small></h1>
</header>
<p>Chosen has a number of options and attributes that allow you to have full control of your select boxes.</p>

Expand Down Expand Up @@ -231,7 +231,7 @@ <h3>Example:</h3>
</table>

<p>
<strong>Note:</strong> all custom Chosen events (those that being with <code class="language-javascript">chosen:</code>) also include the <code class="language-javascript">chosen</code> object as a parameter.
<strong>Note:</strong> all custom Chosen events (those that begin with <code class="language-javascript">chosen:</code>) also include the <code class="language-javascript">chosen</code> object as a parameter.
</p>

<h2><a name="triggerable-events" class="anchor" href="#triggerable-events">Triggerable Events</a></h2>
Expand Down
2 changes: 0 additions & 2 deletions sass/chosen.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ $chosen-sprite-retina: image-url('[email protected]') !default;
display: inline-block;
vertical-align: middle;
font-size: 13px;
zoom: 1;
*display: inline;
@include user-select(none);
* {
@include box-sizing(border-box);
Expand Down

0 comments on commit b0da2a2

Please sign in to comment.