rails_admin 2.3.0 → 3.0.0.beta

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rails_admin might be problematic. Click here for more details.

Files changed (329) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +9 -11
  3. data/README.md +37 -31
  4. data/Rakefile +2 -2
  5. data/app/assets/javascripts/rails_admin.js +21 -0
  6. data/app/assets/stylesheets/rails_admin/custom/mixins.scss +1 -1
  7. data/app/assets/stylesheets/rails_admin/custom/variables.scss +1 -1
  8. data/app/assets/stylesheets/rails_admin.scss.erb +76 -0
  9. data/app/controllers/rails_admin/application_controller.rb +4 -3
  10. data/app/controllers/rails_admin/main_controller.rb +43 -24
  11. data/app/helpers/rails_admin/application_helper.rb +69 -52
  12. data/app/helpers/rails_admin/form_builder.rb +5 -4
  13. data/app/helpers/rails_admin/main_helper.rb +27 -43
  14. data/app/views/kaminari/ra-twitter-bootstrap/_gap.html.erb +5 -0
  15. data/app/views/kaminari/ra-twitter-bootstrap/_next_page.html.erb +9 -0
  16. data/app/views/kaminari/ra-twitter-bootstrap/_page.html.erb +9 -0
  17. data/app/views/kaminari/ra-twitter-bootstrap/_paginator.html.erb +13 -0
  18. data/app/views/kaminari/ra-twitter-bootstrap/_prev_page.html.erb +9 -0
  19. data/app/views/kaminari/ra-twitter-bootstrap/without_count/_next_page.html.erb +9 -0
  20. data/app/views/kaminari/ra-twitter-bootstrap/without_count/_paginator.html.erb +6 -0
  21. data/app/views/kaminari/ra-twitter-bootstrap/without_count/_prev_page.html.erb +9 -0
  22. data/app/views/layouts/rails_admin/_head.html.erb +17 -0
  23. data/app/views/layouts/rails_admin/_navigation.html.erb +21 -0
  24. data/app/views/layouts/rails_admin/_secondary_navigation.html.erb +24 -0
  25. data/app/views/layouts/rails_admin/_sidebar_navigation.html.erb +9 -0
  26. data/app/views/layouts/rails_admin/application.html.erb +27 -0
  27. data/app/views/layouts/rails_admin/modal.js.erb +7 -0
  28. data/app/views/layouts/rails_admin/pjax.html.erb +20 -0
  29. data/app/views/rails_admin/main/_dashboard_history.html.erb +45 -0
  30. data/app/views/rails_admin/main/_delete_notice.html.erb +35 -0
  31. data/app/views/rails_admin/main/_form_action_text.html.erb +7 -0
  32. data/app/views/rails_admin/main/_form_boolean.html.erb +16 -0
  33. data/app/views/rails_admin/main/{_form_ck_editor.html.haml → _form_ck_editor.html.erb} +3 -3
  34. data/app/views/rails_admin/main/_form_code_mirror.html.erb +9 -0
  35. data/app/views/rails_admin/main/_form_colorpicker.html.erb +1 -0
  36. data/app/views/rails_admin/main/_form_datetime.html.erb +9 -0
  37. data/app/views/rails_admin/main/_form_enumeration.html.erb +21 -0
  38. data/app/views/rails_admin/main/_form_field.html.erb +1 -0
  39. data/app/views/rails_admin/main/_form_file_upload.html.erb +17 -0
  40. data/app/views/rails_admin/main/{_form_filtering_multiselect.html.haml → _form_filtering_multiselect.html.erb} +11 -11
  41. data/app/views/rails_admin/main/{_form_filtering_select.html.haml → _form_filtering_select.html.erb} +13 -12
  42. data/app/views/rails_admin/main/_form_froala.html.erb +8 -0
  43. data/app/views/rails_admin/main/_form_multiple_file_upload.html.erb +20 -0
  44. data/app/views/rails_admin/main/_form_nested_many.html.erb +21 -0
  45. data/app/views/rails_admin/main/_form_nested_one.html.erb +21 -0
  46. data/app/views/rails_admin/main/_form_polymorphic_association.html.erb +27 -0
  47. data/app/views/rails_admin/main/_form_simple_mde.html.erb +8 -0
  48. data/app/views/rails_admin/main/_form_text.html.erb +1 -0
  49. data/app/views/rails_admin/main/_form_wysihtml5.html.erb +8 -0
  50. data/app/views/rails_admin/main/_submit_buttons.html.erb +25 -0
  51. data/app/views/rails_admin/main/bulk_delete.html.erb +19 -0
  52. data/app/views/rails_admin/main/dashboard.html.erb +64 -0
  53. data/app/views/rails_admin/main/delete.html.erb +21 -0
  54. data/app/views/rails_admin/main/edit.html.erb +3 -0
  55. data/app/views/rails_admin/main/export.html.erb +146 -0
  56. data/app/views/rails_admin/main/history.html.erb +78 -0
  57. data/app/views/rails_admin/main/index.html.erb +193 -0
  58. data/app/views/rails_admin/main/new.html.erb +3 -0
  59. data/app/views/rails_admin/main/show.html.erb +28 -0
  60. data/config/initializers/active_record_extensions.rb +3 -1
  61. data/config/initializers/mongoid_extensions.rb +1 -1
  62. data/config/locales/rails_admin.en.yml +5 -1
  63. data/lib/generators/rails_admin/install_generator.rb +51 -3
  64. data/lib/generators/rails_admin/templates/environment.js +6 -0
  65. data/lib/generators/rails_admin/templates/initializer.erb +2 -1
  66. data/lib/generators/rails_admin/templates/rails_admin.js.erb +2 -0
  67. data/lib/generators/rails_admin/templates/rails_admin.scss +1 -0
  68. data/lib/generators/rails_admin/templates/webpack.config.js +32 -0
  69. data/lib/rails_admin/abstract_model.rb +24 -10
  70. data/lib/rails_admin/adapters/active_record/association.rb +20 -1
  71. data/lib/rails_admin/adapters/active_record/object_extension.rb +29 -0
  72. data/lib/rails_admin/adapters/active_record/property.rb +1 -1
  73. data/lib/rails_admin/adapters/active_record.rb +19 -21
  74. data/lib/rails_admin/adapters/mongoid/association.rb +38 -9
  75. data/lib/rails_admin/adapters/mongoid/bson.rb +4 -5
  76. data/lib/rails_admin/adapters/mongoid/extension.rb +3 -1
  77. data/lib/rails_admin/adapters/mongoid/object_extension.rb +32 -0
  78. data/lib/rails_admin/adapters/mongoid/property.rb +2 -2
  79. data/lib/rails_admin/adapters/mongoid.rb +25 -19
  80. data/lib/rails_admin/config/actions/base.rb +7 -2
  81. data/lib/rails_admin/config/actions/bulk_delete.rb +2 -2
  82. data/lib/rails_admin/config/actions/dashboard.rb +4 -3
  83. data/lib/rails_admin/config/actions/delete.rb +5 -9
  84. data/lib/rails_admin/config/actions/edit.rb +7 -7
  85. data/lib/rails_admin/config/actions/export.rb +2 -2
  86. data/lib/rails_admin/config/actions/history_index.rb +2 -2
  87. data/lib/rails_admin/config/actions/history_show.rb +2 -2
  88. data/lib/rails_admin/config/actions/index.rb +5 -7
  89. data/lib/rails_admin/config/actions/new.rb +9 -9
  90. data/lib/rails_admin/config/actions/show.rb +1 -1
  91. data/lib/rails_admin/config/actions/show_in_app.rb +6 -2
  92. data/lib/rails_admin/config/actions.rb +4 -4
  93. data/lib/rails_admin/config/configurable.rb +2 -2
  94. data/lib/rails_admin/config/fields/association.rb +15 -12
  95. data/lib/rails_admin/config/fields/base.rb +44 -24
  96. data/lib/rails_admin/config/fields/factories/active_storage.rb +1 -0
  97. data/lib/rails_admin/config/fields/factories/association.rb +6 -8
  98. data/lib/rails_admin/config/fields/factories/carrierwave.rb +2 -1
  99. data/lib/rails_admin/config/fields/factories/devise.rb +2 -1
  100. data/lib/rails_admin/config/fields/factories/dragonfly.rb +2 -1
  101. data/lib/rails_admin/config/fields/factories/paperclip.rb +2 -1
  102. data/lib/rails_admin/config/fields/factories/shrine.rb +1 -1
  103. data/lib/rails_admin/config/fields/group.rb +1 -2
  104. data/lib/rails_admin/config/fields/types/active_record_enum.rb +2 -0
  105. data/lib/rails_admin/config/fields/types/active_storage.rb +9 -7
  106. data/lib/rails_admin/config/fields/types/all.rb +1 -0
  107. data/lib/rails_admin/config/fields/types/belongs_to_association.rb +4 -12
  108. data/lib/rails_admin/config/fields/types/boolean.rb +32 -8
  109. data/lib/rails_admin/config/fields/types/carrierwave.rb +1 -0
  110. data/lib/rails_admin/config/fields/types/citext.rb +13 -0
  111. data/lib/rails_admin/config/fields/types/color.rb +6 -2
  112. data/lib/rails_admin/config/fields/types/date.rb +5 -8
  113. data/lib/rails_admin/config/fields/types/datetime.rb +18 -21
  114. data/lib/rails_admin/config/fields/types/decimal.rb +9 -2
  115. data/lib/rails_admin/config/fields/types/dragonfly.rb +3 -1
  116. data/lib/rails_admin/config/fields/types/enum.rb +1 -1
  117. data/lib/rails_admin/config/fields/types/file_upload.rb +4 -3
  118. data/lib/rails_admin/config/fields/types/float.rb +9 -2
  119. data/lib/rails_admin/config/fields/types/has_many_association.rb +1 -5
  120. data/lib/rails_admin/config/fields/types/has_one_association.rb +1 -13
  121. data/lib/rails_admin/config/fields/types/integer.rb +2 -6
  122. data/lib/rails_admin/config/fields/types/multiple_active_storage.rb +8 -6
  123. data/lib/rails_admin/config/fields/types/multiple_carrierwave.rb +1 -0
  124. data/lib/rails_admin/config/fields/types/multiple_file_upload.rb +4 -3
  125. data/lib/rails_admin/config/fields/types/numeric.rb +18 -0
  126. data/lib/rails_admin/config/fields/types/polymorphic_association.rb +3 -2
  127. data/lib/rails_admin/config/fields/types/string.rb +1 -1
  128. data/lib/rails_admin/config/fields/types/time.rb +1 -4
  129. data/lib/rails_admin/config/fields/types/timestamp.rb +0 -4
  130. data/lib/rails_admin/config/fields/types.rb +1 -1
  131. data/lib/rails_admin/config/fields.rb +3 -1
  132. data/lib/rails_admin/config/has_fields.rb +5 -6
  133. data/lib/rails_admin/config/hideable.rb +1 -1
  134. data/lib/rails_admin/config/inspectable.rb +1 -3
  135. data/lib/rails_admin/config/model.rb +10 -10
  136. data/lib/rails_admin/config/sections/base.rb +2 -3
  137. data/lib/rails_admin/config/sections/list.rb +4 -15
  138. data/lib/rails_admin/config/sections.rb +1 -1
  139. data/lib/rails_admin/config.rb +73 -38
  140. data/lib/rails_admin/engine.rb +36 -23
  141. data/lib/rails_admin/extension.rb +6 -14
  142. data/lib/rails_admin/extensions/cancancan/authorization_adapter.rb +4 -2
  143. data/lib/rails_admin/extensions/paper_trail/auditing_adapter.rb +12 -7
  144. data/lib/rails_admin/extensions/pundit/authorization_adapter.rb +6 -7
  145. data/lib/rails_admin/support/csv_converter.rb +12 -13
  146. data/lib/rails_admin/support/datetime.rb +40 -74
  147. data/lib/rails_admin/support/esmodule_preprocessor.rb +32 -0
  148. data/lib/rails_admin/support/hash_helper.rb +6 -5
  149. data/lib/rails_admin/version.rb +7 -3
  150. data/lib/rails_admin.rb +1 -4
  151. data/lib/tasks/rails_admin.rake +3 -3
  152. data/package.json +28 -0
  153. data/src/rails_admin/base.js +21 -0
  154. data/src/rails_admin/filter-box.js +405 -0
  155. data/src/rails_admin/filtering-multiselect.js +394 -0
  156. data/src/rails_admin/filtering-select.js +302 -0
  157. data/src/rails_admin/i18n.js +19 -0
  158. data/src/rails_admin/nested-form-hooks.js +100 -0
  159. data/src/rails_admin/remote-form.js +190 -0
  160. data/src/rails_admin/sidescroll.js +20 -0
  161. data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/theming.scss +93 -34
  162. data/src/rails_admin/styles/base.scss +64 -0
  163. data/src/rails_admin/styles/filtering-multiselect.scss +53 -0
  164. data/src/rails_admin/styles/filtering-select.scss +70 -0
  165. data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/cerulean/theming.scss +23 -21
  166. data/src/rails_admin/styles/themes/cerulean/variables.scss +830 -0
  167. data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/default/mixins.scss +1 -1
  168. data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/default/variables.scss +1 -1
  169. data/src/rails_admin/styles/widgets.scss +35 -0
  170. data/src/rails_admin/ui.js +172 -0
  171. data/src/rails_admin/vendor/jquery.pjax.js +899 -0
  172. data/src/rails_admin/vendor/jquery_nested_form.js +122 -0
  173. data/src/rails_admin/widgets.js +512 -0
  174. data/vendor/assets/fonts/rails_admin/fa-solid-900.eot +0 -0
  175. data/vendor/assets/fonts/rails_admin/fa-solid-900.svg +5034 -0
  176. data/vendor/assets/fonts/rails_admin/fa-solid-900.ttf +0 -0
  177. data/vendor/assets/fonts/rails_admin/fa-solid-900.woff +0 -0
  178. data/vendor/assets/fonts/rails_admin/fa-solid-900.woff2 +0 -0
  179. data/vendor/assets/javascripts/rails_admin/jquery-ui/data.js +41 -0
  180. data/vendor/assets/javascripts/rails_admin/jquery-ui/effect.js +1637 -0
  181. data/vendor/assets/javascripts/rails_admin/jquery-ui/ie.js +17 -0
  182. data/vendor/assets/javascripts/rails_admin/jquery-ui/keycode.js +47 -0
  183. data/vendor/assets/javascripts/rails_admin/jquery-ui/position.js +500 -0
  184. data/vendor/assets/javascripts/rails_admin/jquery-ui/safe-active-element.js +42 -0
  185. data/vendor/assets/javascripts/rails_admin/jquery-ui/scroll-parent.js +47 -0
  186. data/vendor/assets/javascripts/rails_admin/jquery-ui/unique-id.js +51 -0
  187. data/vendor/assets/javascripts/rails_admin/jquery-ui/version.js +17 -0
  188. data/vendor/assets/javascripts/rails_admin/jquery-ui/widget.js +735 -0
  189. data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/autocomplete.js +689 -0
  190. data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/menu.js +680 -0
  191. data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/mouse.js +230 -0
  192. data/vendor/assets/javascripts/rails_admin/jquery-ui/widgets/sortable.js +1561 -0
  193. data/vendor/assets/javascripts/rails_admin/jquery3.js +10872 -0
  194. data/vendor/assets/stylesheets/rails_admin/font-awesome.scss +4476 -2216
  195. metadata +118 -263
  196. data/app/assets/images/rails_admin/aristo/images/bg_fallback.png +0 -0
  197. data/app/assets/images/rails_admin/aristo/images/icon_sprite.png +0 -0
  198. data/app/assets/images/rails_admin/aristo/images/progress_bar.gif +0 -0
  199. data/app/assets/images/rails_admin/aristo/images/slider_handles.png +0 -0
  200. data/app/assets/images/rails_admin/aristo/images/ui-icons_222222_256x240.png +0 -0
  201. data/app/assets/images/rails_admin/aristo/images/ui-icons_454545_256x240.png +0 -0
  202. data/app/assets/images/rails_admin/bullet_black.png +0 -0
  203. data/app/assets/images/rails_admin/bullet_white.png +0 -0
  204. data/app/assets/images/rails_admin/calendar.png +0 -0
  205. data/app/assets/images/rails_admin/clock.png +0 -0
  206. data/app/assets/images/rails_admin/logo.png +0 -0
  207. data/app/assets/images/rails_admin/magnifier.png +0 -0
  208. data/app/assets/images/rails_admin/multiselect/icon_sprite.png +0 -0
  209. data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-n-dark.png +0 -0
  210. data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-n-light.png +0 -0
  211. data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-s-dark.png +0 -0
  212. data/app/assets/images/rails_admin/multiselect/ui-icon-circle-triangle-s-light.png +0 -0
  213. data/app/assets/javascripts/rails_admin/jquery-ui.js.erb +0 -8
  214. data/app/assets/javascripts/rails_admin/jquery.migrate.js +0 -3
  215. data/app/assets/javascripts/rails_admin/ra.filter-box.js +0 -253
  216. data/app/assets/javascripts/rails_admin/ra.filtering-multiselect.js +0 -331
  217. data/app/assets/javascripts/rails_admin/ra.filtering-select.js +0 -294
  218. data/app/assets/javascripts/rails_admin/ra.i18n.js +0 -28
  219. data/app/assets/javascripts/rails_admin/ra.nested-form-hooks.js +0 -59
  220. data/app/assets/javascripts/rails_admin/ra.remote-form.js +0 -155
  221. data/app/assets/javascripts/rails_admin/ra.sidescroll.js +0 -31
  222. data/app/assets/javascripts/rails_admin/ra.widgets.js +0 -379
  223. data/app/assets/javascripts/rails_admin/rails_admin.js +0 -21
  224. data/app/assets/javascripts/rails_admin/ui.js +0 -135
  225. data/app/assets/stylesheets/rails_admin/aristo/images/bg_fallback.png +0 -0
  226. data/app/assets/stylesheets/rails_admin/aristo/images/icon_sprite.png +0 -0
  227. data/app/assets/stylesheets/rails_admin/aristo/images/progress_bar.gif +0 -0
  228. data/app/assets/stylesheets/rails_admin/aristo/images/slider_handles.png +0 -0
  229. data/app/assets/stylesheets/rails_admin/aristo/images/ui-icons_222222_256x240.png +0 -0
  230. data/app/assets/stylesheets/rails_admin/aristo/images/ui-icons_454545_256x240.png +0 -0
  231. data/app/assets/stylesheets/rails_admin/aristo/jquery-ui-1.8.7.custom.scss +0 -733
  232. data/app/assets/stylesheets/rails_admin/base/font-awesome-4-compability.scss +0 -153
  233. data/app/assets/stylesheets/rails_admin/ra.filtering-multiselect.scss +0 -88
  234. data/app/assets/stylesheets/rails_admin/ra.sidescroll.scss +0 -29
  235. data/app/assets/stylesheets/rails_admin/ra.widgets.scss +0 -17
  236. data/app/assets/stylesheets/rails_admin/rails_admin.scss.erb +0 -110
  237. data/app/assets/stylesheets/rails_admin/themes/cerulean/variables.scss +0 -857
  238. data/app/views/kaminari/ra-twitter-bootstrap/_gap.html.haml +0 -2
  239. data/app/views/kaminari/ra-twitter-bootstrap/_next_page.html.haml +0 -4
  240. data/app/views/kaminari/ra-twitter-bootstrap/_page.html.haml +0 -4
  241. data/app/views/kaminari/ra-twitter-bootstrap/_paginator.html.haml +0 -9
  242. data/app/views/kaminari/ra-twitter-bootstrap/_prev_page.html.haml +0 -4
  243. data/app/views/kaminari/ra-twitter-bootstrap/without_count/_next_page.html.haml +0 -4
  244. data/app/views/kaminari/ra-twitter-bootstrap/without_count/_paginator.html.haml +0 -4
  245. data/app/views/kaminari/ra-twitter-bootstrap/without_count/_prev_page.html.haml +0 -4
  246. data/app/views/layouts/rails_admin/_head.html.haml +0 -7
  247. data/app/views/layouts/rails_admin/_navigation.html.haml +0 -12
  248. data/app/views/layouts/rails_admin/_secondary_navigation.html.haml +0 -10
  249. data/app/views/layouts/rails_admin/_sidebar_navigation.html.haml +0 -3
  250. data/app/views/layouts/rails_admin/application.html.haml +0 -16
  251. data/app/views/layouts/rails_admin/pjax.html.haml +0 -12
  252. data/app/views/rails_admin/main/_dashboard_history.html.haml +0 -21
  253. data/app/views/rails_admin/main/_delete_notice.html.haml +0 -24
  254. data/app/views/rails_admin/main/_form_action_text.html.haml +0 -7
  255. data/app/views/rails_admin/main/_form_boolean.html.haml +0 -3
  256. data/app/views/rails_admin/main/_form_code_mirror.html.haml +0 -9
  257. data/app/views/rails_admin/main/_form_colorpicker.html.haml +0 -1
  258. data/app/views/rails_admin/main/_form_datetime.html.haml +0 -5
  259. data/app/views/rails_admin/main/_form_enumeration.html.haml +0 -19
  260. data/app/views/rails_admin/main/_form_field.html.haml +0 -1
  261. data/app/views/rails_admin/main/_form_file_upload.html.haml +0 -17
  262. data/app/views/rails_admin/main/_form_froala.html.haml +0 -8
  263. data/app/views/rails_admin/main/_form_multiple_file_upload.html.haml +0 -16
  264. data/app/views/rails_admin/main/_form_nested_many.html.haml +0 -15
  265. data/app/views/rails_admin/main/_form_nested_one.html.haml +0 -17
  266. data/app/views/rails_admin/main/_form_polymorphic_association.html.haml +0 -26
  267. data/app/views/rails_admin/main/_form_simple_mde.haml +0 -8
  268. data/app/views/rails_admin/main/_form_text.html.haml +0 -1
  269. data/app/views/rails_admin/main/_form_wysihtml5.html.haml +0 -8
  270. data/app/views/rails_admin/main/_submit_buttons.html.haml +0 -16
  271. data/app/views/rails_admin/main/bulk_delete.html.haml +0 -11
  272. data/app/views/rails_admin/main/dashboard.html.haml +0 -34
  273. data/app/views/rails_admin/main/delete.html.haml +0 -18
  274. data/app/views/rails_admin/main/edit.html.haml +0 -2
  275. data/app/views/rails_admin/main/export.html.haml +0 -92
  276. data/app/views/rails_admin/main/history.html.haml +0 -51
  277. data/app/views/rails_admin/main/index.html.haml +0 -126
  278. data/app/views/rails_admin/main/new.html.haml +0 -2
  279. data/app/views/rails_admin/main/show.html.haml +0 -15
  280. data/config/initializers/haml.rb +0 -5
  281. data/lib/rails_admin/adapters/active_record/abstract_object.rb +0 -38
  282. data/lib/rails_admin/adapters/active_record.rb.bak +0 -348
  283. data/lib/rails_admin/adapters/mongoid/abstract_object.rb +0 -42
  284. data/lib/rails_admin/bootstrap-sass/compass_functions.rb +0 -28
  285. data/lib/rails_admin/bootstrap-sass/sass_functions.rb +0 -16
  286. data/lib/rails_admin/bootstrap-sass.rb +0 -49
  287. data/lib/rails_admin/config/lazy_model.rb +0 -68
  288. data/lib/rails_admin/extensions/history/auditing_adapter.rb +0 -37
  289. data/lib/rails_admin/extensions/history/history.rb +0 -44
  290. data/lib/rails_admin/extensions/history.rb +0 -3
  291. data/lib/rails_admin/support/i18n.rb +0 -43
  292. data/vendor/assets/fonts/rails_admin/FontAwesome.otf +0 -0
  293. data/vendor/assets/fonts/rails_admin/fontawesome-webfont.eot +0 -0
  294. data/vendor/assets/fonts/rails_admin/fontawesome-webfont.svg +0 -2671
  295. data/vendor/assets/fonts/rails_admin/fontawesome-webfont.ttf +0 -0
  296. data/vendor/assets/fonts/rails_admin/fontawesome-webfont.woff +0 -0
  297. data/vendor/assets/fonts/rails_admin/fontawesome-webfont.woff2 +0 -0
  298. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_background.png +0 -0
  299. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hex.png +0 -0
  300. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hsb_b.png +0 -0
  301. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hsb_h.png +0 -0
  302. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_hsb_s.png +0 -0
  303. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_indic.gif +0 -0
  304. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_overlay.png +0 -0
  305. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_rgb_b.png +0 -0
  306. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_rgb_g.png +0 -0
  307. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_rgb_r.png +0 -0
  308. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_select.gif +0 -0
  309. data/vendor/assets/images/rails_admin/colorpicker/colorpicker_submit.png +0 -0
  310. data/vendor/assets/images/rails_admin/colorpicker/custom_background.png +0 -0
  311. data/vendor/assets/images/rails_admin/colorpicker/custom_hex.png +0 -0
  312. data/vendor/assets/images/rails_admin/colorpicker/custom_hsb_b.png +0 -0
  313. data/vendor/assets/images/rails_admin/colorpicker/custom_hsb_h.png +0 -0
  314. data/vendor/assets/images/rails_admin/colorpicker/custom_hsb_s.png +0 -0
  315. data/vendor/assets/images/rails_admin/colorpicker/custom_indic.gif +0 -0
  316. data/vendor/assets/images/rails_admin/colorpicker/custom_rgb_b.png +0 -0
  317. data/vendor/assets/images/rails_admin/colorpicker/custom_rgb_g.png +0 -0
  318. data/vendor/assets/images/rails_admin/colorpicker/custom_rgb_r.png +0 -0
  319. data/vendor/assets/images/rails_admin/colorpicker/custom_submit.png +0 -0
  320. data/vendor/assets/images/rails_admin/colorpicker/select.png +0 -0
  321. data/vendor/assets/images/rails_admin/colorpicker/select2.png +0 -0
  322. data/vendor/assets/images/rails_admin/colorpicker/slider.png +0 -0
  323. data/vendor/assets/javascripts/rails_admin/jquery.colorpicker.js +0 -484
  324. data/vendor/assets/stylesheets/rails_admin/jquery.colorpicker.scss +0 -182
  325. /data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/README.txt +0 -0
  326. /data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/mixins.scss +0 -0
  327. /data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/base/variables.scss +0 -0
  328. /data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/cerulean/mixins.scss +0 -0
  329. /data/{app/assets/stylesheets/rails_admin → src/rails_admin/styles}/themes/default/theming.scss +0 -0
