admin_help 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Gemfile.lock +53 -3
  4. data/README.md +9 -6
  5. data/admin_help.gemspec +2 -0
  6. data/app/assets/fonts/iconfont.eot +0 -0
  7. data/app/assets/fonts/iconfont.svg +68 -0
  8. data/app/assets/fonts/iconfont.ttf +0 -0
  9. data/app/assets/fonts/iconfont.woff +0 -0
  10. data/app/assets/fonts/iconfont.woff2 +0 -0
  11. data/app/assets/javascripts/admin_help.js +2 -3
  12. data/app/assets/javascripts/aiui.js +31 -0
  13. data/app/assets/javascripts/chosen.jquery.js +1359 -0
  14. data/app/assets/stylesheets/admin_help.scss +2 -0
  15. data/app/assets/stylesheets/aiui.scss +82 -0
  16. data/app/assets/stylesheets/alert.scss +34 -0
  17. data/app/assets/stylesheets/aside.scss +85 -0
  18. data/app/assets/stylesheets/button.scss +122 -0
  19. data/app/assets/stylesheets/chosen.css.erb +495 -0
  20. data/app/assets/stylesheets/form.scss +151 -0
  21. data/app/assets/stylesheets/icon.scss.erb +72 -0
  22. data/app/assets/stylesheets/input.scss +52 -0
  23. data/app/assets/stylesheets/nav.scss +28 -0
  24. data/app/assets/stylesheets/pagination.scss +49 -0
  25. data/app/assets/stylesheets/table.scss +73 -0
  26. data/app/assets/stylesheets/tooltip.scss +38 -0
  27. data/app/controllers/admin_help_controller.rb +2 -0
  28. data/app/controllers/frontend_controller.rb +8 -0
  29. data/app/views/frontend/buttons.html.erb +78 -0
  30. data/app/views/frontend/index.html.erb +0 -0
  31. data/app/views/frontend/nav.html.erb +0 -0
  32. data/app/views/frontend/paginate.html.erb +32 -0
  33. data/app/views/frontend/table.html.erb +34 -0
  34. data/{lib/generators/admin_help/templates/layouts → app/views/layouts/frontend}/flash.html.erb +0 -0
  35. data/app/views/layouts/frontend/frontend.html.erb +30 -0
  36. data/app/views/layouts/frontend/header.html.erb +3 -0
  37. data/app/views/layouts/frontend/left_nav.html.erb +29 -0
  38. data/config/routes.rb +24 -0
  39. data/lib/admin_help/engine.rb +4 -0
  40. data/lib/admin_help/version.rb +1 -1
  41. data/lib/generators/admin/scaffold_controller/templates/views/erb/_form.html.erb.erb +9 -34
  42. data/lib/generators/admin/scaffold_controller/templates/views/erb/edit.html.erb.erb +2 -5
  43. data/lib/generators/admin/scaffold_controller/templates/views/erb/index.html.erb.erb +23 -30
  44. data/lib/generators/admin/scaffold_controller/templates/views/erb/new.html.erb.erb +2 -5
  45. data/lib/generators/admin/scaffold_controller/templates/views/erb/show.html.erb.erb +20 -21
  46. data/lib/generators/admin_help/install_generator.rb +12 -4
  47. data/lib/generators/admin_help/templates/app/controllers/admin/home_controller.rb +4 -0
  48. data/lib/generators/admin_help/templates/app/views/admin/home/index.html.erb +1 -0
  49. data/lib/generators/admin_help/templates/app/views/admin/kaminari/_first_page.html.erb +15 -0
  50. data/lib/generators/admin_help/templates/app/views/admin/kaminari/_gap.html.erb +9 -0
  51. data/lib/generators/admin_help/templates/app/views/admin/kaminari/_last_page.html.erb +15 -0
  52. data/lib/generators/admin_help/templates/app/views/admin/kaminari/_next_page.html.erb +12 -0
  53. data/lib/generators/admin_help/templates/app/views/admin/kaminari/_page.html.erb +12 -0
  54. data/lib/generators/admin_help/templates/app/views/admin/kaminari/_paginator.html.erb +32 -0
  55. data/lib/generators/admin_help/templates/app/views/admin/kaminari/_prev_page.html.erb +12 -0
  56. data/lib/generators/admin_help/templates/{layouts/application.html.erb → app/views/layouts/admin_help.html.erb} +7 -3
  57. data/lib/generators/admin_help/templates/app/views/layouts/flash.html.erb +6 -0
  58. data/lib/generators/admin_help/templates/app/views/layouts/header.html.erb +3 -0
  59. data/lib/generators/admin_help/templates/app/views/layouts/left_nav.html.erb +36 -0
  60. data/lib/generators/admin_help/templates/config/initializers/locale.rb +4 -0
  61. data/lib/generators/admin_help/templates/config/locales/models/en.models.yml +7 -0
  62. data/lib/generators/admin_help/templates/config/locales/models/zh-cn.models.yml +7 -0
  63. data/lib/generators/admin_help/templates/config/locales/views/en.common.yml +28 -0
  64. data/lib/generators/admin_help/templates/config/locales/views/zh-cn.common.yml +235 -0
  65. data/lib/generators/admin_help/templates/config/routes.rb +4 -0
  66. metadata +68 -16
  67. data/app/assets/fonts/FontAwesome.otf +0 -0
  68. data/app/assets/fonts/fontawesome-webfont.eot +0 -0
  69. data/app/assets/fonts/fontawesome-webfont.svg +0 -2671
  70. data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
  71. data/app/assets/fonts/fontawesome-webfont.woff +0 -0
  72. data/app/assets/fonts/fontawesome-webfont.woff2 +0 -0
  73. data/app/assets/stylesheets/admin_help.css +0 -4
  74. data/app/assets/stylesheets/aiui.scss.erb +0 -387
  75. data/app/assets/stylesheets/font-awesome.css.erb +0 -2342
  76. data/lib/generators/admin_help/templates/layouts/header.html.erb +0 -41
  77. data/lib/generators/admin_help/templates/layouts/left_nav.html.erb +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d934993799c823ad2ad09e7c0c716e1272ec9bb0497ea35020bf9011155908e4
4
- data.tar.gz: '033058faf939800740167789a819822d4501211c05505349d176960e6cd0e107'
3
+ metadata.gz: 21871c9183d48aed6ee5c017f7dd3f30d9886c507ebd144f1cd6fe78cc0e00a7
4
+ data.tar.gz: cc8ed8d378875f2c46bbc186b72aef70a329176c540539d3aee5cb477f0ec7d2
5
5
  SHA512:
6
- metadata.gz: e9c14fb58ea501aee3555940dc441f728458db9b6c2e2bc92d1e63b009476b5d5197d551ba47f79284b64a535b6d24f20d788ed03c44ef8bc5d78bb9c485108b
7
- data.tar.gz: 91c58ed3cae5b247d300d74aeb43dce26666c290a1f519bfc2ddd8d80c512eebbff883c6c994d57d5082e3dd50600ba51235a41ef472f2664c31a504eeda9ec0
6
+ metadata.gz: 962233a6dedd5f303ec491c61e049a51ddb3023d3e3edfdadea00d8f9dce4caa19ded28c3ee1c2ca0435e4c32227926b19056bb606cc4b98a3073f9e8d1648b3
7
+ data.tar.gz: 225a037c23ddfeaca1e2bb72dc2aad61307100cceca9f88bfd9ea7566b77eacad2191648433e15cbbe318ac2f2e5e75b179d3f323696b91cb5cddef5fde05abb
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "https://rubygems.org"
1
+ source "https://gems.ruby-china.com"
2
2
 
3
3
  # Specify your gem's dependencies in admin_help.gemspec
4
4
  gemspec
@@ -1,12 +1,62 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- admin_help (0.1.4)
4
+ admin_help (0.1.5)
5
+ simple_form
5
6
 
6
7
  GEM
7
- remote: https://rubygems.org/
8
+ remote: https://gems.ruby-china.com/
8
9
  specs:
10
+ actionpack (6.0.2.1)
11
+ actionview (= 6.0.2.1)
12
+ activesupport (= 6.0.2.1)
13
+ rack (~> 2.0, >= 2.0.8)
14
+ rack-test (>= 0.6.3)
15
+ rails-dom-testing (~> 2.0)
16
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
17
+ actionview (6.0.2.1)
18
+ activesupport (= 6.0.2.1)
19
+ builder (~> 3.1)
20
+ erubi (~> 1.4)
21
+ rails-dom-testing (~> 2.0)
22
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
23
+ activemodel (6.0.2.1)
24
+ activesupport (= 6.0.2.1)
25
+ activesupport (6.0.2.1)
26
+ concurrent-ruby (~> 1.0, >= 1.0.2)
27
+ i18n (>= 0.7, < 2)
28
+ minitest (~> 5.1)
29
+ tzinfo (~> 1.1)
30
+ zeitwerk (~> 2.2)
31
+ builder (3.2.4)
32
+ concurrent-ruby (1.1.6)
33
+ crass (1.0.6)
34
+ erubi (1.9.0)
35
+ i18n (1.8.2)
36
+ concurrent-ruby (~> 1.0)
37
+ loofah (2.4.0)
38
+ crass (~> 1.0.2)
39
+ nokogiri (>= 1.5.9)
40
+ mini_portile2 (2.4.0)
41
+ minitest (5.14.0)
42
+ nokogiri (1.10.8)
43
+ mini_portile2 (~> 2.4.0)
44
+ rack (2.2.2)
45
+ rack-test (1.1.0)
46
+ rack (>= 1.0, < 3)
47
+ rails-dom-testing (2.0.3)
48
+ activesupport (>= 4.2.0)
49
+ nokogiri (>= 1.6)
50
+ rails-html-sanitizer (1.3.0)
51
+ loofah (~> 2.3)
9
52
  rake (10.1.0)
53
+ simple_form (5.0.2)
54
+ actionpack (>= 5.0)
55
+ activemodel (>= 5.0)
56
+ thread_safe (0.3.6)
57
+ tzinfo (1.2.6)
58
+ thread_safe (~> 0.1)
59
+ zeitwerk (2.2.2)
10
60
 
