If field is disabled, stop destroy choice clicks as well.

abstract-chosen^2
Patrick Filler 2011-09-23 09:46:01 -05:00
parent 805a60f4a5
commit 6c6f3590bc
7 changed files with 23 additions and 10 deletions

View File

@ -311,6 +311,9 @@
.chzn-disabled .chzn-single {
cursor: default;
}
.chzn-disabled .chzn-choices .search-choice .search-choice-close {
cursor: default;
}
/* @group Right to Left */
.chzn-rtl { direction:rtl;text-align: right; }

View File

@ -414,8 +414,12 @@
};
Chosen.prototype.choice_destroy_link_click = function(evt) {
evt.preventDefault();
this.pending_destroy_click = true;
return this.choice_destroy($(evt.target));
if (!this.is_disabled) {
this.pending_destroy_click = true;
return this.choice_destroy($(evt.target));
} else {
return evt.stopPropagation;
}
};
Chosen.prototype.choice_destroy = function(link) {
this.choices -= 1;

File diff suppressed because one or more lines are too long

View File

@ -404,8 +404,10 @@
};
Chosen.prototype.choice_destroy_link_click = function(evt) {
evt.preventDefault();
this.pending_destroy_click = true;
return this.choice_destroy(evt.target);
if (!this.is_disabled) {
this.pending_destroy_click = true;
return this.choice_destroy(evt.target);
}
};
Chosen.prototype.choice_destroy = function(link) {
this.choices -= 1;

File diff suppressed because one or more lines are too long

View File

@ -336,8 +336,11 @@ class Chosen
choice_destroy_link_click: (evt) ->
evt.preventDefault()
@pending_destroy_click = true
this.choice_destroy $(evt.target)
if not @is_disabled
@pending_destroy_click = true
this.choice_destroy $(evt.target)
else
evt.stopPropagation
choice_destroy: (link) ->
@choices -= 1

View File

@ -333,8 +333,9 @@ class Chosen
choice_destroy_link_click: (evt) ->
evt.preventDefault()
@pending_destroy_click = true
this.choice_destroy evt.target
if not @is_disabled
@pending_destroy_click = true
this.choice_destroy evt.target
choice_destroy: (link) ->
@choices -= 1