rails_marketplace 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (424) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +37 -0
  5. data/app/assets/javascripts/rails_marketplace/application.js +46 -0
  6. data/app/assets/javascripts/rails_marketplace/catalog.coffee +3 -0
  7. data/app/assets/javascripts/rails_marketplace/flash.js +6 -0
  8. data/app/assets/javascripts/rails_marketplace/footermanifest.js +1 -0
  9. data/app/assets/javascripts/rails_marketplace/js/autocomplete/countries.js +267 -0
  10. data/app/assets/javascripts/rails_marketplace/js/autocomplete/jquery.autocomplete.js +986 -0
  11. data/app/assets/javascripts/rails_marketplace/js/bootstrap.min.js +7 -0
  12. data/app/assets/javascripts/rails_marketplace/js/calendar/fullcalendar.min.js +9 -0
  13. data/app/assets/javascripts/rails_marketplace/js/chartjs/chart.min.js +14 -0
  14. data/app/assets/javascripts/rails_marketplace/js/colorpicker/bootstrap-colorpicker.min.js +1087 -0
  15. data/app/assets/javascripts/rails_marketplace/js/colorpicker/docs.js +17 -0
  16. data/app/assets/javascripts/rails_marketplace/js/cropping/cropper.min.js +10 -0
  17. data/app/assets/javascripts/rails_marketplace/js/cropping/main.js +321 -0
  18. data/app/assets/javascripts/rails_marketplace/js/cropping/main2.js +160 -0
  19. data/app/assets/javascripts/rails_marketplace/js/custom.js +380 -0
  20. data/app/assets/javascripts/rails_marketplace/js/datatables/buttons.bootstrap.min.css +1 -0
  21. data/app/assets/javascripts/rails_marketplace/js/datatables/buttons.bootstrap.min.js +6 -0
  22. data/app/assets/javascripts/rails_marketplace/js/datatables/buttons.html5.min.js +22 -0
  23. data/app/assets/javascripts/rails_marketplace/js/datatables/buttons.print.min.js +4 -0
  24. data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.bootstrap.js +8 -0
  25. data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.buttons.min.js +36 -0
  26. data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.fixedHeader.min.js +17 -0
  27. data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.keyTable.min.js +18 -0
  28. data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.responsive.min.js +25 -0
  29. data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.scroller.min.js +26 -0
  30. data/app/assets/javascripts/rails_marketplace/js/datatables/fixedHeader.bootstrap.min.css +1 -0
  31. data/app/assets/javascripts/rails_marketplace/js/datatables/jquery.dataTables.min.css +333 -0
  32. data/app/assets/javascripts/rails_marketplace/js/datatables/jquery.dataTables.min.js +166 -0
  33. data/app/assets/javascripts/rails_marketplace/js/datatables/json/scroller-demo.json +2502 -0
  34. data/app/assets/javascripts/rails_marketplace/js/datatables/jszip.min.js +14 -0
  35. data/app/assets/javascripts/rails_marketplace/js/datatables/pdfmake.min.js +22 -0
  36. data/app/assets/javascripts/rails_marketplace/js/datatables/responsive.bootstrap.min.css +1 -0
  37. data/app/assets/javascripts/rails_marketplace/js/datatables/responsive.bootstrap.min.js +7 -0
  38. data/app/assets/javascripts/rails_marketplace/js/datatables/scroller.bootstrap.min.css +1 -0
  39. data/app/assets/javascripts/rails_marketplace/js/datatables/vfs_fonts.js +1 -0
  40. data/app/assets/javascripts/rails_marketplace/js/datepicker/daterangepicker.js +1 -0
  41. data/app/assets/javascripts/rails_marketplace/js/dropzone/dropzone.js +2 -0
  42. data/app/assets/javascripts/rails_marketplace/js/easypie/jquery.easypiechart.min.js +9 -0
  43. data/app/assets/javascripts/rails_marketplace/js/echart/echarts-all.js +35 -0
  44. data/app/assets/javascripts/rails_marketplace/js/echart/green.js +212 -0
  45. data/app/assets/javascripts/rails_marketplace/js/editor/bootstrap-wysiwyg.js +200 -0
  46. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-apollo.js +2 -0
  47. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-basic.js +3 -0
  48. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-clj.js +18 -0
  49. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-css.js +2 -0
  50. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-dart.js +3 -0
  51. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-erlang.js +2 -0
  52. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-go.js +1 -0
  53. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-hs.js +2 -0
  54. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-lisp.js +3 -0
  55. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-llvm.js +1 -0
  56. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-lua.js +2 -0
  57. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-matlab.js +6 -0
  58. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-ml.js +2 -0
  59. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-mumps.js +2 -0
  60. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-n.js +4 -0
  61. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-pascal.js +3 -0
  62. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-proto.js +1 -0
  63. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-r.js +2 -0
  64. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-rd.js +1 -0
  65. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-scala.js +2 -0
  66. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-sql.js +2 -0
  67. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-tcl.js +3 -0
  68. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-tex.js +1 -0
  69. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-vb.js +2 -0
  70. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-vhdl.js +3 -0
  71. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-wiki.js +2 -0
  72. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-xq.js +3 -0
  73. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-yaml.js +2 -0
  74. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/prettify.js +30 -0
  75. data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/run_prettify.js +34 -0
  76. data/app/assets/javascripts/rails_marketplace/js/editor/external/jquery.hotkeys.js +100 -0
  77. data/app/assets/javascripts/rails_marketplace/js/flot/curvedLines.js +483 -0
  78. data/app/assets/javascripts/rails_marketplace/js/flot/date.js +104 -0
  79. data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.js +2 -0
  80. data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.orderBars.js +201 -0
  81. data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.pie.js +820 -0
  82. data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.resize.js +57 -0
  83. data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.spline.js +212 -0
  84. data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.stack.js +188 -0
  85. data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.time.min.js +1 -0
  86. data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.tooltip.min.js +12 -0
  87. data/app/assets/javascripts/rails_marketplace/js/gauge/gauge.min.js +1 -0
  88. data/app/assets/javascripts/rails_marketplace/js/gauge/gauge_demo.js +21 -0
  89. data/app/assets/javascripts/rails_marketplace/js/icheck/icheck.min.js +11 -0
  90. data/app/assets/javascripts/rails_marketplace/js/input_mask/jquery.inputmask.js +2 -0
  91. data/app/assets/javascripts/rails_marketplace/js/ion_range/ion.rangeSlider.min.js +66 -0
  92. data/app/assets/javascripts/rails_marketplace/js/jquery.min.js +5 -0
  93. data/app/assets/javascripts/rails_marketplace/js/knob/jquery.knob.min.js +1 -0
  94. data/app/assets/javascripts/rails_marketplace/js/maps/gdp-data.js +185 -0
  95. data/app/assets/javascripts/rails_marketplace/js/maps/jquery-jvectormap-2.0.3.min.js +2 -0
  96. data/app/assets/javascripts/rails_marketplace/js/maps/jquery-jvectormap-us-aea-en.js +1 -0
  97. data/app/assets/javascripts/rails_marketplace/js/maps/jquery-jvectormap-world-mill-en.js +1 -0
  98. data/app/assets/javascripts/rails_marketplace/js/maps/us-unemployment.json +1 -0
  99. data/app/assets/javascripts/rails_marketplace/js/moment/moment.min.js +7 -0
  100. data/app/assets/javascripts/rails_marketplace/js/moris/example.js +127 -0
  101. data/app/assets/javascripts/rails_marketplace/js/moris/morris.min.js +7 -0
  102. data/app/assets/javascripts/rails_marketplace/js/moris/raphael-min.js +11 -0
  103. data/app/assets/javascripts/rails_marketplace/js/notify/pnotify.buttons.js +132 -0
  104. data/app/assets/javascripts/rails_marketplace/js/notify/pnotify.core.js +1 -0
  105. data/app/assets/javascripts/rails_marketplace/js/notify/pnotify.nonblock.js +151 -0
  106. data/app/assets/javascripts/rails_marketplace/js/nprogress.js +476 -0
  107. data/app/assets/javascripts/rails_marketplace/js/pace/pace.min.js +2 -0
  108. data/app/assets/javascripts/rails_marketplace/js/parsley/parsley.min.js +9 -0
  109. data/app/assets/javascripts/rails_marketplace/js/progressbar/bootstrap-progressbar.min.js +2 -0
  110. data/app/assets/javascripts/rails_marketplace/js/select/select2.full.js +2 -0
  111. data/app/assets/javascripts/rails_marketplace/js/sidebar/classie.js +80 -0
  112. data/app/assets/javascripts/rails_marketplace/js/sidebar/component.css +569 -0
  113. data/app/assets/javascripts/rails_marketplace/js/sidebar/modernizr.custom.js +4 -0
  114. data/app/assets/javascripts/rails_marketplace/js/sidebar/sidebarEffects.js +63 -0
  115. data/app/assets/javascripts/rails_marketplace/js/skycons/skycons.min.js +1 -0
  116. data/app/assets/javascripts/rails_marketplace/js/sparkline/jquery.sparkline.min.js +5 -0
  117. data/app/assets/javascripts/rails_marketplace/js/switchery/switchery.min.js +1 -0
  118. data/app/assets/javascripts/rails_marketplace/js/tags/jquery.tagsinput.min.js +1 -0
  119. data/app/assets/javascripts/rails_marketplace/js/textarea/autosize.min.js +6 -0
  120. data/app/assets/javascripts/rails_marketplace/js/validator/validator.js +411 -0
  121. data/app/assets/javascripts/rails_marketplace/js/wizard/jquery.smartWizard.js +489 -0
  122. data/app/assets/javascripts/rails_marketplace/less/custom.css +6355 -0
  123. data/app/assets/javascripts/rails_marketplace/marketplace.js +17 -0
  124. data/app/assets/javascripts/rails_marketplace/welcome.coffee +3 -0
  125. data/app/assets/stylesheets/rails_marketplace/application.scss +31 -0
  126. data/app/assets/stylesheets/rails_marketplace/catalog.scss +132 -0
  127. data/app/assets/stylesheets/rails_marketplace/css/animate.min.css +11 -0
  128. data/app/assets/stylesheets/rails_marketplace/css/bootstrap.min.css +6 -0
  129. data/app/assets/stylesheets/rails_marketplace/css/calendar/fullcalendar.css +1116 -0
  130. data/app/assets/stylesheets/rails_marketplace/css/calendar/fullcalendar.min.css +5 -0
  131. data/app/assets/stylesheets/rails_marketplace/css/calendar/fullcalendar.print.css +208 -0
  132. data/app/assets/stylesheets/rails_marketplace/css/colorpicker/bootstrap-colorpicker.min.css +9 -0
  133. data/app/assets/stylesheets/rails_marketplace/css/colorpicker/img/bootstrap-colorpicker/alpha-horizontal.png +0 -0
  134. data/app/assets/stylesheets/rails_marketplace/css/colorpicker/img/bootstrap-colorpicker/alpha.png +0 -0
  135. data/app/assets/stylesheets/rails_marketplace/css/colorpicker/img/bootstrap-colorpicker/hue-horizontal.png +0 -0
  136. data/app/assets/stylesheets/rails_marketplace/css/colorpicker/img/bootstrap-colorpicker/hue.png +0 -0
  137. data/app/assets/stylesheets/rails_marketplace/css/colorpicker/img/bootstrap-colorpicker/saturation.png +0 -0
  138. data/app/assets/stylesheets/rails_marketplace/css/custom.css +5347 -0
  139. data/app/assets/stylesheets/rails_marketplace/css/datatables/css/demo_page.css +103 -0
  140. data/app/assets/stylesheets/rails_marketplace/css/datatables/css/demo_table.css +258 -0
  141. data/app/assets/stylesheets/rails_marketplace/css/datatables/css/demo_table_jui.css +501 -0
  142. data/app/assets/stylesheets/rails_marketplace/css/datatables/css/jquery.dataTables.css +221 -0
  143. data/app/assets/stylesheets/rails_marketplace/css/datatables/css/jquery.dataTables_themeroller.css +244 -0
  144. data/app/assets/stylesheets/rails_marketplace/css/datatables/images/Sorting icons.psd +0 -0
  145. data/app/assets/stylesheets/rails_marketplace/css/datatables/images/back_disabled.png +0 -0
  146. data/app/assets/stylesheets/rails_marketplace/css/datatables/images/back_enabled.png +0 -0
  147. data/app/assets/stylesheets/rails_marketplace/css/datatables/images/back_enabled_hover.png +0 -0
  148. data/app/assets/stylesheets/rails_marketplace/css/datatables/images/favicon.ico +0 -0
  149. data/app/assets/stylesheets/rails_marketplace/css/datatables/images/forward_disabled.png +0 -0
  150. data/app/assets/stylesheets/rails_marketplace/css/datatables/images/forward_enabled.png +0 -0
  151. data/app/assets/stylesheets/rails_marketplace/css/datatables/images/forward_enabled_hover.png +0 -0
  152. data/app/assets/stylesheets/rails_marketplace/css/datatables/images/sort_asc.png +0 -0
  153. data/app/assets/stylesheets/rails_marketplace/css/datatables/images/sort_asc_disabled.png +0 -0
  154. data/app/assets/stylesheets/rails_marketplace/css/datatables/images/sort_both.png +0 -0
  155. data/app/assets/stylesheets/rails_marketplace/css/datatables/images/sort_desc.png +0 -0
  156. data/app/assets/stylesheets/rails_marketplace/css/datatables/images/sort_desc_disabled.png +0 -0
  157. data/app/assets/stylesheets/rails_marketplace/css/datatables/tools/css/dataTables.tableTools.css +336 -0
  158. data/app/assets/stylesheets/rails_marketplace/css/editor/external/google-code-prettify/prettify.css +1 -0
  159. data/app/assets/stylesheets/rails_marketplace/css/editor/index.css +42 -0
  160. data/app/assets/stylesheets/rails_marketplace/css/floatexamples.css +22 -0
  161. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/_all.css +530 -0
  162. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/aero.css +53 -0
  163. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/aero.png +0 -0
  164. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/aero@2x.png +0 -0
  165. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/blue.css +53 -0
  166. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/blue.png +0 -0
  167. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/blue@2x.png +0 -0
  168. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/flat.css +53 -0
  169. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/flat.png +0 -0
  170. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/flat@2x.png +0 -0
  171. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/green.css +53 -0
  172. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/green.png +0 -0
  173. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/green@2x.png +0 -0
  174. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/grey.css +53 -0
  175. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/grey.png +0 -0
  176. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/grey@2x.png +0 -0
  177. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/orange.css +53 -0
  178. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/orange.png +0 -0
  179. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/orange@2x.png +0 -0
  180. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/pink.css +53 -0
  181. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/pink.png +0 -0
  182. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/pink@2x.png +0 -0
  183. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/purple.css +53 -0
  184. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/purple.png +0 -0
  185. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/purple@2x.png +0 -0
  186. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/red.css +53 -0
  187. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/red.png +0 -0
  188. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/red@2x.png +0 -0
  189. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/yellow.css +53 -0
  190. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/yellow.png +0 -0
  191. data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/yellow@2x.png +0 -0
  192. data/app/assets/stylesheets/rails_marketplace/css/ion.rangeSlider.css +146 -0
  193. data/app/assets/stylesheets/rails_marketplace/css/ion.rangeSlider.skinFlat.css +106 -0
  194. data/app/assets/stylesheets/rails_marketplace/css/maps/jquery-jvectormap-2.0.3.css +135 -0
  195. data/app/assets/stylesheets/rails_marketplace/css/normalize.css +421 -0
  196. data/app/assets/stylesheets/rails_marketplace/css/nprogress.css +74 -0
  197. data/app/assets/stylesheets/rails_marketplace/css/progressbar/bootstrap-progressbar-3.3.0.css +161 -0
  198. data/app/assets/stylesheets/rails_marketplace/css/select/select2.min.css +404 -0
  199. data/app/assets/stylesheets/rails_marketplace/css/switchery/switchery.min.css +1 -0
  200. data/app/assets/stylesheets/rails_marketplace/fonts/css/font-awesome.css +2086 -0
  201. data/app/assets/stylesheets/rails_marketplace/fonts/css/font-awesome.min.css +4 -0
  202. data/app/assets/stylesheets/rails_marketplace/fonts/fonts/FontAwesome.otf +0 -0
  203. data/app/assets/stylesheets/rails_marketplace/fonts/fonts/fontawesome-webfont.eot +0 -0
  204. data/app/assets/stylesheets/rails_marketplace/fonts/fonts/fontawesome-webfont.svg +655 -0
  205. data/app/assets/stylesheets/rails_marketplace/fonts/fonts/fontawesome-webfont.ttf +0 -0
  206. data/app/assets/stylesheets/rails_marketplace/fonts/fonts/fontawesome-webfont.woff +0 -0
  207. data/app/assets/stylesheets/rails_marketplace/fonts/fonts/fontawesome-webfont.woff2 +0 -0
  208. data/app/assets/stylesheets/rails_marketplace/fonts/glyphicons-halflings-regular.eot +0 -0
  209. data/app/assets/stylesheets/rails_marketplace/fonts/glyphicons-halflings-regular.svg +288 -0
  210. data/app/assets/stylesheets/rails_marketplace/fonts/glyphicons-halflings-regular.ttf +0 -0
  211. data/app/assets/stylesheets/rails_marketplace/fonts/glyphicons-halflings-regular.woff +0 -0
  212. data/app/assets/stylesheets/rails_marketplace/fonts/glyphicons-halflings-regular.woff2 +0 -0
  213. data/app/assets/stylesheets/rails_marketplace/fonts/less/animated.less +34 -0
  214. data/app/assets/stylesheets/rails_marketplace/fonts/less/bordered-pulled.less +25 -0
  215. data/app/assets/stylesheets/rails_marketplace/fonts/less/core.less +12 -0
  216. data/app/assets/stylesheets/rails_marketplace/fonts/less/fixed-width.less +6 -0
  217. data/app/assets/stylesheets/rails_marketplace/fonts/less/font-awesome.less +17 -0
  218. data/app/assets/stylesheets/rails_marketplace/fonts/less/icons.less +697 -0
  219. data/app/assets/stylesheets/rails_marketplace/fonts/less/larger.less +13 -0
  220. data/app/assets/stylesheets/rails_marketplace/fonts/less/list.less +19 -0
  221. data/app/assets/stylesheets/rails_marketplace/fonts/less/mixins.less +26 -0
  222. data/app/assets/stylesheets/rails_marketplace/fonts/less/path.less +15 -0
  223. data/app/assets/stylesheets/rails_marketplace/fonts/less/rotated-flipped.less +20 -0
  224. data/app/assets/stylesheets/rails_marketplace/fonts/less/spinning.less +29 -0
  225. data/app/assets/stylesheets/rails_marketplace/fonts/less/stacked.less +20 -0
  226. data/app/assets/stylesheets/rails_marketplace/fonts/less/variables.less +708 -0
  227. data/app/assets/stylesheets/rails_marketplace/fonts/scss/_animated.scss +34 -0
  228. data/app/assets/stylesheets/rails_marketplace/fonts/scss/_bordered-pulled.scss +25 -0
  229. data/app/assets/stylesheets/rails_marketplace/fonts/scss/_core.scss +12 -0
  230. data/app/assets/stylesheets/rails_marketplace/fonts/scss/_fixed-width.scss +6 -0
  231. data/app/assets/stylesheets/rails_marketplace/fonts/scss/_icons.scss +697 -0
  232. data/app/assets/stylesheets/rails_marketplace/fonts/scss/_larger.scss +13 -0
  233. data/app/assets/stylesheets/rails_marketplace/fonts/scss/_list.scss +19 -0
  234. data/app/assets/stylesheets/rails_marketplace/fonts/scss/_mixins.scss +26 -0
  235. data/app/assets/stylesheets/rails_marketplace/fonts/scss/_path.scss +15 -0
  236. data/app/assets/stylesheets/rails_marketplace/fonts/scss/_rotated-flipped.scss +20 -0
  237. data/app/assets/stylesheets/rails_marketplace/fonts/scss/_spinning.scss +29 -0
  238. data/app/assets/stylesheets/rails_marketplace/fonts/scss/_stacked.scss +20 -0
  239. data/app/assets/stylesheets/rails_marketplace/fonts/scss/_variables.scss +708 -0
  240. data/app/assets/stylesheets/rails_marketplace/fonts/scss/font-awesome.scss +17 -0
  241. data/app/assets/stylesheets/rails_marketplace/images/1.png +0 -0
  242. data/app/assets/stylesheets/rails_marketplace/images/4.jpg +0 -0
  243. data/app/assets/stylesheets/rails_marketplace/images/american-express.png +0 -0
  244. data/app/assets/stylesheets/rails_marketplace/images/back_disabled.png +0 -0
  245. data/app/assets/stylesheets/rails_marketplace/images/back_enabled.png +0 -0
  246. data/app/assets/stylesheets/rails_marketplace/images/back_enabled_hover.png +0 -0
  247. data/app/assets/stylesheets/rails_marketplace/images/bootstrap-colorpicker/alpha-horizontal.png +0 -0
  248. data/app/assets/stylesheets/rails_marketplace/images/bootstrap-colorpicker/alpha.png +0 -0
  249. data/app/assets/stylesheets/rails_marketplace/images/bootstrap-colorpicker/hue-horizontal.png +0 -0
  250. data/app/assets/stylesheets/rails_marketplace/images/bootstrap-colorpicker/hue.png +0 -0
  251. data/app/assets/stylesheets/rails_marketplace/images/bootstrap-colorpicker/saturation.png +0 -0
  252. data/app/assets/stylesheets/rails_marketplace/images/data.png +0 -0
  253. data/app/assets/stylesheets/rails_marketplace/images/favicon.ico +0 -0
  254. data/app/assets/stylesheets/rails_marketplace/images/forward_disabled.png +0 -0
  255. data/app/assets/stylesheets/rails_marketplace/images/forward_enabled.png +0 -0
  256. data/app/assets/stylesheets/rails_marketplace/images/forward_enabled_hover.png +0 -0
  257. data/app/assets/stylesheets/rails_marketplace/images/icons.png +0 -0
  258. data/app/assets/stylesheets/rails_marketplace/images/img.jpg +0 -0
  259. data/app/assets/stylesheets/rails_marketplace/images/loading.gif +0 -0
  260. data/app/assets/stylesheets/rails_marketplace/images/mastercard.png +0 -0
  261. data/app/assets/stylesheets/rails_marketplace/images/paypal2.png +0 -0
  262. data/app/assets/stylesheets/rails_marketplace/images/picture-2.jpg +0 -0
  263. data/app/assets/stylesheets/rails_marketplace/images/picture.jpg +0 -0
  264. data/app/assets/stylesheets/rails_marketplace/images/picture2.jpg +0 -0
  265. data/app/assets/stylesheets/rails_marketplace/images/prod1.jpg +0 -0
  266. data/app/assets/stylesheets/rails_marketplace/images/prod2.jpg +0 -0
  267. data/app/assets/stylesheets/rails_marketplace/images/prod3.jpg +0 -0
  268. data/app/assets/stylesheets/rails_marketplace/images/prod4.jpg +0 -0
  269. data/app/assets/stylesheets/rails_marketplace/images/prod5.jpg +0 -0
  270. data/app/assets/stylesheets/rails_marketplace/images/sprite-skin-flat.png +0 -0
  271. data/app/assets/stylesheets/rails_marketplace/images/sprite-skin-modern.png +0 -0
  272. data/app/assets/stylesheets/rails_marketplace/images/sprite-skin-nice.png +0 -0
  273. data/app/assets/stylesheets/rails_marketplace/images/sprite-skin-simple.png +0 -0
  274. data/app/assets/stylesheets/rails_marketplace/images/user.png +0 -0
  275. data/app/assets/stylesheets/rails_marketplace/images/visa.png +0 -0
  276. data/app/assets/stylesheets/rails_marketplace/marketplace.scss +20 -0
  277. data/app/assets/stylesheets/rails_marketplace/pace.css +76 -0
  278. data/app/assets/stylesheets/rails_marketplace/welcome.scss +3 -0
  279. data/app/assets/stylesheets/scaffold.css +56 -0
  280. data/app/controllers/rails_marketplace/admin_controller.rb +151 -0
  281. data/app/controllers/rails_marketplace/application_controller.rb +4 -0
  282. data/app/controllers/rails_marketplace/catalog_controller.rb +172 -0
  283. data/app/controllers/rails_marketplace/seller_controller.rb +181 -0
  284. data/app/helpers/rails_marketplace/admin_helper.rb +16 -0
  285. data/app/helpers/rails_marketplace/application_helper.rb +4 -0
  286. data/app/helpers/rails_marketplace/catalog_helper.rb +4 -0
  287. data/app/helpers/rails_marketplace/plainpage_helper.rb +4 -0
  288. data/app/helpers/rails_marketplace/seller_helper.rb +16 -0
  289. data/app/models/rails_marketplace/admin.rb +10 -0
  290. data/app/models/rails_marketplace/admin_setting.rb +13 -0
  291. data/app/models/rails_marketplace/cart.rb +49 -0
  292. data/app/models/rails_marketplace/cart_product.rb +7 -0
  293. data/app/models/rails_marketplace/category.rb +22 -0
  294. data/app/models/rails_marketplace/category_product.rb +6 -0
  295. data/app/models/rails_marketplace/customer.rb +6 -0
  296. data/app/models/rails_marketplace/order.rb +22 -0
  297. data/app/models/rails_marketplace/order_product.rb +7 -0
  298. data/app/models/rails_marketplace/product.rb +34 -0
  299. data/app/models/rails_marketplace/seller.rb +13 -0
  300. data/app/models/rails_marketplace/seller_setting.rb +5 -0
  301. data/app/views/layouts/rails_marketplace/application.html.erb +37 -0
  302. data/app/views/layouts/rails_marketplace/seller_central.html.erb +58 -0
  303. data/app/views/layouts/rails_marketplace/super_admin.html.erb +58 -0
  304. data/app/views/rails_marketplace/admin/add_category.html.erb +63 -0
  305. data/app/views/rails_marketplace/admin/categories.html.erb +50 -0
  306. data/app/views/rails_marketplace/admin/category_products.html.erb +54 -0
  307. data/app/views/rails_marketplace/admin/dashboard.html.erb +50 -0
  308. data/app/views/rails_marketplace/admin/edit_category.html.erb +63 -0
  309. data/app/views/rails_marketplace/admin/login_form.html.erb +20 -0
  310. data/app/views/rails_marketplace/admin/products.html.erb +54 -0
  311. data/app/views/rails_marketplace/admin/seller_products.html.erb +54 -0
  312. data/app/views/rails_marketplace/admin/sellers.html.erb +48 -0
  313. data/app/views/rails_marketplace/admin/settings_form.html.erb +39 -0
  314. data/app/views/rails_marketplace/admin/signup_form.html.erb +25 -0
  315. data/app/views/rails_marketplace/catalog/cart.html.erb +80 -0
  316. data/app/views/rails_marketplace/catalog/category_products.html.erb +52 -0
  317. data/app/views/rails_marketplace/catalog/checkout.html.erb +207 -0
  318. data/app/views/rails_marketplace/catalog/checkout_success.html.erb +15 -0
  319. data/app/views/rails_marketplace/catalog/index.html.erb +1 -0
  320. data/app/views/rails_marketplace/catalog/product_detail.html.erb +88 -0
  321. data/app/views/rails_marketplace/partials/_admin_sidenav.html.erb +80 -0
  322. data/app/views/rails_marketplace/partials/_admin_topnav.html.erb +111 -0
  323. data/app/views/rails_marketplace/partials/_footer.html.erb +19 -0
  324. data/app/views/rails_marketplace/partials/_menu.html.erb +42 -0
  325. data/app/views/rails_marketplace/partials/_sidenav.html.erb +77 -0
  326. data/app/views/rails_marketplace/partials/_topnav.html.erb +105 -0
  327. data/app/views/rails_marketplace/seller/add_bulk_products.html.erb +0 -0
  328. data/app/views/rails_marketplace/seller/add_product.html.erb +67 -0
  329. data/app/views/rails_marketplace/seller/dashboard.html.erb +50 -0
  330. data/app/views/rails_marketplace/seller/edit_product.html.erb +69 -0
  331. data/app/views/rails_marketplace/seller/login_form.html.erb +36 -0
  332. data/app/views/rails_marketplace/seller/order_details.html.erb +69 -0
  333. data/app/views/rails_marketplace/seller/orders.html.erb +68 -0
  334. data/app/views/rails_marketplace/seller/products.html.erb +55 -0
  335. data/app/views/rails_marketplace/seller/settings_general.html.erb +64 -0
  336. data/app/views/rails_marketplace/seller/settings_payment.html.erb +34 -0
  337. data/app/views/rails_marketplace/seller/settings_shipping.html.erb +34 -0
  338. data/app/views/rails_marketplace/seller/settings_tax.html.erb +34 -0
  339. data/app/views/rails_marketplace/seller/signup_form.html.erb +28 -0
  340. data/app/views/rails_marketplace/seller/step_two.html.erb +17 -0
  341. data/app/views/rails_marketplace/shared/_admin_error_messages.html.erb +12 -0
  342. data/app/views/rails_marketplace/shared/_product_error_messages.html.erb +12 -0
  343. data/app/views/rails_marketplace/shared/_seller_error_messages.html.erb +12 -0
  344. data/config/routes.rb +58 -0
  345. data/db/migrate/20161013194852_create_sellers.rb +13 -0
  346. data/db/migrate/20161013195006_create_customers.rb +13 -0
  347. data/db/migrate/20161013195758_create_orders.rb +8 -0
  348. data/db/migrate/20161014013032_create_category_products.rb +10 -0
  349. data/db/migrate/20161014013058_create_order_products.rb +13 -0
  350. data/db/migrate/20161017185755_create_admins.rb +12 -0
  351. data/db/migrate/20161017232347_create_products.rb +14 -0
  352. data/db/migrate/20161019012043_add_reference_product_seller.rb +5 -0
  353. data/db/migrate/20161019013502_change_data_type_images_files.rb +6 -0
  354. data/db/migrate/20161019022020_add_reference_order_customers.rb +5 -0
  355. data/db/migrate/20161109191644_create_categories.rb +15 -0
  356. data/db/migrate/20161110021043_create_friendly_id_slugs.rb +15 -0
  357. data/db/migrate/20161110021131_add_slug_to_category.rb +6 -0
  358. data/db/migrate/20161110024118_add_slug_to_product.rb +6 -0
  359. data/db/migrate/20161111001446_create_carts.rb +8 -0
  360. data/db/migrate/20161111004451_create_cart_products.rb +12 -0
  361. data/db/migrate/20161115013956_add_currency_format_to_price.rb +6 -0
  362. data/db/migrate/20161115015227_monetize_product.rb +5 -0
  363. data/db/migrate/20161115032905_add_stripe_key_to_admin.rb +6 -0
  364. data/db/migrate/20161124015608_add_order_fields.rb +16 -0
  365. data/db/migrate/20161207193917_add_seller_to_orders.rb +6 -0
  366. data/db/migrate/20161208012601_add_price_to_cart_products.rb +6 -0
  367. data/db/migrate/20161208013402_add_money_to_cart_products.rb +6 -0
  368. data/db/migrate/20170217183953_create_seller_settings.rb +29 -0
  369. data/db/migrate/20170218003202_create_admin_settings.rb +24 -0
  370. data/db/migrate/20170224230449_create_stripe_managed_accounts.rb +9 -0
  371. data/db/migrate/20170224233736_add_stripe_to_admin_settings.rb +9 -0
  372. data/db/migrate/20170224235259_add_id_to_settings.rb +6 -0
  373. data/db/migrate/20170225002939_delete_stripe_accounts.rb +8 -0
  374. data/db/migrate/20170225003252_add_stripe_account_id_to_seller_settings.rb +5 -0
  375. data/lib/rails_marketplace.rb +4 -0
  376. data/lib/rails_marketplace/engine.rb +9 -0
  377. data/lib/rails_marketplace/version.rb +3 -0
  378. data/lib/tasks/rails_marketplace_tasks.rake +4 -0
  379. data/spec/controllers/rails_marketplace/catalog_controller_spec.rb +75 -0
  380. data/spec/dummy/README.rdoc +28 -0
  381. data/spec/dummy/Rakefile +6 -0
  382. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  383. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  384. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  385. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  386. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  387. data/spec/dummy/bin/bundle +3 -0
  388. data/spec/dummy/bin/rails +4 -0
  389. data/spec/dummy/bin/rake +4 -0
  390. data/spec/dummy/bin/setup +29 -0
  391. data/spec/dummy/config.ru +4 -0
  392. data/spec/dummy/config/application.rb +32 -0
  393. data/spec/dummy/config/boot.rb +5 -0
  394. data/spec/dummy/config/database.yml +25 -0
  395. data/spec/dummy/config/environment.rb +5 -0
  396. data/spec/dummy/config/environments/development.rb +41 -0
  397. data/spec/dummy/config/environments/production.rb +79 -0
  398. data/spec/dummy/config/environments/test.rb +42 -0
  399. data/spec/dummy/config/initializers/assets.rb +11 -0
  400. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  401. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  402. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  403. data/spec/dummy/config/initializers/inflections.rb +16 -0
  404. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  405. data/spec/dummy/config/initializers/session_store.rb +3 -0
  406. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  407. data/spec/dummy/config/locales/en.yml +23 -0
  408. data/spec/dummy/config/routes.rb +4 -0
  409. data/spec/dummy/config/secrets.yml +22 -0
  410. data/spec/dummy/db/schema.rb +194 -0
  411. data/spec/dummy/log/development.log +889 -0
  412. data/spec/dummy/log/test.log +1229 -0
  413. data/spec/dummy/public/404.html +67 -0
  414. data/spec/dummy/public/422.html +67 -0
  415. data/spec/dummy/public/500.html +66 -0
  416. data/spec/dummy/public/favicon.ico +0 -0
  417. data/spec/helpers/rails_marketplace/catalog_helper_spec.rb +17 -0
  418. data/spec/routing/rails_marketplace/catalog_routing_spec.rb +44 -0
  419. data/spec/spec_helper.rb +44 -0
  420. data/spec/views/rails_marketplace/catalog/edit.html.erb_spec.rb +15 -0
  421. data/spec/views/rails_marketplace/catalog/index.html.erb_spec.rb +15 -0
  422. data/spec/views/rails_marketplace/catalog/new.html.erb_spec.rb +15 -0
  423. data/spec/views/rails_marketplace/catalog/show.html.erb_spec.rb +12 -0
  424. metadata +595 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fec74d727841008cf24649828f950b5b6778ac693924d2ed79d39192e5e6177f
