Permalink
Browse files

Merge branch 'feature/placeholder-styling'

  • Loading branch information...
2 parents dc2eb01 + 15cdf5e commit 8e7d3008a7eafc782eab82f4a44d163bf33d6bca @parshap committed Jan 29, 2012
View
@@ -51,6 +51,9 @@
color: #444444;
text-decoration: none;
}
+.chzn-container-single .chzn-default {
+ color: #999;
+}
.chzn-container-single .chzn-single span {
margin-right: 26px;
display: block;
@@ -307,7 +307,7 @@ Copyright (c) 2011 by Harvest
if (this.is_multiple) {
container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
} else {
- container_div.html('<a href="javascript:void(0)" class="chzn-single"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>');
+ container_div.html('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>');
}
this.form_field_jq.hide().after(container_div);
this.container = $('#' + this.container_id);
@@ -661,6 +661,7 @@ Copyright (c) 2011 by Harvest
Chosen.prototype.results_reset = function(evt) {
this.form_field.options[0].selected = true;
this.selected_item.find("span").text(this.default_text);
+ this.container.find(".chzn-single").addClass("chzn-default");
this.show_search_field_default();
$(evt.target).remove();
this.form_field_jq.trigger("change");
@@ -680,6 +681,7 @@ Copyright (c) 2011 by Harvest
this.result_single_selected = high;
}
high.addClass("result-selected");
+ this.container.find(".chzn-single").removeClass("chzn-default");
position = high_id.substr(high_id.lastIndexOf("_") + 1);
item = this.results_data[position];
item.selected = true;
Oops, something went wrong.
@@ -281,7 +281,7 @@ Copyright (c) 2011 by Harvest
Chosen.prototype.set_default_values = function() {
Chosen.__super__.set_default_values.call(this);
- this.single_temp = new Template('<a href="javascript:void(0)" class="chzn-single"><span>#{default}</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>');
+ this.single_temp = new Template('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>#{default}</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>');
this.multi_temp = new Template('<ul class="chzn-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
this.choice_temp = new Template('<li class="search-choice" id="#{id}"><span>#{choice}</span><a href="javascript:void(0)" class="search-choice-close" rel="#{position}"></a></li>');
return this.no_results_temp = new Template('<li class="no-results">' + this.results_none_found + ' "<span>#{terms}</span>"</li>');
@@ -659,6 +659,7 @@ Copyright (c) 2011 by Harvest
Chosen.prototype.results_reset = function(evt) {
this.form_field.options[0].selected = true;
this.selected_item.down("span").update(this.default_text);
+ this.container.down(".chzn-single").addClassName("chzn-default");
this.show_search_field_default();
evt.target.remove();
if (typeof Event.simulate === 'function') this.form_field.simulate("change");
@@ -677,6 +678,7 @@ Copyright (c) 2011 by Harvest
this.result_single_selected = high;
}
high.addClassName("result-selected");
+ this.container.down(".chzn-single").removeClassName("chzn-default");
position = high.id.substr(high.id.lastIndexOf("_") + 1);
item = this.results_data[position];
item.selected = true;
Oops, something went wrong.
@@ -40,7 +40,7 @@ class Chosen extends AbstractChosen
if @is_multiple
container_div.html '<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + @default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'
else
- container_div.html '<a href="javascript:void(0)" class="chzn-single"><span>' + @default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'
+ container_div.html '<a href="javascript:void(0)" class="chzn-single chzn-default"><span>' + @default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'
@form_field_jq.hide().after container_div
@container = ($ '#' + @container_id)
@@ -315,6 +315,7 @@ class Chosen extends AbstractChosen
results_reset: (evt) ->
@form_field.options[0].selected = true
@selected_item.find("span").text @default_text
+ @container.find(".chzn-single").addClass("chzn-default")
this.show_search_field_default()
$(evt.target).remove();
@form_field_jq.trigger "change"
@@ -334,6 +335,7 @@ class Chosen extends AbstractChosen
@result_single_selected = high
high.addClass "result-selected"
+ @container.find(".chzn-single").removeClass("chzn-default")
position = high_id.substr(high_id.lastIndexOf("_") + 1 )
item = @results_data[position]
@@ -16,7 +16,7 @@ class Chosen extends AbstractChosen
super()
# HTML Templates
- @single_temp = new Template('<a href="javascript:void(0)" class="chzn-single"><span>#{default}</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>')
+ @single_temp = new Template('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>#{default}</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>')
@multi_temp = new Template('<ul class="chzn-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>')
@choice_temp = new Template('<li class="search-choice" id="#{id}"><span>#{choice}</span><a href="javascript:void(0)" class="search-choice-close" rel="#{position}"></a></li>')
@no_results_temp = new Template('<li class="no-results">' + @results_none_found + ' "<span>#{terms}</span>"</li>')
@@ -308,6 +308,7 @@ class Chosen extends AbstractChosen
results_reset: (evt) ->
@form_field.options[0].selected = true
@selected_item.down("span").update(@default_text)
+ @container.down(".chzn-single").addClassName("chzn-default")
this.show_search_field_default()
evt.target.remove()
@form_field.simulate("change") if typeof Event.simulate is 'function'
@@ -325,6 +326,7 @@ class Chosen extends AbstractChosen
@result_single_selected = high
high.addClassName("result-selected")
+ @container.down(".chzn-single").removeClassName("chzn-default")
position = high.id.substr(high.id.lastIndexOf("_") + 1 )
item = @results_data[position]

0 comments on commit 8e7d300

Please sign in to comment.