Skip to content

Commit

Permalink
Merge branch 'master' into anchors_on_doc_headers
Browse files Browse the repository at this point in the history
  • Loading branch information
pfiller committed Jul 24, 2013
2 parents 2072150 + 2b9b15a commit d37cc94
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 24 deletions.
4 changes: 4 additions & 0 deletions chosen.jquery.json
Expand Up @@ -33,6 +33,10 @@
{
"name": "Ken Earley",
"url": "https://github.com/kenearley"
},
{
"name": "Koen Punt",
"url": "https://github.com/koenpunt"
}
],
"download": "https://github.com/harvesthq/chosen/releases",
Expand Down
20 changes: 12 additions & 8 deletions coffee/chosen.jquery.coffee
Expand Up @@ -39,7 +39,7 @@ class Chosen extends AbstractChosen
if @is_multiple
@container.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"><ul class="chzn-results"></ul></div>'
else
@container.html '<a href="javascript:void(0)" class="chzn-single chzn-default" tabindex="-1"><span>' + @default_text + '</span><div><b></b></div></a><div class="chzn-drop"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'
@container.html '<a class="chzn-single chzn-default" tabindex="-1"><span>' + @default_text + '</span><div><b></b></div></a><div class="chzn-drop"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'

@form_field_jq.hide().after @container
@dropdown = @container.find('div.chzn-drop').first()
Expand Down Expand Up @@ -231,10 +231,10 @@ class Chosen extends AbstractChosen


set_tab_index: (el) ->
if @form_field_jq.attr "tabindex"
ti = @form_field_jq.attr "tabindex"
@form_field_jq.attr "tabindex", -1
@search_field.attr "tabindex", ti
if @form_field.tabIndex
ti = @form_field.tabIndex
@form_field.tabIndex = -1
@search_field[0].tabIndex = ti

set_label_behavior: ->
@form_field_label = @form_field_jq.parents("label") # first check for a parent label
Expand Down Expand Up @@ -272,7 +272,7 @@ class Chosen extends AbstractChosen
if item.disabled
choice.addClass 'search-choice-disabled'
else
close_link = $('<a />', { href: '#', class: 'search-choice-close', rel: item.array_index })
close_link = $('<a />', { class: 'search-choice-close', 'data-option-array-index': item.array_index })
close_link.click (evt) => this.choice_destroy_link_click(evt)
choice.append close_link

Expand All @@ -284,7 +284,7 @@ class Chosen extends AbstractChosen
this.choice_destroy $(evt.target) unless @is_disabled

choice_destroy: (link) ->
if this.result_deselect (link.attr "rel")
if this.result_deselect( link[0].getAttribute("data-option-array-index") )
this.show_search_field_default()

this.results_hide() if @is_multiple and this.choices_count() > 0 and @search_field.val().length < 1
Expand Down Expand Up @@ -319,7 +319,11 @@ class Chosen extends AbstractChosen
if @is_multiple
high.removeClass("active-result")
else
@search_results.find(".result-selected").removeClass "result-selected"
if @result_single_selected
@result_single_selected.removeClass("result-selected")
selected_index = @result_single_selected[0].getAttribute('data-option-array-index')
@results_data[selected_index].selected = false

@result_single_selected = high

high.addClass "result-selected"
Expand Down
8 changes: 6 additions & 2 deletions coffee/chosen.proto.coffee
Expand Up @@ -11,7 +11,7 @@ class @Chosen extends AbstractChosen
super()

# HTML Templates
@single_temp = new Template('<a href="javascript:void(0)" class="chzn-single chzn-default" tabindex="-1"><span>#{default}</span><div><b></b></div></a><div class="chzn-drop"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>')
@single_temp = new Template('<a class="chzn-single chzn-default" tabindex="-1"><span>#{default}</span><div><b></b></div></a><div class="chzn-drop"><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"><ul class="chzn-results"></ul></div>')
@no_results_temp = new Template('<li class="no-results">' + @results_none_found + ' "<span>#{terms}</span>"</li>')

Expand Down Expand Up @@ -306,7 +306,11 @@ class @Chosen extends AbstractChosen
if @is_multiple
high.removeClassName("active-result")
else
@search_results.descendants(".result-selected").invoke "removeClassName", "result-selected"
if @result_single_selected
@result_single_selected.removeClassName("result-selected")
selected_index = @result_single_selected.getAttribute('data-option-array-index')
@results_data[selected_index].selected = false

@result_single_selected = high