11
61
  PLATFORMS
12
62
  ruby
@@ -17,4 +67,4 @@ DEPENDENCIES
17
67
  rake (~> 10.0)
18
68
 
19
69
  BUNDLED WITH
20
- 2.0.2
70
+ 2.1.4
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # AdminHelp
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/admin_help`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ It is a lightweight friendly ui framework
6
4
 
7
5
  ## Installation
8
6
 
@@ -22,12 +20,17 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- In your application.css, include the css file:
23
+ In your application.css, include the scss file:
26
24
 
27
25
  ```
28
26
  /*
29
- *= require admin_help
30
- */
27
+ *= require admin_help.scss
28
+ */
29
+ ```
30
+ Or in your application.scss, include the scss file:
31
+
32
+ ```
33
+ @import "admin_help"
31
34
  ```
32
35
 
33
36
  ## Development
@@ -28,6 +28,8 @@ Gem::Specification.new do |spec|
28
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ["lib"]
30
30
 
31
+ spec.add_dependency "simple_form"
32
+
31
33
  spec.add_development_dependency "bundler", "~> 2.0"
32
34
  spec.add_development_dependency "rake", "~> 10.0"
33
35
  end
@@ -0,0 +1,68 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3
+ <!--
4
+ 2013-9-30: Created.
5
+ -->
6
+ <svg>
7
+ <metadata>
8
+ Created by iconfont
9
+ </metadata>
10
+ <defs>
11
+
12
+ <font id="iconfont" horiz-adv-x="1024" >
13
+ <font-face
14
+ font-family="iconfont"
15
+ font-weight="500"
16
+ font-stretch="normal"
17
+ units-per-em="1024"
18
+ ascent="896"
19
+ descent="-128"
20
+ />
21
+ <missing-glyph />
22
+
23
+ <glyph glyph-name="apple" unicode="&#61117;" d="M383.853411-108.039389c-66.287729 0-128.272455 51.699476-189.496865 158.054759l-0.089027 0.155542c-28.493961 50.523697-50.203402 100.8325-64.523549 149.531642-14.611789 49.689702-22.020526 99.346659-22.020526 147.592476 0 90.942245 23.13286 166.95343 68.756966 225.922473 46.715975 59.836807 106.670461 90.140996 178.2538 90.140996 29.623691 0 64.516386-5.864568 106.673532-17.928325 14.694677-4.25593 26.590612-7.426133 36.208666-9.779737 1.874697 58.716286 18.030655 110.375853 48.049343 153.609517 31.197536 44.886303 83.298148 76.074629 154.86102 92.706425l20.184715 4.690835 4.440125-20.240996c0.405229-1.847068 0.817622-3.540639 1.197268-5.107321 0.717338-2.954285 1.394766-5.744841 1.854231-8.636705l0.251734-1.591241v-1.611707c0-1.193175 0.106424-2.536776 0.228197-4.093225 0.166799-2.111081 0.355087-4.503571 0.355087-7.30436 0-25.764803-6.036483-54.374398-17.943674-85.032651l-0.071631-0.182149c-12.361539-30.948873-31.746028-59.756989-57.614186-85.625146a259.275091 259.275091 0 0 0-10.313903-9.773598c26.934442 7.03216 50.611701 10.476609 71.758324 10.476609 49.365314 0 94.161566-13.69593 133.151579-40.711214 21.166065-14.513552 42.583864-35.052331 63.657832-61.045331l12.632715-15.581883-15.326057-12.942777c-28.836769-24.353664-48.910966-45.047985-61.372789-63.265906l-0.079818-0.115633c-22.196535-31.980365-33.45188-67.787896-33.45188-106.427938 0-42.668799 12.018731-81.560574 35.722596-115.593692 23.382547-33.535791 50.073442-55.073316 79.325673-64.005756l19.772323-6.036483-6.237051-19.710924c-15.490809-48.958038-39.920198-98.68151-72.614832-147.794068-25.642007-39.040155-51.963489-68.968791-78.236875-88.962147-27.971052-21.284769-56.741305-32.076556-85.512582-32.076556-21.243837 0-48.781006 6.166443-86.662779 19.408025l-0.404206 0.146333c-29.740348 11.101849-57.05546 16.969487-78.993099 16.969486-20.411889 0-45.056172-5.821589-73.247234-17.305131-33.770128-14.07967-60.959374-20.922519-83.123163-20.922518zM229.874481 70.360743c27.103288-47.069015 54.232159-82.517365 80.630389-105.355513 24.976858-21.608134 48.969295-32.112372 73.347518-32.112371 11.301394 0 32.177863 3.089361 67.454298 17.806551l0.155543 0.064468c33.144888 13.508665 63.007009 20.358677 88.757486 20.358677 27.103288 0 58.426691-6.553253 93.103468-19.47761 32.847106-11.470239 56.71163-17.045211 72.956615-17.045212 41.258683 0 84.85255 34.527374 129.568985 102.625332l0.071631 0.107448c26.499537 39.800471 47.136553 79.846536 61.503772 119.309316-30.261211 13.992689-57.513902 38.202067-81.223906 72.207555-28.582989 41.038672-43.071981 87.800695-43.071981 138.995681 0 47.122227 13.70207 90.766236 40.724517 129.718387 12.065803 17.623379 29.553083 36.663014 53.18327 57.867965-14.264888 15.836687-28.41312 28.595268-42.206265 38.049595l-0.091074 0.062422c-32.022321 22.201651-68.994374 33.459043-109.889783 33.459042-24.64019 0-55.629995-6.16849-92.118024-18.334577-39.098483-13.586436-68.777433-20.476357-88.210017-20.476357-9.711176 0-29.030174 1.856277-84.440158 17.904789-38.379099 10.982122-69.588915 16.32992-95.348601 16.32992-59.152215 0-106.887402-24.312732-145.934721-74.326822-40.452317-52.284807-60.143799-117.992321-60.143798-200.804399 0.002047-89.417519 26.572192-180.009793 81.220836-276.934287zM688.091554 836.365808c-50.119491-14.950504-86.665849-38.598086-108.809171-70.457702-22.10853-31.842219-35.355229-69.447698-39.50269-112.044865 15.338337 2.087545 25.218358 4.405333 31.327496 6.242168 17.315364 5.845125 35.264155 17.97949 53.354162 36.07052 21.895683 21.895683 38.217417 46.045709 48.510854 71.777766 9.764388 25.166169 14.848173 48.171116 15.119349 68.412113z" horiz-adv-x="1024" />
24
+
25
+
26
+ <glyph glyph-name="archive" unicode="&#59134;" d="M621.714286 420.571429q0 14.857143-10.857143 25.714285t-25.714286 10.857143H438.857143q-14.857143 0-25.714286-10.857143t-10.857143-25.714285 10.857143-25.714286 25.714286-10.857143h146.285714q14.857143 0 25.714286 10.857143t10.857143 25.714286z m329.142857 109.714285v-548.571428q0-14.857143-10.857143-25.714286t-25.714286-10.857143H109.714286q-14.857143 0-25.714286 10.857143t-10.857143 25.714286V530.285714q0 14.857143 10.857143 25.714286t25.714286 10.857143h804.571428q14.857143 0 25.714286-10.857143t10.857143-25.714286z m36.571428 256v-146.285714q0-14.857143-10.857142-25.714286t-25.714286-10.857143H73.142857q-14.857143 0-25.714286 10.857143t-10.857142 25.714286V786.285714q0 14.857143 10.857142 25.714286t25.714286 10.857143h877.714286q14.857143 0 25.714286-10.857143t10.857142-25.714286z" horiz-adv-x="1024" />
27
+
28
+
29
+ <glyph glyph-name="gongzuotai" unicode="&#58892;" d="M934.4 825.6H89.6C38.4 825.6 0 787.2 0 742.4v-563.2c0-51.2 38.4-89.6 89.6-89.6h384v-76.8H224c-25.6 0-44.8-19.2-57.6-38.4s0-38.4 0-38.4h684.8s12.8 12.8 0 38.4c-12.8 19.2-32 32-57.6 38.4H550.4v76.8h384c51.2 0 89.6 38.4 89.6 89.6V742.4c0 44.8-38.4 83.2-89.6 83.2z m-25.6-595.2H115.2c-25.6 0-51.2 25.6-51.2 57.6V716.8c0 25.6 25.6 51.2 51.2 51.2h793.6c25.6 0 51.2-25.6 51.2-51.2v-428.8c0-32-25.6-57.6-51.2-57.6z" horiz-adv-x="1024" />
30
+
31
+
32
+ <glyph glyph-name="pencil-line" unicode="&#58881;" d="M0.001184 153.17418399999997l0-281.17416 281.176528 0 562.350688 562.350688L562.347137 715.5296069999999 0.001184 153.17418399999997zM245.352094-41.48157200000003L245.352094-41.48157200000003l-72.323572-0.00947 0 86.518404L86.51722 45.02736200000004l0 72.330674 61.506996 61.506996 158.834874-158.832506L245.352094-41.48157200000003zM583.994493 600.621538c9.900399 0 14.8577-4.959669 14.8577-14.86717 0-4.512233-1.571943-8.335558-4.7324-11.496015L227.776638 207.91756399999997c-3.155722-3.143886-6.988517-4.72293-11.49128-4.72293-9.905133 0-14.864802 4.966771-14.864802 14.864802 0 4.512233 1.576678 8.335558 4.727665 11.496015l366.345523 366.336054C575.639996 599.04486 579.472791 600.621538 583.994493 600.621538zM998.980282 712.163187l-158.830139 158.155435C823.029224 887.432438 802.525314 896 778.64078 896c-24.343806 0-44.606243-8.567562-60.825189-25.681378l-112.199782-111.525078 281.181263-281.17416 112.199782 112.195048c16.671116 16.673483 25.001939 36.950125 25.001939 60.834659C1023.989323 674.074351 1015.660867 694.582996 998.980282 712.163187z" horiz-adv-x="1024" />
33
+
34
+
35
+ <glyph glyph-name="shenglve" unicode="&#58938;" d="M773.9 384m90.1 0a90.1 90.1 0 1 1-180.2 0 90.1 90.1 0 1 1 180.2 0ZM512 384m90.09999999 0a90.1 90.1 0 1 1-180.19999998 0 90.1 90.1 0 1 1 180.19999998 0ZM250.1 384m90.1 0a90.1 90.1 0 1 1-180.2 0 90.1 90.1 0 1 1 180.2 0Z" horiz-adv-x="1024" />
36
+
37
+
38
+ <glyph glyph-name="home" unicode="&#58913;" d="M874.097778 431.957333a30.549333 30.549333 0 0 0 30.72-30.72v-396.060444c0-71.68-64.853333-133.176889-146.659556-133.176889H239.729778c-81.863111 0-146.659556 58.026667-146.659556 133.12V401.294222a30.606222 30.606222 0 0 0 52.451556 21.731556c5.745778-5.745778 8.988444-13.596444 8.931555-21.731556v-396.060444c0-40.96 37.546667-71.68 85.333334-71.68h518.371555c47.786667 0 85.276444 30.72 85.276445 71.68V401.237333a30.606222 30.606222 0 0 0 30.72 30.72z m143.928889 16.782223c10.24-13.653333 6.826667-34.133333-6.826667-44.373334-17.066667-6.826667-34.076444-3.413333-44.316444 10.24-3.413333 3.413333-6.826667 10.24-10.24 13.653334L578.104889 807.253333c-34.133333 34.133333-92.103111 34.133333-126.179556 0L69.916444 428.259556c-3.413333-6.826667-6.826667-10.24-10.24-13.653334-6.826667-6.826667-17.066667-13.653333-27.306666-13.653333s-20.48 6.826667-27.306667 17.066667a25.6 25.6 0 0 0 0 30.72c6.826667 10.24 13.653333 17.066667 20.48 23.893333L407.608889 851.626667C434.858667 878.933333 472.405333 896 513.308444 896c40.96 0 78.449778-17.066667 105.699556-44.373333l378.595556-378.993778c6.826667-6.826667 13.653333-17.066667 20.48-23.893333z" horiz-adv-x="1024" />
39
+
40
+
41
+ <glyph glyph-name="app" unicode="&#59055;" d="M432.032 818.944H55.712a12.128 12.128 0 0 1-12.064-12.064v-376.32c0-6.624 5.44-12.064 12.064-12.064h376.32c6.624 0 12.064 5.44 12.064 12.064V807.04a12 12 0 0 1-12.064 11.936z m-40.512-347.744H96.352V766.368h295.008v-295.168z m585.312 164.512l-211.936 211.936a22.592 22.592 0 0 1-31.968 0l-211.936-211.936a22.592 22.592 0 0 1 0-31.968l211.936-212.096a22.592 22.592 0 0 1 31.968 0l211.936 211.936a22.752 22.752 0 0 1 0 32.096zM432.032 313.44H55.712a12.128 12.128 0 0 1-12.064-12.064v-376.32c0-6.624 5.44-12.064 12.064-12.064h376.32c6.624 0 12.064 5.44 12.064 12.064V301.536a12 12 0 0 1-12.064 11.936z m-40.512-347.584H96.352v295.008h295.008v-295.008z m540.992 347.584h-376.32a12.128 12.128 0 0 1-12.064-12.064v-376.32c0-6.624 5.44-12.064 12.064-12.064h376.32c6.624 0 12.064 5.44 12.064 12.064V301.536a12 12 0 0 1-12.064 11.936z m-40.64-347.584h-295.008v295.008h295.008v-295.008z" horiz-adv-x="1024" />
42
+
43
+
44
+ <glyph glyph-name="fenye-shangyiye" unicode="&#58912;" d="M254.89 384l448 448 60.417-60.33-448-448L254.89 384z m60.843 60.757l453.291-453.376-60.33-60.33-453.377 453.376 60.416 60.33z" horiz-adv-x="1024" />
45
+
46
+
47
+ <glyph glyph-name="-times-bold" unicode="&#60850;" d="M983.072 679.232L688.768 383.136 983.072 88.8a31.456 31.456 0 0 0 0-44.544l-133.632-133.6a31.424 31.424 0 0 0-44.512 0L511.104 204.48 219.04-89.344a31.456 31.456 0 0 0-44.544 0l-133.6 133.6a31.52 31.52 0 0 0 0 44.544L332.96 382.624 40.928 674.656a31.52 31.52 0 0 0 0 44.544l133.6 133.6a31.456 31.456 0 0 0 44.544 0l291.52-291.52L804.96 857.376a31.424 31.424 0 0 0 44.512 0l133.632-133.6a31.552 31.552 0 0 0-0.032-44.544z" horiz-adv-x="1024" />
48
+
49
+
50
+ <glyph glyph-name="fenye-shangyiye1" unicode="&#58882;" d="M769.11 384l-448-448-60.417 60.33 448 448L769.11 384z m-60.843-60.757l-453.291 453.376 60.33 60.33 453.377-453.376-60.416-60.33z" horiz-adv-x="1024" />
51
+
52
+
53
+ <glyph glyph-name="Cube" unicode="&#59008;" d="M478.008889 889.986844a99.328 99.328 0 0 0 67.982222 0l416-155.989333a104.248889 104.248889 0 0 0 44.999111-36.010667c11.349333-15.985778 17.009778-33.991111 17.009778-53.987555v-449.991111c0-40.021333-18.005333-68.664889-53.987556-86.016l-416-207.985778c-28.017778-14.677333-56.689778-14.677333-86.016 0L51.996444 107.992178C17.351111 125.343289 0 153.986844 0 194.008178v449.991111c0 19.996444 5.688889 38.001778 17.009778 53.987555a104.248889 104.248889 0 0 0 44.999111 36.010667zM512 834.008178L64 665.986844 512 470.004622l448 195.982222zM64 596.013511v-422.001778l416-208.014222v448z m480-630.016L960 174.040178v422.001778l-416-182.016z" horiz-adv-x="1024" />
54
+
55
+
56
+ <glyph glyph-name="file" unicode="&#58991;" d="M576 624V896H176C149.4 896 128 874.6 128 848v-928c0-26.6 21.4-48 48-48h672c26.6 0 48 21.4 48 48V576H624c-26.4 0-48 21.6-48 48z m320 28.2v-12.2H640V896h12.2c12.8 0 25-5 34-14l195.8-196c9-9 14-21.2 14-33.8z" horiz-adv-x="1024" />
57
+
58
+
59
+ <glyph glyph-name="yonghu" unicode="&#58880;" d="M232.25157405 365.75995575c-52.61003536 42.73141381-86.26803042 108.19750875-86.26803042 181.58488336 0 128.74830381 103.59413065 233.12045195 231.38447612 233.12045195s231.3831816-104.37214815 231.38318158-233.12045195c0-73.38737461-33.65670053-138.85346955-86.2680304-181.58488336C662.15996682 308.13487912999994 760.55134815 169.81734843000004 760.55134815 8.345706189999987c0-15.57588448-0.91523856-30.93687562-2.69522868-46.02989732h-83.28541424a307.51756642 307.51756642 0 0 1 3.44864995 46.02989732c0 167.2918863-134.60608948 302.90901017-300.65133543 302.90901017-166.04524595 0-300.65133543-135.61712387-300.65133543-302.90901017 0-15.64837863 1.17802983-31.01972606 3.44864996-46.02989732h-83.28541425A392.93637973 392.93637973 0 0 0-5.81530864 8.345706189999987c0 161.47164223 98.39267587 299.78917294 238.06688269 357.41424956zM377.36801975 397.37516942c82.2083584 0 148.85248317 67.14252199 148.85248316 149.96837515 0 82.82585315-66.64283022 149.96966969-148.85248316 149.96966969-82.2083584 0-148.85248317-67.14381653-148.85248316-149.96966969 0-82.82455861 66.64283022-149.96837515 148.85248316-149.96837515zM646.31999653 804.7249382699999c127.70878957 0 231.2381933-104.39156622 231.2381933-233.16705534 0-73.40032-33.63598791-138.87936032-86.21365981-181.61983588 139.58617822-57.63672747 237.91671625-195.98273802 237.91671624-357.48544916 0-15.57847357-0.91394402-30.94205377-2.69263959-46.0389591h-83.23363272a307.82825561 307.82825561 0 0 1 3.44735542 46.0389591c0 167.3255443-134.5219445 302.96855893-300.46233284 302.96855893h0.98384907c-23.78714075 0-43.0692883 19.28214755-43.06928829 43.0692883 0 23.78584621 19.28214755 43.0692883 43.06928829 43.0692883h-0.98384907c82.15657687 0 148.75798187 67.15676192 148.75798187 149.99814951 0 82.84268215-66.60140499 149.99814953-148.75798187 149.99814955-5.74774992 0-12.46122541-0.6899889-20.1391319-2.07385031-20.01356169-3.60528909-39.16237179 9.69738619-42.76766088 29.71353694a36.82314114 36.82314114 0 0 0-0.38965602 2.76125014c-2.58519293 25.13993324 15.31438775 47.76975677 40.37535416 51.04364405 8.80674386 1.14954998 16.44710875 1.72432498 22.92109464 1.72432497z" horiz-adv-x="1024" />
60
+
61
+
62
+ <glyph glyph-name="user" unicode="&#58941;" d="M858.5 132.4c-18.9 44.8-46.1 85-80.6 119.5-34.5 34.5-74.7 61.6-119.5 80.6-0.4 0.2-0.8 0.3-1.2 0.5C719.5 378 760 451.3 760 534c0 137-111 248-248 248S264 671 264 534c0-82.7 40.5-156 102.8-201.1-0.4-0.2-0.8-0.3-1.2-0.5-44.8-18.9-85-46-119.5-80.6-34.5-34.5-61.6-74.7-80.6-119.5C146.9 88.5 137 42 136-5.8c-0.1-4.5 3.5-8.2 8-8.2h60c4.4 0 7.9 3.5 8 7.8 2 77.2 33 149.5 87.8 204.3 56.7 56.7 132 87.9 212.2 87.9s155.5-31.2 212.2-87.9C779 143.3 810 71 812-6.2c0.1-4.4 3.6-7.8 8-7.8h60c4.5 0 8.1 3.7 8 8.2-1 47.8-10.9 94.3-29.5 138.2zM512 362c-45.9 0-89.1 17.9-121.6 50.4S340 488.1 340 534c0 45.9 17.9 89.1 50.4 121.6S466.1 706 512 706s89.1-17.9 121.6-50.4S684 579.9 684 534c0-45.9-17.9-89.1-50.4-121.6S557.9 362 512 362z" horiz-adv-x="1024" />
63
+
64
+
65
+
66
+
67
+ </font>
68
+ </defs></svg>
@@ -1,4 +1,3 @@
1
- //= require rails-ujs
2
- //= require activestorage
3
- //= require turbolinks
4
1
  //= require jquery-3.4.1.min
2
+ //= require chosen.jquery
3
+ //= require aiui
@@ -0,0 +1,31 @@
1
+ function IsPC() {
2
+ var userAgentInfo = navigator.userAgent;
3
+ var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");
4
+ var flag = true;
5
+ for (var v = 0; v < Agents.length; v++) {
6
+ if (userAgentInfo.indexOf(Agents[v]) > 0) {
7
+ flag = false;
8
+ break;
9
+ }
10
+ }
11
+ return flag;
12
+ }
13
+ $("#nav_pin").click(function(){
14
+ if(IsPC()){
15
+ if(localStorage.getItem('left_nav_status') == "close") {
16
+ $("aside").fadeToggle(100);
17
+ localStorage.setItem('left_nav_status', 'open');
18
+ }else {
19
+ $("aside").fadeToggle(100);
20
+ localStorage.setItem('left_nav_status', 'close');
21
+ }
22
+ } else {
23
+ $("aside").fadeToggle(100);
24
+ }
25
+ });
26
+ if(!IsPC()){
27
+ $("aside").hide();
28
+ }
29
+ if(localStorage.getItem('left_nav_status') == "close") {
30
+ $("aside").hide();
31
+ }
@@ -0,0 +1,1359 @@
1
+ /*!
2
+ Chosen, a Select Box Enhancer for jQuery and Prototype
3
+ by Patrick Filler for Harvest, http://getharvest.com
4
+
5
+ Version 1.8.7
6
+ Full source at https://github.com/harvesthq/chosen
7
+ Copyright (c) 2011-2018 Harvest http://getharvest.com
8
+
9
+ MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
10
+ This file is generated by `grunt build`, do not edit it by hand.
11
+ */
12
+
13
+ (function() {
14
+ var $, AbstractChosen, Chosen, SelectParser,
15
+ bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
16
+ extend = 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; },
17
+ hasProp = {}.hasOwnProperty;
18
+
19
+ SelectParser = (function() {
20
+ function SelectParser() {
21
+ this.options_index = 0;
22
+ this.parsed = [];
23
+ }
24
+
25
+ SelectParser.prototype.add_node = function(child) {
26
+ if (child.nodeName.toUpperCase() === "OPTGROUP") {
27
+ return this.add_group(child);
28
+ } else {
29
+ return this.add_option(child);
30
+ }
31
+ };
32
+
33
+ SelectParser.prototype.add_group = function(group) {
34
+ var group_position, i, len, option, ref, results1;
35
+ group_position = this.parsed.length;
36
+ this.parsed.push({
37
+ array_index: group_position,
38
+ group: true,
39
+ label: group.label,
40
+ title: group.title ? group.title : void 0,
41
+ children: 0,
42
+ disabled: group.disabled,
43
+ classes: group.className
44
+ });
45
+ ref = group.childNodes;
46
+ results1 = [];
47
+ for (i = 0, len = ref.length; i < len; i++) {
48
+ option = ref[i];
49
+ results1.push(this.add_option(option, group_position, group.disabled));
50
+ }
51
+ return results1;
52
+ };
53
+
54
+ SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
55
+ if (option.nodeName.toUpperCase() === "OPTION") {
56
+ if (option.text !== "") {
57
+ if (group_position != null) {
58
+ this.parsed[group_position].children += 1;
59
+ }
60
+ this.parsed.push({
61
+ array_index: this.parsed.length,
62
+ options_index: this.options_index,
63
+ value: option.value,
64
+ text: option.text,
65
+ html: option.innerHTML,
66
+ title: option.title ? option.title : void 0,
67
+ selected: option.selected,
68
+ disabled: group_disabled === true ? group_disabled : option.disabled,
69
+ group_array_index: group_position,
70
+ group_label: group_position != null ? this.parsed[group_position].label : null,
71
+ classes: option.className,
72
+ style: option.style.cssText
73
+ });
74
+ } else {
75
+ this.parsed.push({
76
+ array_index: this.parsed.length,
77
+ options_index: this.options_index,
78
+ empty: true
79
+ });
80
+ }
81
+ return this.options_index += 1;
82
+ }
83
+ };
84
+
85
+ return SelectParser;
86
+
87
+ })();
88
+
89
+ SelectParser.select_to_array = function(select) {
90
+ var child, i, len, parser, ref;
91
+ parser = new SelectParser();
92
+ ref = select.childNodes;
93
+ for (i = 0, len = ref.length; i < len; i++) {
94
+ child = ref[i];
95
+ parser.add_node(child);
96
+ }
97
+ return parser.parsed;
98
+ };
99
+
100
+ AbstractChosen = (function() {
101
+ function AbstractChosen(form_field, options1) {
102
+ this.form_field = form_field;
103
+ this.options = options1 != null ? options1 : {};
104
+ this.label_click_handler = bind(this.label_click_handler, this);
105
+ if (!AbstractChosen.browser_is_supported()) {
106
+ return;
107
+ }
108
+ this.is_multiple = this.form_field.multiple;
109
+ this.set_default_text();
110
+ this.set_default_values();
111
+ this.setup();
112
+ this.set_up_html();
113
+ this.register_observers();
114
+ this.on_ready();
115
+ }
116
+
117
+ AbstractChosen.prototype.set_default_values = function() {
118
+ this.click_test_action = (function(_this) {
119
+ return function(evt) {
120
+ return _this.test_active_click(evt);
121
+ };
122
+ })(this);
123
+ this.activate_action = (function(_this) {
124
+ return function(evt) {
125
+ return _this.activate_field(evt);
126
+ };
127
+ })(this);
128
+ this.active_field = false;
129
+ this.mouse_on_container = false;
130
+ this.results_showing = false;
131
+ this.result_highlighted = null;
132
+ this.is_rtl = this.options.rtl || /\bchosen-rtl\b/.test(this.form_field.className);
133
+ 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;
134
+ this.disable_search_threshold = this.options.disable_search_threshold || 0;
135
+ this.disable_search = this.options.disable_search || false;
136
+ this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
137
+ this.group_search = this.options.group_search != null ? this.options.group_search : true;
138
+ this.search_contains = this.options.search_contains || false;
139
+ this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
140
+ this.max_selected_options = this.options.max_selected_options || Infinity;
141
+ this.inherit_select_classes = this.options.inherit_select_classes || false;
142
+ this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
143
+ this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
144
+ this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;
145
+ this.max_shown_results = this.options.max_shown_results || Number.POSITIVE_INFINITY;
146
+ this.case_sensitive_search = this.options.case_sensitive_search || false;
147
+ return this.hide_results_on_select = this.options.hide_results_on_select != null ? this.options.hide_results_on_select : true;
148
+ };
149
+
150
+ AbstractChosen.prototype.set_default_text = function() {
151
+ if (this.form_field.getAttribute("data-placeholder")) {
152
+ this.default_text = this.form_field.getAttribute("data-placeholder");
153
+ } else if (this.is_multiple) {
154
+ this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
155
+ } else {
156
+ this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
157
+ }
158
+ this.default_text = this.escape_html(this.default_text);
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'>" + (this.escape_html(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
+ if (this.is_multiple) {
180
+ if (!this.active_field) {
181
+ return setTimeout(((function(_this) {
182
+ return function() {
183
+ return _this.container_mousedown();
184
+ };
185
+ })(this)), 50);
186
+ }
187
+ } else {
188
+ if (!this.active_field) {
189
+ return this.activate_field();
190
+ }
191
+ }
192
+ };
193
+
194
+ AbstractChosen.prototype.input_blur = function(evt) {
195
+ if (!this.mouse_on_container) {
196
+ this.active_field = false;
197
+ return setTimeout(((function(_this) {
198
+ return function() {
199
+ return _this.blur_test();
200
+ };
201
+ })(this)), 100);
202
+ }
203
+ };
204
+
205
+ AbstractChosen.prototype.label_click_handler = function(evt) {
206
+ if (this.is_multiple) {
207
+ return this.container_mousedown(evt);
208
+ } else {
209
+ return this.activate_field();
210
+ }
211
+ };
212
+
213
+ AbstractChosen.prototype.results_option_build = function(options) {
214
+ var content, data, data_content, i, len, ref, shown_results;
215
+ content = '';
216
+ shown_results = 0;
217
+ ref = this.results_data;
218
+ for (i = 0, len = ref.length; i < len; i++) {
219
+ data = ref[i];
220
+ data_content = '';
221
+ if (data.group) {
222
+ data_content = this.result_add_group(data);
223
+ } else {
224
+ data_content = this.result_add_option(data);
225
+ }
226
+ if (data_content !== '') {
227
+ shown_results++;
228
+ content += data_content;
229
+ }
230
+ if (options != null ? options.first : void 0) {
231
+ if (data.selected && this.is_multiple) {
232
+ this.choice_build(data);
233
+ } else if (data.selected && !this.is_multiple) {
234
+ this.single_set_selected_text(this.choice_label(data));
235
+ }
236
+ }
237
+ if (shown_results >= this.max_shown_results) {
238
+ break;
239
+ }
240
+ }
241
+ return content;
242
+ };
243
+
244
+ AbstractChosen.prototype.result_add_option = function(option) {
245
+ var classes, option_el;
246
+ if (!option.search_match) {
247
+ return '';
248
+ }
249
+ if (!this.include_option_in_results(option)) {
250
+ return '';
251
+ }
252
+ classes = [];
253
+ if (!option.disabled && !(option.selected && this.is_multiple)) {
254
+ classes.push("active-result");
255
+ }
256
+ if (option.disabled && !(option.selected && this.is_multiple)) {
257
+ classes.push("disabled-result");
258
+ }
259
+ if (option.selected) {
260
+ classes.push("result-selected");
261
+ }
262
+ if (option.group_array_index != null) {
263
+ classes.push("group-option");
264
+ }
265
+ if (option.classes !== "") {
266
+ classes.push(option.classes);
267
+ }
268
+ option_el = document.createElement("li");
269
+ option_el.className = classes.join(" ");
270
+ if (option.style) {
271
+ option_el.style.cssText = option.style;
272
+ }
273
+ option_el.setAttribute("data-option-array-index", option.array_index);
274
+ option_el.innerHTML = option.highlighted_html || option.html;
275
+ if (option.title) {
276
+ option_el.title = option.title;
277
+ }
278
+ return this.outerHTML(option_el);
279
+ };
280
+
281
+ AbstractChosen.prototype.result_add_group = function(group) {
282
+ var classes, group_el;
283
+ if (!(group.search_match || group.group_match)) {
284
+ return '';
285
+ }
286
+ if (!(group.active_options > 0)) {
287
+ return '';
288
+ }
289
+ classes = [];
290
+ classes.push("group-result");
291
+ if (group.classes) {
292
+ classes.push(group.classes);
293
+ }
294
+ group_el = document.createElement("li");
295
+ group_el.className = classes.join(" ");
296
+ group_el.innerHTML = group.highlighted_html || this.escape_html(group.label);
297
+ if (group.title) {
298
+ group_el.title = group.title;
299
+ }
300
+ return this.outerHTML(group_el);
301
+ };
302
+
303
+ AbstractChosen.prototype.results_update_field = function() {
304
+ this.set_default_text();
305
+ if (!this.is_multiple) {
306
+ this.results_reset_cleanup();
307
+ }
308
+ this.result_clear_highlight();
309
+ this.results_build();
310
+ if (this.results_showing) {
311
+ return this.winnow_results();
312
+ }
313
+ };
314
+
315
+ AbstractChosen.prototype.reset_single_select_options = function() {
316
+ var i, len, ref, result, results1;
317
+ ref = this.results_data;
318
+ results1 = [];
319
+ for (i = 0, len = ref.length; i < len; i++) {
320
+ result = ref[i];
321
+ if (result.selected) {
322
+ results1.push(result.selected = false);
323
+ } else {
324
+ results1.push(void 0);
325
+ }
326
+ }
327
+ return results1;
328
+ };
329
+
330
+ AbstractChosen.prototype.results_toggle = function() {
331
+ if (this.results_showing) {
332
+ return this.results_hide();
333
+ } else {
334
+ return this.results_show();
335
+ }
336
+ };
337
+
338
+ AbstractChosen.prototype.results_search = function(evt) {
339
+ if (this.results_showing) {
340
+ return this.winnow_results();
341
+ } else {
342
+ return this.results_show();
343
+ }
344
+ };
345
+
346
+ AbstractChosen.prototype.winnow_results = function(options) {
347
+ var escapedQuery, fix, i, len, option, prefix, query, ref, regex, results, results_group, search_match, startpos, suffix, text;
348
+ this.no_results_clear();
349
+ results = 0;
350
+ query = this.get_search_text();
351
+ escapedQuery = query.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
352
+ regex = this.get_search_regex(escapedQuery);
353
+ ref = this.results_data;
354
+ for (i = 0, len = ref.length; i < len; i++) {
355
+ option = ref[i];
356
+ option.search_match = false;
357
+ results_group = null;
358
+ search_match = null;
359
+ option.highlighted_html = '';
360
+ if (this.include_option_in_results(option)) {
361
+ if (option.group) {
362
+ option.group_match = false;
363
+ option.active_options = 0;
364
+ }
365
+ if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {
366
+ results_group = this.results_data[option.group_array_index];
367
+ if (results_group.active_options === 0 && results_group.search_match) {
368
+ results += 1;
369
+ }
370
+ results_group.active_options += 1;
371
+ }
372
+ text = option.group ? option.label : option.text;
373
+ if (!(option.group && !this.group_search)) {
374
+ search_match = this.search_string_match(text, regex);
375
+ option.search_match = search_match != null;
376
+ if (option.search_match && !option.group) {
377
+ results += 1;
378
+ }
379
+ if (option.search_match) {
380
+ if (query.length) {
381
+ startpos = search_match.index;
382
+ prefix = text.slice(0, startpos);
383
+ fix = text.slice(startpos, startpos + query.length);
384
+ suffix = text.slice(startpos + query.length);
385
+ option.highlighted_html = (this.escape_html(prefix)) + "<em>" + (this.escape_html(fix)) + "</em>" + (this.escape_html(suffix));
386
+ }
387
+ if (results_group != null) {
388
+ results_group.group_match = true;
389
+ }
390
+ } else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
391
+ option.search_match = true;
392
+ }
393
+ }
394
+ }
395
+ }
396
+ this.result_clear_highlight();
397
+ if (results < 1 && query.length) {
398
+ this.update_results_content("");
399
+ return this.no_results(query);
400
+ } else {
401
+ this.update_results_content(this.results_option_build());
402
+ if (!(options != null ? options.skip_highlight : void 0)) {
403
+ return this.winnow_results_set_highlight();
404
+ }
405
+ }
406
+ };
407
+
408
+ AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
409
+ var regex_flag, regex_string;
410
+ regex_string = this.search_contains ? escaped_search_string : "(^|\\s|\\b)" + escaped_search_string + "[^\\s]*";
411
+ if (!(this.enable_split_word_search || this.search_contains)) {
412
+ regex_string = "^" + regex_string;
413
+ }
414
+ regex_flag = this.case_sensitive_search ? "" : "i";
415
+ return new RegExp(regex_string, regex_flag);
416
+ };
417
+
418
+ AbstractChosen.prototype.search_string_match = function(search_string, regex) {
419
+ var match;
420
+ match = regex.exec(search_string);
421
+ if (!this.search_contains && (match != null ? match[1] : void 0)) {
422
+ match.index += 1;
423
+ }
424
+ return match;
425
+ };
426
+
427
+ AbstractChosen.prototype.choices_count = function() {
428
+ var i, len, option, ref;
429
+ if (this.selected_option_count != null) {
430
+ return this.selected_option_count;
431
+ }
432
+ this.selected_option_count = 0;
433
+ ref = this.form_field.options;
434
+ for (i = 0, len = ref.length; i < len; i++) {
435
+ option = ref[i];
436
+ if (option.selected) {
437
+ this.selected_option_count += 1;
438
+ }
439
+ }
440
+ return this.selected_option_count;
441
+ };
442
+
443
+ AbstractChosen.prototype.choices_click = function(evt) {
444
+ evt.preventDefault();
445
+ this.activate_field();
446
+ if (!(this.results_showing || this.is_disabled)) {
447
+ return this.results_show();
448
+ }
449
+ };
450
+
451
+ AbstractChosen.prototype.keydown_checker = function(evt) {
452
+ var ref, stroke;
453
+ stroke = (ref = evt.which) != null ? ref : evt.keyCode;
454
+ this.search_field_scale();
455
+ if (stroke !== 8 && this.pending_backstroke) {
456
+ this.clear_backstroke();
457
+ }
458
+ switch (stroke) {
459
+ case 8:
460
+ this.backstroke_length = this.get_search_field_value().length;
461
+ break;
462
+ case 9:
463
+ if (this.results_showing && !this.is_multiple) {
464
+ this.result_select(evt);
465
+ }
466
+ this.mouse_on_container = false;
467
+ break;
468
+ case 13:
469
+ if (this.results_showing) {
470
+ evt.preventDefault();
471
+ }
472
+ break;
473
+ case 27:
474
+ if (this.results_showing) {
475
+ evt.preventDefault();
476
+ }
477
+ break;
478
+ case 32:
479
+ if (this.disable_search) {
480
+ evt.preventDefault();
481
+ }
482
+ break;
483
+ case 38:
484
+ evt.preventDefault();
485
+ this.keyup_arrow();
486
+ break;
487
+ case 40:
488
+ evt.preventDefault();
489
+ this.keydown_arrow();
490
+ break;
491
+ }
492
+ };
493
+
494
+ AbstractChosen.prototype.keyup_checker = function(evt) {
495
+ var ref, stroke;
496
+ stroke = (ref = evt.which) != null ? ref : evt.keyCode;
497
+ this.search_field_scale();
498
+ switch (stroke) {
499
+ case 8:
500
+ if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
501
+ this.keydown_backstroke();
502
+ } else if (!this.pending_backstroke) {
503
+ this.result_clear_highlight();
504
+ this.results_search();
505
+ }
506
+ break;
507
+ case 13:
508
+ evt.preventDefault();
509
+ if (this.results_showing) {
510
+ this.result_select(evt);
511
+ }
512
+ break;
513
+ case 27:
514
+ if (this.results_showing) {
515
+ this.results_hide();
516
+ }
517
+ break;
518
+ case 9:
519
+ case 16:
520
+ case 17:
521
+ case 18:
522
+ case 38:
523
+ case 40:
524
+ case 91:
525
+ break;
526
+ default:
527
+ this.results_search();
528
+ break;
529
+ }
530
+ };
531
+
532
+ AbstractChosen.prototype.clipboard_event_checker = function(evt) {
533
+ if (this.is_disabled) {
534
+ return;
535
+ }
536
+ return setTimeout(((function(_this) {
537
+ return function() {
538
+ return _this.results_search();
539
+ };
540
+ })(this)), 50);
541
+ };
542
+
543
+ AbstractChosen.prototype.container_width = function() {
544
+ if (this.options.width != null) {
545
+ return this.options.width;
546
+ } else {
547
+ return this.form_field.offsetWidth + "px";
548
+ }
549
+ };
550
+
551
+ AbstractChosen.prototype.include_option_in_results = function(option) {
552
+ if (this.is_multiple && (!this.display_selected_options && option.selected)) {
553
+ return false;
554
+ }
555
+ if (!this.display_disabled_options && option.disabled) {
556
+ return false;
557
+ }
558
+ if (option.empty) {
559
+ return false;
560
+ }
561
+ return true;
562
+ };
563
+
564
+ AbstractChosen.prototype.search_results_touchstart = function(evt) {
565
+ this.touch_started = true;
566
+ return this.search_results_mouseover(evt);
567
+ };
568
+
569
+ AbstractChosen.prototype.search_results_touchmove = function(evt) {
570
+ this.touch_started = false;
571
+ return this.search_results_mouseout(evt);
572
+ };
573
+
574
+ AbstractChosen.prototype.search_results_touchend = function(evt) {
575
+ if (this.touch_started) {
576
+ return this.search_results_mouseup(evt);
577
+ }
578
+ };
579
+
580
+ AbstractChosen.prototype.outerHTML = function(element) {
581
+ var tmp;
582
+ if (element.outerHTML) {
583
+ return element.outerHTML;
584
+ }
585
+ tmp = document.createElement("div");
586
+ tmp.appendChild(element);
587
+ return tmp.innerHTML;
588
+ };
589
+
590
+ AbstractChosen.prototype.get_single_html = function() {
591
+ return "<a class=\"chosen-single chosen-default\">\n <span>" + this.default_text + "</span>\n <div><b></b></div>\n</a>\n<div class=\"chosen-drop\">\n <div class=\"chosen-search\">\n <input class=\"chosen-search-input\" type=\"text\" autocomplete=\"off\" />\n </div>\n <ul class=\"chosen-results\"></ul>\n</div>";
592
+ };
593
+
594
+ AbstractChosen.prototype.get_multi_html = function() {
595
+ return "<ul class=\"chosen-choices\">\n <li class=\"search-field\">\n <input class=\"chosen-search-input\" type=\"text\" autocomplete=\"off\" value=\"" + this.default_text + "\" />\n </li>\n</ul>\n<div class=\"chosen-drop\">\n <ul class=\"chosen-results\"></ul>\n</div>";
596
+ };
597
+
598
+ AbstractChosen.prototype.get_no_results_html = function(terms) {
599
+ return "<li class=\"no-results\">\n " + this.results_none_found + " <span>" + (this.escape_html(terms)) + "</span>\n</li>";
600
+ };
601
+
602
+ AbstractChosen.browser_is_supported = function() {
603
+ if ("Microsoft Internet Explorer" === window.navigator.appName) {
604
+ return document.documentMode >= 8;
605
+ }
606
+ if (/iP(od|hone)/i.test(window.navigator.userAgent) || /IEMobile/i.test(window.navigator.userAgent) || /Windows Phone/i.test(window.navigator.userAgent) || /BlackBerry/i.test(window.navigator.userAgent) || /BB10/i.test(window.navigator.userAgent) || /Android.*Mobile/i.test(window.navigator.userAgent)) {
607
+ return false;
608
+ }
609
+ return true;
610
+ };
611
+
612
+ AbstractChosen.default_multiple_text = "Select Some Options";
613
+
614
+ AbstractChosen.default_single_text = "Select an Option";
615
+
616
+ AbstractChosen.default_no_result_text = "No results match";
617
+
618
+ return AbstractChosen;
619
+
620
+ })();
621
+
622
+ $ = jQuery;
623
+
624
+ $.fn.extend({
625
+ chosen: function(options) {
626
+ if (!AbstractChosen.browser_is_supported()) {
627
+ return this;
628
+ }
629
+ return this.each(function(input_field) {
630
+ var $this, chosen;
631
+ $this = $(this);
632
+ chosen = $this.data('chosen');
633
+ if (options === 'destroy') {
634
+ if (chosen instanceof Chosen) {
635
+ chosen.destroy();
636
+ }
637
+ return;
638
+ }
639
+ if (!(chosen instanceof Chosen)) {
640
+ $this.data('chosen', new Chosen(this, options));
641
+ }
642
+ });
643
+ }
644
+ });
645
+
646
+ Chosen = (function(superClass) {
647
+ extend(Chosen, superClass);
648
+
649
+ function Chosen() {
650
+ return Chosen.__super__.constructor.apply(this, arguments);
651
+ }
652
+
653
+ Chosen.prototype.setup = function() {
654
+ this.form_field_jq = $(this.form_field);
655
+ return this.current_selectedIndex = this.form_field.selectedIndex;
656
+ };
657
+
658
+ Chosen.prototype.set_up_html = function() {
659
+ var container_classes, container_props;
660
+ container_classes = ["chosen-container"];
661
+ container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
662
+ if (this.inherit_select_classes && this.form_field.className) {
663
+ container_classes.push(this.form_field.className);
664
+ }
665
+ if (this.is_rtl) {
666
+ container_classes.push("chosen-rtl");
667
+ }
668
+ container_props = {
669
+ 'class': container_classes.join(' '),
670
+ 'title': this.form_field.title
671
+ };
672
+ if (this.form_field.id.length) {
673
+ container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
674
+ }
675
+ this.container = $("<div />", container_props);
676
+ this.container.width(this.container_width());
677
+ if (this.is_multiple) {
678
+ this.container.html(this.get_multi_html());
679
+ } else {
680
+ this.container.html(this.get_single_html());
681
+ }
682
+ this.form_field_jq.hide().after(this.container);
683
+ this.dropdown = this.container.find('div.chosen-drop').first();
684
+ this.search_field = this.container.find('input').first();
685
+ this.search_results = this.container.find('ul.chosen-results').first();
686
+ this.search_field_scale();
687
+ this.search_no_results = this.container.find('li.no-results').first();
688
+ if (this.is_multiple) {
689
+ this.search_choices = this.container.find('ul.chosen-choices').first();
690
+ this.search_container = this.container.find('li.search-field').first();
691
+ } else {
692
+ this.search_container = this.container.find('div.chosen-search').first();
693
+ this.selected_item = this.container.find('.chosen-single').first();
694
+ }
695
+ this.results_build();
696
+ this.set_tab_index();
697
+ return this.set_label_behavior();
698
+ };
699
+
700
+ Chosen.prototype.on_ready = function() {
701
+ return this.form_field_jq.trigger("chosen:ready", {
702
+ chosen: this
703
+ });
704
+ };
705
+
706
+ Chosen.prototype.register_observers = function() {
707
+ this.container.on('touchstart.chosen', (function(_this) {
708
+ return function(evt) {
709
+ _this.container_mousedown(evt);
710
+ };
711
+ })(this));
712
+ this.container.on('touchend.chosen', (function(_this) {
713
+ return function(evt) {
714
+ _this.container_mouseup(evt);
715
+ };
716
+ })(this));
717
+ this.container.on('mousedown.chosen', (function(_this) {
718
+ return function(evt) {
719
+ _this.container_mousedown(evt);
720
+ };
721
+ })(this));
722
+ this.container.on('mouseup.chosen', (function(_this) {
723
+ return function(evt) {
724
+ _this.container_mouseup(evt);
725
+ };
726
+ })(this));
727
+ this.container.on('mouseenter.chosen', (function(_this) {
728
+ return function(evt) {
729
+ _this.mouse_enter(evt);
730
+ };
731
+ })(this));
732
+ this.container.on('mouseleave.chosen', (function(_this) {
733
+ return function(evt) {
734
+ _this.mouse_leave(evt);
735
+ };
736
+ })(this));
737
+ this.search_results.on('mouseup.chosen', (function(_this) {
738
+ return function(evt) {
739
+ _this.search_results_mouseup(evt);
740
+ };
741
+ })(this));
742
+ this.search_results.on('mouseover.chosen', (function(_this) {
743
+ return function(evt) {
744
+ _this.search_results_mouseover(evt);
745
+ };
746
+ })(this));
747
+ this.search_results.on('mouseout.chosen', (function(_this) {
748
+ return function(evt) {
749
+ _this.search_results_mouseout(evt);
750
+ };
751
+ })(this));
752
+ this.search_results.on('mousewheel.chosen DOMMouseScroll.chosen', (function(_this) {
753
+ return function(evt) {
754
+ _this.search_results_mousewheel(evt);
755
+ };
756
+ })(this));
757
+ this.search_results.on('touchstart.chosen', (function(_this) {
758
+ return function(evt) {
759
+ _this.search_results_touchstart(evt);
760
+ };
761
+ })(this));
762
+ this.search_results.on('touchmove.chosen', (function(_this) {
763
+ return function(evt) {
764
+ _this.search_results_touchmove(evt);
765
+ };
766
+ })(this));
767
+ this.search_results.on('touchend.chosen', (function(_this) {
768
+ return function(evt) {
769
+ _this.search_results_touchend(evt);
770
+ };
771
+ })(this));
772
+ this.form_field_jq.on("chosen:updated.chosen", (function(_this) {
773
+ return function(evt) {
774
+ _this.results_update_field(evt);
775
+ };
776
+ })(this));
777
+ this.form_field_jq.on("chosen:activate.chosen", (function(_this) {
778
+ return function(evt) {
779
+ _this.activate_field(evt);
780
+ };
781
+ })(this));
782
+ this.form_field_jq.on("chosen:open.chosen", (function(_this) {
783
+ return function(evt) {
784
+ _this.container_mousedown(evt);
785
+ };
786
+ })(this));
787
+ this.form_field_jq.on("chosen:close.chosen", (function(_this) {
788
+ return function(evt) {
789
+ _this.close_field(evt);
790
+ };
791
+ })(this));
792
+ this.search_field.on('blur.chosen', (function(_this) {
793
+ return function(evt) {
794
+ _this.input_blur(evt);
795
+ };
796
+ })(this));
797
+ this.search_field.on('keyup.chosen', (function(_this) {
798
+ return function(evt) {
799
+ _this.keyup_checker(evt);
800
+ };
801
+ })(this));
802
+ this.search_field.on('keydown.chosen', (function(_this) {
803
+ return function(evt) {
804
+ _this.keydown_checker(evt);
805
+ };
806
+ })(this));
807
+ this.search_field.on('focus.chosen', (function(_this) {
808
+ return function(evt) {
809
+ _this.input_focus(evt);
810
+ };
811
+ })(this));
812
+ this.search_field.on('cut.chosen', (function(_this) {
813
+ return function(evt) {
814
+ _this.clipboard_event_checker(evt);
815
+ };
816
+ })(this));
817
+ this.search_field.on('paste.chosen', (function(_this) {
818
+ return function(evt) {
819
+ _this.clipboard_event_checker(evt);
820
+ };
821
+ })(this));
822
+ if (this.is_multiple) {
823
+ return this.search_choices.on('click.chosen', (function(_this) {
824
+ return function(evt) {
825
+ _this.choices_click(evt);
826
+ };
827
+ })(this));
828
+ } else {
829
+ return this.container.on('click.chosen', function(evt) {
830
+ evt.preventDefault();
831
+ });
832
+ }
833
+ };
834
+
835
+ Chosen.prototype.destroy = function() {
836
+ $(this.container[0].ownerDocument).off('click.chosen', this.click_test_action);
837
+ if (this.form_field_label.length > 0) {
838
+ this.form_field_label.off('click.chosen');
839
+ }
840
+ if (this.search_field[0].tabIndex) {
841
+ this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex;
842
+ }
843
+ this.container.remove();
844
+ this.form_field_jq.removeData('chosen');
845
+ return this.form_field_jq.show();
846
+ };
847
+
848
+ Chosen.prototype.search_field_disabled = function() {
849
+ this.is_disabled = this.form_field.disabled || this.form_field_jq.parents('fieldset').is(':disabled');
850
+ this.container.toggleClass('chosen-disabled', this.is_disabled);
851
+ this.search_field[0].disabled = this.is_disabled;
852
+ if (!this.is_multiple) {
853
+ this.selected_item.off('focus.chosen', this.activate_field);
854
+ }
855
+ if (this.is_disabled) {
856
+ return this.close_field();
857
+ } else if (!this.is_multiple) {
858
+ return this.selected_item.on('focus.chosen', this.activate_field);
859
+ }
860
+ };
861
+
862
+ Chosen.prototype.container_mousedown = function(evt) {
863
+ var ref;
864
+ if (this.is_disabled) {
865
+ return;
866
+ }
867
+ if (evt && ((ref = evt.type) === 'mousedown' || ref === 'touchstart') && !this.results_showing) {
868
+ evt.preventDefault();
869
+ }
870
+ if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
871
+ if (!this.active_field) {
872
+ if (this.is_multiple) {
873
+ this.search_field.val("");
874
+ }
875
+ $(this.container[0].ownerDocument).on('click.chosen', this.click_test_action);
876
+ this.results_show();
877
+ } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
878
+ evt.preventDefault();
879
+ this.results_toggle();
880
+ }
881
+ return this.activate_field();
882
+ }
883
+ };
884
+
885
+ Chosen.prototype.container_mouseup = function(evt) {
886
+ if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
887
+ return this.results_reset(evt);
888
+ }
889
+ };
890
+
891
+ Chosen.prototype.search_results_mousewheel = function(evt) {
892
+ var delta;
893
+ if (evt.originalEvent) {
894
+ delta = evt.originalEvent.deltaY || -evt.originalEvent.wheelDelta || evt.originalEvent.detail;
895
+ }
896
+ if (delta != null) {
897
+ evt.preventDefault();
898
+ if (evt.type === 'DOMMouseScroll') {
899
+ delta = delta * 40;
900
+ }
901
+ return this.search_results.scrollTop(delta + this.search_results.scrollTop());
902
+ }
903
+ };
904
+
905
+ Chosen.prototype.blur_test = function(evt) {
906
+ if (!this.active_field && this.container.hasClass("chosen-container-active")) {
907
+ return this.close_field();
908
+ }
909
+ };
910
+
911
+ Chosen.prototype.close_field = function() {
912
+ $(this.container[0].ownerDocument).off("click.chosen", this.click_test_action);
913
+ this.active_field = false;
914
+ this.results_hide();
915
+ this.container.removeClass("chosen-container-active");
916
+ this.clear_backstroke();
917
+ this.show_search_field_default();
918
+ this.search_field_scale();
919
+ return this.search_field.blur();
920
+ };
921
+
922
+ Chosen.prototype.activate_field = function() {
923
+ if (this.is_disabled) {
924
+ return;
925
+ }
926
+ this.container.addClass("chosen-container-active");
927
+ this.active_field = true;
928
+ this.search_field.val(this.search_field.val());
929
+ return this.search_field.focus();
930
+ };
931
+
932
+ Chosen.prototype.test_active_click = function(evt) {
933
+ var active_container;
934
+ active_container = $(evt.target).closest('.chosen-container');
935
+ if (active_container.length && this.container[0] === active_container[0]) {
936
+ return this.active_field = true;
937
+ } else {
938
+ return this.close_field();
939
+ }
940
+ };
941
+
942
+ Chosen.prototype.results_build = function() {
943
+ this.parsing = true;
944
+ this.selected_option_count = null;
945
+ this.results_data = SelectParser.select_to_array(this.form_field);
946
+ if (this.is_multiple) {
947
+ this.search_choices.find("li.search-choice").remove();
948
+ } else {
949
+ this.single_set_selected_text();
950
+ if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
951
+ this.search_field[0].readOnly = true;
952
+ this.container.addClass("chosen-container-single-nosearch");
953
+ } else {
954
+ this.search_field[0].readOnly = false;
955
+ this.container.removeClass("chosen-container-single-nosearch");
956
+ }
957
+ }
958
+ this.update_results_content(this.results_option_build({
959
+ first: true
960
+ }));
961
+ this.search_field_disabled();
962
+ this.show_search_field_default();
963
+ this.search_field_scale();
964
+ return this.parsing = false;
965
+ };
966
+
967
+ Chosen.prototype.result_do_highlight = function(el) {
968
+ var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
969
+ if (el.length) {
970
+ this.result_clear_highlight();
971
+ this.result_highlight = el;
972
+ this.result_highlight.addClass("highlighted");
973
+ maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
974
+ visible_top = this.search_results.scrollTop();
975
+ visible_bottom = maxHeight + visible_top;
976
+ high_top = this.result_highlight.position().top + this.search_results.scrollTop();
977
+ high_bottom = high_top + this.result_highlight.outerHeight();
978
+ if (high_bottom >= visible_bottom) {
979
+ return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
980
+ } else if (high_top < visible_top) {
981
+ return this.search_results.scrollTop(high_top);
982
+ }
983
+ }
984
+ };
985
+
986
+ Chosen.prototype.result_clear_highlight = function() {
987
+ if (this.result_highlight) {
988
+ this.result_highlight.removeClass("highlighted");
989
+ }
990
+ return this.result_highlight = null;
991
+ };
992
+
993
+ Chosen.prototype.results_show = function() {
994
+ if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
995
+ this.form_field_jq.trigger("chosen:maxselected", {
996
+ chosen: this
997
+ });
998
+ return false;
999
+ }
1000
+ this.container.addClass("chosen-with-drop");
1001
+ this.results_showing = true;
1002
+ this.search_field.focus();
1003
+ this.search_field.val(this.get_search_field_value());
1004
+ this.winnow_results();
1005
+ return this.form_field_jq.trigger("chosen:showing_dropdown", {
1006
+ chosen: this
1007
+ });
1008
+ };
1009
+
1010
+ Chosen.prototype.update_results_content = function(content) {
1011
+ return this.search_results.html(content);
1012
+ };
1013
+
1014
+ Chosen.prototype.results_hide = function() {
1015
+ if (this.results_showing) {
1016
+ this.result_clear_highlight();
1017
+ this.container.removeClass("chosen-with-drop");
1018
+ this.form_field_jq.trigger("chosen:hiding_dropdown", {
1019
+ chosen: this
1020
+ });
1021
+ }
1022
+ return this.results_showing = false;
1023
+ };
1024
+
1025
+ Chosen.prototype.set_tab_index = function(el) {
1026
+ var ti;
1027
+ if (this.form_field.tabIndex) {
1028
+ ti = this.form_field.tabIndex;
1029
+ this.form_field.tabIndex = -1;
1030
+ return this.search_field[0].tabIndex = ti;
1031
+ }
1032
+ };
1033
+
1034
+ Chosen.prototype.set_label_behavior = function() {
1035
+ this.form_field_label = this.form_field_jq.parents("label");
1036
+ if (!this.form_field_label.length && this.form_field.id.length) {
1037
+ this.form_field_label = $("label[for='" + this.form_field.id + "']");
1038
+ }
1039
+ if (this.form_field_label.length > 0) {
1040
+ return this.form_field_label.on('click.chosen', this.label_click_handler);
1041
+ }
1042
+ };
1043
+
1044
+ Chosen.prototype.show_search_field_default = function() {
1045
+ if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {
1046
+ this.search_field.val(this.default_text);
1047
+ return this.search_field.addClass("default");
1048
+ } else {
1049
+ this.search_field.val("");
1050
+ return this.search_field.removeClass("default");
1051
+ }
1052
+ };
1053
+
1054
+ Chosen.prototype.search_results_mouseup = function(evt) {
1055
+ var target;
1056
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
1057
+ if (target.length) {
1058
+ this.result_highlight = target;
1059
+ this.result_select(evt);
1060
+ return this.search_field.focus();
1061
+ }
1062
+ };
1063
+
1064
+ Chosen.prototype.search_results_mouseover = function(evt) {
1065
+ var target;
1066
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
1067
+ if (target) {
1068
+ return this.result_do_highlight(target);
1069
+ }
1070
+ };
1071
+
1072
+ Chosen.prototype.search_results_mouseout = function(evt) {
1073
+ if ($(evt.target).hasClass("active-result") || $(evt.target).parents('.active-result').first()) {
1074
+ return this.result_clear_highlight();
1075
+ }
1076
+ };
1077
+
1078
+ Chosen.prototype.choice_build = function(item) {
1079
+ var choice, close_link;
1080
+ choice = $('<li />', {
1081
+ "class": "search-choice"
1082
+ }).html("<span>" + (this.choice_label(item)) + "</span>");
1083
+ if (item.disabled) {
1084
+ choice.addClass('search-choice-disabled');
1085
+ } else {
1086
+ close_link = $('<a />', {
1087
+ "class": 'search-choice-close',
1088
+ 'data-option-array-index': item.array_index
1089
+ });
1090
+ close_link.on('click.chosen', (function(_this) {
1091
+ return function(evt) {
1092
+ return _this.choice_destroy_link_click(evt);
1093
+ };
1094
+ })(this));
1095
+ choice.append(close_link);
1096
+ }
1097
+ return this.search_container.before(choice);
1098
+ };
1099
+
1100
+ Chosen.prototype.choice_destroy_link_click = function(evt) {
1101
+ evt.preventDefault();
1102
+ evt.stopPropagation();
1103
+ if (!this.is_disabled) {
1104
+ return this.choice_destroy($(evt.target));
1105
+ }
1106
+ };
1107
+
1108
+ Chosen.prototype.choice_destroy = function(link) {
1109
+ if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) {
1110
+ if (this.active_field) {
1111
+ this.search_field.focus();
1112
+ } else {
1113
+ this.show_search_field_default();
1114
+ }
1115
+ if (this.is_multiple && this.choices_count() > 0 && this.get_search_field_value().length < 1) {
1116
+ this.results_hide();
1117
+ }
1118
+ link.parents('li').first().remove();
1119
+ return this.search_field_scale();
1120
+ }
1121
+ };
1122
+
1123
+ Chosen.prototype.results_reset = function() {
1124
+ this.reset_single_select_options();
1125
+ this.form_field.options[0].selected = true;
1126
+ this.single_set_selected_text();
1127
+ this.show_search_field_default();
1128
+ this.results_reset_cleanup();
1129
+ this.trigger_form_field_change();
1130
+ if (this.active_field) {
1131
+ return this.results_hide();
1132
+ }
1133
+ };
1134
+
1135
+ Chosen.prototype.results_reset_cleanup = function() {
1136
+ this.current_selectedIndex = this.form_field.selectedIndex;
1137
+ return this.selected_item.find("abbr").remove();
1138
+ };
1139
+
1140
+ Chosen.prototype.result_select = function(evt) {
1141
+ var high, item;
1142
+ if (this.result_highlight) {
1143
+ high = this.result_highlight;
1144
+ this.result_clear_highlight();
1145
+ if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
1146
+ this.form_field_jq.trigger("chosen:maxselected", {
1147
+ chosen: this
1148
+ });
1149
+ return false;
1150
+ }
1151
+ if (this.is_multiple) {
1152
+ high.removeClass("active-result");
1153
+ } else {
1154
+ this.reset_single_select_options();
1155
+ }
1156
+ high.addClass("result-selected");
1157
+ item = this.results_data[high[0].getAttribute("data-option-array-index")];
1158
+ item.selected = true;
1159
+ this.form_field.options[item.options_index].selected = true;
1160
+ this.selected_option_count = null;
1161
+ if (this.is_multiple) {
1162
+ this.choice_build(item);
1163
+ } else {
1164
+ this.single_set_selected_text(this.choice_label(item));
1165
+ }
1166
+ if (this.is_multiple && (!this.hide_results_on_select || (evt.metaKey || evt.ctrlKey))) {
1167
+ if (evt.metaKey || evt.ctrlKey) {
1168
+ this.winnow_results({
1169
+ skip_highlight: true
1170
+ });
1171
+ } else {
1172
+ this.search_field.val("");
1173
+ this.winnow_results();
1174
+ }
1175
+ } else {
1176
+ this.results_hide();
1177
+ this.show_search_field_default();
1178
+ }
1179
+ if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
1180
+ this.trigger_form_field_change({
1181
+ selected: this.form_field.options[item.options_index].value
1182
+ });
1183
+ }
1184
+ this.current_selectedIndex = this.form_field.selectedIndex;
1185
+ evt.preventDefault();
1186
+ return this.search_field_scale();
1187
+ }
1188
+ };
1189
+
1190
+ Chosen.prototype.single_set_selected_text = function(text) {
1191
+ if (text == null) {
1192
+ text = this.default_text;
1193
+ }
1194
+ if (text === this.default_text) {
1195
+ this.selected_item.addClass("chosen-default");
1196
+ } else {
1197
+ this.single_deselect_control_build();
1198
+ this.selected_item.removeClass("chosen-default");
1199
+ }
1200
+ return this.selected_item.find("span").html(text);
1201
+ };
1202
+
1203
+ Chosen.prototype.result_deselect = function(pos) {
1204
+ var result_data;
1205
+ result_data = this.results_data[pos];
1206
+ if (!this.form_field.options[result_data.options_index].disabled) {
1207
+ result_data.selected = false;
1208
+ this.form_field.options[result_data.options_index].selected = false;
1209
+ this.selected_option_count = null;
1210
+ this.result_clear_highlight();
1211
+ if (this.results_showing) {
1212
+ this.winnow_results();
1213
+ }
1214
+ this.trigger_form_field_change({
1215
+ deselected: this.form_field.options[result_data.options_index].value
1216
+ });
1217
+ this.search_field_scale();
1218
+ return true;
1219
+ } else {
1220
+ return false;
1221
+ }
1222
+ };
1223
+
1224
+ Chosen.prototype.single_deselect_control_build = function() {
1225
+ if (!this.allow_single_deselect) {
1226
+ return;
1227
+ }
1228
+ if (!this.selected_item.find("abbr").length) {
1229
+ this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
1230
+ }
1231
+ return this.selected_item.addClass("chosen-single-with-deselect");
1232
+ };
1233
+
1234
+ Chosen.prototype.get_search_field_value = function() {
1235
+ return this.search_field.val();
1236
+ };
1237
+
1238
+ Chosen.prototype.get_search_text = function() {
1239
+ return $.trim(this.get_search_field_value());
1240
+ };
1241
+
1242
+ Chosen.prototype.escape_html = function(text) {
1243
+ return $('<div/>').text(text).html();
1244
+ };
1245
+
1246
+ Chosen.prototype.winnow_results_set_highlight = function() {
1247
+ var do_high, selected_results;
1248
+ selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
1249
+ do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
1250
+ if (do_high != null) {
1251
+ return this.result_do_highlight(do_high);
1252
+ }
1253
+ };
1254
+
1255
+ Chosen.prototype.no_results = function(terms) {
1256
+ var no_results_html;
1257
+ no_results_html = this.get_no_results_html(terms);
1258
+ this.search_results.append(no_results_html);
1259
+ return this.form_field_jq.trigger("chosen:no_results", {
1260
+ chosen: this
1261
+ });
1262
+ };
1263
+
1264
+ Chosen.prototype.no_results_clear = function() {
1265
+ return this.search_results.find(".no-results").remove();
1266
+ };
1267
+
1268
+ Chosen.prototype.keydown_arrow = function() {
1269
+ var next_sib;
1270
+ if (this.results_showing && this.result_highlight) {
1271
+ next_sib = this.result_highlight.nextAll("li.active-result").first();
1272
+ if (next_sib) {
1273
+ return this.result_do_highlight(next_sib);
1274
+ }
1275
+ } else {
1276
+ return this.results_show();
1277
+ }
1278
+ };
1279
+
1280
+ Chosen.prototype.keyup_arrow = function() {
1281
+ var prev_sibs;
1282
+ if (!this.results_showing && !this.is_multiple) {
1283
+ return this.results_show();
1284
+ } else if (this.result_highlight) {
1285
+ prev_sibs = this.result_highlight.prevAll("li.active-result");
1286
+ if (prev_sibs.length) {
1287
+ return this.result_do_highlight(prev_sibs.first());
1288
+ } else {
1289
+ if (this.choices_count() > 0) {
1290
+ this.results_hide();
1291
+ }
1292
+ return this.result_clear_highlight();
1293
+ }
1294
+ }
1295
+ };
1296
+
1297
+ Chosen.prototype.keydown_backstroke = function() {
1298
+ var next_available_destroy;
1299
+ if (this.pending_backstroke) {
1300
+ this.choice_destroy(this.pending_backstroke.find("a").first());
1301
+ return this.clear_backstroke();
1302
+ } else {
1303
+ next_available_destroy = this.search_container.siblings("li.search-choice").last();
1304
+ if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) {
1305
+ this.pending_backstroke = next_available_destroy;
1306
+ if (this.single_backstroke_delete) {
1307
+ return this.keydown_backstroke();
1308
+ } else {
1309
+ return this.pending_backstroke.addClass("search-choice-focus");
1310
+ }
1311
+ }
1312
+ }
1313
+ };
1314
+
1315
+ Chosen.prototype.clear_backstroke = function() {
1316
+ if (this.pending_backstroke) {
1317
+ this.pending_backstroke.removeClass("search-choice-focus");
1318
+ }
1319
+ return this.pending_backstroke = null;
1320
+ };
1321
+
1322
+ Chosen.prototype.search_field_scale = function() {
1323
+ var div, i, len, style, style_block, styles, width;
1324
+ if (!this.is_multiple) {
1325
+ return;
1326
+ }
1327
+ style_block = {
1328
+ position: 'absolute',
1329
+ left: '-1000px',
1330
+ top: '-1000px',
1331
+ display: 'none',
1332
+ whiteSpace: 'pre'
1333
+ };
1334
+ styles = ['fontSize', 'fontStyle', 'fontWeight', 'fontFamily', 'lineHeight', 'textTransform', 'letterSpacing'];
1335
+ for (i = 0, len = styles.length; i < len; i++) {
1336
+ style = styles[i];
1337
+ style_block[style] = this.search_field.css(style);
1338
+ }
1339
+ div = $('<div />').css(style_block);
1340
+ div.text(this.get_search_field_value());
1341
+ $('body').append(div);
1342
+ width = div.width() + 25;
1343
+ div.remove();
1344
+ if (this.container.is(':visible')) {
1345
+ width = Math.min(this.container.outerWidth() - 10, width);
1346
+ }
1347
+ return this.search_field.width(width);
1348
+ };
1349
+
1350
+ Chosen.prototype.trigger_form_field_change = function(extra) {
1351
+ this.form_field_jq.trigger("input", extra);
1352
+ return this.form_field_jq.trigger("change", extra);
1353
+ };
1354
+
1355
+ return Chosen;
1356
+
1357
+ })(AbstractChosen);
1358
+
1359
+ }).call(this);