flexselect 1.1.0 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.1.2
@@ -1,4 +1,4 @@
1
- class FlexselectGenerator < Rails::Generator::NamedBase
1
+ class FlexselectGenerator < Rails::Generator::Base
2
2
  def manifest
3
3
  record do |m|
4
4
  m.template "flexselect.css" , "public/stylesheets/flexselect.css"
@@ -257,28 +257,28 @@
257
257
  focusAndHide: function() { this.focus(); this.hide(); }
258
258
  });
259
259
 
260
- $.fn.flexselect = function() {
261
- // EOGA: Little modification for the flexselect gem.
262
- // Allow the user to provide just two options,
263
- // name of the activerecord class and name of the attribute to autocomplete.
264
- // The third parameter can contain the options object as before.
265
- var options;
266
-
267
- if (arguments.length == 1) { var object_opt = arguments[0]; } else { var array_opt = arguments; }
268
-
260
+ $.fn.flexselect = function(options) {
269
261
  this.each(function() {
270
- if (array_opt) {
271
- var transf = function(id) { return array_opt[0] + "[" + array_opt[1] + "]"; }
272
- options = { allowMismatch: true, inputIdTransform: transf };
273
-
274
- // Allow additional options to follow the string params
275
- if (array_opt[2]) $.extend(options, array_opt[2]);
276
- } else {
277
- options = object_opt;
278
- }
279
-
280
262
  if (this.tagName == "SELECT") new $.flexselect(this, options);
281
263
  });
282
264
  return this;
283
265
  };
284
266
  })(jQuery);
267
+
268
+ // EOGA: Little add on for the flexselect gem.
269
+ // Allow the user to provide just two options,
270
+ // name of the activerecord class and name of the attribute to autocomplete.
271
+ // The third parameter can contain the options object as before.
272
+ jQuery.fn.attr_flex_selector = function(resource_name, attribute_name) {
273
+ return this.each(function(){
274
+
275
+ jQuery(this).flexselect({
276
+ allowMismatch: true,
277
+ inputNameTransform: function(id) {
278
+ return resource_name + "[flex_" + attribute_name + "_input]";
279
+ }
280
+ });
281
+
282
+ return this;
283
+ });
284
+ };
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flexselect
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emmanuel Oga
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-07 00:00:00 -03:00
12
+ date: 2010-01-08 00:00:00 -03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency