ajax-chosen-rails 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -14,16 +14,16 @@ Include `ajax-chosen-rails` in Gemfile
14
14
 
15
15
  Then run `bundle install`
16
16
 
17
- ### Include chosen and ajax-chosen javascript assets
17
+ ### Include ajax-chosen (and chosen) javascript assets
18
+
19
+ #### NOTE: Ajax-Chosen automatically loads Chosen as a dependency
18
20
 
19
21
  Add to your `app/assets/stylesheets/application.js` if use with jQuery
20
22
 
21
- //= require chosen-jquery
22
23
  //= require ajax-chosen-jquery
23
24
 
24
25
  Or with Prototype
25
26
 
26
- //= require chosen-prototype
27
27
  //= require ajax-chosen-prototype
28
28
 
29
29
 
@@ -1,6 +1,6 @@
1
1
  module AjaxChosen
2
2
  module Rails
3
- VERSION = "0.1.0"
4
- EDITOR_VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
+ EDITOR_VERSION = "0.1.1"
5
5
  end
6
6
  end
@@ -0,0 +1,2 @@
1
+ //= require chosen-jquery
2
+ //= require ajax-chosen.jquery
@@ -0,0 +1,2 @@
1
+ //= require chosen-prototype
2
+ //= require ajax-chosen.proto
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ajax-chosen-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-03 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
- requirement: &74066110 !ruby/object:Gem::Requirement
16
+ requirement: &84780440 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *74066110
24
+ version_requirements: *84780440
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: thor
27
- requirement: &74065860 !ruby/object:Gem::Requirement
27
+ requirement: &84779900 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0.14'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *74065860
35
+ version_requirements: *84779900
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: chosen-rails
38
- requirement: &74065670 !ruby/object:Gem::Requirement
38
+ requirement: &84779240 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *74065670
46
+ version_requirements: *84779240
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &74065400 !ruby/object:Gem::Requirement
49
+ requirement: &84776960 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '1.0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *74065400
57
+ version_requirements: *84776960
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rails
60
- requirement: &74065150 !ruby/object:Gem::Requirement
60
+ requirement: &84776670 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '3.0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *74065150
68
+ version_requirements: *84776670
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sass
71
- requirement: &74064920 !ruby/object:Gem::Requirement
71
+ requirement: &84776090 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '3.1'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *74064920
79
+ version_requirements: *84776090
80
80
  description: Chosen is a javascript library of select box enhancer for jQuery and
81
81
  Protoype. This gem integrates Ajax-Chosen with Rails asset pipeline for ease of
82
82
  use.
@@ -98,10 +98,10 @@ files:
98
98
  - lib/ajax-chosen-rails/source_file.rb
99
99
  - lib/ajax-chosen-rails/version.rb
100
100
  - vendor/assets/VERSION
101
+ - vendor/assets/javascripts/ajax-chosen-jquery.js
102
+ - vendor/assets/javascripts/ajax-chosen-prototype.js
101
103
  - vendor/assets/javascripts/ajax-chosen.jquery.coffee
102
- - vendor/assets/javascripts/ajax-chosen.jquery.js
103
104
  - vendor/assets/javascripts/ajax-chosen.proto.coffee
104
- - vendor/assets/javascripts/ajax-chosen.proto.js
105
105
  homepage: https://github.com/fatfreecrm/ajax-chosen-rails
106
106
  licenses: []
107
107
  post_install_message:
@@ -1,47 +0,0 @@
1
- (function() {
2
- (function($) {
3
- return $.fn.ajaxChosen = function(options, callback) {
4
- var select;
5
- select = this;
6
- this.chosen();
7
- return this.next('.chzn-container').find(".search-field > input").bind('keyup', function() {
8
- var field, val;
9
- val = $.trim($(this).attr('value'));
10
- if (val.length < 3 || val === $(this).data('prevVal')) {
11
- return false;
12
- }
13
- $(this).data('prevVal', val);
14
- field = $(this);
15
- options.data = {
16
- term: val
17
- };
18
- if (typeof success !== "undefined" && success !== null) {
19
- success;
20
- } else {
21
- success = options.success;
22
- };
23
- options.success = function(data) {
24
- var items;
25
- if (!(data != null)) {
26
- return;
27
- }
28
- select.find('option').each(function() {
29
- if (!$(this).is(":selected")) {
30
- return $(this).remove();
31
- }
32
- });
33
- items = callback(data);
34
- $.each(items, function(value, text) {
35
- return $("<option />").attr('value', value).html(text).appendTo(select);
36
- });
37
- select.trigger("liszt:updated");
38
- field.attr('value', val);
39
- if (typeof success !== "undefined" && success !== null) {
40
- return success();
41
- }
42
- };
43
- return $.ajax(options);
44
- });
45
- };
46
- })(jQuery);
47
- }).call(this);
@@ -1,67 +0,0 @@
1
- (function() {
2
- var ajaxChosen, root;
3
- var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
4
- for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
5
- function ctor() { this.constructor = child; }
6
- ctor.prototype = parent.prototype;
7
- child.prototype = new ctor;
8
- child.__super__ = parent.prototype;
9
- return child;
10
- };
11
- root = this;
12
- ajaxChosen = (function() {
13
- __extends(ajaxChosen, Chosen);
14
- ajaxChosen.prototype.activate_field = function() {
15
- if (this.options.show_on_activate && !this.active_field) {
16
- this.results_show();
17
- }
18
- return ajaxChosen.__super__.activate_field.apply(this, arguments);
19
- };
20
- function ajaxChosen(select, options, callback) {
21
- this.options = options;
22
- ajaxChosen.__super__.constructor.call(this, select, options);
23
- select.next('.chzn-container').down('.chzn-search > input').observe('keyup', function() {
24
- var field, query_key, success, val;
25
- val = $(this).value.strip();
26
- if (val.length < 3 || val === $(this).readAttribute('data-prevVal')) {
27
- return false;
28
- }
29
- $(this).writeAttribute('data-prevVal', val);
30
- field = $(this);
31
- query_key = options.query_key || "term";
32
- (options.parameters || (options.parameters = {}))[query_key] = val;
33
- success = options.success;
34
- options.onSuccess = function(data) {
35
- var items;
36
- if (!(data != null)) {
37
- return;
38
- }
39
- select.childElements().each(function(el) {
40
- if (!el.selected) {
41
- return el.remove();
42
- }
43
- });
44
- items = callback ? callback(data.responseJSON) : data.responseJSON;
45
- $H(items).each(function(pair) {
46
- if (select.value !== pair.key) {
47
- return select.insert({
48
- bottom: new Element("option", {
49
- value: pair.key
50
- }).update(pair.value)
51
- });
52
- }
53
- });
54
- val = field.value;
55
- select.fire("liszt:updated");
56
- field.value = val;
57
- if (success != null) {
58
- return success();
59
- }
60
- };
61
- return new Ajax.Request(options.url, options);
62
- });
63
- }
64
- return ajaxChosen;
65
- })();
66
- root.ajaxChosen = ajaxChosen;
67
- }).call(this);