Skip to content

Commit

Permalink
Merge tag 'v1.7.0'
Browse files Browse the repository at this point in the history
* tag 'v1.7.0': (76 commits)
  Go to 1.7.0
  add max_shown_results spec for prototype
  replace event.simulate for simulant library
  update grunt tasks
  rename _template functions to _html
  move style block to external css file
  move html templates to abstract class
  rewrite search_field_scale to prevent CSP errors
  add Content-Security-Policy to html
  consider disabled fieldset for disabled state (harvesthq#2718)
  only prevent default on touchevents when results are not showing (harvesthq#2725)
  clip results instead of moving them (harvesthq#2727)
  prevent action on clipboard events when disabled (harvesthq#2722)
  prevent activating disabled fields (harvesthq#2721)
  always close on chosen:close event (harvesthq#2711)
  restore focus if chosen was activated (harvesthq#2710)
  Contributing: add grunt command for tests [ci-skip] (harvesthq#2700)
  do not clear search text on multi selection (harvesthq#2709)
  escape default text (harvesthq#2712)
  add white-space: pre for search field scaling (harvesthq#2714)
  ...
  • Loading branch information
sdemjanenko committed Aug 14, 2017
2 parents bdcc311 + 8913ff9 commit fdea164
Show file tree
Hide file tree
Showing 33 changed files with 1,037 additions and 650 deletions.
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE.md
@@ -0,0 +1,47 @@
<!---
Please read our Contributing Guidelines before opening this issue: https://github.com/harvesthq/chosen/blob/master/contributing.md
Specifically, please note that the issue tracker is intended for bug reports and specific feature requests.
If you have a general support or usage question, please post somewhere like StackOverflow using the `jquery-chosen` tag: http://stackoverflow.com/questions/tagged/jquery-chosen — you'll be much more likely to get a quick answer there.
-->

Summarize your issue here.

### Steps to reproduce

Tell us how to reproduce this issue.

1. This is the first step

2. This is the second step

3. Further steps, etc.

Additionally, please link to a working demo that shows the issue so we can attempt to reproduce. You can use [this template](https://jsfiddle.net/5v3v353z/) as a base. Alternatively, confirm that the [Chosen demo page](http://harvesthq.github.io/chosen/) shows the issue.


### Expected behavior

Tell us what should happen.


### Actual behavior

Tell us what happens instead.


### Environment

- **Chosen Version**:

- **jQuery or Prototype Version**:

- **Browser and Version**:

- **OS and Version**:


### Additional information

Any other information you want to share that is relevant to the issue being reported. This might include the lines of code that you have identified as causing the bug, or potential solutions and workarounds.
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,23 @@
<!---
Good pull requests — patches, improvements, new features — are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.
Please review the Pull Requests section of our Contributing Guidelines before submitting your work: https://github.com/harvesthq/chosen/blob/master/contributing.md#pull-requests
-->

### Summary

Provide a general description of the code changes in your pull request.

Please double-check that:

- [ ] All changes were made in CoffeeScript files, **not** JavaScript files.
- [ ] You used [Grunt](https://github.com/harvesthq/chosen/blob/master/contributing.md#grunt) to build the JavaScript files and tested them locally.
- [ ] You've updated both the jQuery *and* Prototype versions.
- [ ] You haven't manually updated the version number in `package.json`.
- [ ] If necessary, you've updated [the documentation](https://github.com/harvesthq/chosen/blob/master/public/options.html).

See the [Pull Requests section of our Contributing Guidelines](https://github.com/harvesthq/chosen/blob/master/contributing.md#pull-requests) for more details.

### References

If your pull request is in reference to one or more open GitHub issues, please mention them here to keep the conversations linked together.
4 changes: 2 additions & 2 deletions .gitignore
Expand Up @@ -3,8 +3,8 @@ node_modules
.project
public/*.js
public/*.css
public/bower.json
chosen.zip
public/*.json
chosen*.zip
.sass-cache
.ruby-version
.rbenv-gemsets
Expand Down
20 changes: 13 additions & 7 deletions .travis.yml
@@ -1,15 +1,21 @@
sudo: false

language: node_js

node_js:
- "0.10"
- "node"

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

before_install:
- npm install -g grunt-cli
- gem install bundler
- bundle install
before_script: grunt build
before_install: npm install -g grunt-cli
before_script: grunt build package-npm package-bower

after_success: ./bower-publish.sh
after_success: ./publish-package.sh

env:
global:
Expand Down
3 changes: 0 additions & 3 deletions Gemfile

This file was deleted.

16 changes: 0 additions & 16 deletions Gemfile.lock

This file was deleted.

150 changes: 57 additions & 93 deletions Gruntfile.coffee
@@ -1,13 +1,9 @@
module.exports = (grunt) ->
require('load-grunt-tasks')(grunt);

version = ->
grunt.file.readJSON("package.json").version
version_tag = ->
"v#{version()}"
require('load-grunt-tasks')(grunt)

grunt.initConfig
pkg: grunt.file.readJSON("package.json")
pkg: grunt.file.readJSON('package.json')
version_tag: 'v<%= pkg.version %>'
comments: """
/*!
Chosen, a Select Box Enhancer for jQuery and Prototype
Expand All @@ -22,134 +18,102 @@ This file is generated by `grunt build`, do not edit it by hand.
*/
\n
"""
minified_comments: "/* Chosen #{version_tag()} | (c) 2011-<%= grunt.template.today('yyyy') %> by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */\n"
minified_comments: "/* Chosen <%= version_tag %> | (c) 2011-<%= grunt.template.today('yyyy') %> by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */\n"

concat:
options:
banner: "<%= comments %>"
banner: '<%= comments %>'
jquery:
src: ["public/chosen.jquery.js"]
dest: "public/chosen.jquery.js"
src: ['public/chosen.jquery.js']
dest: 'public/chosen.jquery.js'
proto:
src: ["public/chosen.proto.js"]
dest: "public/chosen.proto.js"
src: ['public/chosen.proto.js']
dest: 'public/chosen.proto.js'
css:
src: ["public/chosen.css"]
dest: "public/chosen.css"
src: ['public/chosen.css']
dest: 'public/chosen.css'

coffee:
options:
join: true
compile:
jquery:
files:
'public/chosen.jquery.js': ['coffee/lib/select-parser.coffee', 'coffee/lib/abstract-chosen.coffee', 'coffee/chosen.jquery.coffee']
proto:
files:
'public/chosen.proto.js': ['coffee/lib/select-parser.coffee', 'coffee/lib/abstract-chosen.coffee', 'coffee/chosen.proto.coffee']
test:
files:
'spec/public/jquery_specs.js': 'spec/jquery/*.spec.coffee'
'spec/public/proto_specs.js': 'spec/proto/*.spec.coffee'

uglify:
options:
mangle:
except: ['jQuery', 'AbstractChosen', 'Chosen', 'SelectParser']
banner: "<%= minified_comments %>"
minified_chosen_js:
banner: '<%= minified_comments %>'
jquery:
options:
mangle:
except: ['jQuery']
files:
'public/chosen.jquery.min.js': ['public/chosen.jquery.js']
proto:
files:
'public/chosen.proto.min.js': ['public/chosen.proto.js']

compass:
sass:
options:
outputStyle: 'expanded'
chosen_css:
options:
bundleExec: true
specify: ['sass/chosen.scss']
files:
'public/chosen.css': 'sass/chosen.scss'

postcss:
options:
processors: [
require('autoprefixer')(browsers: 'last 2 versions, IE 8')
]
main:
src: 'public/chosen.css'

cssmin:
minified_chosen_css:
options:
banner: "<%= minified_comments %>"
keepSpecialComments: 0
options:
banner: '<%= minified_comments %>'
keepSpecialComments: 0
main:
src: 'public/chosen.css'
dest: 'public/chosen.min.css'

watch:
scripts:
default:
files: ['coffee/**/*.coffee', 'sass/*.scss']
tasks: ['build']

dom_munger:
latest_version:
src: ['public/index.html', 'public/index.proto.html', 'public/options.html']
options:
callback: ($) ->
$("#latest-version").text(version_tag())
zip:
chosen:
cwd: 'public/'
src: ['public/**/*']
dest: "chosen_#{version_tag()}.zip"

'gh-pages':
options:
base: 'public',
message: "Updated to new Chosen version #{version()}"
src: ['**']
tasks: ['build', 'jasmine']
test:
files: ['spec/**/*.coffee']
tasks: ['jasmine']

jasmine:
jquery:
src: [ 'public/chosen.jquery.js' ]
options:
vendor: [ 'http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js' ]
vendor: [
'https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js'
]
specs: 'spec/public/jquery_specs.js'
src: [ 'public/chosen.jquery.js' ]
proto:
src: [ 'public/chosen.proto.js' ]
options:
vendor: [
'https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js',
'public/docsupport/event.simulate.js'
'https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js'
'node_modules/simulant/dist/simulant.umd.js'
]
specs: 'spec/public/proto_specs.js'
src: [ 'public/chosen.proto.js' ]

grunt.loadTasks 'tasks'

grunt.registerTask 'default', ['build']
grunt.registerTask 'build', ['coffee', 'compass', 'concat', 'uglify', 'cssmin', 'package-bower']
grunt.registerTask 'prep-release', ['build', 'dom_munger:latest_version', 'zip:chosen','package-jquery']
grunt.registerTask 'build', ['coffee:jquery', 'coffee:proto', 'sass', 'concat', 'uglify', 'postcss', 'cssmin', 'package-bower']
grunt.registerTask 'test', ['coffee', 'jasmine']
grunt.registerTask 'test:jquery', ['coffee:test', 'coffee:jquery', 'jasmine:jquery']
grunt.registerTask 'test:proto', ['coffee:test', 'coffee:proto', 'jasmine:proto']

grunt.registerTask 'publish-release', ['gh-pages']

grunt.registerTask 'package-jquery', 'Generate a jquery.json manifest file from package.json', () ->
src = "package.json"
dest = "chosen.jquery.json"
pkg = grunt.file.readJSON(src)
json1 =
"name": pkg.name
"description": pkg.description
"version": version()
"licenses": pkg.licenses
json2 = pkg.jqueryJSON
json1[key] = json2[key] for key of json2
json1.author.name = pkg.author
grunt.file.write('chosen.jquery.json', JSON.stringify(json1, null, 2) + "\n")

grunt.registerTask 'package-bower', 'Generate a bower.json manifest file from package.json', () ->
pkg = grunt.file.readJSON("package.json")
bowerjson = pkg.bowerJSON
jqueryjson = pkg.jqueryJSON

bower =
"name": pkg.name
"description": pkg.description
"version": version()
"main": bowerjson.main
"license": pkg.licenses
"ignore": []
"keywords": jqueryjson.keywords
"authors": jqueryjson.maintainers
"homepage": jqueryjson.homepage
"repository": pkg.repository
"dependencies": jqueryjson.dependencies
"devDependencies": []

grunt.file.write("public/bower.json", JSON.stringify(bower, null, 2) + "\n")

grunt.registerTask 'cleanup-bower', 'Delete generated bower.json file', () ->
grunt.file.delete("public/bower.json")
2 changes: 1 addition & 1 deletion LICENSE.md
@@ -1,6 +1,6 @@
#### Chosen
- by Patrick Filler for [Harvest](http://getharvest.com)
- Copyright (c) 2011-2015 by Harvest
- Copyright (c) 2011-2016 by Harvest

Available for use under the [MIT License](http://en.wikipedia.org/wiki/MIT_License)

Expand Down
20 changes: 16 additions & 4 deletions README.md
Expand Up @@ -11,12 +11,24 @@ http://harvesthq.github.io/chosen/
For **downloads**, see:
https://github.com/harvesthq/chosen/releases/

### Bower Installation
### Package managers

Chosen is available for Bower installation:
`bower install chosen`
Chosen is available through [Bower](https://bower.io/) and [npm](https://www.npmjs.com),
_however, the package names are not the same_.

The compiled files for the Bower package are automatically generated and stored in a [2nd Chosen repository](https://github.com/harvesthq/bower-chosen). No pull requests will be accepted to that repository.
To install with Bower:

```
bower install chosen
```

To install with npm:

```
npm install chosen-js
```

The compiled files for these packages are automatically generated and stored in a [2nd Chosen repository](https://github.com/harvesthq/chosen-package). No pull requests will be accepted to that repository.

### Contributing to this project

Expand Down

0 comments on commit fdea164

Please sign in to comment.