4
+ data.tar.gz: 31e19a5cf2045423371ad0f418797d4de07b032139f62cafccde24e64f53aa79
5
+ SHA512:
6
+ metadata.gz: 625375394975e80f68b2115ac31290c30e692bfe66c111ea002ac91ec1e4eee6a1d35f212e3a13a026f7a631813c846e5ebafe7df075cc8174b27fd3ca5f70f7
7
+ data.tar.gz: 8f89122b70ba1f9f599a36c563607aa7434df3ec435e27044ef0c9fe983412e2121fe124f3a367e4598e3f630fdd09482c15538bf9d627bf5bf61097daa36d81
@@ -0,0 +1,20 @@
1
+ Copyright 2017 Josh Yan
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ = RailsMarketplace
2
+
3
+ This project rocks and uses MIT-LICENSE.
@@ -0,0 +1,37 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'RailsMarketplace'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ Bundler::GemHelper.install_tasks
26
+
27
+ require 'rake/testtask'
28
+
29
+ Rake::TestTask.new(:test) do |t|
30
+ t.libs << 'lib'
31
+ t.libs << 'test'
32
+ t.pattern = 'test/**/*_test.rb'
33
+ t.verbose = false
34
+ end
35
+
36
+
37
+ task default: :test
@@ -0,0 +1,46 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require bootstrap-sprockets
15
+
16
+ //= require jquery_ujs
17
+ //= require turbolinks
18
+
19
+ //= require rails_marketplace/js/flot/jquery.flot.js
20
+ //= require rails_marketplace/js/flot/jquery.flot.pie.js
21
+ //= require rails_marketplace/js/flot/jquery.flot.orderBars.js
22
+ //= require rails_marketplace/js/flot/jquery.flot.time.min.js
23
+ //= require rails_marketplace/js/flot/date.js
24
+ //= require rails_marketplace/js/flot/jquery.flot.spline.js
25
+ //= require rails_marketplace/js/flot/jquery.flot.stack.js
26
+ //= require rails_marketplace/js/flot/curvedLines.js
27
+ //= require rails_marketplace/js/flot/jquery.flot.resize.js
28
+
29
+ //= require rails_marketplace/js/progressbar/bootstrap-progressbar.min.js
30
+
31
+ //= require rails_marketplace/js/icheck/icheck.min.js
32
+
33
+ //= require rails_marketplace/js/moment/moment.min.js
34
+ //= require rails_marketplace/js/datepicker/daterangepicker.js
35
+
36
+ //= require rails_marketplace/js/chartjs/chart.min.js
37
+
38
+ //= require rails_marketplace/js/pace/pace.min.js
39
+
40
+ //= require rails_marketplace/js/nprogress.js
41
+
42
+ //= require rails_marketplace/flash.js
43
+
44
+ //= require bootstrap-wysihtml5
45
+
46
+
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://coffeescript.org/
@@ -0,0 +1,6 @@
1
+ $(function() {
2
+ $('#flash').delay(500).fadeIn('normal', function() {
3
+ $(this).delay(2500).fadeOut();
4
+ });
5
+ });
6
+
@@ -0,0 +1 @@
1
+ //= require rails_marketplace/js/custom.js
@@ -0,0 +1,267 @@
1
+ var countries = {
2
+ "AD": "Andorra",
3
+ "A2": "Andorra Test",
4
+ "AE": "United Arab Emirates",
5
+ "AF": "Afghanistan",
6
+ "AG": "Antigua and Barbuda",
7
+ "AI": "Anguilla",
8
+ "AL": "Albania",
9
+ "AM": "Armenia",
10
+ "AN": "Netherlands Antilles",
11
+ "AO": "Angola",
12
+ "AQ": "Antarctica",
13
+ "AR": "Argentina",
14
+ "AS": "American Samoa",
15
+ "AT": "Austria",
16
+ "AU": "Australia",
17
+ "AW": "Aruba",
18
+ "AX": "\u00c5land Islands",
19
+ "AZ": "Azerbaijan",
20
+ "BA": "Bosnia and Herzegovina",
21
+ "BB": "Barbados",
22
+ "BD": "Bangladesh",
23
+ "BE": "Belgium",
24
+ "BF": "Burkina Faso",
25
+ "BG": "Bulgaria",
26
+ "BH": "Bahrain",
27
+ "BI": "Burundi",
28
+ "BJ": "Benin",
29
+ "BL": "Saint Barth\u00e9lemy",
30
+ "BM": "Bermuda",
31
+ "BN": "Brunei",
32
+ "BO": "Bolivia",
33
+ "BQ": "British Antarctic Territory",
34
+ "BR": "Brazil",
35
+ "BS": "Bahamas",
36
+ "BT": "Bhutan",
37
+ "BV": "Bouvet Island",
38
+ "BW": "Botswana",
39
+ "BY": "Belarus",
40
+ "BZ": "Belize",
41
+ "CA": "Canada",
42
+ "CC": "Cocos [Keeling] Islands",
43
+ "CD": "Congo - Kinshasa",
44
+ "CF": "Central African Republic",
45
+ "CG": "Congo - Brazzaville",
46
+ "CH": "Switzerland",
47
+ "CI": "C\u00f4te d\u2019Ivoire",
48
+ "CK": "Cook Islands",
49
+ "CL": "Chile",
50
+ "CM": "Cameroon",
51
+ "CN": "China",
52
+ "CO": "Colombia",
53
+ "CR": "Costa Rica",
54
+ "CS": "Serbia and Montenegro",
55
+ "CT": "Canton and Enderbury Islands",
56
+ "CU": "Cuba",
57
+ "CV": "Cape Verde",
58
+ "CX": "Christmas Island",
59
+ "CY": "Cyprus",
60
+ "CZ": "Czech Republic",
61
+ "DD": "East Germany",
62
+ "DE": "Germany",
63
+ "DJ": "Djibouti",
64
+ "DK": "Denmark",
65
+ "DM": "Dominica",
66
+ "DO": "Dominican Republic",
67
+ "DZ": "Algeria",
68
+ "EC": "Ecuador",
69
+ "EE": "Estonia",
70
+ "EG": "Egypt",
71
+ "EH": "Western Sahara",
72
+ "ER": "Eritrea",
73
+ "ES": "Spain",
74
+ "ET": "Ethiopia",
75
+ "FI": "Finland",
76
+ "FJ": "Fiji",
77
+ "FK": "Falkland Islands",
78
+ "FM": "Micronesia",
79
+ "FO": "Faroe Islands",
80
+ "FQ": "French Southern and Antarctic Territories",
81
+ "FR": "France",
82
+ "FX": "Metropolitan France",
83
+ "GA": "Gabon",
84
+ "GB": "United Kingdom",
85
+ "GD": "Grenada",
86
+ "GE": "Georgia",
87
+ "GF": "French Guiana",
88
+ "GG": "Guernsey",
89
+ "GH": "Ghana",
90
+ "GI": "Gibraltar",
91
+ "GL": "Greenland",
92
+ "GM": "Gambia",
93
+ "GN": "Guinea",
94
+ "GP": "Guadeloupe",
95
+ "GQ": "Equatorial Guinea",
96
+ "GR": "Greece",
97
+ "GS": "South Georgia and the South Sandwich Islands",
98
+ "GT": "Guatemala",
99
+ "GU": "Guam",
100
+ "GW": "Guinea-Bissau",
101
+ "GY": "Guyana",
102
+ "HK": "Hong Kong SAR China",
103
+ "HM": "Heard Island and McDonald Islands",
104
+ "HN": "Honduras",
105
+ "HR": "Croatia",
106
+ "HT": "Haiti",
107
+ "HU": "Hungary",
108
+ "ID": "Indonesia",
109
+ "IE": "Ireland",
110
+ "IL": "Israel",
111
+ "IM": "Isle of Man",
112
+ "IN": "India",
113
+ "IO": "British Indian Ocean Territory",
114
+ "IQ": "Iraq",
115
+ "IR": "Iran",
116
+ "IS": "Iceland",
117
+ "IT": "Italy",
118
+ "JE": "Jersey",
119
+ "JM": "Jamaica",
120
+ "JO": "Jordan",
121
+ "JP": "Japan",
122
+ "JT": "Johnston Island",
123
+ "KE": "Kenya",
124
+ "KG": "Kyrgyzstan",
125
+ "KH": "Cambodia",
126
+ "KI": "Kiribati",
127
+ "KM": "Comoros",
128
+ "KN": "Saint Kitts and Nevis",
129
+ "KP": "North Korea",
130
+ "KR": "South Korea",
131
+ "KW": "Kuwait",
132
+ "KY": "Cayman Islands",
133
+ "KZ": "Kazakhstan",
134
+ "LA": "Laos",
135
+ "LB": "Lebanon",
136
+ "LC": "Saint Lucia",
137
+ "LI": "Liechtenstein",
138
+ "LK": "Sri Lanka",
139
+ "LR": "Liberia",
140
+ "LS": "Lesotho",
141
+ "LT": "Lithuania",
142
+ "LU": "Luxembourg",
143
+ "LV": "Latvia",
144
+ "LY": "Libya",
145
+ "MA": "Morocco",
146
+ "MC": "Monaco",
147
+ "MD": "Moldova",
148
+ "ME": "Montenegro",
149
+ "MF": "Saint Martin",
150
+ "MG": "Madagascar",
151
+ "MH": "Marshall Islands",
152
+ "MI": "Midway Islands",
153
+ "MK": "Macedonia",
154
+ "ML": "Mali",
155
+ "MM": "Myanmar [Burma]",
156
+ "MN": "Mongolia",
157
+ "MO": "Macau SAR China",
158
+ "MP": "Northern Mariana Islands",
159
+ "MQ": "Martinique",
160
+ "MR": "Mauritania",
161
+ "MS": "Montserrat",
162
+ "MT": "Malta",
163
+ "MU": "Mauritius",
164
+ "MV": "Maldives",
165
+ "MW": "Malawi",
166
+ "MX": "Mexico",
167
+ "MY": "Malaysia",
168
+ "MZ": "Mozambique",
169
+ "NA": "Namibia",
170
+ "NC": "New Caledonia",
171
+ "NE": "Niger",
172
+ "NF": "Norfolk Island",
173
+ "NG": "Nigeria",
174
+ "NI": "Nicaragua",
175
+ "NL": "Netherlands",
176
+ "NO": "Norway",
177
+ "NP": "Nepal",
178
+ "NQ": "Dronning Maud Land",
179
+ "NR": "Nauru",
180
+ "NT": "Neutral Zone",
181
+ "NU": "Niue",
182
+ "NZ": "New Zealand",
183
+ "OM": "Oman",
184
+ "PA": "Panama",
185
+ "PC": "Pacific Islands Trust Territory",
186
+ "PE": "Peru",
187
+ "PF": "French Polynesia",
188
+ "PG": "Papua New Guinea",
189
+ "PH": "Philippines",
190
+ "PK": "Pakistan",
191
+ "PL": "Poland",
192
+ "PM": "Saint Pierre and Miquelon",
193
+ "PN": "Pitcairn Islands",
194
+ "PR": "Puerto Rico",
195
+ "PS": "Palestinian Territories",
196
+ "PT": "Portugal",
197
+ "PU": "U.S. Miscellaneous Pacific Islands",
198
+ "PW": "Palau",
199
+ "PY": "Paraguay",
200
+ "PZ": "Panama Canal Zone",
201
+ "QA": "Qatar",
202
+ "RE": "R\u00e9union",
203
+ "RO": "Romania",
204
+ "RS": "Serbia",
205
+ "RU": "Russia",
206
+ "RW": "Rwanda",
207
+ "SA": "Saudi Arabia",
208
+ "SB": "Solomon Islands",
209
+ "SC": "Seychelles",
210
+ "SD": "Sudan",
211
+ "SE": "Sweden",
212
+ "SG": "Singapore",
213
+ "SH": "Saint Helena",
214
+ "SI": "Slovenia",
215
+ "SJ": "Svalbard and Jan Mayen",
216
+ "SK": "Slovakia",
217
+ "SL": "Sierra Leone",
218
+ "SM": "San Marino",
219
+ "SN": "Senegal",
220
+ "SO": "Somalia",
221
+ "SR": "Suriname",
222
+ "ST": "S\u00e3o Tom\u00e9 and Pr\u00edncipe",
223
+ "SU": "Union of Soviet Socialist Republics",
224
+ "SV": "El Salvador",
225
+ "SY": "Syria",
226
+ "SZ": "Swaziland",
227
+ "TC": "Turks and Caicos Islands",
228
+ "TD": "Chad",
229
+ "TF": "French Southern Territories",
230
+ "TG": "Togo",
231
+ "TH": "Thailand",
232
+ "TJ": "Tajikistan",
233
+ "TK": "Tokelau",
234
+ "TL": "Timor-Leste",
235
+ "TM": "Turkmenistan",
236
+ "TN": "Tunisia",
237
+ "TO": "Tonga",
238
+ "TR": "Turkey",
239
+ "TT": "Trinidad and Tobago",
240
+ "TV": "Tuvalu",
241
+ "TW": "Taiwan",
242
+ "TZ": "Tanzania",
243
+ "UA": "Ukraine",
244
+ "UG": "Uganda",
245
+ "UM": "U.S. Minor Outlying Islands",
246
+ "US": "United States",
247
+ "UY": "Uruguay",
248
+ "UZ": "Uzbekistan",
249
+ "VA": "Vatican City",
250
+ "VC": "Saint Vincent and the Grenadines",
251
+ "VD": "North Vietnam",
252
+ "VE": "Venezuela",
253
+ "VG": "British Virgin Islands",
254
+ "VI": "U.S. Virgin Islands",
255
+ "VN": "Vietnam",
256
+ "VU": "Vanuatu",
257
+ "WF": "Wallis and Futuna",
258
+ "WK": "Wake Island",
259
+ "WS": "Samoa",
260
+ "YD": "People's Democratic Republic of Yemen",
261
+ "YE": "Yemen",
262
+ "YT": "Mayotte",
263
+ "ZA": "South Africa",
264
+ "ZM": "Zambia",
265
+ "ZW": "Zimbabwe",
266
+ "ZZ": "Unknown or Invalid Region"
267
+ }
@@ -0,0 +1,986 @@
1
+ /**
2
+ * Ajax Autocomplete for jQuery, version 1.2.27
3
+ * (c) 2015 Tomas Kirda
4
+ *
5
+ * Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
6
+ * For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete
7
+ */
8
+
9
+ /*jslint browser: true, white: true, plusplus: true, vars: true */
10
+ /*global define, window, document, jQuery, exports, require */
11
+
12
+ // Expose plugin as an AMD module if AMD loader is present:
13
+ (function (factory) {
14
+ 'use strict';
15
+ if (typeof define === 'function' && define.amd) {
16
+ // AMD. Register as an anonymous module.
17
+ define(['jquery'], factory);
18
+ } else if (typeof exports === 'object' && typeof require === 'function') {
19
+ // Browserify
20
+ factory(require('jquery'));
21
+ } else {
22
+ // Browser globals
23
+ factory(jQuery);
24
+ }
25
+ }(function ($) {
26
+ 'use strict';
27
+
28
+ var
29
+ utils = (function () {
30
+ return {
31
+ escapeRegExChars: function (value) {
32
+ return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
33
+ },
34
+ createNode: function (containerClass) {
35
+ var div = document.createElement('div');
36
+ div.className = containerClass;
37
+ div.style.position = 'absolute';
38
+ div.style.display = 'none';
39
+ return div;
40
+ }
41
+ };
42
+ }()),
43
+
44
+ keys = {
45
+ ESC: 27,
46
+ TAB: 9,
47
+ RETURN: 13,
48
+ LEFT: 37,
49
+ UP: 38,
50
+ RIGHT: 39,
51
+ DOWN: 40
52
+ };
53
+
54
+ function Autocomplete(el, options) {
55
+ var noop = function () { },
56
+ that = this,
57
+ defaults = {
58
+ ajaxSettings: {},
59
+ autoSelectFirst: false,
60
+ appendTo: document.body,
61
+ serviceUrl: null,
62
+ lookup: null,
63
+ onSelect: null,
64
+ width: 'auto',
65
+ minChars: 1,
66
+ maxHeight: 300,
67
+ deferRequestBy: 0,
68
+ params: {},
69
+ formatResult: Autocomplete.formatResult,
70
+ delimiter: null,
71
+ zIndex: 9999,
72
+ type: 'GET',
73
+ noCache: false,
74
+ onSearchStart: noop,
75
+ onSearchComplete: noop,
76
+ onSearchError: noop,
77
+ preserveInput: false,
78
+ containerClass: 'autocomplete-suggestions',
79
+ tabDisabled: false,
80
+ dataType: 'text',
81
+ currentRequest: null,
82
+ triggerSelectOnValidInput: true,
83
+ preventBadQueries: true,
84
+ lookupFilter: function (suggestion, originalQuery, queryLowerCase) {
85
+ return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1;
86
+ },
87
+ paramName: 'query',
88
+ transformResult: function (response) {
89
+ return typeof response === 'string' ? $.parseJSON(response) : response;
90
+ },
91
+ showNoSuggestionNotice: false,
92
+ noSuggestionNotice: 'No results',
93
+ orientation: 'bottom',
94
+ forceFixPosition: false
95
+ };
96
+
97
+ // Shared variables:
98
+ that.element = el;
99
+ that.el = $(el);
100
+ that.suggestions = [];
101
+ that.badQueries = [];
102
+ that.selectedIndex = -1;
103
+ that.currentValue = that.element.value;
104
+ that.intervalId = 0;
105
+ that.cachedResponse = {};
106
+ that.onChangeInterval = null;
107
+ that.onChange = null;
108
+ that.isLocal = false;
109
+ that.suggestionsContainer = null;
110
+ that.noSuggestionsContainer = null;
111
+ that.options = $.extend({}, defaults, options);
112
+ that.classes = {
113
+ selected: 'autocomplete-selected',
114
+ suggestion: 'autocomplete-suggestion'
115
+ };
116
+ that.hint = null;
117
+ that.hintValue = '';
118
+ that.selection = null;
119
+
120
+ // Initialize and set options:
121
+ that.initialize();
122
+ that.setOptions(options);
123
+ }
124
+
125
+ Autocomplete.utils = utils;
126
+
127
+ $.Autocomplete = Autocomplete;
128
+
129
+ Autocomplete.formatResult = function (suggestion, currentValue) {
130
+ // Do not replace anything if there current value is empty
131
+ if (!currentValue) {
132
+ return suggestion.value;
133
+ }
134
+
135
+ var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
136
+
137
+ return suggestion.value
138
+ .replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>')
139
+ .replace(/&/g, '&amp;')
140
+ .replace(/</g, '&lt;')
141
+ .replace(/>/g, '&gt;')
142
+ .replace(/"/g, '&quot;')
143
+ .replace(/&lt;(\/?strong)&gt;/g, '<$1>');
144
+ };
145
+
146
+ Autocomplete.prototype = {
147
+
148
+ killerFn: null,
149
+
150
+ initialize: function () {
151
+ var that = this,
152
+ suggestionSelector = '.' + that.classes.suggestion,
153
+ selected = that.classes.selected,
154
+ options = that.options,
155
+ container;
156
+
157
+ // Remove autocomplete attribute to prevent native suggestions:
158
+ that.element.setAttribute('autocomplete', 'off');
159
+
160
+ that.killerFn = function (e) {
161
+ if ($(e.target).closest('.' + that.options.containerClass).length === 0) {
162
+ that.killSuggestions();
163
+ that.disableKillerFn();
164
+ }
165
+ };
166
+
167
+ // html() deals with many types: htmlString or Element or Array or jQuery
168
+ that.noSuggestionsContainer = $('<div class="autocomplete-no-suggestion"></div>')
169
+ .html(this.options.noSuggestionNotice).get(0);
170
+
171
+ that.suggestionsContainer = Autocomplete.utils.createNode(options.containerClass);
172
+
173
+ container = $(that.suggestionsContainer);
174
+
175
+ container.appendTo(options.appendTo);
176
+
177
+ // Only set width if it was provided:
178
+ if (options.width !== 'auto') {
179
+ container.width(options.width);
180
+ }
181
+
182
+ // Listen for mouse over event on suggestions list:
183
+ container.on('mouseover.autocomplete', suggestionSelector, function () {
184
+ that.activate($(this).data('index'));
185
+ });
186
+
187
+ // Deselect active element when mouse leaves suggestions container:
188
+ container.on('mouseout.autocomplete', function () {
189
+ that.selectedIndex = -1;
190
+ container.children('.' + selected).removeClass(selected);
191
+ });
192
+
193
+ // Listen for click event on suggestions list:
194
+ container.on('click.autocomplete', suggestionSelector, function () {
195
+ that.select($(this).data('index'));
196
+ });
197
+
198
+ that.fixPositionCapture = function () {
199
+ if (that.visible) {
200
+ that.fixPosition();
201
+ }
202
+ };
203
+
204
+ $(window).on('resize.autocomplete', that.fixPositionCapture);
205
+
206
+ that.el.on('keydown.autocomplete', function (e) { that.onKeyPress(e); });
207
+ that.el.on('keyup.autocomplete', function (e) { that.onKeyUp(e); });
208
+ that.el.on('blur.autocomplete', function () { that.onBlur(); });
209
+ that.el.on('focus.autocomplete', function () { that.onFocus(); });
210
+ that.el.on('change.autocomplete', function (e) { that.onKeyUp(e); });
211
+ that.el.on('input.autocomplete', function (e) { that.onKeyUp(e); });
212
+ },
213
+
214
+ onFocus: function () {
215
+ var that = this;
216
+
217
+ that.fixPosition();
218
+
219
+ if (that.el.val().length >= that.options.minChars) {
220
+ that.onValueChange();
221
+ }
222
+ },
223
+
224
+ onBlur: function () {
225
+ this.enableKillerFn();
226
+ },
227
+
228
+ abortAjax: function () {
229
+ var that = this;
230
+ if (that.currentRequest) {
231
+ that.currentRequest.abort();
232
+ that.currentRequest = null;
233
+ }
234
+ },
235
+
236
+ setOptions: function (suppliedOptions) {
237
+ var that = this,
238
+ options = that.options;
239
+
240
+ $.extend(options, suppliedOptions);
241
+
242
+ that.isLocal = $.isArray(options.lookup);
243
+
244
+ if (that.isLocal) {
245
+ options.lookup = that.verifySuggestionsFormat(options.lookup);
246
+ }
247
+
248
+ options.orientation = that.validateOrientation(options.orientation, 'bottom');
249
+
250
+ // Adjust height, width and z-index:
251
+ $(that.suggestionsContainer).css({
252
+ 'max-height': options.maxHeight + 'px',
253
+ 'width': options.width + 'px',
254
+ 'z-index': options.zIndex
255
+ });
256
+ },
257
+
258
+
259
+ clearCache: function () {
260
+ this.cachedResponse = {};
261
+ this.badQueries = [];
262
+ },
263
+
264
+ clear: function () {
265
+ this.clearCache();
266
+ this.currentValue = '';
267
+ this.suggestions = [];
268
+ },
269
+
270
+ disable: function () {
271
+ var that = this;
272
+ that.disabled = true;
273
+ clearInterval(that.onChangeInterval);
274
+ that.abortAjax();
275
+ },
276
+
277
+ enable: function () {
278
+ this.disabled = false;
279
+ },
280
+
281
+ fixPosition: function () {
282
+ // Use only when container has already its content
283
+
284
+ var that = this,
285
+ $container = $(that.suggestionsContainer),
286
+ containerParent = $container.parent().get(0);
287
+ // Fix position automatically when appended to body.
288
+ // In other cases force parameter must be given.
289
+ if (containerParent !== document.body && !that.options.forceFixPosition) {
290
+ return;
291
+ }
292
+
293
+ // Choose orientation
294
+ var orientation = that.options.orientation,
295
+ containerHeight = $container.outerHeight(),
296
+ height = that.el.outerHeight(),
297
+ offset = that.el.offset(),
298
+ styles = { 'top': offset.top, 'left': offset.left };
299
+
300
+ if (orientation === 'auto') {
301
+ var viewPortHeight = $(window).height(),
302
+ scrollTop = $(window).scrollTop(),
303
+ topOverflow = -scrollTop + offset.top - containerHeight,
304
+ bottomOverflow = scrollTop + viewPortHeight - (offset.top + height + containerHeight);
305
+
306
+ orientation = (Math.max(topOverflow, bottomOverflow) === topOverflow) ? 'top' : 'bottom';
307
+ }
308
+
309
+ if (orientation === 'top') {
310
+ styles.top += -containerHeight;
311
+ } else {
312
+ styles.top += height;
313
+ }
314
+
315
+ // If container is not positioned to body,
316
+ // correct its position using offset parent offset
317
+ if(containerParent !== document.body) {
318
+ var opacity = $container.css('opacity'),
319
+ parentOffsetDiff;
320
+
321
+ if (!that.visible){
322
+ $container.css('opacity', 0).show();
323
+ }
324
+
325
+ parentOffsetDiff = $container.offsetParent().offset();
326
+ styles.top -= parentOffsetDiff.top;
327
+ styles.left -= parentOffsetDiff.left;
328
+
329
+ if (!that.visible){
330
+ $container.css('opacity', opacity).hide();
331
+ }
332
+ }
333
+
334
+ // -2px to account for suggestions border.
335
+ if (that.options.width === 'auto') {
336
+ styles.width = (that.el.outerWidth() - 2) + 'px';
337
+ }
338
+
339
+ $container.css(styles);
340
+ },
341
+
342
+ enableKillerFn: function () {
343
+ var that = this;
344
+ $(document).on('click.autocomplete', that.killerFn);
345
+ },
346
+
347
+ disableKillerFn: function () {
348
+ var that = this;
349
+ $(document).off('click.autocomplete', that.killerFn);
350
+ },
351
+
352
+ killSuggestions: function () {
353
+ var that = this;
354
+ that.stopKillSuggestions();
355
+ that.intervalId = window.setInterval(function () {
356
+ if (that.visible) {
357
+ that.el.val(that.currentValue);
358
+ that.hide();
359
+ }
360
+
361
+ that.stopKillSuggestions();
362
+ }, 50);
363
+ },
364
+
365
+ stopKillSuggestions: function () {
366
+ window.clearInterval(this.intervalId);
367
+ },
368
+
369
+ isCursorAtEnd: function () {
370
+ var that = this,
371
+ valLength = that.el.val().length,
372
+ selectionStart = that.element.selectionStart,
373
+ range;
374
+
375
+ if (typeof selectionStart === 'number') {
376
+ return selectionStart === valLength;
377
+ }
378
+ if (document.selection) {
379
+ range = document.selection.createRange();
380
+ range.moveStart('character', -valLength);
381
+ return valLength === range.text.length;
382
+ }
383
+ return true;
384
+ },
385
+
386
+ onKeyPress: function (e) {
387
+ var that = this;
388
+
389
+ // If suggestions are hidden and user presses arrow down, display suggestions:
390
+ if (!that.disabled && !that.visible && e.which === keys.DOWN && that.currentValue) {
391
+ that.suggest();
392
+ return;
393
+ }
394
+
395
+ if (that.disabled || !that.visible) {
396
+ return;
397
+ }
398
+
399
+ switch (e.which) {
400
+ case keys.ESC:
401
+ that.el.val(that.currentValue);
402
+ that.hide();
403
+ break;
404
+ case keys.RIGHT:
405
+ if (that.hint && that.options.onHint && that.isCursorAtEnd()) {
406
+ that.selectHint();
407
+ break;
408
+ }
409
+ return;
410
+ case keys.TAB:
411
+ if (that.hint && that.options.onHint) {
412
+ that.selectHint();
413
+ return;
414
+ }
415
+ if (that.selectedIndex === -1) {
416
+ that.hide();
417
+ return;
418
+ }
419
+ that.select(that.selectedIndex);
420
+ if (that.options.tabDisabled === false) {
421
+ return;
422
+ }
423
+ break;
424
+ case keys.RETURN:
425
+ if (that.selectedIndex === -1) {
426
+ that.hide();
427
+ return;
428
+ }
429
+ that.select(that.selectedIndex);
430
+ break;
431
+ case keys.UP:
432
+ that.moveUp();
433
+ break;
434
+ case keys.DOWN:
435
+ that.moveDown();
436
+ break;
437
+ default:
438
+ return;
439
+ }
440
+
441
+ // Cancel event if function did not return:
442
+ e.stopImmediatePropagation();
443
+ e.preventDefault();
444
+ },
445
+
446
+ onKeyUp: function (e) {
447
+ var that = this;
448
+
449
+ if (that.disabled) {
450
+ return;
451
+ }
452
+
453
+ switch (e.which) {
454
+ case keys.UP:
455
+ case keys.DOWN:
456
+ return;
457
+ }
458
+
459
+ clearInterval(that.onChangeInterval);
460
+
461
+ if (that.currentValue !== that.el.val()) {
462
+ that.findBestHint();
463
+ if (that.options.deferRequestBy > 0) {
464
+ // Defer lookup in case when value changes very quickly:
465
+ that.onChangeInterval = setInterval(function () {
466
+ that.onValueChange();
467
+ }, that.options.deferRequestBy);
468
+ } else {
469
+ that.onValueChange();
470
+ }
471
+ }
472
+ },
473
+
474
+ onValueChange: function () {
475
+ var that = this,
476
+ options = that.options,
477
+ value = that.el.val(),
478
+ query = that.getQuery(value);
479
+
480
+ if (that.selection && that.currentValue !== query) {
481
+ that.selection = null;
482
+ (options.onInvalidateSelection || $.noop).call(that.element);
483
+ }
484
+
485
+ clearInterval(that.onChangeInterval);
486
+ that.currentValue = value;
487
+ that.selectedIndex = -1;
488
+
489
+ // Check existing suggestion for the match before proceeding:
490
+ if (options.triggerSelectOnValidInput && that.isExactMatch(query)) {
491
+ that.select(0);
492
+ return;
493
+ }
494
+
495
+ if (query.length < options.minChars) {
496
+ that.hide();
497
+ } else {
498
+ that.getSuggestions(query);
499
+ }
500
+ },
501
+
502
+ isExactMatch: function (query) {
503
+ var suggestions = this.suggestions;
504
+
505
+ return (suggestions.length === 1 && suggestions[0].value.toLowerCase() === query.toLowerCase());
506
+ },
507
+
508
+ getQuery: function (value) {
509
+ var delimiter = this.options.delimiter,
510
+ parts;
511
+
512
+ if (!delimiter) {
513
+ return value;
514
+ }
515
+ parts = value.split(delimiter);
516
+ return $.trim(parts[parts.length - 1]);
517
+ },
518
+
519
+ getSuggestionsLocal: function (query) {
520
+ var that = this,
521
+ options = that.options,
522
+ queryLowerCase = query.toLowerCase(),
523
+ filter = options.lookupFilter,
524
+ limit = parseInt(options.lookupLimit, 10),
525
+ data;
526
+
527
+ data = {
528
+ suggestions: $.grep(options.lookup, function (suggestion) {
529
+ return filter(suggestion, query, queryLowerCase);
530
+ })
531
+ };
532
+
533
+ if (limit && data.suggestions.length > limit) {
534
+ data.suggestions = data.suggestions.slice(0, limit);
535
+ }
536
+
537
+ return data;
538
+ },
539
+
540
+ getSuggestions: function (q) {
541
+ var response,
542
+ that = this,
543
+ options = that.options,
544
+ serviceUrl = options.serviceUrl,
545
+ params,
546
+ cacheKey,
547
+ ajaxSettings;
548
+
549
+ options.params[options.paramName] = q;
550
+ params = options.ignoreParams ? null : options.params;
551
+
552
+ if (options.onSearchStart.call(that.element, options.params) === false) {
553
+ return;
554
+ }
555
+
556
+ if ($.isFunction(options.lookup)){
557
+ options.lookup(q, function (data) {
558
+ that.suggestions = data.suggestions;
559
+ that.suggest();
560
+ options.onSearchComplete.call(that.element, q, data.suggestions);
561
+ });
562
+ return;
563
+ }
564
+
565
+ if (that.isLocal) {
566
+ response = that.getSuggestionsLocal(q);
567
+ } else {
568
+ if ($.isFunction(serviceUrl)) {
569
+ serviceUrl = serviceUrl.call(that.element, q);
570
+ }
571
+ cacheKey = serviceUrl + '?' + $.param(params || {});
572
+ response = that.cachedResponse[cacheKey];
573
+ }
574
+
575
+ if (response && $.isArray(response.suggestions)) {
576
+ that.suggestions = response.suggestions;
577
+ that.suggest();
578
+ options.onSearchComplete.call(that.element, q, response.suggestions);
579
+ } else if (!that.isBadQuery(q)) {
580
+ that.abortAjax();
581
+
582
+ ajaxSettings = {
583
+ url: serviceUrl,
584
+ data: params,
585
+ type: options.type,
586
+ dataType: options.dataType
587
+ };
588
+
589
+ $.extend(ajaxSettings, options.ajaxSettings);
590
+
591
+ that.currentRequest = $.ajax(ajaxSettings).done(function (data) {
592
+ var result;
593
+ that.currentRequest = null;
594
+ result = options.transformResult(data, q);
595
+ that.processResponse(result, q, cacheKey);
596
+ options.onSearchComplete.call(that.element, q, result.suggestions);
597
+ }).fail(function (jqXHR, textStatus, errorThrown) {
598
+ options.onSearchError.call(that.element, q, jqXHR, textStatus, errorThrown);
599
+ });
600
+ } else {
601
+ options.onSearchComplete.call(that.element, q, []);
602
+ }
603
+ },
604
+
605
+ isBadQuery: function (q) {
606
+ if (!this.options.preventBadQueries){
607
+ return false;
608
+ }
609
+
610
+ var badQueries = this.badQueries,
611
+ i = badQueries.length;
612
+
613
+ while (i--) {
614
+ if (q.indexOf(badQueries[i]) === 0) {
615
+ return true;
616
+ }
617
+ }
618
+
619
+ return false;
620
+ },
621
+
622
+ hide: function () {
623
+ var that = this,
624
+ container = $(that.suggestionsContainer);
625
+
626
+ if ($.isFunction(that.options.onHide) && that.visible) {
627
+ that.options.onHide.call(that.element, container);
628
+ }
629
+
630
+ that.visible = false;
631
+ that.selectedIndex = -1;
632
+ clearInterval(that.onChangeInterval);
633
+ $(that.suggestionsContainer).hide();
634
+ that.signalHint(null);
635
+ },
636
+
637
+ suggest: function () {
638
+ if (this.suggestions.length === 0) {
639
+ if (this.options.showNoSuggestionNotice) {
640
+ this.noSuggestions();
641
+ } else {
642
+ this.hide();
643
+ }
644
+ return;
645
+ }
646
+
647
+ var that = this,
648
+ options = that.options,
649
+ groupBy = options.groupBy,
650
+ formatResult = options.formatResult,
651
+ value = that.getQuery(that.currentValue),
652
+ className = that.classes.suggestion,
653
+ classSelected = that.classes.selected,
654
+ container = $(that.suggestionsContainer),
655
+ noSuggestionsContainer = $(that.noSuggestionsContainer),
656
+ beforeRender = options.beforeRender,
657
+ html = '',
658
+ category,
659
+ formatGroup = function (suggestion, index) {
660
+ var currentCategory = suggestion.data[groupBy];
661
+
662
+ if (category === currentCategory){
663
+ return '';
664
+ }
665
+
666
+ category = currentCategory;
667
+
668
+ return '<div class="autocomplete-group"><strong>' + category + '</strong></div>';
669
+ };
670
+
671
+ if (options.triggerSelectOnValidInput && that.isExactMatch(value)) {
672
+ that.select(0);
673
+ return;
674
+ }
675
+
676
+ // Build suggestions inner HTML:
677
+ $.each(that.suggestions, function (i, suggestion) {
678
+ if (groupBy){
679
+ html += formatGroup(suggestion, value, i);
680
+ }
681
+
682
+ html += '<div class="' + className + '" data-index="' + i + '">' + formatResult(suggestion, value) + '</div>';
683
+ });
684
+
685
+ this.adjustContainerWidth();
686
+
687
+ noSuggestionsContainer.detach();
688
+ container.html(html);
689
+
690
+ if ($.isFunction(beforeRender)) {
691
+ beforeRender.call(that.element, container);
692
+ }
693
+
694
+ that.fixPosition();
695
+ container.show();
696
+
697
+ // Select first value by default:
698
+ if (options.autoSelectFirst) {
699
+ that.selectedIndex = 0;
700
+ container.scrollTop(0);
701
+ container.children('.' + className).first().addClass(classSelected);
702
+ }
703
+
704
+ that.visible = true;
705
+ that.findBestHint();
706
+ },
707
+
708
+ noSuggestions: function() {
709
+ var that = this,
710
+ container = $(that.suggestionsContainer),
711
+ noSuggestionsContainer = $(that.noSuggestionsContainer);
712
+
713
+ this.adjustContainerWidth();
714
+
715
+ // Some explicit steps. Be careful here as it easy to get
716
+ // noSuggestionsContainer removed from DOM if not detached properly.
717
+ noSuggestionsContainer.detach();
718
+ container.empty(); // clean suggestions if any
719
+ container.append(noSuggestionsContainer);
720
+
721
+ that.fixPosition();
722
+
723
+ container.show();
724
+ that.visible = true;
725
+ },
726
+
727
+ adjustContainerWidth: function() {
728
+ var that = this,
729
+ options = that.options,
730
+ width,
731
+ container = $(that.suggestionsContainer);
732
+
733
+ // If width is auto, adjust width before displaying suggestions,
734
+ // because if instance was created before input had width, it will be zero.
735
+ // Also it adjusts if input width has changed.
736
+ // -2px to account for suggestions border.
737
+ if (options.width === 'auto') {
738
+ width = that.el.outerWidth() - 2;
739
+ container.width(width > 0 ? width : 300);
740
+ }
741
+ },
742
+
743
+ findBestHint: function () {
744
+ var that = this,
745
+ value = that.el.val().toLowerCase(),
746
+ bestMatch = null;
747
+
748
+ if (!value) {
749
+ return;
750
+ }
751
+
752
+ $.each(that.suggestions, function (i, suggestion) {
753
+ var foundMatch = suggestion.value.toLowerCase().indexOf(value) === 0;
754
+ if (foundMatch) {
755
+ bestMatch = suggestion;
756
+ }
757
+ return !foundMatch;
758
+ });
759
+
760
+ that.signalHint(bestMatch);
761
+ },
762
+
763
+ signalHint: function (suggestion) {
764
+ var hintValue = '',
765
+ that = this;
766
+ if (suggestion) {
767
+ hintValue = that.currentValue + suggestion.value.substr(that.currentValue.length);
768
+ }
769
+ if (that.hintValue !== hintValue) {
770
+ that.hintValue = hintValue;
771
+ that.hint = suggestion;
772
+ (this.options.onHint || $.noop)(hintValue);
773
+ }
774
+ },
775
+
776
+ verifySuggestionsFormat: function (suggestions) {
777
+ // If suggestions is string array, convert them to supported format:
778
+ if (suggestions.length && typeof suggestions[0] === 'string') {
779
+ return $.map(suggestions, function (value) {
780
+ return { value: value, data: null };
781
+ });
782
+ }
783
+
784
+ return suggestions;
785
+ },
786
+
787
+ validateOrientation: function(orientation, fallback) {
788
+ orientation = $.trim(orientation || '').toLowerCase();
789
+
790
+ if($.inArray(orientation, ['auto', 'bottom', 'top']) === -1){
791
+ orientation = fallback;
792
+ }
793
+
794
+ return orientation;
795
+ },
796
+
797
+ processResponse: function (result, originalQuery, cacheKey) {
798
+ var that = this,
799
+ options = that.options;
800
+
801
+ result.suggestions = that.verifySuggestionsFormat(result.suggestions);
802
+
803
+ // Cache results if cache is not disabled:
804
+ if (!options.noCache) {
805
+ that.cachedResponse[cacheKey] = result;
806
+ if (options.preventBadQueries && result.suggestions.length === 0) {
807
+ that.badQueries.push(originalQuery);
808
+ }
809
+ }
810
+
811
+ // Return if originalQuery is not matching current query:
812
+ if (originalQuery !== that.getQuery(that.currentValue)) {
813
+ return;
814
+ }
815
+
816
+ that.suggestions = result.suggestions;
817
+ that.suggest();
818
+ },
819
+
820
+ activate: function (index) {
821
+ var that = this,
822
+ activeItem,
823
+ selected = that.classes.selected,
824
+ container = $(that.suggestionsContainer),
825
+ children = container.find('.' + that.classes.suggestion);
826
+
827
+ container.find('.' + selected).removeClass(selected);
828
+
829
+ that.selectedIndex = index;
830
+
831
+ if (that.selectedIndex !== -1 && children.length > that.selectedIndex) {
832
+ activeItem = children.get(that.selectedIndex);
833
+ $(activeItem).addClass(selected);
834
+ return activeItem;
835
+ }
836
+
837
+ return null;
838
+ },
839
+
840
+ selectHint: function () {
841
+ var that = this,
842
+ i = $.inArray(that.hint, that.suggestions);
843
+
844
+ that.select(i);
845
+ },
846
+
847
+ select: function (i) {
848
+ var that = this;
849
+ that.hide();
850
+ that.onSelect(i);
851
+ },
852
+
853
+ moveUp: function () {
854
+ var that = this;
855
+
856
+ if (that.selectedIndex === -1) {
857
+ return;
858
+ }
859
+
860
+ if (that.selectedIndex === 0) {
861
+ $(that.suggestionsContainer).children().first().removeClass(that.classes.selected);
862
+ that.selectedIndex = -1;
863
+ that.el.val(that.currentValue);
864
+ that.findBestHint();
865
+ return;
866
+ }
867
+
868
+ that.adjustScroll(that.selectedIndex - 1);
869
+ },
870
+
871
+ moveDown: function () {
872
+ var that = this;
873
+
874
+ if (that.selectedIndex === (that.suggestions.length - 1)) {
875
+ return;
876
+ }
877
+
878
+ that.adjustScroll(that.selectedIndex + 1);
879
+ },
880
+
881
+ adjustScroll: function (index) {
882
+ var that = this,
883
+ activeItem = that.activate(index);
884
+
885
+ if (!activeItem) {
886
+ return;
887
+ }
888
+
889
+ var offsetTop,
890
+ upperBound,
891
+ lowerBound,
892
+ heightDelta = $(activeItem).outerHeight();
893
+
894
+ offsetTop = activeItem.offsetTop;
895
+ upperBound = $(that.suggestionsContainer).scrollTop();
896
+ lowerBound = upperBound + that.options.maxHeight - heightDelta;
897
+
898
+ if (offsetTop < upperBound) {
899
+ $(that.suggestionsContainer).scrollTop(offsetTop);
900
+ } else if (offsetTop > lowerBound) {
901
+ $(that.suggestionsContainer).scrollTop(offsetTop - that.options.maxHeight + heightDelta);
902
+ }
903
+
904
+ if (!that.options.preserveInput) {
905
+ that.el.val(that.getValue(that.suggestions[index].value));
906
+ }
907
+ that.signalHint(null);
908
+ },
909
+
910
+ onSelect: function (index) {
911
+ var that = this,
912
+ onSelectCallback = that.options.onSelect,
913
+ suggestion = that.suggestions[index];
914
+
915
+ that.currentValue = that.getValue(suggestion.value);
916
+
917
+ if (that.currentValue !== that.el.val() && !that.options.preserveInput) {
918
+ that.el.val(that.currentValue);
919
+ }
920
+
921
+ that.signalHint(null);
922
+ that.suggestions = [];
923
+ that.selection = suggestion;
924
+
925
+ if ($.isFunction(onSelectCallback)) {
926
+ onSelectCallback.call(that.element, suggestion);
927
+ }
928
+ },
929
+
930
+ getValue: function (value) {
931
+ var that = this,
932
+ delimiter = that.options.delimiter,
933
+ currentValue,
934
+ parts;
935
+
936
+ if (!delimiter) {
937
+ return value;
938
+ }
939
+
940
+ currentValue = that.currentValue;
941
+ parts = currentValue.split(delimiter);
942
+
943
+ if (parts.length === 1) {
944
+ return value;
945
+ }
946
+
947
+ return currentValue.substr(0, currentValue.length - parts[parts.length - 1].length) + value;
948
+ },
949
+
950
+ dispose: function () {
951
+ var that = this;
952
+ that.el.off('.autocomplete').removeData('autocomplete');
953
+ that.disableKillerFn();
954
+ $(window).off('resize.autocomplete', that.fixPositionCapture);
955
+ $(that.suggestionsContainer).remove();
956
+ }
957
+ };
958
+
959
+ // Create chainable jQuery plugin:
960
+ $.fn.autocomplete = $.fn.devbridgeAutocomplete = function (options, args) {
961
+ var dataKey = 'autocomplete';
962
+ // If function invoked without argument return
963
+ // instance of the first matched element:
964
+ if (arguments.length === 0) {
965
+ return this.first().data(dataKey);
966
+ }
967
+
968
+ return this.each(function () {
969
+ var inputElement = $(this),
970
+ instance = inputElement.data(dataKey);
971
+
972
+ if (typeof options === 'string') {
973
+ if (instance && typeof instance[options] === 'function') {
974
+ instance[options](args);
975
+ }
976
+ } else {
977
+ // If instance already exists, destroy it:
978
+ if (instance && instance.dispose) {
979
+ instance.dispose();
980
+ }
981
+ instance = new Autocomplete(this, options);
982
+ inputElement.data(dataKey, instance);
983
+ }
984
+ });
985
+ };
986
+ }));