ad2games-ui_components 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (460) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +28 -0
  4. data/app/assets/javascripts/ui_components.js.erb +26 -0
  5. data/app/assets/javascripts/ui_components/chosen_init.coffee +9 -0
  6. data/app/assets/javascripts/ui_components/domchange.coffee +1 -0
  7. data/app/assets/javascripts/ui_components/hide_empty_dropdowns.coffee +4 -0
  8. data/app/assets/javascripts/ui_components/modal.coffee +1 -0
  9. data/app/assets/javascripts/ui_components/navbar.coffee +2 -0
  10. data/app/assets/javascripts/ui_components/sticky_header.coffee +24 -0
  11. data/app/assets/javascripts/ui_components/submit_on_change.coffee +3 -0
  12. data/app/assets/javascripts/ui_components/turbolinks_progressbar.coffee +2 -0
  13. data/app/assets/stylesheets/a2g_ui_components.scss +8 -0
  14. data/app/assets/stylesheets/default_theme/button.scss +160 -0
  15. data/app/assets/stylesheets/default_theme/common.scss +15 -0
  16. data/app/assets/stylesheets/default_theme/footer.scss +7 -0
  17. data/app/assets/stylesheets/default_theme/form.scss +72 -0
  18. data/app/assets/stylesheets/default_theme/navbar.scss +55 -0
  19. data/app/assets/stylesheets/default_theme/table.scss +68 -0
  20. data/app/assets/stylesheets/default_theme/toolbar.scss +117 -0
  21. data/app/assets/stylesheets/libs.scss +6 -0
  22. data/app/assets/stylesheets/ui_components.scss.erb +15 -0
  23. data/app/assets/stylesheets/ui_components/checkbox_list.scss +11 -0
  24. data/app/assets/stylesheets/ui_components/date_range.scss +5 -0
  25. data/app/assets/stylesheets/ui_components/markdown_textarea.scss +7 -0
  26. data/app/assets/stylesheets/variables.scss +893 -0
  27. data/app/cells/checkbox_list/checkbox_list.yml +7 -0
  28. data/app/cells/checkbox_list/checkbox_list_cell.rb +33 -0
  29. data/app/cells/datagrid_filter/datagrid_filter.yml +14 -0
  30. data/app/cells/datagrid_filter/datagrid_filter_cell.rb +35 -0
  31. data/app/cells/date_range/date_range.coffee +69 -0
  32. data/app/cells/date_range/date_range.yml +7 -0
  33. data/app/cells/date_range/date_range_cell.rb +55 -0
  34. data/app/cells/form_cell_base.rb +26 -0
  35. data/app/cells/hello_world/hello_world.slim +1 -0
  36. data/app/cells/hello_world/hello_world.yml +5 -0
  37. data/app/cells/hello_world/hello_world_cell.rb +4 -0
  38. data/app/cells/markdown_readonly/markdown_readonly.coffee +5 -0
  39. data/app/cells/markdown_readonly/markdown_readonly.slim +1 -0
  40. data/app/cells/markdown_readonly/markdown_readonly.yml +4 -0
  41. data/app/cells/markdown_readonly/markdown_readonly_cell.rb +4 -0
  42. data/app/cells/markdown_textarea/markdown_textarea.coffee +9 -0
  43. data/app/cells/markdown_textarea/markdown_textarea.slim +9 -0
  44. data/app/cells/markdown_textarea/markdown_textarea.yml +8 -0
  45. data/app/cells/markdown_textarea/markdown_textarea_cell.rb +42 -0
  46. data/app/cells/modal/modal.coffee +2 -0
  47. data/app/cells/modal/modal.slim +12 -0
  48. data/app/cells/modal/modal.yml +22 -0
  49. data/app/cells/modal/modal_cell.rb +31 -0
  50. data/app/cells/select/select.coffee +35 -0
  51. data/app/cells/select/select.yml +14 -0
  52. data/app/cells/select/select_cell.rb +59 -0
  53. data/app/helpers/ui_components/view_helper.rb +8 -0
  54. data/lib/generators/generate_component.thor +32 -0
  55. data/lib/tasks/styleguide.rake +8 -0
  56. data/lib/ui_components.rb +14 -0
  57. data/lib/ui_components/cell.rb +16 -0
  58. data/lib/ui_components/cell_attributes.rb +49 -0
  59. data/lib/ui_components/docu_cop.rb +31 -0
  60. data/lib/ui_components/engine.rb +26 -0
  61. data/lib/ui_components/form_helper.rb +32 -0
  62. data/lib/ui_components/templates/cell.tt +2 -0
  63. data/lib/ui_components/templates/coffee.tt +0 -0
  64. data/lib/ui_components/templates/config.tt +9 -0
  65. data/lib/ui_components/templates/sass.tt +0 -0
  66. data/lib/ui_components/templates/view.tt +0 -0
  67. data/vendor/assets/bower_components/ajax-chosen/CHANGELOG.md +10 -0
  68. data/vendor/assets/bower_components/ajax-chosen/Cakefile +93 -0
  69. data/vendor/assets/bower_components/ajax-chosen/Makefile +2 -0
  70. data/vendor/assets/bower_components/ajax-chosen/README.md +131 -0
  71. data/vendor/assets/bower_components/ajax-chosen/VERSION +1 -0
  72. data/vendor/assets/bower_components/ajax-chosen/bower.json +23 -0
  73. data/vendor/assets/bower_components/ajax-chosen/data.json +57 -0
  74. data/vendor/assets/bower_components/ajax-chosen/docs/ajax-chosen.html +71 -0
  75. data/vendor/assets/bower_components/ajax-chosen/docs/docco.css +186 -0
  76. data/vendor/assets/bower_components/ajax-chosen/index.html +47 -0
  77. data/vendor/assets/bower_components/ajax-chosen/lib/ajax-chosen.js +159 -0
  78. data/vendor/assets/bower_components/ajax-chosen/lib/ajax-chosen.min.js +17 -0
  79. data/vendor/assets/bower_components/ajax-chosen/package.json +18 -0
  80. data/vendor/assets/bower_components/ajax-chosen/src/ajax-chosen.coffee +183 -0
  81. data/vendor/assets/bower_components/bootstrap-chosen/README.md +29 -0
  82. data/vendor/assets/bower_components/bootstrap-chosen/bootstrap-chosen-variables.less +24 -0
  83. data/vendor/assets/bower_components/bootstrap-chosen/bootstrap-chosen-variables.scss +16 -0
  84. data/vendor/assets/bower_components/bootstrap-chosen/bootstrap-chosen.less +473 -0
  85. data/vendor/assets/bower_components/bootstrap-chosen/bootstrap-chosen.scss +459 -0
  86. data/vendor/assets/bower_components/bootstrap-chosen/bower.json +25 -0
  87. data/vendor/assets/bower_components/bootstrap-chosen/chosen-sprite.png +0 -0
  88. data/vendor/assets/bower_components/bootstrap-chosen/chosen-sprite@2x.png +0 -0
  89. data/vendor/assets/bower_components/bootstrap-daterangepicker/README.md +200 -0
  90. data/vendor/assets/bower_components/bootstrap-daterangepicker/bower.json +20 -0
  91. data/vendor/assets/bower_components/bootstrap-daterangepicker/daterangepicker-bs2.css +303 -0
  92. data/vendor/assets/bower_components/bootstrap-daterangepicker/daterangepicker-bs3.css +335 -0
  93. data/vendor/assets/bower_components/bootstrap-daterangepicker/daterangepicker.js +1348 -0
  94. data/vendor/assets/bower_components/bootstrap-daterangepicker/examples.html +272 -0
  95. data/vendor/assets/bower_components/bootstrap-daterangepicker/package.js +18 -0
  96. data/vendor/assets/bower_components/bootstrap-daterangepicker/package.json +32 -0
  97. data/vendor/assets/bower_components/chosen/bower.json +50 -0
  98. data/vendor/assets/bower_components/chosen/chosen-sprite.png +0 -0
  99. data/vendor/assets/bower_components/chosen/chosen-sprite@2x.png +0 -0
  100. data/vendor/assets/bower_components/chosen/chosen.css +448 -0
  101. data/vendor/assets/bower_components/chosen/chosen.jquery.js +1272 -0
  102. data/vendor/assets/bower_components/highlightjs/LICENSE +24 -0
  103. data/vendor/assets/bower_components/highlightjs/Makefile +21 -0
  104. data/vendor/assets/bower_components/highlightjs/README.md +12 -0
  105. data/vendor/assets/bower_components/highlightjs/bower.json +14 -0
  106. data/vendor/assets/bower_components/highlightjs/component.json +12 -0
  107. data/vendor/assets/bower_components/highlightjs/composer.json +26 -0
  108. data/vendor/assets/bower_components/highlightjs/highlight.pack.js +15263 -0
  109. data/vendor/assets/bower_components/highlightjs/highlight.pack.min.js +12 -0
  110. data/vendor/assets/bower_components/highlightjs/package.json +8 -0
  111. data/vendor/assets/bower_components/highlightjs/styles/agate.css +108 -0
  112. data/vendor/assets/bower_components/highlightjs/styles/androidstudio.css +66 -0
  113. data/vendor/assets/bower_components/highlightjs/styles/arduino-light.css +88 -0
  114. data/vendor/assets/bower_components/highlightjs/styles/arta.css +73 -0
  115. data/vendor/assets/bower_components/highlightjs/styles/ascetic.css +45 -0
  116. data/vendor/assets/bower_components/highlightjs/styles/atelier-cave-dark.css +83 -0
  117. data/vendor/assets/bower_components/highlightjs/styles/atelier-cave-light.css +85 -0
  118. data/vendor/assets/bower_components/highlightjs/styles/atelier-cave.dark.css +113 -0
  119. data/vendor/assets/bower_components/highlightjs/styles/atelier-cave.light.css +113 -0
  120. data/vendor/assets/bower_components/highlightjs/styles/atelier-dune-dark.css +69 -0
  121. data/vendor/assets/bower_components/highlightjs/styles/atelier-dune-light.css +69 -0
  122. data/vendor/assets/bower_components/highlightjs/styles/atelier-dune.dark.css +94 -0
  123. data/vendor/assets/bower_components/highlightjs/styles/atelier-dune.light.css +94 -0
  124. data/vendor/assets/bower_components/highlightjs/styles/atelier-estuary-dark.css +84 -0
  125. data/vendor/assets/bower_components/highlightjs/styles/atelier-estuary-light.css +84 -0
  126. data/vendor/assets/bower_components/highlightjs/styles/atelier-estuary.dark.css +113 -0
  127. data/vendor/assets/bower_components/highlightjs/styles/atelier-estuary.light.css +113 -0
  128. data/vendor/assets/bower_components/highlightjs/styles/atelier-forest-dark.css +69 -0
  129. data/vendor/assets/bower_components/highlightjs/styles/atelier-forest-light.css +69 -0
  130. data/vendor/assets/bower_components/highlightjs/styles/atelier-forest.dark.css +94 -0
  131. data/vendor/assets/bower_components/highlightjs/styles/atelier-forest.light.css +94 -0
  132. data/vendor/assets/bower_components/highlightjs/styles/atelier-heath-dark.css +69 -0
  133. data/vendor/assets/bower_components/highlightjs/styles/atelier-heath-light.css +69 -0
  134. data/vendor/assets/bower_components/highlightjs/styles/atelier-heath.dark.css +94 -0
  135. data/vendor/assets/bower_components/highlightjs/styles/atelier-heath.light.css +94 -0
  136. data/vendor/assets/bower_components/highlightjs/styles/atelier-lakeside-dark.css +69 -0
  137. data/vendor/assets/bower_components/highlightjs/styles/atelier-lakeside-light.css +69 -0
  138. data/vendor/assets/bower_components/highlightjs/styles/atelier-lakeside.dark.css +94 -0
  139. data/vendor/assets/bower_components/highlightjs/styles/atelier-lakeside.light.css +94 -0
  140. data/vendor/assets/bower_components/highlightjs/styles/atelier-plateau-dark.css +84 -0
  141. data/vendor/assets/bower_components/highlightjs/styles/atelier-plateau-light.css +84 -0
  142. data/vendor/assets/bower_components/highlightjs/styles/atelier-plateau.dark.css +113 -0
  143. data/vendor/assets/bower_components/highlightjs/styles/atelier-plateau.light.css +113 -0
  144. data/vendor/assets/bower_components/highlightjs/styles/atelier-savanna-dark.css +84 -0
  145. data/vendor/assets/bower_components/highlightjs/styles/atelier-savanna-light.css +84 -0
  146. data/vendor/assets/bower_components/highlightjs/styles/atelier-savanna.dark.css +113 -0
  147. data/vendor/assets/bower_components/highlightjs/styles/atelier-savanna.light.css +113 -0
  148. data/vendor/assets/bower_components/highlightjs/styles/atelier-seaside-dark.css +69 -0
  149. data/vendor/assets/bower_components/highlightjs/styles/atelier-seaside-light.css +69 -0
  150. data/vendor/assets/bower_components/highlightjs/styles/atelier-seaside.dark.css +94 -0
  151. data/vendor/assets/bower_components/highlightjs/styles/atelier-seaside.light.css +94 -0
  152. data/vendor/assets/bower_components/highlightjs/styles/atelier-sulphurpool-dark.css +69 -0
  153. data/vendor/assets/bower_components/highlightjs/styles/atelier-sulphurpool-light.css +69 -0
  154. data/vendor/assets/bower_components/highlightjs/styles/atelier-sulphurpool.dark.css +94 -0
  155. data/vendor/assets/bower_components/highlightjs/styles/atelier-sulphurpool.light.css +94 -0
  156. data/vendor/assets/bower_components/highlightjs/styles/brown-paper.css +64 -0
  157. data/vendor/assets/bower_components/highlightjs/styles/brown-papersq.png +0 -0
  158. data/vendor/assets/bower_components/highlightjs/styles/brown_paper.css +103 -0
  159. data/vendor/assets/bower_components/highlightjs/styles/brown_papersq.png +0 -0
  160. data/vendor/assets/bower_components/highlightjs/styles/codepen-embed.css +60 -0
  161. data/vendor/assets/bower_components/highlightjs/styles/color-brewer.css +71 -0
  162. data/vendor/assets/bower_components/highlightjs/styles/dark.css +63 -0
  163. data/vendor/assets/bower_components/highlightjs/styles/darkula.css +74 -0
  164. data/vendor/assets/bower_components/highlightjs/styles/default.css +99 -0
  165. data/vendor/assets/bower_components/highlightjs/styles/docco.css +97 -0
  166. data/vendor/assets/bower_components/highlightjs/styles/dracula.css +76 -0
  167. data/vendor/assets/bower_components/highlightjs/styles/far.css +71 -0
  168. data/vendor/assets/bower_components/highlightjs/styles/foundation.css +88 -0
  169. data/vendor/assets/bower_components/highlightjs/styles/github-gist.css +71 -0
  170. data/vendor/assets/bower_components/highlightjs/styles/github.css +99 -0
  171. data/vendor/assets/bower_components/highlightjs/styles/googlecode.css +89 -0
  172. data/vendor/assets/bower_components/highlightjs/styles/grayscale.css +101 -0
  173. data/vendor/assets/bower_components/highlightjs/styles/gruvbox-dark.css +108 -0
  174. data/vendor/assets/bower_components/highlightjs/styles/gruvbox-light.css +108 -0
  175. data/vendor/assets/bower_components/highlightjs/styles/hopscotch.css +83 -0
  176. data/vendor/assets/bower_components/highlightjs/styles/hybrid.css +102 -0
  177. data/vendor/assets/bower_components/highlightjs/styles/idea.css +97 -0
  178. data/vendor/assets/bower_components/highlightjs/styles/ir-black.css +73 -0
  179. data/vendor/assets/bower_components/highlightjs/styles/ir_black.css +106 -0
  180. data/vendor/assets/bower_components/highlightjs/styles/kimbie.dark.css +74 -0
  181. data/vendor/assets/bower_components/highlightjs/styles/kimbie.light.css +74 -0
  182. data/vendor/assets/bower_components/highlightjs/styles/magula.css +70 -0
  183. data/vendor/assets/bower_components/highlightjs/styles/mono-blue.css +59 -0
  184. data/vendor/assets/bower_components/highlightjs/styles/monokai-sublime.css +83 -0
  185. data/vendor/assets/bower_components/highlightjs/styles/monokai.css +70 -0
  186. data/vendor/assets/bower_components/highlightjs/styles/monokai_sublime.css +154 -0
  187. data/vendor/assets/bower_components/highlightjs/styles/obsidian.css +88 -0
  188. data/vendor/assets/bower_components/highlightjs/styles/paraiso-dark.css +72 -0
  189. data/vendor/assets/bower_components/highlightjs/styles/paraiso-light.css +72 -0
  190. data/vendor/assets/bower_components/highlightjs/styles/paraiso.dark.css +96 -0
  191. data/vendor/assets/bower_components/highlightjs/styles/paraiso.light.css +96 -0
  192. data/vendor/assets/bower_components/highlightjs/styles/pojoaque.css +83 -0
  193. data/vendor/assets/bower_components/highlightjs/styles/pojoaque.jpg +0 -0
  194. data/vendor/assets/bower_components/highlightjs/styles/qtcreator_dark.css +83 -0
  195. data/vendor/assets/bower_components/highlightjs/styles/qtcreator_light.css +83 -0
  196. data/vendor/assets/bower_components/highlightjs/styles/railscasts.css +106 -0
  197. data/vendor/assets/bower_components/highlightjs/styles/rainbow.css +85 -0
  198. data/vendor/assets/bower_components/highlightjs/styles/school-book.css +72 -0
  199. data/vendor/assets/bower_components/highlightjs/styles/school-book.png +0 -0
  200. data/vendor/assets/bower_components/highlightjs/styles/school_book.css +111 -0
  201. data/vendor/assets/bower_components/highlightjs/styles/school_book.png +0 -0
  202. data/vendor/assets/bower_components/highlightjs/styles/solarized-dark.css +84 -0
  203. data/vendor/assets/bower_components/highlightjs/styles/solarized-light.css +84 -0
  204. data/vendor/assets/bower_components/highlightjs/styles/solarized_dark.css +107 -0
  205. data/vendor/assets/bower_components/highlightjs/styles/solarized_light.css +107 -0
  206. data/vendor/assets/bower_components/highlightjs/styles/sunburst.css +102 -0
  207. data/vendor/assets/bower_components/highlightjs/styles/tomorrow-night-blue.css +75 -0
  208. data/vendor/assets/bower_components/highlightjs/styles/tomorrow-night-bright.css +74 -0
  209. data/vendor/assets/bower_components/highlightjs/styles/tomorrow-night-eighties.css +74 -0
  210. data/vendor/assets/bower_components/highlightjs/styles/tomorrow-night.css +75 -0
  211. data/vendor/assets/bower_components/highlightjs/styles/tomorrow.css +72 -0
  212. data/vendor/assets/bower_components/highlightjs/styles/vs.css +68 -0
  213. data/vendor/assets/bower_components/highlightjs/styles/xcode.css +93 -0
  214. data/vendor/assets/bower_components/highlightjs/styles/zenburn.css +80 -0
  215. data/vendor/assets/bower_components/jquery.floatThead/CONTRIBUTING.md +33 -0
  216. data/vendor/assets/bower_components/jquery.floatThead/README.md +285 -0
  217. data/vendor/assets/bower_components/jquery.floatThead/bower.json +34 -0
  218. data/vendor/assets/bower_components/jquery.floatThead/dist/jquery.floatThead-slim.js +899 -0
  219. data/vendor/assets/bower_components/jquery.floatThead/dist/jquery.floatThead-slim.min.js +3 -0
  220. data/vendor/assets/bower_components/jquery.floatThead/dist/jquery.floatThead.js +964 -0
  221. data/vendor/assets/bower_components/jquery.floatThead/dist/jquery.floatThead.min.js +3 -0
  222. data/vendor/assets/bower_components/jquery.floatThead/license.txt +21 -0
  223. data/vendor/assets/bower_components/jquery/AUTHORS.txt +278 -0
  224. data/vendor/assets/bower_components/jquery/LICENSE.txt +36 -0
  225. data/vendor/assets/bower_components/jquery/README.md +65 -0
  226. data/vendor/assets/bower_components/jquery/bower.json +14 -0
  227. data/vendor/assets/bower_components/jquery/dist/jquery.js +9842 -0
  228. data/vendor/assets/bower_components/jquery/dist/jquery.min.js +4 -0
  229. data/vendor/assets/bower_components/jquery/dist/jquery.min.map +1 -0
  230. data/vendor/assets/bower_components/jquery/dist/jquery.slim.js +7877 -0
  231. data/vendor/assets/bower_components/jquery/dist/jquery.slim.min.js +4 -0
  232. data/vendor/assets/bower_components/jquery/dist/jquery.slim.min.map +1 -0
  233. data/vendor/assets/bower_components/jquery/sizzle/LICENSE.txt +36 -0
  234. data/vendor/assets/bower_components/jquery/sizzle/dist/sizzle.js +2143 -0
  235. data/vendor/assets/bower_components/jquery/sizzle/dist/sizzle.min.js +3 -0
  236. data/vendor/assets/bower_components/jquery/sizzle/dist/sizzle.min.map +1 -0
  237. data/vendor/assets/bower_components/jquery/src/ajax.js +845 -0
  238. data/vendor/assets/bower_components/jquery/src/ajax/jsonp.js +100 -0
  239. data/vendor/assets/bower_components/jquery/src/ajax/load.js +83 -0
  240. data/vendor/assets/bower_components/jquery/src/ajax/parseJSON.js +13 -0
  241. data/vendor/assets/bower_components/jquery/src/ajax/parseXML.js +27 -0
  242. data/vendor/assets/bower_components/jquery/src/ajax/script.js +68 -0
  243. data/vendor/assets/bower_components/jquery/src/ajax/var/location.js +3 -0
  244. data/vendor/assets/bower_components/jquery/src/ajax/var/nonce.js +5 -0
  245. data/vendor/assets/bower_components/jquery/src/ajax/var/rquery.js +3 -0
  246. data/vendor/assets/bower_components/jquery/src/ajax/xhr.js +167 -0
  247. data/vendor/assets/bower_components/jquery/src/attributes.js +11 -0
  248. data/vendor/assets/bower_components/jquery/src/attributes/attr.js +142 -0
  249. data/vendor/assets/bower_components/jquery/src/attributes/classes.js +177 -0
  250. data/vendor/assets/bower_components/jquery/src/attributes/prop.js +125 -0
  251. data/vendor/assets/bower_components/jquery/src/attributes/support.js +36 -0
  252. data/vendor/assets/bower_components/jquery/src/attributes/val.js +177 -0
  253. data/vendor/assets/bower_components/jquery/src/callbacks.js +232 -0
  254. data/vendor/assets/bower_components/jquery/src/core.js +494 -0
  255. data/vendor/assets/bower_components/jquery/src/core/DOMEval.js +14 -0
  256. data/vendor/assets/bower_components/jquery/src/core/access.js +65 -0
  257. data/vendor/assets/bower_components/jquery/src/core/init.js +134 -0
  258. data/vendor/assets/bower_components/jquery/src/core/parseHTML.js +41 -0
  259. data/vendor/assets/bower_components/jquery/src/core/ready.js +103 -0
  260. data/vendor/assets/bower_components/jquery/src/core/support.js +18 -0
  261. data/vendor/assets/bower_components/jquery/src/core/var/rsingleTag.js +5 -0
  262. data/vendor/assets/bower_components/jquery/src/css.js +515 -0
  263. data/vendor/assets/bower_components/jquery/src/css/addGetHookIf.js +24 -0
  264. data/vendor/assets/bower_components/jquery/src/css/adjustCSS.js +65 -0
  265. data/vendor/assets/bower_components/jquery/src/css/curCSS.js +60 -0
  266. data/vendor/assets/bower_components/jquery/src/css/defaultDisplay.js +72 -0
  267. data/vendor/assets/bower_components/jquery/src/css/hiddenVisibleSelectors.js +18 -0
  268. data/vendor/assets/bower_components/jquery/src/css/showHide.js +48 -0
  269. data/vendor/assets/bower_components/jquery/src/css/support.js +121 -0
  270. data/vendor/assets/bower_components/jquery/src/css/var/cssExpand.js +3 -0
  271. data/vendor/assets/bower_components/jquery/src/css/var/getStyles.js +15 -0
  272. data/vendor/assets/bower_components/jquery/src/css/var/isHidden.js +16 -0
  273. data/vendor/assets/bower_components/jquery/src/css/var/rmargin.js +3 -0
  274. data/vendor/assets/bower_components/jquery/src/css/var/rnumnonpx.js +5 -0
  275. data/vendor/assets/bower_components/jquery/src/css/var/swap.js +24 -0
  276. data/vendor/assets/bower_components/jquery/src/data.js +187 -0
  277. data/vendor/assets/bower_components/jquery/src/data/Data.js +200 -0
  278. data/vendor/assets/bower_components/jquery/src/data/accepts.js +20 -0
  279. data/vendor/assets/bower_components/jquery/src/data/support.js +23 -0
  280. data/vendor/assets/bower_components/jquery/src/data/var/acceptData.js +18 -0
  281. data/vendor/assets/bower_components/jquery/src/data/var/dataPriv.js +5 -0
  282. data/vendor/assets/bower_components/jquery/src/data/var/dataUser.js +5 -0
  283. data/vendor/assets/bower_components/jquery/src/deferred.js +158 -0
  284. data/vendor/assets/bower_components/jquery/src/deferred/exceptionHook.js +19 -0
  285. data/vendor/assets/bower_components/jquery/src/deprecated.js +32 -0
  286. data/vendor/assets/bower_components/jquery/src/dimensions.js +54 -0
  287. data/vendor/assets/bower_components/jquery/src/effects.js +629 -0
  288. data/vendor/assets/bower_components/jquery/src/effects/Tween.js +121 -0
  289. data/vendor/assets/bower_components/jquery/src/effects/animatedSelector.js +13 -0
  290. data/vendor/assets/bower_components/jquery/src/effects/support.js +58 -0
  291. data/vendor/assets/bower_components/jquery/src/event.js +710 -0
  292. data/vendor/assets/bower_components/jquery/src/event/ajax.js +20 -0
  293. data/vendor/assets/bower_components/jquery/src/event/alias.js +27 -0
  294. data/vendor/assets/bower_components/jquery/src/event/focusin.js +53 -0
  295. data/vendor/assets/bower_components/jquery/src/event/support.js +9 -0
  296. data/vendor/assets/bower_components/jquery/src/event/trigger.js +199 -0
  297. data/vendor/assets/bower_components/jquery/src/exports/amd.js +24 -0
  298. data/vendor/assets/bower_components/jquery/src/exports/global.js +26 -0
  299. data/vendor/assets/bower_components/jquery/src/intro.js +44 -0
  300. data/vendor/assets/bower_components/jquery/src/jquery.js +37 -0
  301. data/vendor/assets/bower_components/jquery/src/manipulation.js +481 -0
  302. data/vendor/assets/bower_components/jquery/src/manipulation/_evalUrl.js +20 -0
  303. data/vendor/assets/bower_components/jquery/src/manipulation/buildFragment.js +102 -0
  304. data/vendor/assets/bower_components/jquery/src/manipulation/createSafeFragment.js +20 -0
  305. data/vendor/assets/bower_components/jquery/src/manipulation/getAll.js +21 -0
  306. data/vendor/assets/bower_components/jquery/src/manipulation/setGlobalEval.js +20 -0
  307. data/vendor/assets/bower_components/jquery/src/manipulation/support.js +33 -0
  308. data/vendor/assets/bower_components/jquery/src/manipulation/var/nodeNames.js +5 -0
  309. data/vendor/assets/bower_components/jquery/src/manipulation/var/rcheckableType.js +3 -0
  310. data/vendor/assets/bower_components/jquery/src/manipulation/var/rleadingWhitespace.js +3 -0
  311. data/vendor/assets/bower_components/jquery/src/manipulation/var/rscriptType.js +3 -0
  312. data/vendor/assets/bower_components/jquery/src/manipulation/var/rtagName.js +3 -0
  313. data/vendor/assets/bower_components/jquery/src/manipulation/wrapMap.js +27 -0
  314. data/vendor/assets/bower_components/jquery/src/offset.js +218 -0
  315. data/vendor/assets/bower_components/jquery/src/outro.js +2 -0
  316. data/vendor/assets/bower_components/jquery/src/queue.js +143 -0
  317. data/vendor/assets/bower_components/jquery/src/queue/delay.js +22 -0
  318. data/vendor/assets/bower_components/jquery/src/selector-native.js +211 -0
  319. data/vendor/assets/bower_components/jquery/src/selector-sizzle.js +14 -0
  320. data/vendor/assets/bower_components/jquery/src/selector.js +1 -0
  321. data/vendor/assets/bower_components/jquery/src/serialize.js +125 -0
  322. data/vendor/assets/bower_components/jquery/src/support.js +63 -0
  323. data/vendor/assets/bower_components/jquery/src/traversing.js +175 -0
  324. data/vendor/assets/bower_components/jquery/src/traversing/findFilter.js +100 -0
  325. data/vendor/assets/bower_components/jquery/src/traversing/var/dir.js +20 -0
  326. data/vendor/assets/bower_components/jquery/src/traversing/var/rneedsContext.js +6 -0
  327. data/vendor/assets/bower_components/jquery/src/traversing/var/siblings.js +15 -0
  328. data/vendor/assets/bower_components/jquery/src/var/arr.js +3 -0
  329. data/vendor/assets/bower_components/jquery/src/var/class2type.js +5 -0
  330. data/vendor/assets/bower_components/jquery/src/var/concat.js +5 -0
  331. data/vendor/assets/bower_components/jquery/src/var/deletedIds.js +3 -0
  332. data/vendor/assets/bower_components/jquery/src/var/document.js +3 -0
  333. data/vendor/assets/bower_components/jquery/src/var/documentElement.js +5 -0
  334. data/vendor/assets/bower_components/jquery/src/var/hasOwn.js +5 -0
  335. data/vendor/assets/bower_components/jquery/src/var/indexOf.js +5 -0
  336. data/vendor/assets/bower_components/jquery/src/var/pnum.js +3 -0
  337. data/vendor/assets/bower_components/jquery/src/var/push.js +5 -0
  338. data/vendor/assets/bower_components/jquery/src/var/rcssNum.js +7 -0
  339. data/vendor/assets/bower_components/jquery/src/var/rnotwhite.js +3 -0
  340. data/vendor/assets/bower_components/jquery/src/var/slice.js +5 -0
  341. data/vendor/assets/bower_components/jquery/src/var/support.js +5 -0
  342. data/vendor/assets/bower_components/jquery/src/var/toString.js +5 -0
  343. data/vendor/assets/bower_components/jquery/src/wrap.js +79 -0
  344. data/vendor/assets/bower_components/marked/Gulpfile.js +22 -0
  345. data/vendor/assets/bower_components/marked/LICENSE +19 -0
  346. data/vendor/assets/bower_components/marked/Makefile +12 -0
  347. data/vendor/assets/bower_components/marked/README.md +406 -0
  348. data/vendor/assets/bower_components/marked/bin/marked +187 -0
  349. data/vendor/assets/bower_components/marked/bower.json +24 -0
  350. data/vendor/assets/bower_components/marked/component.json +10 -0
  351. data/vendor/assets/bower_components/marked/doc/broken.md +426 -0
  352. data/vendor/assets/bower_components/marked/doc/todo.md +2 -0
  353. data/vendor/assets/bower_components/marked/index.js +1 -0
  354. data/vendor/assets/bower_components/marked/lib/marked.js +1285 -0
  355. data/vendor/assets/bower_components/marked/man/marked.1 +91 -0
  356. data/vendor/assets/bower_components/marked/marked.min.js +6 -0
  357. data/vendor/assets/bower_components/marked/package.json +24 -0
  358. data/vendor/assets/bower_components/moment/CHANGELOG.md +423 -0
  359. data/vendor/assets/bower_components/moment/LICENSE +22 -0
  360. data/vendor/assets/bower_components/moment/Moment.js.nuspec +28 -0
  361. data/vendor/assets/bower_components/moment/README.md +39 -0
  362. data/vendor/assets/bower_components/moment/benchmarks/clone.js +10 -0
  363. data/vendor/assets/bower_components/moment/bower.json +20 -0
  364. data/vendor/assets/bower_components/moment/locale/af.js +71 -0
  365. data/vendor/assets/bower_components/moment/locale/ar-ma.js +57 -0
  366. data/vendor/assets/bower_components/moment/locale/ar-sa.js +101 -0
  367. data/vendor/assets/bower_components/moment/locale/ar-tn.js +55 -0
  368. data/vendor/assets/bower_components/moment/locale/ar.js +134 -0
  369. data/vendor/assets/bower_components/moment/locale/az.js +107 -0
  370. data/vendor/assets/bower_components/moment/locale/be.js +154 -0
  371. data/vendor/assets/bower_components/moment/locale/bg.js +88 -0
  372. data/vendor/assets/bower_components/moment/locale/bn.js +111 -0
  373. data/vendor/assets/bower_components/moment/locale/bo.js +108 -0
  374. data/vendor/assets/bower_components/moment/locale/br.js +109 -0
  375. data/vendor/assets/bower_components/moment/locale/bs.js +140 -0
  376. data/vendor/assets/bower_components/moment/locale/ca.js +77 -0
  377. data/vendor/assets/bower_components/moment/locale/cs.js +157 -0
  378. data/vendor/assets/bower_components/moment/locale/cv.js +61 -0
  379. data/vendor/assets/bower_components/moment/locale/cy.js +79 -0
  380. data/vendor/assets/bower_components/moment/locale/da.js +58 -0
  381. data/vendor/assets/bower_components/moment/locale/de-at.js +74 -0
  382. data/vendor/assets/bower_components/moment/locale/de.js +73 -0
  383. data/vendor/assets/bower_components/moment/locale/el.js +94 -0
  384. data/vendor/assets/bower_components/moment/locale/en-au.js +64 -0
  385. data/vendor/assets/bower_components/moment/locale/en-ca.js +61 -0
  386. data/vendor/assets/bower_components/moment/locale/en-gb.js +65 -0
  387. data/vendor/assets/bower_components/moment/locale/eo.js +71 -0
  388. data/vendor/assets/bower_components/moment/locale/es.js +77 -0
  389. data/vendor/assets/bower_components/moment/locale/et.js +78 -0
  390. data/vendor/assets/bower_components/moment/locale/eu.js +62 -0
  391. data/vendor/assets/bower_components/moment/locale/fa.js +103 -0
  392. data/vendor/assets/bower_components/moment/locale/fi.js +107 -0
  393. data/vendor/assets/bower_components/moment/locale/fo.js +58 -0
  394. data/vendor/assets/bower_components/moment/locale/fr-ca.js +56 -0
  395. data/vendor/assets/bower_components/moment/locale/fr.js +60 -0
  396. data/vendor/assets/bower_components/moment/locale/fy.js +69 -0
  397. data/vendor/assets/bower_components/moment/locale/gl.js +73 -0
  398. data/vendor/assets/bower_components/moment/locale/he.js +80 -0
  399. data/vendor/assets/bower_components/moment/locale/hi.js +121 -0
  400. data/vendor/assets/bower_components/moment/locale/hr.js +141 -0
  401. data/vendor/assets/bower_components/moment/locale/hu.js +111 -0
  402. data/vendor/assets/bower_components/moment/locale/hy-am.js +118 -0
  403. data/vendor/assets/bower_components/moment/locale/id.js +81 -0
  404. data/vendor/assets/bower_components/moment/locale/is.js +126 -0
  405. data/vendor/assets/bower_components/moment/locale/it.js +68 -0
  406. data/vendor/assets/bower_components/moment/locale/ja.js +63 -0
  407. data/vendor/assets/bower_components/moment/locale/ka.js +109 -0
  408. data/vendor/assets/bower_components/moment/locale/km.js +56 -0
  409. data/vendor/assets/bower_components/moment/locale/ko.js +65 -0
  410. data/vendor/assets/bower_components/moment/locale/lb.js +139 -0
  411. data/vendor/assets/bower_components/moment/locale/lt.js +120 -0
  412. data/vendor/assets/bower_components/moment/locale/lv.js +79 -0
  413. data/vendor/assets/bower_components/moment/locale/mk.js +88 -0
  414. data/vendor/assets/bower_components/moment/locale/ml.js +69 -0
  415. data/vendor/assets/bower_components/moment/locale/mr.js +120 -0
  416. data/vendor/assets/bower_components/moment/locale/ms-my.js +80 -0
  417. data/vendor/assets/bower_components/moment/locale/my.js +89 -0
  418. data/vendor/assets/bower_components/moment/locale/nb.js +59 -0
  419. data/vendor/assets/bower_components/moment/locale/ne.js +121 -0
  420. data/vendor/assets/bower_components/moment/locale/nl.js +69 -0
  421. data/vendor/assets/bower_components/moment/locale/nn.js +58 -0
  422. data/vendor/assets/bower_components/moment/locale/pl.js +100 -0
  423. data/vendor/assets/bower_components/moment/locale/pt-br.js +58 -0
  424. data/vendor/assets/bower_components/moment/locale/pt.js +62 -0
  425. data/vendor/assets/bower_components/moment/locale/ro.js +73 -0
  426. data/vendor/assets/bower_components/moment/locale/ru.js +176 -0
  427. data/vendor/assets/bower_components/moment/locale/sk.js +158 -0
  428. data/vendor/assets/bower_components/moment/locale/sl.js +146 -0
  429. data/vendor/assets/bower_components/moment/locale/sq.js +67 -0
  430. data/vendor/assets/bower_components/moment/locale/sr-cyrl.js +107 -0
  431. data/vendor/assets/bower_components/moment/locale/sr.js +107 -0
  432. data/vendor/assets/bower_components/moment/locale/sv.js +65 -0
  433. data/vendor/assets/bower_components/moment/locale/ta.js +130 -0
  434. data/vendor/assets/bower_components/moment/locale/th.js +63 -0
  435. data/vendor/assets/bower_components/moment/locale/tl-ph.js +60 -0
  436. data/vendor/assets/bower_components/moment/locale/tr.js +94 -0
  437. data/vendor/assets/bower_components/moment/locale/tzm-latn.js +56 -0
  438. data/vendor/assets/bower_components/moment/locale/tzm.js +56 -0
  439. data/vendor/assets/bower_components/moment/locale/uk.js +163 -0
  440. data/vendor/assets/bower_components/moment/locale/uz.js +56 -0
  441. data/vendor/assets/bower_components/moment/locale/vi.js +64 -0
  442. data/vendor/assets/bower_components/moment/locale/zh-cn.js +125 -0
  443. data/vendor/assets/bower_components/moment/locale/zh-tw.js +99 -0
  444. data/vendor/assets/bower_components/moment/meteor/README.md +25 -0
  445. data/vendor/assets/bower_components/moment/meteor/export.js +3 -0
  446. data/vendor/assets/bower_components/moment/meteor/test.js +5 -0
  447. data/vendor/assets/bower_components/moment/min/locales.js +7306 -0
  448. data/vendor/assets/bower_components/moment/min/locales.min.js +4 -0
  449. data/vendor/assets/bower_components/moment/min/moment-with-locales.js +9792 -0
  450. data/vendor/assets/bower_components/moment/min/moment-with-locales.min.js +10 -0
  451. data/vendor/assets/bower_components/moment/min/moment.min.js +7 -0
  452. data/vendor/assets/bower_components/moment/moment.js +3043 -0
  453. data/vendor/assets/bower_components/moment/scripts/npm_prepublish.sh +43 -0
  454. data/vendor/assets/bower_components/underscore/LICENSE +23 -0
  455. data/vendor/assets/bower_components/underscore/README.md +22 -0
  456. data/vendor/assets/bower_components/underscore/bower.json +7 -0
  457. data/vendor/assets/bower_components/underscore/underscore-min.js +6 -0
  458. data/vendor/assets/bower_components/underscore/underscore-min.map +1 -0
  459. data/vendor/assets/bower_components/underscore/underscore.js +1548 -0
  460. metadata +782 -0