high.addClassName("result-selected")
Expand Down
4 changes: 4 additions & 0 deletions package.json
Expand Up @@ -57,6 +57,10 @@
{
"name": "Ken Earley",
"url": "https://github.com/kenearley"
},
{
"name": "Koen Punt",
"url": "https://github.com/koenpunt"
}
],
"download": "https://github.com/harvesthq/chosen/releases",
Expand Down
18 changes: 9 additions & 9 deletions public/index.html
Expand Up @@ -1425,12 +1425,12 @@ <h3>Do you have all the available options documented somewhere?</h3>
<p>Yes! You can find them on <a href="options.html">the options page</a>.</p>
</li>
<li>
<h3>Something doesn't work. Can you fix it?</h3>
<p>Yes! Please report all issues using the <a href="http://github.com/harvesthq/chosen/issues">GitHub issue tracking tool</a>. Please include the plugin version (jQuery or Prototype), browser and OS. The more information provided, the easier it is to fix a problem.</p>
<h3>Something doesn't work. Can you fix it?</h3>
<p>Yes! Please report all issues using the <a href="http://github.com/harvesthq/chosen/issues">GitHub issue tracking tool</a>. Please include the plugin version (jQuery or Prototype), browser and OS. The more information provided, the easier it is to fix a problem.</p>
</li>
<li>
<h3>What browsers are supported?</h3>
<p>All modern browsers are supported (Firefox, Chrome, Safari and IE9). Legacy support for IE8 is also enabled.</p>
<h3>What browsers are supported?</h3>
<p>All modern browsers are supported (Firefox, Chrome, Safari and IE9). Legacy support for IE8 is also enabled.</p>
</li>
<li>
<h3>Didn't there used to be a Prototype version of Chosen?</h3>
Expand All @@ -1441,14 +1441,14 @@ <h3>Didn't there used to be a Prototype version of Chosen?</h3>
<h2><a name="credits" class="anchor" href="#credits">Credits</a></h2>

<ul class="credits">
<li>Concept and development by <a href="http://patrickfiller.com">Patrick Filler</a> for <a href="https://getharvest.com">Harvest</a>.</li>
<li>Design and CSS by <a href="http://matthewlettini.com">Matthew Lettini</a>.</li>
<li>Repository maintained by <a href="https://github.com/pfiller">@pfiller</a>, <a href="https://github.com/kenearley">@kenearley</a>, and <a href="https://github.com/stof">@stof</a>.</li>
<li>Chosen includes <a href="https://github.com/harvesthq/chosen/contributors">contributions by many fine folks</a>.</li>
<li>Concept and development by <a href="http://patrickfiller.com">Patrick Filler</a> for <a href="https://getharvest.com">Harvest</a>.</li>
<li>Design and CSS by <a href="http://matthewlettini.com">Matthew Lettini</a>.</li>
<li>Repository maintained by <a href="https://github.com/pfiller">@pfiller</a>, <a href="https://github.com/kenearley">@kenearley</a>, <a href="https://github.com/stof">@stof</a> and <a href="https://github.com/koenpunt">@koenpunt</a>.</li>
<li>Chosen includes <a href="https://github.com/harvesthq/chosen/contributors">contributions by many fine folks</a>.</li>
</ul>

<footer>
&copy; 2011 <a href="http://www.getharvest.com/">Harvest</a> - Chosen is licensed under the <a href="http://en.wikipedia.org/wiki/MIT_License">MIT license</a>.
&copy; 2011&ndash;2013 <a href="http://www.getharvest.com/">Harvest</a>. Chosen is licensed under the <a href="https://github.com/harvesthq/chosen/blob/master/LICENSE.md">MIT license</a>.
</footer>

</div>
Expand Down
7 changes: 2 additions & 5 deletions public/index.proto.html
Expand Up @@ -1443,17 +1443,14 @@ <h2><a name="credits" class="anchor" href="#credits">Credits</a></h2>
<ul class="credits">
<li>Concept and development by <a href="http://patrickfiller.com">Patrick Filler</a> for <a href="https://getharvest.com">Harvest</a>.</li>
<li>Design and CSS by <a href="http://matthewlettini.com">Matthew Lettini</a>.</li>
<li>Repository maintained by <a href="https://github.com/pfiller">@pfiller</a>, <a href="https://github.com/kenearley">@kenearley</a>, and <a href="https://github.com/stof">@stof</a>.</li>
<li>Repository maintained by <a href="https://github.com/pfiller">@pfiller</a>, <a href="https://github.com/kenearley">@kenearley</a>, <a href="https://github.com/stof">@stof</a> and <a href="https://github.com/koenpunt">@koenpunt</a>.</li>
<li>Chosen includes <a href="https://github.com/harvesthq/chosen/contributors">contributions by many fine folks</a>.</li>
</ul>

<footer>
&copy; 2011 <a href="http://www.getharvest.com/">Harvest</a> - Chosen is licensed under the <a href="http://en.wikipedia.org/wiki/MIT_License">MIT license</a>.
&copy; 2011&ndash;2013 <a href="http://www.getharvest.com/">Harvest</a>. Chosen is licensed under the <a href="https://github.com/harvesthq/chosen/blob/master/LICENSE.md">MIT license</a>.
</footer>




</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js" type="text/javascript"></script>
Expand Down
3 changes: 3 additions & 0 deletions sass/chosen.scss
Expand Up @@ -29,6 +29,9 @@ $chosen-sprite-retina: image-url('chosen-sprite@2x.png');
&.chzn-with-drop .chzn-drop {
left: 0;
}
a{
cursor: pointer;
}
}
/* @end */

Expand Down

0 comments on commit d37cc94

Please sign in to comment.