@@ -0,0 +1,394 @@
1
+ import jQuery from "jquery";
2
+ import "jquery-ui/ui/widget";
3
+ import I18n from "./i18n";
4
+
5
+ (function ($) {
6
+ $.widget("ra.filteringMultiselect", {
7
+ _cache: {},
8
+ options: {
9
+ createQuery: function (query) {
10
+ return { query: query };
11
+ },
12
+ sortable: false,
13
+ removable: true,
14
+ regional: {
15
+ add: "Add",
16
+ chooseAll: "Choose all",
17
+ clearAll: "Clear all",
18
+ down: "Down",
19
+ remove: "Remove",
20
+ search: "Search",
21
+ up: "Up",
22
+ },
23
+ searchDelay: 400,
24
+ remote_source: null,
25
+ xhr: false,
26
+ },
27
+
28
+ wrapper: null,
29
+ filter: null,
30
+ collection: null,
31
+ addAll: null,
32
+ add: null,
33
+ remove: null,
34
+ up: null,
35
+ down: null,
36
+ selection: null,
37
+ removeAll: null,
38
+
39
+ _create: function () {
40
+ this._cache = {};
41
+ this._build();
42
+ this._buildCache();
43
+ this._bindEvents();
44
+ },
45
+
46
+ _build: function () {
47
+ var i;
48
+
49
+ this.wrapper = this.element.siblings(
50
+ '.ra-multiselect[data-input-for="' + this.element.attr("id") + '"]'
51
+ );
52
+
53
+ // Prevent duplication on browser back
54
+ if (this.wrapper.length > 0) {
55
+ this.filter = this.wrapper.find("input.ra-multiselect-search");
56
+ this.collection = this.wrapper.find("select.ra-multiselect-collection");
57
+ this.addAll = this.wrapper.find("a.ra-multiselect-item-add-all");
58
+ this.add = this.wrapper.find("a.ra-multiselect-item-add");
59
+ this.remove = this.wrapper.find("a.ra-multiselect-item-remove");
60
+ this.up = this.wrapper.find("a.ra-multiselect-item-up");
61
+ this.down = this.wrapper.find("a.ra-multiselect-item-down");
62
+ this.selection = this.wrapper.find("select.ra-multiselect-selection");
63
+ this.removeAll = this.wrapper.find("a.ra-multiselect-item-remove-all");
64
+ return;
65
+ }
66
+
67
+ this.wrapper = $('<div class="ra-multiselect">').attr(
68
+ "data-input-for",
69
+ this.element.attr("id")
70
+ );
71
+ this.wrapper.insertAfter(this.element);
72
+ var header = $('<div class="ra-multiselect-header">');
73
+ this.filter = $(
74
+ '<input type="search" placeholder="' +
75
+ this.options.regional.search +
76
+ '" class="form-control ra-multiselect-search"/>'
77
+ );
78
+ header.append(this.filter);
79
+ this.wrapper.append(header);
80
+
81
+ var columns = {
82
+ left: $('<div class="ra-multiselect-column ra-multiselect-left">'),
83
+ center: $('<div class="ra-multiselect-column ra-multiselect-center">'),
84
+ right: $('<div class="ra-multiselect-column ra-multiselect-right">'),
85
+ };
86
+
87
+ for (i in columns) {
88
+ if (columns.hasOwnProperty(i)) {
89
+ this.wrapper.append(columns[i]);
90
+ }
91
+ }
92
+
93
+ this.collection = $('<select multiple="multiple"></select>');
94
+ this.collection.addClass("form-control ra-multiselect-collection");
95
+ this.addAll = $(
96
+ '<a href="#" class="ra-multiselect-item-add-all"><span class="fas fa-chevron-circle-right"></span>' +
97
+ this.options.regional.chooseAll +
98
+ "</a>"
99
+ );
100
+ columns.left.html(this.collection).append(this.addAll);
101
+ this.collection.wrap('<div class="wrapper"/>');
102
+
103
+ this.add = $(
104
+ '<a href="#" class="fas fa-chevron-circle-right ra-multiselect-item-add"></a>'
105
+ ).attr("title", this.options.regional.add);
106
+ columns.center.append(this.add);
107
+ if (this.options.removable) {
108
+ this.remove = $(
109
+ '<a href="#" class="fas fa-chevron-circle-left ra-multiselect-item-remove"></a>'
110
+ ).attr("title", this.options.regional.remove);
111
+ columns.center.append(this.remove);
112
+ }
113
+ if (this.options.sortable) {
114
+ this.up = $(
115
+ '<a href="#" class="fas fa-chevron-circle-up ra-multiselect-item-up">' +
116
+ this.options.regional.up +
117
+ "</a>"
118
+ );
119
+ this.down = $(
120
+ '<a href="#" class="fas fa-chevron-circle-down ra-multiselect-item-down">' +
121
+ this.options.regional.down +
122
+ "</a>"
123
+ );
124
+ columns.center.append(this.up).append(this.down);
125
+ }
126
+
127
+ this.selection = $(
128
+ '<select class="form-control ra-multiselect-selection" multiple="multiple"></select>'
129
+ );
130
+ columns.right.append(this.selection);
131
+ if (this.options.removable) {
132
+ this.removeAll = $(
133
+ '<a href="#" class="ra-multiselect-item-remove-all"><span class="fas fa-chevron-circle-left"></span>' +
134
+ this.options.regional.clearAll +
135
+ "</a>"
136
+ );
137
+ columns.right.append(this.removeAll);
138
+ }
139
+ this.selection.wrap('<div class="wrapper"/>');
140
+
141
+ this.element.css({ display: "none" });
142
+
143
+ this.tooManyObjectsPlaceholder = $('<option disabled="disabled" />').text(
144
+ I18n.t("too_many_objects")
145
+ );
146
+ this.noObjectsPlaceholder = $('<option disabled="disabled" />').text(
147
+ I18n.t("no_objects")
148
+ );
149
+
150
+ if (this.options.xhr) {
151
+ this.collection.append(this.tooManyObjectsPlaceholder);
152
+ }
153
+ },
154
+
155
+ _bindEvents: function () {
156
+ var widget = this;
157
+
158
+ /* Add all to selection */
159
+ this.addAll.click(function (e) {
160
+ widget._select($("option:not(:disabled)", widget.collection));
161
+ e.preventDefault();
162
+ widget.selection.trigger("change");
163
+ });
164
+
165
+ /* Add to selection */
166
+ this.add.click(function (e) {
167
+ widget._select($(":selected", widget.collection));
168
+
169
+ e.preventDefault();
170
+ widget.selection.trigger("change");
171
+ });
172
+
173
+ if (this.options.removable) {
174
+ /* Remove all from selection */
175
+ this.removeAll.click(function (e) {
176
+ widget._deSelect($("option", widget.selection));
177
+ e.preventDefault();
178
+ widget.selection.trigger("change");
179
+ });
180
+
181
+ /* Remove from selection */
182
+ this.remove.click(function (e) {
183
+ widget._deSelect($(":selected", widget.selection));
184
+ e.preventDefault();
185
+ widget.selection.trigger("change");
186
+ });
187
+ }
188
+
189
+ var timeout = null;
190
+ if (this.options.sortable) {
191
+ /* Move selection up */
192
+ this.up.click(function (e) {
193
+ widget._move("up", $(":selected", widget.selection));
194
+ e.preventDefault();
195
+ });
196
+
197
+ /* Move selection down */
198
+ this.down.click(function (e) {
199
+ widget._move("down", $(":selected", widget.selection));
200
+ e.preventDefault();
201
+ });
202
+ }
203
+
204
+ /* Typing to the filter */
205
+ this.filter.bind("keyup click", function (e) {
206
+ if (timeout) {
207
+ clearTimeout(timeout);
208
+ }
209
+ timeout = setTimeout(function () {
210
+ widget._queryFilter(widget.filter.val());
211
+ }, widget.options.searchDelay);
212
+ });
213
+ },
214
+
215
+ _queryFilter: function (val) {
216
+ var widget = this;
217
+ widget._query(val, function (matches) {
218
+ var filtered = [];
219
+ var i;
220
+
221
+ for (i = 0; i < matches.length; i++) {
222
+ if (!widget.selected(matches[i].id)) {
223
+ filtered.push(i);
224
+ }
225
+ }
226
+ if (filtered.length > 0) {
227
+ widget.collection.html("");
228
+ for (i = 0; i < filtered.length; i++) {
229
+ var newOptions = $("<option></option>")
230
+ .prop("value", matches[filtered[i]].id)
231
+ .prop("title", matches[filtered[i]].label)
232
+ .text(matches[filtered[i]].label);
233
+ widget.collection.append(newOptions);
234
+ }
235
+ } else {
236
+ widget.collection.html(widget.noObjectsPlaceholder);
237
+ }
238
+ });
239
+ },
240
+
241
+ /*
242
+ * Cache key is stored in the format `o_<option value>` to avoid JS
243
+ * engine coercing string keys to int keys, and thereby preserving
244
+ * the insertion order. The value for each key is in turn an object
245
+ * that stores the option tag's HTML text and the value. Example:
246
+ * cache = {
247
+ * 'o_271': { id: 271, value: 'CartItem #271'},
248
+ * 'o_270': { id: 270, value: 'CartItem #270'}
249
+ * }
250
+ */
251
+ _buildCache: function (options) {
252
+ var widget = this;
253
+
254
+ this.element.find("option").each(function (i, option) {
255
+ widget._cache["o_" + option.value] = {
256
+ id: option.value,
257
+ value: $(option).text(),
258
+ };
259
+ if (option.selected) {
260
+ $(option)
261
+ .clone()
262
+ .appendTo(widget.selection)
263
+ .prop("selected", false)
264
+ .prop("title", $(option).text());
265
+ } else {
266
+ $(option)
267
+ .clone()
268
+ .appendTo(widget.collection)
269
+ .prop("selected", false)
270
+ .prop("title", $(option).text());
271
+ }
272
+ });
273
+ },
274
+
275
+ _deSelect: function (options) {
276
+ var widget = this;
277
+ options.each(function (i, option) {
278
+ widget.element
279
+ .find('option[value="' + option.value + '"]')
280
+ .prop("selected", false);
281
+ });
282
+ $(options).appendTo(this.collection).prop("selected", false);
283
+ },
284
+
285
+ _query: function (query, success) {
286
+ var i,
287
+ matches = [];
288
+
289
+ if (query === "") {
290
+ if (!this.options.xhr) {
291
+ for (i in this._cache) {
292
+ if (this._cache.hasOwnProperty(i)) {
293
+ var option = this._cache[i];
294
+ matches.push({ id: option.id, label: option.value });
295
+ }
296
+ }
297
+ success.apply(this, [matches]);
298
+ } else {
299
+ this.collection.html(this.tooManyObjectsPlaceholder);
300
+ }
301
+ } else {
302
+ if (this.options.xhr) {
303
+ $.ajax({
304
+ beforeSend: function (xhr) {
305
+ xhr.setRequestHeader("Accept", "application/json");
306
+ },
307
+ url: this.options.remote_source,
308
+ data: this.options.createQuery(query),
309
+ success: success,
310
+ });
311
+ } else {
312
+ query = new RegExp(query + ".*", "i");
313
+
314
+ for (i in this._cache) {
315
+ if (
316
+ this._cache.hasOwnProperty(i) &&
317
+ query.test(this._cache[i]["value"])
318
+ ) {
319
+ var option = this._cache[i];
320
+ matches.push({ id: option.id, label: option.value });
321
+ }
322
+ }
323
+
324
+ success.apply(this, [matches]);
325
+ }
326
+ }
327
+ },
328
+
329
+ _select: function (options) {
330
+ var widget = this;
331
+ options.each(function (i, option) {
332
+ var el = widget.element.find('option[value="' + option.value + '"]');
333
+ if (el.length) {
334
+ el.prop("selected", true);
335
+ } else {
336
+ widget.element.append(
337
+ $("<option></option>")
338
+ .prop("value", option.value)
339
+ .prop("selected", true)
340
+ );
341
+ }
342
+ });
343
+ $(options).appendTo(this.selection).prop("selected", false);
344
+ },
345
+
346
+ _move: function (direction, options) {
347
+ var widget = this;
348
+ if (direction == "up") {
349
+ options.each(function (i, option) {
350
+ var prev = $(option).prev();
351
+ if (prev.length > 0) {
352
+ var el = widget.element.find(
353
+ 'option[value="' + option.value + '"]'
354
+ );
355
+ var el_prev = widget.element.find(
356
+ 'option[value="' + prev[0].value + '"]'
357
+ );
358
+ el_prev.before(el);
359
+ prev.before($(option));
360
+ }
361
+ });
362
+ } else {
363
+ $.fn.reverse = [].reverse; // needed to lower last items first
364
+ options.reverse().each(function (i, option) {
365
+ var next = $(option).next();
366
+ if (next.length > 0) {
367
+ var el = widget.element.find(
368
+ 'option[value="' + option.value + '"]'
369
+ );
370
+ var el_next = widget.element.find(
371
+ 'option[value="' + next[0].value + '"]'
372
+ );
373
+ el_next.after(el);
374
+ next.after($(option));
375
+ }
376
+ });
377
+ }
378
+ },
379
+
380
+ selected: function (value) {
381
+ if (
382
+ this.selection[0].querySelectorAll('option[value="' + value + '"]')[0]
383
+ ) {
384
+ return true;
385
+ }
386
+ },
387
+
388
+ destroy: function () {
389
+ this.wrapper.remove();
390
+ this.element.css({ display: "inline" });
391
+ $.Widget.prototype.destroy.apply(this, arguments);
392
+ },
393
+ });
394
+ })(jQuery);
@@ -0,0 +1,302 @@
1
+ import jQuery from "jquery";
2
+ import "jquery-ui/ui/widget";
3
+ import "jquery-ui/ui/widgets/autocomplete";
4
+ import I18n from "./i18n";
5
+
6
+ (function ($) {
7
+ "use strict";
8
+
9
+ $.widget("ra.filteringSelect", {
10
+ options: {
11
+ createQuery: function (query) {
12
+ return { query: query };
13
+ },
14
+ minLength: 0,
15
+ searchDelay: 200,
16
+ remote_source: null,
17
+ source: null,
18
+ xhr: false,
19
+ },
20
+
21
+ button: null,
22
+ input: null,
23
+ select: null,
24
+ filtering_select: null,
25
+
26
+ _create: function () {
27
+ this.filtering_select = this.element.siblings(
28
+ '[data-input-for="' + this.element.attr("id") + '"]'
29
+ );
30
+
31
+ // When using the browser back and forward buttons, it is possible that
32
+ // the autocomplete field will be cached which causes duplicate fields
33
+ // to be generated.
34
+ if (this.filtering_select.length > 0) {
35
+ this.input = this.filtering_select.children("input");
36
+ this.button = this.filtering_select.children(".input-group-btn");
37
+ } else {
38
+ this.element.hide();
39
+ this.filtering_select = this._inputGroup(this.element.attr("id"));
40
+ this.input = this._inputField();
41
+ this.button = this._buttonField();
42
+ }
43
+ this.clearOption = $('<span style="color: #888"></span>').append(
44
+ '<i class="fas fa-times"></i> ' +
45
+ $("<span></span>").text(I18n.t("clear")).html()
46
+ );
47
+ this.noObjectsPlaceholder = $('<option disabled="disabled" />').text(
48
+ I18n.t("no_objects")
49
+ );
50
+
51
+ this._setOptionsSource();
52
+ this._initAutocomplete();
53
+ this._initKeyEvent();
54
+ this._overloadRenderItem();
55
+ this._autocompleteDropdownEvent(this.button);
56
+
57
+ return this.filtering_select
58
+ .append(this.input)
59
+ .append(this.button)
60
+ .insertAfter(this.element);
61
+ },
62
+
63
+ _getResultSet: function (request, data, xhr) {
64
+ var matcher = new RegExp(
65
+ $.ui.autocomplete.escapeRegex(request.term),
66
+ "i"
67
+ );
68
+
69
+ var spannedContent = function (content) {
70
+ return $("<span>").text(content).html();
71
+ };
72
+
73
+ var highlighter = function (label, word) {
74
+ if (word.length) {
75
+ return $.map(label.split(word), function (el) {
76
+ return spannedContent(el);
77
+ }).join($("<strong>").text(word)[0].outerHTML);
78
+ } else {
79
+ return spannedContent(label);
80
+ }
81
+ };
82
+
83
+ var matches = $.map(data, function (el) {
84
+ var id = el.id || el.value;
85
+ var value = el.label || el.id;
86
+ // match regexp only for local requests, remote ones are already
87
+ // filtered, and label may not contain filtered term.
88
+ if (id && (xhr || matcher.test(el.label))) {
89
+ return {
90
+ html: highlighter(value, request.term),
91
+ value: value,
92
+ id: id,
93
+ };
94
+ }
95
+ });
96
+
97
+ if (request.term.length === 0 && !this.input.attr("required")) {
98
+ return [{ html: this.clearOption, value: null, id: null }].concat(
99
+ matches
100
+ );
101
+ } else if (matches.length === 0) {
102
+ return [{ html: this.noObjectsPlaceholder, value: null, id: null }];
103
+ } else {
104
+ return matches;
105
+ }
106
+ },
107
+
108
+ _getSourceFunction: function (source) {
109
+ var self = this;
110
+ var requestIndex = 0;
111
+
112
+ if ($.isArray(source)) {
113
+ return function (request, response) {
114
+ response(self._getResultSet(request, source, false));
115
+ };
116
+ } else if (typeof source === "string") {
117
+ return function (request, response) {
118
+ if (this.xhr) {
119
+ this.xhr.abort();
120
+ }
121
+
122
+ this.xhr = $.ajax({
123
+ url: source,
124
+ data: self.options.createQuery(request.term),
125
+ dataType: "json",
126
+ autocompleteRequest: ++requestIndex,
127
+ success: function (data, status) {
128
+ if (this.autocompleteRequest === requestIndex) {
129
+ response(self._getResultSet(request, data, true));
130
+ }
131
+ },
132
+ error: function () {
133
+ if (this.autocompleteRequest === requestIndex) {
134
+ response([]);
135
+ }
136
+ },
137
+ });
138
+ };
139
+ } else {
140
+ return source;
141
+ }
142
+ },
143
+
144
+ _setOptionsSource: function () {
145
+ if (this.options.xhr) {
146
+ this.options.source = this.options.remote_source;
147
+ } else {
148
+ this.options.source = this.element
149
+ .children("option")
150
+ .map(function () {
151
+ return { label: $(this).text(), value: this.value };
152
+ })
153
+ .toArray();
154
+ }
155
+ },
156
+
157
+ _buttonField: function () {
158
+ return $(
159
+ '<span class="input-group-btn">' +
160
+ '<label class="btn btn-info dropdown-toggle" data-toggle="dropdown" aria-expanded="false" title="Show All Items" role="button">' +
161
+ '<span class="caret"></span>' +
162
+ '<span class="ui-button-text">&nbsp;</span>' +
163
+ "</label>" +
164
+ "</span>"
165
+ );
166
+ },
167
+
168
+ _autocompleteDropdownEvent: function (element) {
169
+ var self = this;
170
+
171
+ return element.click(function () {
172
+ // close if already visible
173
+ if (self.input.autocomplete("widget").is(":visible")) {
174
+ self.input.autocomplete("close");
175
+ return;
176
+ }
177
+
178
+ // pass empty string as value to search for, displaying all results
179
+ self.input.autocomplete("search", "");
180
+ self.input.focus();
181
+ });
182
+ },
183
+
184
+ _inputField: function () {
185
+ var input;
186
+ var selected = this.element.children(":selected");
187
+ var value = selected.val() ? selected.text() : "";
188
+
189
+ input = $('<input type="text">')
190
+ .val(value)
191
+ .addClass("form-control ra-filtering-select-input")
192
+ .attr("style", this.element.attr("style"))
193
+ .show();
194
+
195
+ if (this.element.attr("placeholder")) {
196
+ input.attr("placeholder", this.element.attr("placeholder"));
197
+ }
198
+
199
+ if (this.element.attr("required")) {
200
+ input.attr("required", this.element.attr("required"));
201
+ this.element.attr("required", false);
202
+ }
203
+
204
+ return input;
205
+ },
206
+
207
+ _inputGroup: function (inputFor) {
208
+ return $("<div>")
209
+ .addClass("input-group filtering-select col-sm-2")
210
+ .attr("data-input-for", inputFor)
211
+ .css("float", this.element.css("float"));
212
+ },
213
+
214
+ _initAutocomplete: function () {
215
+ var self = this;
216
+
217
+ return this.input.autocomplete({
218
+ delay: this.options.searchDelay,
219
+ minLength: this.options.minLength,
220
+ source: this._getSourceFunction(this.options.source),
221
+ select: function (event, ui) {
222
+ var option = $("<option>")
223
+ .attr("value", ui.item.id)
224
+ .attr("selected", "selected")
225
+ .text(ui.item.value);
226
+ self.element.html(option).trigger("change", ui.item.id);
227
+ self._trigger("selected", event, {
228
+ item: option,
229
+ });
230
+ $(self.element.parents(".controls")[0])
231
+ .find(".update")
232
+ .removeClass("disabled");
233
+ },
234
+ change: function (event, ui) {
235
+ if (ui.item) {
236
+ return;
237
+ }
238
+
239
+ var matcher = new RegExp(
240
+ "^" + $.ui.autocomplete.escapeRegex($(this).val()) + "$",
241
+ "i"
242
+ );
243
+ var valid = false;
244
+
245
+ self.element.children("option").each(function () {
246
+ if ($(this).text().match(matcher)) {
247
+ valid = true;
248
+ return false;
249
+ }
250
+ });
251
+
252
+ if (valid || $(this).val() !== "") {
253
+ return;
254
+ }
255
+
256
+ // remove invalid value, as it didn't match anything
257
+ $(this).val(null);
258
+ self.element.html(
259
+ $('<option value="" selected="selected"></option>')
260
+ );
261
+ self.input.data("ui-autocomplete").term = "";
262
+ $(self.element.parents(".controls")[0])
263
+ .find(".update")
264
+ .addClass("disabled");
265
+ return false;
266
+ },
267
+ });
268
+ },
269
+
270
+ _initKeyEvent: function () {
271
+ var self = this;
272
+
273
+ return this.input.keyup(function () {
274
+ if ($(this).val().length) {
275
+ return;
276
+ }
277
+
278
+ /* Clear select options and trigger change if selected item is deleted */
279
+ return self.element
280
+ .html($('<option value="" selected="selected"></option>'))
281
+ .trigger("change");
282
+ });
283
+ },
284
+
285
+ _overloadRenderItem: function () {
286
+ this.input.data("ui-autocomplete")._renderItem = function (ul, item) {
287
+ return $("<li></li>")
288
+ .data("ui-autocomplete-item", item)
289
+ .append($("<a></a>").html(item.html || item.id))
290
+ .appendTo(ul);
291
+ };
292
+ },
293
+
294
+ destroy: function () {
295
+ this.input.remove();
296
+ this.button.remove();
297
+ this.element.show();
298
+ this.filtering_select.remove();
299
+ $.Widget.prototype.destroy.call(this);
300
+ },
301
+ });
302
+ })(jQuery);