@@ -0,0 +1,1272 @@
1
+ (function() {
2
+ var $, AbstractChosen, Chosen, SelectParser, _ref,
3
+ __hasProp = {}.hasOwnProperty,
4
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
5
+
6
+ SelectParser = (function() {
7
+ function SelectParser() {
8
+ this.options_index = 0;
9
+ this.parsed = [];
10
+ }
11
+
12
+ SelectParser.prototype.add_node = function(child) {
13
+ if (child.nodeName.toUpperCase() === "OPTGROUP") {
14
+ return this.add_group(child);
15
+ } else {
16
+ return this.add_option(child);
17
+ }
18
+ };
19
+
20
+ SelectParser.prototype.add_group = function(group) {
21
+ var group_position, option, _i, _len, _ref, _results;
22
+ group_position = this.parsed.length;
23
+ this.parsed.push({
24
+ array_index: group_position,
25
+ group: true,
26
+ label: this.escapeExpression(group.label),
27
+ title: group.title ? group.title : void 0,
28
+ children: 0,
29
+ disabled: group.disabled,
30
+ classes: group.className
31
+ });
32
+ _ref = group.childNodes;
33
+ _results = [];
34
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
35
+ option = _ref[_i];
36
+ _results.push(this.add_option(option, group_position, group.disabled));
37
+ }
38
+ return _results;
39
+ };
40
+
41
+ SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
42
+ if (option.nodeName.toUpperCase() === "OPTION") {
43
+ if (option.text !== "") {
44
+ if (group_position != null) {
45
+ this.parsed[group_position].children += 1;
46
+ }
47
+ this.parsed.push({
48
+ array_index: this.parsed.length,
49
+ options_index: this.options_index,
50
+ value: option.value,
51
+ text: option.text,
52
+ html: option.innerHTML,
53
+ title: option.title ? option.title : void 0,
54
+ selected: option.selected,
55
+ disabled: group_disabled === true ? group_disabled : option.disabled,
56
+ group_array_index: group_position,
57
+ group_label: group_position != null ? this.parsed[group_position].label : null,
58
+ classes: option.className,
59
+ style: option.style.cssText
60
+ });
61
+ } else {
62
+ this.parsed.push({
63
+ array_index: this.parsed.length,
64
+ options_index: this.options_index,
65
+ empty: true
66
+ });
67
+ }
68
+ return this.options_index += 1;
69
+ }
70
+ };
71
+
72
+ SelectParser.prototype.escapeExpression = function(text) {
73
+ var map, unsafe_chars;
74
+ if ((text == null) || text === false) {
75
+ return "";
76
+ }
77
+ if (!/[\&\<\>\"\'\`]/.test(text)) {
78
+ return text;
79
+ }
80
+ map = {
81
+ "<": "&lt;",
82
+ ">": "&gt;",
83
+ '"': "&quot;",
84
+ "'": "&#x27;",
85
+ "`": "&#x60;"
86
+ };
87
+ unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
88
+ return text.replace(unsafe_chars, function(chr) {
89
+ return map[chr] || "&amp;";
90
+ });
91
+ };
92
+
93
+ return SelectParser;
94
+
95
+ })();
96
+
97
+ SelectParser.select_to_array = function(select) {
98
+ var child, parser, _i, _len, _ref;
99
+ parser = new SelectParser();
100
+ _ref = select.childNodes;
101
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
102
+ child = _ref[_i];
103
+ parser.add_node(child);
104
+ }
105
+ return parser.parsed;
106
+ };
107
+
108
+ AbstractChosen = (function() {
109
+ function AbstractChosen(form_field, options) {
110
+ this.form_field = form_field;
111
+ this.options = options != null ? options : {};
112
+ if (!AbstractChosen.browser_is_supported()) {
113
+ return;
114
+ }
115
+ this.is_multiple = this.form_field.multiple;
116
+ this.set_default_text();
117
+ this.set_default_values();
118
+ this.setup();
119
+ this.set_up_html();
120
+ this.register_observers();
121
+ this.on_ready();
122
+ }
123
+
124
+ AbstractChosen.prototype.set_default_values = function() {
125
+ var _this = this;
126
+ this.click_test_action = function(evt) {
127
+ return _this.test_active_click(evt);
128
+ };
129
+ this.activate_action = function(evt) {
130
+ return _this.activate_field(evt);
131
+ };
132
+ this.active_field = false;
133
+ this.mouse_on_container = false;
134
+ this.results_showing = false;
135
+ this.result_highlighted = null;
136
+ this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
137
+ this.disable_search_threshold = this.options.disable_search_threshold || 0;
138
+ this.disable_search = this.options.disable_search || false;
139
+ this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
140
+ this.group_search = this.options.group_search != null ? this.options.group_search : true;
141
+ this.search_contains = this.options.search_contains || false;
142
+ this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
143
+ this.max_selected_options = this.options.max_selected_options || Infinity;
144
+ this.inherit_select_classes = this.options.inherit_select_classes || false;
145
+ this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
146
+ this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
147
+ this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;
148
+ return this.max_shown_results = this.options.max_shown_results || Number.POSITIVE_INFINITY;
149
+ };
150
+
151
+ AbstractChosen.prototype.set_default_text = function() {
152
+ if (this.form_field.getAttribute("data-placeholder")) {
153
+ this.default_text = this.form_field.getAttribute("data-placeholder");
154
+ } else if (this.is_multiple) {
155
+ this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
156
+ } else {
157
+ this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
158
+ }
159
+ return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
160
+ };
161
+
162
+ AbstractChosen.prototype.choice_label = function(item) {
163
+ if (this.include_group_label_in_selected && (item.group_label != null)) {
164
+ return "<b class='group-name'>" + item.group_label + "</b>" + item.html;
165
+ } else {
166
+ return item.html;
167
+ }
168
+ };
169
+
170
+ AbstractChosen.prototype.mouse_enter = function() {
171
+ return this.mouse_on_container = true;
172
+ };
173
+
174
+ AbstractChosen.prototype.mouse_leave = function() {
175
+ return this.mouse_on_container = false;
176
+ };
177
+
178
+ AbstractChosen.prototype.input_focus = function(evt) {
179
+ var _this = this;
180
+ if (this.is_multiple) {
181
+ if (!this.active_field) {
182
+ return setTimeout((function() {
183
+ return _this.container_mousedown();
184
+ }), 50);
185
+ }
186
+ } else {
187
+ if (!this.active_field) {
188
+ return this.activate_field();
189
+ }
190
+ }
191
+ };
192
+
193
+ AbstractChosen.prototype.input_blur = function(evt) {
194
+ var _this = this;
195
+ if (!this.mouse_on_container) {
196
+ this.active_field = false;
197
+ return setTimeout((function() {
198
+ return _this.blur_test();
199
+ }), 100);
200
+ }
201
+ };
202
+
203
+ AbstractChosen.prototype.results_option_build = function(options) {
204
+ var content, data, data_content, shown_results, _i, _len, _ref;
205
+ content = '';
206
+ shown_results = 0;
207
+ _ref = this.results_data;
208
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
209
+ data = _ref[_i];
210
+ data_content = '';
211
+ if (data.group) {
212
+ data_content = this.result_add_group(data);
213
+ } else {
214
+ data_content = this.result_add_option(data);
215
+ }
216
+ if (data_content !== '') {
217
+ shown_results++;
218
+ content += data_content;
219
+ }
220
+ if (options != null ? options.first : void 0) {
221
+ if (data.selected && this.is_multiple) {
222
+ this.choice_build(data);
223
+ } else if (data.selected && !this.is_multiple) {
224
+ this.single_set_selected_text(this.choice_label(data));
225
+ }
226
+ }
227
+ if (shown_results >= this.max_shown_results) {
228
+ break;
229
+ }
230
+ }
231
+ return content;
232
+ };
233
+
234
+ AbstractChosen.prototype.result_add_option = function(option) {
235
+ var classes, option_el;
236
+ if (!option.search_match) {
237
+ return '';
238
+ }
239
+ if (!this.include_option_in_results(option)) {
240
+ return '';
241
+ }
242
+ classes = [];
243
+ if (!option.disabled && !(option.selected && this.is_multiple)) {
244
+ classes.push("active-result");
245
+ }
246
+ if (option.disabled && !(option.selected && this.is_multiple)) {
247
+ classes.push("disabled-result");
248
+ }
249
+ if (option.selected) {
250
+ classes.push("result-selected");
251
+ }
252
+ if (option.group_array_index != null) {
253
+ classes.push("group-option");
254
+ }
255
+ if (option.classes !== "") {
256
+ classes.push(option.classes);
257
+ }
258
+ option_el = document.createElement("li");
259
+ option_el.className = classes.join(" ");
260
+ option_el.style.cssText = option.style;
261
+ option_el.setAttribute("data-option-array-index", option.array_index);
262
+ option_el.innerHTML = option.search_text;
263
+ if (option.title) {
264
+ option_el.title = option.title;
265
+ }
266
+ return this.outerHTML(option_el);
267
+ };
268
+
269
+ AbstractChosen.prototype.result_add_group = function(group) {
270
+ var classes, group_el;
271
+ if (!(group.search_match || group.group_match)) {
272
+ return '';
273
+ }
274
+ if (!(group.active_options > 0)) {
275
+ return '';
276
+ }
277
+ classes = [];
278
+ classes.push("group-result");
279
+ if (group.classes) {
280
+ classes.push(group.classes);
281
+ }
282
+ group_el = document.createElement("li");
283
+ group_el.className = classes.join(" ");
284
+ group_el.innerHTML = group.search_text;
285
+ if (group.title) {
286
+ group_el.title = group.title;
287
+ }
288
+ return this.outerHTML(group_el);
289
+ };
290
+
291
+ AbstractChosen.prototype.results_update_field = function() {
292
+ this.set_default_text();
293
+ if (!this.is_multiple) {
294
+ this.results_reset_cleanup();
295
+ }
296
+ this.result_clear_highlight();
297
+ this.results_build();
298
+ if (this.results_showing) {
299
+ return this.winnow_results();
300
+ }
301
+ };
302
+
303
+ AbstractChosen.prototype.reset_single_select_options = function() {
304
+ var result, _i, _len, _ref, _results;
305
+ _ref = this.results_data;
306
+ _results = [];
307
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
308
+ result = _ref[_i];
309
+ if (result.selected) {
310
+ _results.push(result.selected = false);
311
+ } else {
312
+ _results.push(void 0);
313
+ }
314
+ }
315
+ return _results;
316
+ };
317
+
318
+ AbstractChosen.prototype.results_toggle = function() {
319
+ if (this.results_showing) {
320
+ return this.results_hide();
321
+ } else {
322
+ return this.results_show();
323
+ }
324
+ };
325
+
326
+ AbstractChosen.prototype.results_search = function(evt) {
327
+ if (this.results_showing) {
328
+ return this.winnow_results();
329
+ } else {
330
+ return this.results_show();
331
+ }
332
+ };
333
+
334
+ AbstractChosen.prototype.winnow_results = function() {
335
+ var escapedSearchText, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
336
+ this.no_results_clear();
337
+ results = 0;
338
+ searchText = this.get_search_text();
339
+ escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
340
+ zregex = new RegExp(escapedSearchText, 'i');
341
+ regex = this.get_search_regex(escapedSearchText);
342
+ _ref = this.results_data;
343
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
344
+ option = _ref[_i];
345
+ option.search_match = false;
346
+ results_group = null;
347
+ if (this.include_option_in_results(option)) {
348
+ if (option.group) {
349
+ option.group_match = false;
350
+ option.active_options = 0;
351
+ }
352
+ if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {
353
+ results_group = this.results_data[option.group_array_index];
354
+ if (results_group.active_options === 0 && results_group.search_match) {
355
+ results += 1;
356
+ }
357
+ results_group.active_options += 1;
358
+ }
359
+ option.search_text = option.group ? option.label : option.html;
360
+ if (!(option.group && !this.group_search)) {
361
+ option.search_match = this.search_string_match(option.search_text, regex);
362
+ if (option.search_match && !option.group) {
363
+ results += 1;
364
+ }
365
+ if (option.search_match) {
366
+ if (searchText.length) {
367
+ startpos = option.search_text.search(zregex);
368
+ text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
369
+ option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
370
+ }
371
+ if (results_group != null) {
372
+ results_group.group_match = true;
373
+ }
374
+ } else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
375
+ option.search_match = true;
376
+ }
377
+ }
378
+ }
379
+ }
380
+ this.result_clear_highlight();
381
+ if (results < 1 && searchText.length) {
382
+ this.update_results_content("");
383
+ return this.no_results(searchText);
384
+ } else {
385
+ this.update_results_content(this.results_option_build());
386
+ return this.winnow_results_set_highlight();
387
+ }
388
+ };
389
+
390
+ AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
391
+ var regex_anchor;
392
+ regex_anchor = this.search_contains ? "" : "^";
393
+ return new RegExp(regex_anchor + escaped_search_string, 'i');
394
+ };
395
+
396
+ AbstractChosen.prototype.search_string_match = function(search_string, regex) {
397
+ var part, parts, _i, _len;
398
+ if (regex.test(search_string)) {
399
+ return true;
400
+ } else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
401
+ parts = search_string.replace(/\[|\]/g, "").split(" ");
402
+ if (parts.length) {
403
+ for (_i = 0, _len = parts.length; _i < _len; _i++) {
404
+ part = parts[_i];
405
+ if (regex.test(part)) {
406
+ return true;
407
+ }
408
+ }
409
+ }
410
+ }
411
+ };
412
+
413
+ AbstractChosen.prototype.choices_count = function() {
414
+ var option, _i, _len, _ref;
415
+ if (this.selected_option_count != null) {
416
+ return this.selected_option_count;
417
+ }
418
+ this.selected_option_count = 0;
419
+ _ref = this.form_field.options;
420
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
421
+ option = _ref[_i];
422
+ if (option.selected) {
423
+ this.selected_option_count += 1;
424
+ }
425
+ }
426
+ return this.selected_option_count;
427
+ };
428
+
429
+ AbstractChosen.prototype.choices_click = function(evt) {
430
+ evt.preventDefault();
431
+ if (!(this.results_showing || this.is_disabled)) {
432
+ return this.results_show();
433
+ }
434
+ };
435
+
436
+ AbstractChosen.prototype.keyup_checker = function(evt) {
437
+ var stroke, _ref;
438
+ stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
439
+ this.search_field_scale();
440
+ switch (stroke) {
441
+ case 8:
442
+ if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
443
+ return this.keydown_backstroke();
444
+ } else if (!this.pending_backstroke) {
445
+ this.result_clear_highlight();
446
+ return this.results_search();
447
+ }
448
+ break;
449
+ case 13:
450
+ evt.preventDefault();
451
+ if (this.results_showing) {
452
+ return this.result_select(evt);
453
+ }
454
+ break;
455
+ case 27:
456
+ if (this.results_showing) {
457
+ this.results_hide();
458
+ }
459
+ return true;
460
+ case 9:
461
+ case 38:
462
+ case 40:
463
+ case 16:
464
+ case 91:
465
+ case 17:
466
+ case 18:
467
+ break;
468
+ default:
469
+ return this.results_search();
470
+ }
471
+ };
472
+
473
+ AbstractChosen.prototype.clipboard_event_checker = function(evt) {
474
+ var _this = this;
475
+ return setTimeout((function() {
476
+ return _this.results_search();
477
+ }), 50);
478
+ };
479
+
480
+ AbstractChosen.prototype.container_width = function() {
481
+ if (this.options.width != null) {
482
+ return this.options.width;
483
+ } else {
484
+ return "" + this.form_field.offsetWidth + "px";
485
+ }
486
+ };
487
+
488
+ AbstractChosen.prototype.include_option_in_results = function(option) {
489
+ if (this.is_multiple && (!this.display_selected_options && option.selected)) {
490
+ return false;
491
+ }
492
+ if (!this.display_disabled_options && option.disabled) {
493
+ return false;
494
+ }
495
+ if (option.empty) {
496
+ return false;
497
+ }
498
+ return true;
499
+ };
500
+
501
+ AbstractChosen.prototype.search_results_touchstart = function(evt) {
502
+ this.touch_started = true;
503
+ return this.search_results_mouseover(evt);
504
+ };
505
+
506
+ AbstractChosen.prototype.search_results_touchmove = function(evt) {
507
+ this.touch_started = false;
508
+ return this.search_results_mouseout(evt);
509
+ };
510
+
511
+ AbstractChosen.prototype.search_results_touchend = function(evt) {
512
+ if (this.touch_started) {
513
+ return this.search_results_mouseup(evt);
514
+ }
515
+ };
516
+
517
+ AbstractChosen.prototype.outerHTML = function(element) {
518
+ var tmp;
519
+ if (element.outerHTML) {
520
+ return element.outerHTML;
521
+ }
522
+ tmp = document.createElement("div");
523
+ tmp.appendChild(element);
524
+ return tmp.innerHTML;
525
+ };
526
+
527
+ AbstractChosen.browser_is_supported = function() {
528
+ if (/iP(od|hone)/i.test(window.navigator.userAgent)) {
529
+ return false;
530
+ }
531
+ if (/Android/i.test(window.navigator.userAgent)) {
532
+ if (/Mobile/i.test(window.navigator.userAgent)) {
533
+ return false;
534
+ }
535
+ }
536
+ if (/IEMobile/i.test(window.navigator.userAgent)) {
537
+ return false;
538
+ }
539
+ if (/Windows Phone/i.test(window.navigator.userAgent)) {
540
+ return false;
541
+ }
542
+ if (/BlackBerry/i.test(window.navigator.userAgent)) {
543
+ return false;
544
+ }
545
+ if (/BB10/i.test(window.navigator.userAgent)) {
546
+ return false;
547
+ }
548
+ if (window.navigator.appName === "Microsoft Internet Explorer") {
549
+ return document.documentMode >= 8;
550
+ }
551
+ return true;
552
+ };
553
+
554
+ AbstractChosen.default_multiple_text = "Select Some Options";
555
+
556
+ AbstractChosen.default_single_text = "Select an Option";
557
+
558
+ AbstractChosen.default_no_result_text = "No results match";
559
+
560
+ return AbstractChosen;
561
+
562
+ })();
563
+
564
+ $ = jQuery;
565
+
566
+ $.fn.extend({
567
+ chosen: function(options) {
568
+ if (!AbstractChosen.browser_is_supported()) {
569
+ return this;
570
+ }
571
+ return this.each(function(input_field) {
572
+ var $this, chosen;
573
+ $this = $(this);
574
+ chosen = $this.data('chosen');
575
+ if (options === 'destroy') {
576
+ if (chosen instanceof Chosen) {
577
+ chosen.destroy();
578
+ }
579
+ return;
580
+ }
581
+ if (!(chosen instanceof Chosen)) {
582
+ $this.data('chosen', new Chosen(this, options));
583
+ }
584
+ });
585
+ }
586
+ });
587
+
588
+ Chosen = (function(_super) {
589
+ __extends(Chosen, _super);
590
+
591
+ function Chosen() {
592
+ _ref = Chosen.__super__.constructor.apply(this, arguments);
593
+ return _ref;
594
+ }
595
+
596
+ Chosen.prototype.setup = function() {
597
+ this.form_field_jq = $(this.form_field);
598
+ this.current_selectedIndex = this.form_field.selectedIndex;
599
+ return this.is_rtl = this.form_field_jq.hasClass("chosen-rtl");
600
+ };
601
+
602
+ Chosen.prototype.set_up_html = function() {
603
+ var container_classes, container_props;
604
+ container_classes = ["chosen-container"];
605
+ container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
606
+ if (this.inherit_select_classes && this.form_field.className) {
607
+ container_classes.push(this.form_field.className);
608
+ }
609
+ if (this.is_rtl) {
610
+ container_classes.push("chosen-rtl");
611
+ }
612
+ container_props = {
613
+ 'class': container_classes.join(' '),
614
+ 'style': "width: " + (this.container_width()) + ";",
615
+ 'title': this.form_field.title
616
+ };
617
+ if (this.form_field.id.length) {
618
+ container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
619
+ }
620
+ this.container = $("<div />", container_props);
621
+ if (this.is_multiple) {
622
+ this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>');
623
+ } else {
624
+ this.container.html('<a class="chosen-single chosen-default"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>');
625
+ }
626
+ this.form_field_jq.hide().after(this.container);
627
+ this.dropdown = this.container.find('div.chosen-drop').first();
628
+ this.search_field = this.container.find('input').first();
629
+ this.search_results = this.container.find('ul.chosen-results').first();
630
+ this.search_field_scale();
631
+ this.search_no_results = this.container.find('li.no-results').first();
632
+ if (this.is_multiple) {
633
+ this.search_choices = this.container.find('ul.chosen-choices').first();
634
+ this.search_container = this.container.find('li.search-field').first();
635
+ } else {
636
+ this.search_container = this.container.find('div.chosen-search').first();
637
+ this.selected_item = this.container.find('.chosen-single').first();
638
+ }
639
+ this.results_build();
640
+ this.set_tab_index();
641
+ return this.set_label_behavior();
642
+ };
643
+
644
+ Chosen.prototype.on_ready = function() {
645
+ return this.form_field_jq.trigger("chosen:ready", {
646
+ chosen: this
647
+ });
648
+ };
649
+
650
+ Chosen.prototype.register_observers = function() {
651
+ var _this = this;
652
+ this.container.bind('touchstart.chosen', function(evt) {
653
+ _this.container_mousedown(evt);
654
+ return evt.preventDefault();
655
+ });
656
+ this.container.bind('touchend.chosen', function(evt) {
657
+ _this.container_mouseup(evt);
658
+ return evt.preventDefault();
659
+ });
660
+ this.container.bind('mousedown.chosen', function(evt) {
661
+ _this.container_mousedown(evt);
662
+ });
663
+ this.container.bind('mouseup.chosen', function(evt) {
664
+ _this.container_mouseup(evt);
665
+ });
666
+ this.container.bind('mouseenter.chosen', function(evt) {
667
+ _this.mouse_enter(evt);
668
+ });
669
+ this.container.bind('mouseleave.chosen', function(evt) {
670
+ _this.mouse_leave(evt);
671
+ });
672
+ this.search_results.bind('mouseup.chosen', function(evt) {
673
+ _this.search_results_mouseup(evt);
674
+ });
675
+ this.search_results.bind('mouseover.chosen', function(evt) {
676
+ _this.search_results_mouseover(evt);
677
+ });
678
+ this.search_results.bind('mouseout.chosen', function(evt) {
679
+ _this.search_results_mouseout(evt);
680
+ });
681
+ this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) {
682
+ _this.search_results_mousewheel(evt);
683
+ });
684
+ this.search_results.bind('touchstart.chosen', function(evt) {
685
+ _this.search_results_touchstart(evt);
686
+ });
687
+ this.search_results.bind('touchmove.chosen', function(evt) {
688
+ _this.search_results_touchmove(evt);
689
+ });
690
+ this.search_results.bind('touchend.chosen', function(evt) {
691
+ _this.search_results_touchend(evt);
692
+ });
693
+ this.form_field_jq.bind("chosen:updated.chosen", function(evt) {
694
+ _this.results_update_field(evt);
695
+ });
696
+ this.form_field_jq.bind("chosen:activate.chosen", function(evt) {
697
+ _this.activate_field(evt);
698
+ });
699
+ this.form_field_jq.bind("chosen:open.chosen", function(evt) {
700
+ _this.container_mousedown(evt);
701
+ });
702
+ this.form_field_jq.bind("chosen:close.chosen", function(evt) {
703
+ _this.input_blur(evt);
704
+ });
705
+ this.search_field.bind('blur.chosen', function(evt) {
706
+ _this.input_blur(evt);
707
+ });
708
+ this.search_field.bind('keyup.chosen', function(evt) {
709
+ _this.keyup_checker(evt);
710
+ });
711
+ this.search_field.bind('keydown.chosen', function(evt) {
712
+ _this.keydown_checker(evt);
713
+ });
714
+ this.search_field.bind('focus.chosen', function(evt) {
715
+ _this.input_focus(evt);
716
+ });
717
+ this.search_field.bind('cut.chosen', function(evt) {
718
+ _this.clipboard_event_checker(evt);
719
+ });
720
+ this.search_field.bind('paste.chosen', function(evt) {
721
+ _this.clipboard_event_checker(evt);
722
+ });
723
+ if (this.is_multiple) {
724
+ return this.search_choices.bind('click.chosen', function(evt) {
725
+ _this.choices_click(evt);
726
+ });
727
+ } else {
728
+ return this.container.bind('click.chosen', function(evt) {
729
+ evt.preventDefault();
730
+ });
731
+ }
732
+ };
733
+
734
+ Chosen.prototype.destroy = function() {
735
+ $(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
736
+ if (this.search_field[0].tabIndex) {
737
+ this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex;
738
+ }
739
+ this.container.remove();
740
+ this.form_field_jq.removeData('chosen');
741
+ return this.form_field_jq.show();
742
+ };
743
+
744
+ Chosen.prototype.search_field_disabled = function() {
745
+ this.is_disabled = this.form_field_jq[0].disabled;
746
+ if (this.is_disabled) {
747
+ this.container.addClass('chosen-disabled');
748
+ this.search_field[0].disabled = true;
749
+ if (!this.is_multiple) {
750
+ this.selected_item.unbind("focus.chosen", this.activate_action);
751
+ }
752
+ return this.close_field();
753
+ } else {
754
+ this.container.removeClass('chosen-disabled');
755
+ this.search_field[0].disabled = false;
756
+ if (!this.is_multiple) {
757
+ return this.selected_item.bind("focus.chosen", this.activate_action);
758
+ }
759
+ }
760
+ };
761
+
762
+ Chosen.prototype.container_mousedown = function(evt) {
763
+ if (!this.is_disabled) {
764
+ if (evt && evt.type === "mousedown" && !this.results_showing) {
765
+ evt.preventDefault();
766
+ }
767
+ if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
768
+ if (!this.active_field) {
769
+ if (this.is_multiple) {
770
+ this.search_field.val("");
771
+ }
772
+ $(this.container[0].ownerDocument).bind('click.chosen', this.click_test_action);
773
+ this.results_show();
774
+ } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
775
+ evt.preventDefault();
776
+ this.results_toggle();
777
+ }
778
+ return this.activate_field();
779
+ }
780
+ }
781
+ };
782
+
783
+ Chosen.prototype.container_mouseup = function(evt) {
784
+ if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
785
+ return this.results_reset(evt);
786
+ }
787
+ };
788
+
789
+ Chosen.prototype.search_results_mousewheel = function(evt) {
790
+ var delta;
791
+ if (evt.originalEvent) {
792
+ delta = evt.originalEvent.deltaY || -evt.originalEvent.wheelDelta || evt.originalEvent.detail;
793
+ }
794
+ if (delta != null) {
795
+ evt.preventDefault();
796
+ if (evt.type === 'DOMMouseScroll') {
797
+ delta = delta * 40;
798
+ }
799
+ return this.search_results.scrollTop(delta + this.search_results.scrollTop());
800
+ }
801
+ };
802
+
803
+ Chosen.prototype.blur_test = function(evt) {
804
+ if (!this.active_field && this.container.hasClass("chosen-container-active")) {
805
+ return this.close_field();
806
+ }
807
+ };
808
+
809
+ Chosen.prototype.close_field = function() {
810
+ $(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
811
+ this.active_field = false;
812
+ this.results_hide();
813
+ this.container.removeClass("chosen-container-active");
814
+ this.clear_backstroke();
815
+ this.show_search_field_default();
816
+ return this.search_field_scale();
817
+ };
818
+
819
+ Chosen.prototype.activate_field = function() {
820
+ this.container.addClass("chosen-container-active");
821
+ this.active_field = true;
822
+ this.search_field.val(this.search_field.val());
823
+ return this.search_field.focus();
824
+ };
825
+
826
+ Chosen.prototype.test_active_click = function(evt) {
827
+ var active_container;
828
+ active_container = $(evt.target).closest('.chosen-container');
829
+ if (active_container.length && this.container[0] === active_container[0]) {
830
+ return this.active_field = true;
831
+ } else {
832
+ return this.close_field();
833
+ }
834
+ };
835
+
836
+ Chosen.prototype.results_build = function() {
837
+ this.parsing = true;
838
+ this.selected_option_count = null;
839
+ this.results_data = SelectParser.select_to_array(this.form_field);
840
+ if (this.is_multiple) {
841
+ this.search_choices.find("li.search-choice").remove();
842
+ } else if (!this.is_multiple) {
843
+ this.single_set_selected_text();
844
+ if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
845
+ this.search_field[0].readOnly = true;
846
+ this.container.addClass("chosen-container-single-nosearch");
847
+ } else {
848
+ this.search_field[0].readOnly = false;
849
+ this.container.removeClass("chosen-container-single-nosearch");
850
+ }
851
+ }
852
+ this.update_results_content(this.results_option_build({
853
+ first: true
854
+ }));
855
+ this.search_field_disabled();
856
+ this.show_search_field_default();
857
+ this.search_field_scale();
858
+ return this.parsing = false;
859
+ };
860
+
861
+ Chosen.prototype.result_do_highlight = function(el) {
862
+ var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
863
+ if (el.length) {
864
+ this.result_clear_highlight();
865
+ this.result_highlight = el;
866
+ this.result_highlight.addClass("highlighted");
867
+ maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
868
+ visible_top = this.search_results.scrollTop();
869
+ visible_bottom = maxHeight + visible_top;
870
+ high_top = this.result_highlight.position().top + this.search_results.scrollTop();
871
+ high_bottom = high_top + this.result_highlight.outerHeight();
872
+ if (high_bottom >= visible_bottom) {
873
+ return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
874
+ } else if (high_top < visible_top) {
875
+ return this.search_results.scrollTop(high_top);
876
+ }
877
+ }
878
+ };
879
+
880
+ Chosen.prototype.result_clear_highlight = function() {
881
+ if (this.result_highlight) {
882
+ this.result_highlight.removeClass("highlighted");
883
+ }
884
+ return this.result_highlight = null;
885
+ };
886
+
887
+ Chosen.prototype.results_show = function() {
888
+ if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
889
+ this.form_field_jq.trigger("chosen:maxselected", {
890
+ chosen: this
891
+ });
892
+ return false;
893
+ }
894
+ this.container.addClass("chosen-with-drop");
895
+ this.results_showing = true;
896
+ this.search_field.focus();
897
+ this.search_field.val(this.search_field.val());
898
+ this.winnow_results();
899
+ return this.form_field_jq.trigger("chosen:showing_dropdown", {
900
+ chosen: this
901
+ });
902
+ };
903
+
904
+ Chosen.prototype.update_results_content = function(content) {
905
+ return this.search_results.html(content);
906
+ };
907
+
908
+ Chosen.prototype.results_hide = function() {
909
+ if (this.results_showing) {
910
+ this.result_clear_highlight();
911
+ this.container.removeClass("chosen-with-drop");
912
+ this.form_field_jq.trigger("chosen:hiding_dropdown", {
913
+ chosen: this
914
+ });
915
+ }
916
+ return this.results_showing = false;
917
+ };
918
+
919
+ Chosen.prototype.set_tab_index = function(el) {
920
+ var ti;
921
+ if (this.form_field.tabIndex) {
922
+ ti = this.form_field.tabIndex;
923
+ this.form_field.tabIndex = -1;
924
+ return this.search_field[0].tabIndex = ti;
925
+ }
926
+ };
927
+
928
+ Chosen.prototype.set_label_behavior = function() {
929
+ var _this = this;
930
+ this.form_field_label = this.form_field_jq.parents("label");
931
+ if (!this.form_field_label.length && this.form_field.id.length) {
932
+ this.form_field_label = $("label[for='" + this.form_field.id + "']");
933
+ }
934
+ if (this.form_field_label.length > 0) {
935
+ return this.form_field_label.bind('click.chosen', function(evt) {
936
+ if (_this.is_multiple) {
937
+ return _this.container_mousedown(evt);
938
+ } else {
939
+ return _this.activate_field();
940
+ }
941
+ });
942
+ }
943
+ };
944
+
945
+ Chosen.prototype.show_search_field_default = function() {
946
+ if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {
947
+ this.search_field.val(this.default_text);
948
+ return this.search_field.addClass("default");
949
+ } else {
950
+ this.search_field.val("");
951
+ return this.search_field.removeClass("default");
952
+ }
953
+ };
954
+
955
+ Chosen.prototype.search_results_mouseup = function(evt) {
956
+ var target;
957
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
958
+ if (target.length) {
959
+ this.result_highlight = target;
960
+ this.result_select(evt);
961
+ return this.search_field.focus();
962
+ }
963
+ };
964
+
965
+ Chosen.prototype.search_results_mouseover = function(evt) {
966
+ var target;
967
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
968
+ if (target) {
969
+ return this.result_do_highlight(target);
970
+ }
971
+ };
972
+
973
+ Chosen.prototype.search_results_mouseout = function(evt) {
974
+ if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
975
+ return this.result_clear_highlight();
976
+ }
977
+ };
978
+
979
+ Chosen.prototype.choice_build = function(item) {
980
+ var choice, close_link,
981
+ _this = this;
982
+ choice = $('<li />', {
983
+ "class": "search-choice"
984
+ }).html("<span>" + (this.choice_label(item)) + "</span>");
985
+ if (item.disabled) {
986
+ choice.addClass('search-choice-disabled');
987
+ } else {
988
+ close_link = $('<a />', {
989
+ "class": 'search-choice-close',
990
+ 'data-option-array-index': item.array_index
991
+ });
992
+ close_link.bind('click.chosen', function(evt) {
993
+ return _this.choice_destroy_link_click(evt);
994
+ });
995
+ choice.append(close_link);
996
+ }
997
+ return this.search_container.before(choice);
998
+ };
999
+
1000
+ Chosen.prototype.choice_destroy_link_click = function(evt) {
1001
+ evt.preventDefault();
1002
+ evt.stopPropagation();
1003
+ if (!this.is_disabled) {
1004
+ return this.choice_destroy($(evt.target));
1005
+ }
1006
+ };
1007
+
1008
+ Chosen.prototype.choice_destroy = function(link) {
1009
+ if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) {
1010
+ this.show_search_field_default();
1011
+ if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) {
1012
+ this.results_hide();
1013
+ }
1014
+ link.parents('li').first().remove();
1015
+ return this.search_field_scale();
1016
+ }
1017
+ };
1018
+
1019
+ Chosen.prototype.results_reset = function() {
1020
+ this.reset_single_select_options();
1021
+ this.form_field.options[0].selected = true;
1022
+ this.single_set_selected_text();
1023
+ this.show_search_field_default();
1024
+ this.results_reset_cleanup();
1025
+ this.form_field_jq.trigger("change");
1026
+ if (this.active_field) {
1027
+ return this.results_hide();
1028
+ }
1029
+ };
1030
+
1031
+ Chosen.prototype.results_reset_cleanup = function() {
1032
+ this.current_selectedIndex = this.form_field.selectedIndex;
1033
+ return this.selected_item.find("abbr").remove();
1034
+ };
1035
+
1036
+ Chosen.prototype.result_select = function(evt) {
1037
+ var high, item;
1038
+ if (this.result_highlight) {
1039
+ high = this.result_highlight;
1040
+ this.result_clear_highlight();
1041
+ if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
1042
+ this.form_field_jq.trigger("chosen:maxselected", {
1043
+ chosen: this
1044
+ });
1045
+ return false;
1046
+ }
1047
+ if (this.is_multiple) {
1048
+ high.removeClass("active-result");
1049
+ } else {
1050
+ this.reset_single_select_options();
1051
+ }
1052
+ high.addClass("result-selected");
1053
+ item = this.results_data[high[0].getAttribute("data-option-array-index")];
1054
+ item.selected = true;
1055
+ this.form_field.options[item.options_index].selected = true;
1056
+ this.selected_option_count = null;
1057
+ if (this.is_multiple) {
1058
+ this.choice_build(item);
1059
+ } else {
1060
+ this.single_set_selected_text(this.choice_label(item));
1061
+ }
1062
+ if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
1063
+ this.results_hide();
1064
+ }
1065
+ this.show_search_field_default();
1066
+ if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
1067
+ this.form_field_jq.trigger("change", {
1068
+ 'selected': this.form_field.options[item.options_index].value
1069
+ });
1070
+ }
1071
+ this.current_selectedIndex = this.form_field.selectedIndex;
1072
+ evt.preventDefault();
1073
+ return this.search_field_scale();
1074
+ }
1075
+ };
1076
+
1077
+ Chosen.prototype.single_set_selected_text = function(text) {
1078
+ if (text == null) {
1079
+ text = this.default_text;
1080
+ }
1081
+ if (text === this.default_text) {
1082
+ this.selected_item.addClass("chosen-default");
1083
+ } else {
1084
+ this.single_deselect_control_build();
1085
+ this.selected_item.removeClass("chosen-default");
1086
+ }
1087
+ return this.selected_item.find("span").html(text);
1088
+ };
1089
+
1090
+ Chosen.prototype.result_deselect = function(pos) {
1091
+ var result_data;
1092
+ result_data = this.results_data[pos];
1093
+ if (!this.form_field.options[result_data.options_index].disabled) {
1094
+ result_data.selected = false;
1095
+ this.form_field.options[result_data.options_index].selected = false;
1096
+ this.selected_option_count = null;
1097
+ this.result_clear_highlight();
1098
+ if (this.results_showing) {
1099
+ this.winnow_results();
1100
+ }
1101
+ this.form_field_jq.trigger("change", {
1102
+ deselected: this.form_field.options[result_data.options_index].value
1103
+ });
1104
+ this.search_field_scale();
1105
+ return true;
1106
+ } else {
1107
+ return false;
1108
+ }
1109
+ };
1110
+
1111
+ Chosen.prototype.single_deselect_control_build = function() {
1112
+ if (!this.allow_single_deselect) {
1113
+ return;
1114
+ }
1115
+ if (!this.selected_item.find("abbr").length) {
1116
+ this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
1117
+ }
1118
+ return this.selected_item.addClass("chosen-single-with-deselect");
1119
+ };
1120
+
1121
+ Chosen.prototype.get_search_text = function() {
1122
+ return $('<div/>').text($.trim(this.search_field.val())).html();
1123
+ };
1124
+
1125
+ Chosen.prototype.winnow_results_set_highlight = function() {
1126
+ var do_high, selected_results;
1127
+ selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
1128
+ do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
1129
+ if (do_high != null) {
1130
+ return this.result_do_highlight(do_high);
1131
+ }
1132
+ };
1133
+
1134
+ Chosen.prototype.no_results = function(terms) {
1135
+ var no_results_html;
1136
+ no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
1137
+ no_results_html.find("span").first().html(terms);
1138
+ this.search_results.append(no_results_html);
1139
+ return this.form_field_jq.trigger("chosen:no_results", {
1140
+ chosen: this
1141
+ });
1142
+ };
1143
+
1144
+ Chosen.prototype.no_results_clear = function() {
1145
+ return this.search_results.find(".no-results").remove();
1146
+ };
1147
+
1148
+ Chosen.prototype.keydown_arrow = function() {
1149
+ var next_sib;
1150
+ if (this.results_showing && this.result_highlight) {
1151
+ next_sib = this.result_highlight.nextAll("li.active-result").first();
1152
+ if (next_sib) {
1153
+ return this.result_do_highlight(next_sib);
1154
+ }
1155
+ } else {
1156
+ return this.results_show();
1157
+ }
1158
+ };
1159
+
1160
+ Chosen.prototype.keyup_arrow = function() {
1161
+ var prev_sibs;
1162
+ if (!this.results_showing && !this.is_multiple) {
1163
+ return this.results_show();
1164
+ } else if (this.result_highlight) {
1165
+ prev_sibs = this.result_highlight.prevAll("li.active-result");
1166
+ if (prev_sibs.length) {
1167
+ return this.result_do_highlight(prev_sibs.first());
1168
+ } else {
1169
+ if (this.choices_count() > 0) {
1170
+ this.results_hide();
1171
+ }
1172
+ return this.result_clear_highlight();
1173
+ }
1174
+ }
1175
+ };
1176
+
1177
+ Chosen.prototype.keydown_backstroke = function() {
1178
+ var next_available_destroy;
1179
+ if (this.pending_backstroke) {
1180
+ this.choice_destroy(this.pending_backstroke.find("a").first());
1181
+ return this.clear_backstroke();
1182
+ } else {
1183
+ next_available_destroy = this.search_container.siblings("li.search-choice").last();
1184
+ if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) {
1185
+ this.pending_backstroke = next_available_destroy;
1186
+ if (this.single_backstroke_delete) {
1187
+ return this.keydown_backstroke();
1188
+ } else {
1189
+ return this.pending_backstroke.addClass("search-choice-focus");
1190
+ }
1191
+ }
1192
+ }
1193
+ };
1194
+
1195
+ Chosen.prototype.clear_backstroke = function() {
1196
+ if (this.pending_backstroke) {
1197
+ this.pending_backstroke.removeClass("search-choice-focus");
1198
+ }
1199
+ return this.pending_backstroke = null;
1200
+ };
1201
+
1202
+ Chosen.prototype.keydown_checker = function(evt) {
1203
+ var stroke, _ref1;
1204
+ stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
1205
+ this.search_field_scale();
1206
+ if (stroke !== 8 && this.pending_backstroke) {
1207
+ this.clear_backstroke();
1208
+ }
1209
+ switch (stroke) {
1210
+ case 8:
1211
+ this.backstroke_length = this.search_field.val().length;
1212
+ break;
1213
+ case 9:
1214
+ if (this.results_showing && !this.is_multiple) {
1215
+ this.result_select(evt);
1216
+ }
1217
+ this.mouse_on_container = false;
1218
+ break;
1219
+ case 13:
1220
+ if (this.results_showing) {
1221
+ evt.preventDefault();
1222
+ }
1223
+ break;
1224
+ case 32:
1225
+ if (this.disable_search) {
1226
+ evt.preventDefault();
1227
+ }
1228
+ break;
1229
+ case 38:
1230
+ evt.preventDefault();
1231
+ this.keyup_arrow();
1232
+ break;
1233
+ case 40:
1234
+ evt.preventDefault();
1235
+ this.keydown_arrow();
1236
+ break;
1237
+ }
1238
+ };
1239
+
1240
+ Chosen.prototype.search_field_scale = function() {
1241
+ var div, f_width, h, style, style_block, styles, w, _i, _len;
1242
+ if (this.is_multiple) {
1243
+ h = 0;
1244
+ w = 0;
1245
+ style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
1246
+ styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
1247
+ for (_i = 0, _len = styles.length; _i < _len; _i++) {
1248
+ style = styles[_i];
1249
+ style_block += style + ":" + this.search_field.css(style) + ";";
1250
+ }
1251
+ div = $('<div />', {
1252
+ 'style': style_block
1253
+ });
1254
+ div.text(this.search_field.val());
1255
+ $('body').append(div);
1256
+ w = div.width() + 25;
1257
+ div.remove();
1258
+ f_width = this.container.outerWidth();
1259
+ if (w > f_width - 10) {
1260
+ w = f_width - 10;
1261
+ }
1262
+ return this.search_field.css({
1263
+ 'width': w + 'px'
1264
+ });
1265
+ }
1266
+ };
1267
+
1268
+ return Chosen;
1269
+
1270
+ })(AbstractChosen);
1271
+
1272
+ }).call(this);