Merge pull request #258 from Nagyman/8922e6e85425bb48e09429a9c85b503088fbc9be

Use @ shortcut for constructor arguments
This commit is contained in:
Patrick Filler 2011-09-19 13:05:17 -07:00
commit b51d4a798f
6 changed files with 14 additions and 22 deletions

View file

@ -11,7 +11,8 @@
/* /*
Chosen source: generate output using 'cake build' Chosen source: generate output using 'cake build'
Copyright (c) 2011 by Harvest Copyright (c) 2011 by Harvest
*/ var $, Chosen, get_side_border_padding, root; */
var $, Chosen, get_side_border_padding, root;
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
root = this; root = this;
$ = jQuery; $ = jQuery;
@ -28,13 +29,10 @@
} }
}); });
Chosen = (function() { Chosen = (function() {
function Chosen(elmn, options) { function Chosen(form_field, options) {
if (options == null) { this.form_field = form_field;
options = {}; this.options = options != null ? options : {};
}
this.options = options;
this.set_default_values(); this.set_default_values();
this.form_field = elmn;
this.form_field_jq = $(this.form_field); this.form_field_jq = $(this.form_field);
this.is_multiple = this.form_field.multiple; this.is_multiple = this.form_field.multiple;
this.is_rtl = this.form_field_jq.hasClass("chzn-rtl"); this.is_rtl = this.form_field_jq.hasClass("chzn-rtl");

File diff suppressed because one or more lines are too long

View file

@ -11,17 +11,15 @@
/* /*
Chosen source: generate output using 'cake build' Chosen source: generate output using 'cake build'
Copyright (c) 2011 by Harvest Copyright (c) 2011 by Harvest
*/ var Chosen, get_side_border_padding, root; */
var Chosen, get_side_border_padding, root;
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
root = this; root = this;
Chosen = (function() { Chosen = (function() {
function Chosen(elmn, options) { function Chosen(form_field, options) {
if (options == null) { this.form_field = form_field;
options = {}; this.options = options != null ? options : {};
}
this.options = options;
this.set_default_values(); this.set_default_values();
this.form_field = elmn;
this.is_multiple = this.form_field.multiple; this.is_multiple = this.form_field.multiple;
this.is_rtl = this.form_field.hasClassName("chzn-rtl"); this.is_rtl = this.form_field.hasClassName("chzn-rtl");
this.default_text_default = this.form_field.multiple ? "Select Some Options" : "Select an Option"; this.default_text_default = this.form_field.multiple ? "Select Some Options" : "Select an Option";

File diff suppressed because one or more lines are too long

View file

@ -15,11 +15,9 @@ $.fn.extend({
class Chosen class Chosen
constructor: (elmn, options={}) -> constructor: (@form_field, @options={}) ->
@options = options
this.set_default_values() this.set_default_values()
@form_field = elmn
@form_field_jq = $ @form_field @form_field_jq = $ @form_field
@is_multiple = @form_field.multiple @is_multiple = @form_field.multiple
@is_rtl = @form_field_jq.hasClass "chzn-rtl" @is_rtl = @form_field_jq.hasClass "chzn-rtl"

View file

@ -6,12 +6,10 @@ root = this
class Chosen class Chosen
constructor: (elmn, options={}) -> constructor: (@form_field, @options={}) ->
@options = options
this.set_default_values() this.set_default_values()
@form_field = elmn
@is_multiple = @form_field.multiple @is_multiple = @form_field.multiple
@is_rtl = @form_field.hasClassName "chzn-rtl" @is_rtl = @form_field.hasClassName "chzn-rtl"