active_admin_pro 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (295) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +20 -0
  3. data/README.md +5 -0
  4. data/Rakefile +34 -0
  5. data/app/assets/javascripts/active_admin_pro.js +41 -0
  6. data/app/assets/javascripts/active_admin_pro/actions/new.js +8 -0
  7. data/app/assets/javascripts/active_admin_pro/actions/show.js +12 -0
  8. data/app/assets/javascripts/active_admin_pro/components/codemirror_input.js +92 -0
  9. data/app/assets/javascripts/active_admin_pro/components/flashes.js +9 -0
  10. data/app/assets/javascripts/active_admin_pro/components/link.js +23 -0
  11. data/app/assets/javascripts/active_admin_pro/components/phone_input.js +52 -0
  12. data/app/assets/javascripts/active_admin_pro/components/select_input.js +31 -0
  13. data/app/assets/javascripts/active_admin_pro/components/sortable_handle.js +8 -0
  14. data/app/assets/javascripts/active_admin_pro/components/summernote_input.js +132 -0
  15. data/app/assets/javascripts/active_admin_pro/components/text_input.js +47 -0
  16. data/app/assets/javascripts/active_admin_pro/components/time_zone_input.js +51 -0
  17. data/app/assets/javascripts/active_admin_pro/components/title_to_slug.js +16 -0
  18. data/app/assets/stylesheets/active_admin_pro.scss +20 -0
  19. data/app/assets/stylesheets/active_admin_pro/breakpoints.scss +3 -0
  20. data/app/assets/stylesheets/active_admin_pro/components/_input_variables.scss +9 -0
  21. data/app/assets/stylesheets/active_admin_pro/components/actions.scss +13 -0
  22. data/app/assets/stylesheets/active_admin_pro/components/boolean_input.scss +13 -0
  23. data/app/assets/stylesheets/active_admin_pro/components/button.scss +7 -0
  24. data/app/assets/stylesheets/active_admin_pro/components/check_boxes_input.scss +38 -0
  25. data/app/assets/stylesheets/active_admin_pro/components/codemirror_input.scss +53 -0
  26. data/app/assets/stylesheets/active_admin_pro/components/comments.scss +17 -0
  27. data/app/assets/stylesheets/active_admin_pro/components/datepicker.scss +108 -0
  28. data/app/assets/stylesheets/active_admin_pro/components/dialog.scss +66 -0
  29. data/app/assets/stylesheets/active_admin_pro/components/dropdown_menu_button.scss +40 -0
  30. data/app/assets/stylesheets/active_admin_pro/components/fieldset.scss +26 -0
  31. data/app/assets/stylesheets/active_admin_pro/components/file_input.scss +27 -0
  32. data/app/assets/stylesheets/active_admin_pro/components/has_many_fields.scss +4 -0
  33. data/app/assets/stylesheets/active_admin_pro/components/inline_errors.scss +7 -0
  34. data/app/assets/stylesheets/active_admin_pro/components/link.scss +16 -0
  35. data/app/assets/stylesheets/active_admin_pro/components/panel.scss +62 -0
  36. data/app/assets/stylesheets/active_admin_pro/components/phone_input.scss +31 -0
  37. data/app/assets/stylesheets/active_admin_pro/components/radio_input.scss +38 -0
  38. data/app/assets/stylesheets/active_admin_pro/components/segmented_control.scss +41 -0
  39. data/app/assets/stylesheets/active_admin_pro/components/select_input.scss +42 -0
  40. data/app/assets/stylesheets/active_admin_pro/components/sortable_handle.scss +21 -0
  41. data/app/assets/stylesheets/active_admin_pro/components/string_input.scss +85 -0
  42. data/app/assets/stylesheets/active_admin_pro/components/summernote_input.scss +190 -0
  43. data/app/assets/stylesheets/active_admin_pro/components/table.scss +100 -0
  44. data/app/assets/stylesheets/active_admin_pro/components/text_input.scss +55 -0
  45. data/app/assets/stylesheets/active_admin_pro/functions/color.scss +130 -0
  46. data/app/assets/stylesheets/active_admin_pro/functions/text-color.scss +35 -0
  47. data/app/assets/stylesheets/active_admin_pro/layout/actions/comments.scss +14 -0
  48. data/app/assets/stylesheets/active_admin_pro/layout/actions/index.scss +88 -0
  49. data/app/assets/stylesheets/active_admin_pro/layout/actions/show.scss +25 -0
  50. data/app/assets/stylesheets/active_admin_pro/layout/body.scss +60 -0
  51. data/app/assets/stylesheets/active_admin_pro/layout/desktop/action_items.scss +32 -0
  52. data/app/assets/stylesheets/active_admin_pro/layout/desktop/actions/comments.scss +10 -0
  53. data/app/assets/stylesheets/active_admin_pro/layout/desktop/active_admin_content.scss +22 -0
  54. data/app/assets/stylesheets/active_admin_pro/layout/desktop/breadcrumbs.scss +57 -0
  55. data/app/assets/stylesheets/active_admin_pro/layout/desktop/navigation.scss +197 -0
  56. data/app/assets/stylesheets/active_admin_pro/layout/desktop/sidebar.scss +5 -0
  57. data/app/assets/stylesheets/active_admin_pro/layout/desktop/title_bar.scss +24 -0
  58. data/app/assets/stylesheets/active_admin_pro/layout/desktop/wrapper.scss +5 -0
  59. data/app/assets/stylesheets/active_admin_pro/layout/filters.scss +41 -0
  60. data/app/assets/stylesheets/active_admin_pro/layout/flashes.scss +52 -0
  61. data/app/assets/stylesheets/active_admin_pro/layout/footer.scss +3 -0
  62. data/app/assets/stylesheets/active_admin_pro/layout/mobile/actions/index.scss +7 -0
  63. data/app/assets/stylesheets/active_admin_pro/layout/tablet/actions/dashboard.scss +105 -0
  64. data/app/assets/stylesheets/active_admin_pro/layout/tablet/actions/index.scss +20 -0
  65. data/app/assets/stylesheets/active_admin_pro/layout/tablet/actions/show.scss +78 -0
  66. data/app/assets/stylesheets/active_admin_pro/layout/tablet/active_admin_content.scss +9 -0
  67. data/app/assets/stylesheets/active_admin_pro/layout/tablet/flashes.scss +5 -0
  68. data/app/assets/stylesheets/active_admin_pro/layout/tablet/navigation.scss +48 -0
  69. data/app/assets/stylesheets/active_admin_pro/layout/tablet/title_bar.scss +53 -0
  70. data/app/assets/stylesheets/active_admin_pro/mixins/button.scss +48 -0
  71. data/app/assets/stylesheets/active_admin_pro/variables.scss +10 -0
  72. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon.scss +87 -0
  73. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/_bourbon-deprecated-upcoming.scss +411 -0
  74. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_border-color.scss +26 -0
  75. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_border-radius.scss +48 -0
  76. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_border-style.scss +25 -0
  77. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_border-width.scss +25 -0
  78. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_buttons.scss +64 -0
  79. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_clearfix.scss +25 -0
  80. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_ellipsis.scss +30 -0
  81. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_font-stacks.scss +31 -0
  82. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_hide-text.scss +27 -0
  83. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_margin.scss +26 -0
  84. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_padding.scss +26 -0
  85. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_position.scss +48 -0
  86. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_prefixer.scss +66 -0
  87. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_retina-image.scss +25 -0
  88. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_size.scss +51 -0
  89. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_text-inputs.scss +113 -0
  90. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_timing-functions.scss +34 -0
  91. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_triangle.scss +63 -0
  92. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_word-wrap.scss +29 -0
  93. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_animation.scss +43 -0
  94. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_appearance.scss +3 -0
  95. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_backface-visibility.scss +3 -0
  96. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_background-image.scss +42 -0
  97. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_background.scss +55 -0
  98. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_border-image.scss +59 -0
  99. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_calc.scss +4 -0
  100. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_columns.scss +47 -0
  101. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_filter.scss +4 -0
  102. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_flex-box.scss +287 -0
  103. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_font-face.scss +24 -0
  104. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_font-feature-settings.scss +4 -0
  105. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_hidpi-media-query.scss +10 -0
  106. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_hyphens.scss +4 -0
  107. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_image-rendering.scss +14 -0
  108. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_keyframes.scss +36 -0
  109. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_linear-gradient.scss +38 -0
  110. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_perspective.scss +8 -0
  111. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_placeholder.scss +8 -0
  112. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_radial-gradient.scss +39 -0
  113. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_selection.scss +42 -0
  114. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_text-decoration.scss +19 -0
  115. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_transform.scss +15 -0
  116. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_transition.scss +71 -0
  117. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_user-select.scss +3 -0
  118. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_assign-inputs.scss +11 -0
  119. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_contains-falsy.scss +20 -0
  120. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_contains.scss +26 -0
  121. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_is-length.scss +11 -0
  122. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_is-light.scss +21 -0
  123. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_is-number.scss +11 -0
  124. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_is-size.scss +13 -0
  125. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_modular-scale.scss +69 -0
  126. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_px-to-em.scss +13 -0
  127. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_px-to-rem.scss +15 -0
  128. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_shade.scss +24 -0
  129. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_strip-units.scss +17 -0
  130. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_tint.scss +24 -0
  131. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_transition-property-name.scss +22 -0
  132. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_unpack.scss +27 -0
  133. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_convert-units.scss +21 -0
  134. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_directional-values.scss +96 -0
  135. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_font-source-declaration.scss +43 -0
  136. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_gradient-positions-parser.scss +13 -0
  137. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_linear-angle-parser.scss +25 -0
  138. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_linear-gradient-parser.scss +41 -0
  139. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_linear-positions-parser.scss +61 -0
  140. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_linear-side-corner-parser.scss +31 -0
  141. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_radial-arg-parser.scss +69 -0
  142. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_radial-gradient-parser.scss +50 -0
  143. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_radial-positions-parser.scss +18 -0
  144. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_render-gradients.scss +26 -0
  145. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_shape-size-stripper.scss +10 -0
  146. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_str-to-num.scss +50 -0
  147. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/settings/_asset-pipeline.scss +7 -0
  148. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/settings/_prefixer.scss +9 -0
  149. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/settings/_px-to-em.scss +1 -0
  150. data/app/assets/stylesheets/active_admin_pro/vendor/neat.scss +22 -0
  151. data/app/assets/stylesheets/active_admin_pro/vendor/neat/_neat-helpers.scss +8 -0
  152. data/app/assets/stylesheets/active_admin_pro/vendor/neat/functions/_new-breakpoint.scss +49 -0
  153. data/app/assets/stylesheets/active_admin_pro/vendor/neat/functions/_private.scss +108 -0
  154. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_box-sizing.scss +11 -0
  155. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_direction-context.scss +31 -0
  156. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_display-context.scss +26 -0
  157. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_fill-parent.scss +22 -0
  158. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_media.scss +92 -0
  159. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_omega.scss +91 -0
  160. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_outer-container.scss +36 -0
  161. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_pad.scss +23 -0
  162. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_private.scss +35 -0
  163. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_row.scss +53 -0
  164. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_shift.scss +48 -0
  165. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_span-columns.scss +90 -0
  166. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_to-deprecate.scss +105 -0
  167. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_visual-grid.scss +40 -0
  168. data/app/assets/stylesheets/active_admin_pro/vendor/neat/settings/_disable-warnings.scss +11 -0
  169. data/app/assets/stylesheets/active_admin_pro/vendor/neat/settings/_grid.scss +53 -0
  170. data/app/assets/stylesheets/active_admin_pro/vendor/neat/settings/_visual-grid.scss +25 -0
  171. data/app/assets/stylesheets/active_admin_pro/vendor/normalize.css +423 -0
  172. data/app/assets/stylesheets/codemirror/themes/activeadmin_pro.scss +117 -0
  173. data/app/inputs/codemirror_input.rb +27 -0
  174. data/app/inputs/datepicker_input.rb +16 -0
  175. data/app/inputs/phone_input.rb +5 -0
  176. data/app/inputs/summernote_input.rb +5 -0
  177. data/app/inputs/time_zone_input.rb +43 -0
  178. data/app/models/activeadmin_pro/summernote_image.rb +5 -0
  179. data/config/initializers/active_admin.rb +50 -0
  180. data/config/locales/en.yml +55 -0
  181. data/lib/active_admin_pro/admin_user/admin_user.rb +52 -0
  182. data/lib/active_admin_pro/engine.rb +8 -0
  183. data/lib/active_admin_pro/summernote_image/summernote_image.rb +61 -0
  184. data/lib/active_admin_pro/user/user.rb +53 -0
  185. data/lib/active_admin_pro/version.rb +3 -0
  186. data/lib/activeadmin_pro.rb +9 -0
  187. data/lib/generators/activeadmin_pro/install_generator.rb +14 -0
  188. data/lib/tasks/activeadmin_pro_tasks.rake +4 -0
  189. data/spec/spec_helper.rb +34 -0
  190. data/vendor/assets/javascripts/bootstrap.js +1243 -0
  191. data/vendor/assets/javascripts/codemirror.js +8887 -0
  192. data/vendor/assets/javascripts/codemirror/addons/comment/comment.js +183 -0
  193. data/vendor/assets/javascripts/codemirror/addons/comment/continuecomment.js +85 -0
  194. data/vendor/assets/javascripts/codemirror/addons/dialog/dialog.css +32 -0
  195. data/vendor/assets/javascripts/codemirror/addons/dialog/dialog.js +157 -0
  196. data/vendor/assets/javascripts/codemirror/addons/display/autorefresh.js +47 -0
  197. data/vendor/assets/javascripts/codemirror/addons/display/fullscreen.css +6 -0
  198. data/vendor/assets/javascripts/codemirror/addons/display/fullscreen.js +41 -0
  199. data/vendor/assets/javascripts/codemirror/addons/display/panel.js +112 -0
  200. data/vendor/assets/javascripts/codemirror/addons/display/placeholder.js +60 -0
  201. data/vendor/assets/javascripts/codemirror/addons/display/rulers.js +63 -0
  202. data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +195 -0
  203. data/vendor/assets/javascripts/codemirror/addons/edit/closetag.js +169 -0
  204. data/vendor/assets/javascripts/codemirror/addons/edit/continuelist.js +51 -0
  205. data/vendor/assets/javascripts/codemirror/addons/edit/matchbrackets.js +120 -0
  206. data/vendor/assets/javascripts/codemirror/addons/edit/matchtags.js +66 -0
  207. data/vendor/assets/javascripts/codemirror/addons/edit/trailingspace.js +27 -0
  208. data/vendor/assets/javascripts/codemirror/addons/fold/brace-fold.js +105 -0
  209. data/vendor/assets/javascripts/codemirror/addons/fold/comment-fold.js +57 -0
  210. data/vendor/assets/javascripts/codemirror/addons/fold/foldcode.js +149 -0
  211. data/vendor/assets/javascripts/codemirror/addons/fold/foldgutter.css +20 -0
  212. data/vendor/assets/javascripts/codemirror/addons/fold/foldgutter.js +146 -0
  213. data/vendor/assets/javascripts/codemirror/addons/fold/indent-fold.js +44 -0
  214. data/vendor/assets/javascripts/codemirror/addons/fold/markdown-fold.js +49 -0
  215. data/vendor/assets/javascripts/codemirror/addons/fold/xml-fold.js +182 -0
  216. data/vendor/assets/javascripts/codemirror/addons/hint/anyword-hint.js +41 -0
  217. data/vendor/assets/javascripts/codemirror/addons/hint/css-hint.js +60 -0
  218. data/vendor/assets/javascripts/codemirror/addons/hint/html-hint.js +348 -0
  219. data/vendor/assets/javascripts/codemirror/addons/hint/javascript-hint.js +146 -0
  220. data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.css +38 -0
  221. data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +386 -0
  222. data/vendor/assets/javascripts/codemirror/addons/hint/sql-hint.js +254 -0
  223. data/vendor/assets/javascripts/codemirror/addons/hint/xml-hint.js +110 -0
  224. data/vendor/assets/javascripts/codemirror/addons/lint/coffeescript-lint.js +41 -0
  225. data/vendor/assets/javascripts/codemirror/addons/lint/css-lint.js +35 -0
  226. data/vendor/assets/javascripts/codemirror/addons/lint/html-lint.js +46 -0
  227. data/vendor/assets/javascripts/codemirror/addons/lint/javascript-lint.js +136 -0
  228. data/vendor/assets/javascripts/codemirror/addons/lint/json-lint.js +31 -0
  229. data/vendor/assets/javascripts/codemirror/addons/lint/lint.css +73 -0
  230. data/vendor/assets/javascripts/codemirror/addons/lint/lint.js +231 -0
  231. data/vendor/assets/javascripts/codemirror/addons/lint/yaml-lint.js +28 -0
  232. data/vendor/assets/javascripts/codemirror/addons/merge/merge.css +112 -0
  233. data/vendor/assets/javascripts/codemirror/addons/merge/merge.js +775 -0
  234. data/vendor/assets/javascripts/codemirror/addons/mode/loadmode.js +64 -0
  235. data/vendor/assets/javascripts/codemirror/addons/mode/multiplex.js +123 -0
  236. data/vendor/assets/javascripts/codemirror/addons/mode/multiplex_test.js +33 -0
  237. data/vendor/assets/javascripts/codemirror/addons/mode/overlay.js +85 -0
  238. data/vendor/assets/javascripts/codemirror/addons/mode/simple.js +213 -0
  239. data/vendor/assets/javascripts/codemirror/addons/runmode/colorize.js +40 -0
  240. data/vendor/assets/javascripts/codemirror/addons/runmode/runmode-standalone.js +157 -0
  241. data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.js +72 -0
  242. data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.node.js +178 -0
  243. data/vendor/assets/javascripts/codemirror/addons/scroll/annotatescrollbar.js +115 -0
  244. data/vendor/assets/javascripts/codemirror/addons/scroll/scrollpastend.js +46 -0
  245. data/vendor/assets/javascripts/codemirror/addons/scroll/simplescrollbars.css +66 -0
  246. data/vendor/assets/javascripts/codemirror/addons/scroll/simplescrollbars.js +147 -0
  247. data/vendor/assets/javascripts/codemirror/addons/search/match-highlighter.js +128 -0
  248. data/vendor/assets/javascripts/codemirror/addons/search/matchesonscrollbar.css +8 -0
  249. data/vendor/assets/javascripts/codemirror/addons/search/matchesonscrollbar.js +97 -0
  250. data/vendor/assets/javascripts/codemirror/addons/search/search.js +228 -0
  251. data/vendor/assets/javascripts/codemirror/addons/search/searchcursor.js +189 -0
  252. data/vendor/assets/javascripts/codemirror/addons/selection/active-line.js +71 -0
  253. data/vendor/assets/javascripts/codemirror/addons/selection/mark-selection.js +118 -0
  254. data/vendor/assets/javascripts/codemirror/addons/selection/selection-pointer.js +98 -0
  255. data/vendor/assets/javascripts/codemirror/addons/tern/tern.css +87 -0
  256. data/vendor/assets/javascripts/codemirror/addons/tern/tern.js +700 -0
  257. data/vendor/assets/javascripts/codemirror/addons/tern/worker.js +44 -0
  258. data/vendor/assets/javascripts/codemirror/addons/wrap/hardwrap.js +139 -0
  259. data/vendor/assets/javascripts/codemirror/modes/coffeescript.js +366 -0
  260. data/vendor/assets/javascripts/codemirror/modes/css.js +823 -0
  261. data/vendor/assets/javascripts/codemirror/modes/diff.js +47 -0
  262. data/vendor/assets/javascripts/codemirror/modes/dockerfile.js +79 -0
  263. data/vendor/assets/javascripts/codemirror/modes/gfm.js +130 -0
  264. data/vendor/assets/javascripts/codemirror/modes/go.js +185 -0
  265. data/vendor/assets/javascripts/codemirror/modes/haml.js +159 -0
  266. data/vendor/assets/javascripts/codemirror/modes/handlebars.js +53 -0
  267. data/vendor/assets/javascripts/codemirror/modes/htmlembedded.js +28 -0
  268. data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +150 -0
  269. data/vendor/assets/javascripts/codemirror/modes/javascript.js +708 -0
  270. data/vendor/assets/javascripts/codemirror/modes/markdown.js +792 -0
  271. data/vendor/assets/javascripts/codemirror/modes/nginx.js +178 -0
  272. data/vendor/assets/javascripts/codemirror/modes/php.js +234 -0
  273. data/vendor/assets/javascripts/codemirror/modes/python.js +358 -0
  274. data/vendor/assets/javascripts/codemirror/modes/ruby.js +285 -0
  275. data/vendor/assets/javascripts/codemirror/modes/rust.js +58 -0
  276. data/vendor/assets/javascripts/codemirror/modes/sass.js +414 -0
  277. data/vendor/assets/javascripts/codemirror/modes/shell.js +139 -0
  278. data/vendor/assets/javascripts/codemirror/modes/xml.js +385 -0
  279. data/vendor/assets/javascripts/codemirror/modes/yaml.js +117 -0
  280. data/vendor/assets/javascripts/intl-tel-input.js +963 -0
  281. data/vendor/assets/javascripts/intl-tel-utils.js +480 -0
  282. data/vendor/assets/javascripts/slug.js +212 -0
  283. data/vendor/assets/javascripts/summernote.js +6939 -0
  284. data/vendor/assets/stylesheets/codemirror.css +334 -0
  285. data/vendor/assets/stylesheets/codemirror/themes/base16-dark.css +38 -0
  286. data/vendor/assets/stylesheets/codemirror/themes/base16-light.css +38 -0
  287. data/vendor/assets/stylesheets/codemirror/themes/dracula.css +41 -0
  288. data/vendor/assets/stylesheets/codemirror/themes/material.css +53 -0
  289. data/vendor/assets/stylesheets/codemirror/themes/monokai.css +35 -0
  290. data/vendor/assets/stylesheets/codemirror/themes/solarized.css +163 -0
  291. data/vendor/assets/stylesheets/codemirror/themes/vibrant-ink.css +34 -0
  292. data/vendor/assets/stylesheets/intl-tel-input.scss +1054 -0
  293. data/vendor/assets/stylesheets/summernote-bs3.css +5425 -0
  294. data/vendor/assets/stylesheets/summernote.css +1 -0
  295. metadata +604 -0
@@ -0,0 +1,146 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ var Pos = CodeMirror.Pos;
13
+
14
+ function forEach(arr, f) {
15
+ for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
16
+ }
17
+
18
+ function arrayContains(arr, item) {
19
+ if (!Array.prototype.indexOf) {
20
+ var i = arr.length;
21
+ while (i--) {
22
+ if (arr[i] === item) {
23
+ return true;
24
+ }
25
+ }
26
+ return false;
27
+ }
28
+ return arr.indexOf(item) != -1;
29
+ }
30
+
31
+ function scriptHint(editor, keywords, getToken, options) {
32
+ // Find the token at the cursor
33
+ var cur = editor.getCursor(), token = getToken(editor, cur);
34
+ if (/\b(?:string|comment)\b/.test(token.type)) return;
35
+ token.state = CodeMirror.innerMode(editor.getMode(), token.state).state;
36
+
37
+ // If it's not a 'word-style' token, ignore the token.
38
+ if (!/^[\w$_]*$/.test(token.string)) {
39
+ token = {start: cur.ch, end: cur.ch, string: "", state: token.state,
40
+ type: token.string == "." ? "property" : null};
41
+ } else if (token.end > cur.ch) {
42
+ token.end = cur.ch;
43
+ token.string = token.string.slice(0, cur.ch - token.start);
44
+ }
45
+
46
+ var tprop = token;
47
+ // If it is a property, find out what it is a property of.
48
+ while (tprop.type == "property") {
49
+ tprop = getToken(editor, Pos(cur.line, tprop.start));
50
+ if (tprop.string != ".") return;
51
+ tprop = getToken(editor, Pos(cur.line, tprop.start));
52
+ if (!context) var context = [];
53
+ context.push(tprop);
54
+ }
55
+ return {list: getCompletions(token, context, keywords, options),
56
+ from: Pos(cur.line, token.start),
57
+ to: Pos(cur.line, token.end)};
58
+ }
59
+
60
+ function javascriptHint(editor, options) {
61
+ return scriptHint(editor, javascriptKeywords,
62
+ function (e, cur) {return e.getTokenAt(cur);},
63
+ options);
64
+ };
65
+ CodeMirror.registerHelper("hint", "javascript", javascriptHint);
66
+
67
+ function getCoffeeScriptToken(editor, cur) {
68
+ // This getToken, it is for coffeescript, imitates the behavior of
69
+ // getTokenAt method in javascript.js, that is, returning "property"
70
+ // type and treat "." as indepenent token.
71
+ var token = editor.getTokenAt(cur);
72
+ if (cur.ch == token.start + 1 && token.string.charAt(0) == '.') {
73
+ token.end = token.start;
74
+ token.string = '.';
75
+ token.type = "property";
76
+ }
77
+ else if (/^\.[\w$_]*$/.test(token.string)) {
78
+ token.type = "property";
79
+ token.start++;
80
+ token.string = token.string.replace(/\./, '');
81
+ }
82
+ return token;
83
+ }
84
+
85
+ function coffeescriptHint(editor, options) {
86
+ return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken, options);
87
+ }
88
+ CodeMirror.registerHelper("hint", "coffeescript", coffeescriptHint);
89
+
90
+ var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " +
91
+ "toUpperCase toLowerCase split concat match replace search").split(" ");
92
+ var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " +
93
+ "lastIndexOf every some filter forEach map reduce reduceRight ").split(" ");
94
+ var funcProps = "prototype apply call bind".split(" ");
95
+ var javascriptKeywords = ("break case catch continue debugger default delete do else false finally for function " +
96
+ "if in instanceof new null return switch throw true try typeof var void while with").split(" ");
97
+ var coffeescriptKeywords = ("and break catch class continue delete do else extends false finally for " +
98
+ "if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" ");
99
+
100
+ function getCompletions(token, context, keywords, options) {
101
+ var found = [], start = token.string, global = options && options.globalScope || window;
102
+ function maybeAdd(str) {
103
+ if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) found.push(str);
104
+ }
105
+ function gatherCompletions(obj) {
106
+ if (typeof obj == "string") forEach(stringProps, maybeAdd);
107
+ else if (obj instanceof Array) forEach(arrayProps, maybeAdd);
108
+ else if (obj instanceof Function) forEach(funcProps, maybeAdd);
109
+ for (var name in obj) maybeAdd(name);
110
+ }
111
+
112
+ if (context && context.length) {
113
+ // If this is a property, see if it belongs to some object we can
114
+ // find in the current environment.
115
+ var obj = context.pop(), base;
116
+ if (obj.type && obj.type.indexOf("variable") === 0) {
117
+ if (options && options.additionalContext)
118
+ base = options.additionalContext[obj.string];
119
+ if (!options || options.useGlobalScope !== false)
120
+ base = base || global[obj.string];
121
+ } else if (obj.type == "string") {
122
+ base = "";
123
+ } else if (obj.type == "atom") {
124
+ base = 1;
125
+ } else if (obj.type == "function") {
126
+ if (global.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') &&
127
+ (typeof global.jQuery == 'function'))
128
+ base = global.jQuery();
129
+ else if (global._ != null && (obj.string == '_') && (typeof global._ == 'function'))
130
+ base = global._();
131
+ }
132
+ while (base != null && context.length)
133
+ base = base[context.pop().string];
134
+ if (base != null) gatherCompletions(base);
135
+ } else {
136
+ // If not, just look in the global object and any local scope
137
+ // (reading into JS mode internals to get at the local and global variables)
138
+ for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
139
+ for (var v = token.state.globalVars; v; v = v.next) maybeAdd(v.name);
140
+ if (!options || options.useGlobalScope !== false)
141
+ gatherCompletions(global);
142
+ forEach(keywords, maybeAdd);
143
+ }
144
+ return found;
145
+ }
146
+ });
@@ -0,0 +1,38 @@
1
+ .CodeMirror-hints {
2
+ position: absolute;
3
+ z-index: 10;
4
+ overflow: hidden;
5
+ list-style: none;
6
+
7
+ margin: 0;
8
+ padding: 2px;
9
+
10
+ -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
11
+ -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
12
+ box-shadow: 2px 3px 5px rgba(0,0,0,.2);
13
+ border-radius: 3px;
14
+ border: 1px solid silver;
15
+
16
+ background: white;
17
+ font-size: 90%;
18
+ font-family: monospace;
19
+
20
+ max-height: 20em;
21
+ overflow-y: auto;
22
+ }
23
+
24
+ .CodeMirror-hint {
25
+ margin: 0;
26
+ padding: 0 4px;
27
+ border-radius: 2px;
28
+ max-width: 19em;
29
+ overflow: hidden;
30
+ white-space: pre;
31
+ color: black;
32
+ cursor: pointer;
33
+ }
34
+
35
+ li.CodeMirror-hint-active {
36
+ background: #08f;
37
+ color: white;
38
+ }
@@ -0,0 +1,386 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
14
+ var HINT_ELEMENT_CLASS = "CodeMirror-hint";
15
+ var ACTIVE_HINT_ELEMENT_CLASS = "CodeMirror-hint-active";
16
+
17
+ // This is the old interface, kept around for now to stay
18
+ // backwards-compatible.
19
+ CodeMirror.showHint = function(cm, getHints, options) {
20
+ if (!getHints) return cm.showHint(options);
21
+ if (options && options.async) getHints.async = true;
22
+ var newOpts = {hint: getHints};
23
+ if (options) for (var prop in options) newOpts[prop] = options[prop];
24
+ return cm.showHint(newOpts);
25
+ };
26
+
27
+ CodeMirror.defineExtension("showHint", function(options) {
28
+ // We want a single cursor position.
29
+ if (this.listSelections().length > 1 || this.somethingSelected()) return;
30
+
31
+ if (this.state.completionActive) this.state.completionActive.close();
32
+ var completion = this.state.completionActive = new Completion(this, options);
33
+ if (!completion.options.hint) return;
34
+
35
+ CodeMirror.signal(this, "startCompletion", this);
36
+ completion.update(true);
37
+ });
38
+
39
+ function Completion(cm, options) {
40
+ this.cm = cm;
41
+ this.options = this.buildOptions(options);
42
+ this.widget = null;
43
+ this.debounce = 0;
44
+ this.tick = 0;
45
+ this.startPos = this.cm.getCursor();
46
+ this.startLen = this.cm.getLine(this.startPos.line).length;
47
+
48
+ var self = this;
49
+ cm.on("cursorActivity", this.activityFunc = function() { self.cursorActivity(); });
50
+ }
51
+
52
+ var requestAnimationFrame = window.requestAnimationFrame || function(fn) {
53
+ return setTimeout(fn, 1000/60);
54
+ };
55
+ var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;
56
+
57
+ Completion.prototype = {
58
+ close: function() {
59
+ if (!this.active()) return;
60
+ this.cm.state.completionActive = null;
61
+ this.tick = null;
62
+ this.cm.off("cursorActivity", this.activityFunc);
63
+
64
+ if (this.widget && this.data) CodeMirror.signal(this.data, "close");
65
+ if (this.widget) this.widget.close();
66
+ CodeMirror.signal(this.cm, "endCompletion", this.cm);
67
+ },
68
+
69
+ active: function() {
70
+ return this.cm.state.completionActive == this;
71
+ },
72
+
73
+ pick: function(data, i) {
74
+ var completion = data.list[i];
75
+ if (completion.hint) completion.hint(this.cm, data, completion);
76
+ else this.cm.replaceRange(getText(completion), completion.from || data.from,
77
+ completion.to || data.to, "complete");
78
+ CodeMirror.signal(data, "pick", completion);
79
+ this.close();
80
+ },
81
+
82
+ cursorActivity: function() {
83
+ if (this.debounce) {
84
+ cancelAnimationFrame(this.debounce);
85
+ this.debounce = 0;
86
+ }
87
+
88
+ var pos = this.cm.getCursor(), line = this.cm.getLine(pos.line);
89
+ if (pos.line != this.startPos.line || line.length - pos.ch != this.startLen - this.startPos.ch ||
90
+ pos.ch < this.startPos.ch || this.cm.somethingSelected() ||
91
+ (pos.ch && this.options.closeCharacters.test(line.charAt(pos.ch - 1)))) {
92
+ this.close();
93
+ } else {
94
+ var self = this;
95
+ this.debounce = requestAnimationFrame(function() {self.update();});
96
+ if (this.widget) this.widget.disable();
97
+ }
98
+ },
99
+
100
+ update: function(first) {
101
+ if (this.tick == null) return;
102
+ if (!this.options.hint.async) {
103
+ this.finishUpdate(this.options.hint(this.cm, this.options), first);
104
+ } else {
105
+ var myTick = ++this.tick, self = this;
106
+ this.options.hint(this.cm, function(data) {
107
+ if (self.tick == myTick) self.finishUpdate(data, first);
108
+ }, this.options);
109
+ }
110
+ },
111
+
112
+ finishUpdate: function(data, first) {
113
+ if (this.data) CodeMirror.signal(this.data, "update");
114
+ if (data && this.data && CodeMirror.cmpPos(data.from, this.data.from)) data = null;
115
+ this.data = data;
116
+
117
+ var picked = (this.widget && this.widget.picked) || (first && this.options.completeSingle);
118
+ if (this.widget) this.widget.close();
119
+ if (data && data.list.length) {
120
+ if (picked && data.list.length == 1) {
121
+ this.pick(data, 0);
122
+ } else {
123
+ this.widget = new Widget(this, data);
124
+ CodeMirror.signal(data, "shown");
125
+ }
126
+ }
127
+ },
128
+
129
+ buildOptions: function(options) {
130
+ var editor = this.cm.options.hintOptions;
131
+ var out = {};
132
+ for (var prop in defaultOptions) out[prop] = defaultOptions[prop];
133
+ if (editor) for (var prop in editor)
134
+ if (editor[prop] !== undefined) out[prop] = editor[prop];
135
+ if (options) for (var prop in options)
136
+ if (options[prop] !== undefined) out[prop] = options[prop];
137
+ return out;
138
+ }
139
+ };
140
+
141
+ function getText(completion) {
142
+ if (typeof completion == "string") return completion;
143
+ else return completion.text;
144
+ }
145
+
146
+ function buildKeyMap(completion, handle) {
147
+ var baseMap = {
148
+ Up: function() {handle.moveFocus(-1);},
149
+ Down: function() {handle.moveFocus(1);},
150
+ PageUp: function() {handle.moveFocus(-handle.menuSize() + 1, true);},
151
+ PageDown: function() {handle.moveFocus(handle.menuSize() - 1, true);},
152
+ Home: function() {handle.setFocus(0);},
153
+ End: function() {handle.setFocus(handle.length - 1);},
154
+ Enter: handle.pick,
155
+ Tab: handle.pick,
156
+ Esc: handle.close
157
+ };
158
+ var custom = completion.options.customKeys;
159
+ var ourMap = custom ? {} : baseMap;
160
+ function addBinding(key, val) {
161
+ var bound;
162
+ if (typeof val != "string")
163
+ bound = function(cm) { return val(cm, handle); };
164
+ // This mechanism is deprecated
165
+ else if (baseMap.hasOwnProperty(val))
166
+ bound = baseMap[val];
167
+ else
168
+ bound = val;
169
+ ourMap[key] = bound;
170
+ }
171
+ if (custom)
172
+ for (var key in custom) if (custom.hasOwnProperty(key))
173
+ addBinding(key, custom[key]);
174
+ var extra = completion.options.extraKeys;
175
+ if (extra)
176
+ for (var key in extra) if (extra.hasOwnProperty(key))
177
+ addBinding(key, extra[key]);
178
+ return ourMap;
179
+ }
180
+
181
+ function getHintElement(hintsElement, el) {
182
+ while (el && el != hintsElement) {
183
+ if (el.nodeName.toUpperCase() === "LI" && el.parentNode == hintsElement) return el;
184
+ el = el.parentNode;
185
+ }
186
+ }
187
+
188
+ function Widget(completion, data) {
189
+ this.completion = completion;
190
+ this.data = data;
191
+ this.picked = false;
192
+ var widget = this, cm = completion.cm;
193
+
194
+ var hints = this.hints = document.createElement("ul");
195
+ hints.className = "CodeMirror-hints";
196
+ this.selectedHint = data.selectedHint || 0;
197
+
198
+ var completions = data.list;
199
+ for (var i = 0; i < completions.length; ++i) {
200
+ var elt = hints.appendChild(document.createElement("li")), cur = completions[i];
201
+ var className = HINT_ELEMENT_CLASS + (i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS);
202
+ if (cur.className != null) className = cur.className + " " + className;
203
+ elt.className = className;
204
+ if (cur.render) cur.render(elt, data, cur);
205
+ else elt.appendChild(document.createTextNode(cur.displayText || getText(cur)));
206
+ elt.hintId = i;
207
+ }
208
+
209
+ var pos = cm.cursorCoords(completion.options.alignWithWord ? data.from : null);
210
+ var left = pos.left, top = pos.bottom, below = true;
211
+ hints.style.left = left + "px";
212
+ hints.style.top = top + "px";
213
+ // If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
214
+ var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth);
215
+ var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight);
216
+ (completion.options.container || document.body).appendChild(hints);
217
+ var box = hints.getBoundingClientRect(), overlapY = box.bottom - winH;
218
+ if (overlapY > 0) {
219
+ var height = box.bottom - box.top, curTop = pos.top - (pos.bottom - box.top);
220
+ if (curTop - height > 0) { // Fits above cursor
221
+ hints.style.top = (top = pos.top - height) + "px";
222
+ below = false;
223
+ } else if (height > winH) {
224
+ hints.style.height = (winH - 5) + "px";
225
+ hints.style.top = (top = pos.bottom - box.top) + "px";
226
+ var cursor = cm.getCursor();
227
+ if (data.from.ch != cursor.ch) {
228
+ pos = cm.cursorCoords(cursor);
229
+ hints.style.left = (left = pos.left) + "px";
230
+ box = hints.getBoundingClientRect();
231
+ }
232
+ }
233
+ }
234
+ var overlapX = box.right - winW;
235
+ if (overlapX > 0) {
236
+ if (box.right - box.left > winW) {
237
+ hints.style.width = (winW - 5) + "px";
238
+ overlapX -= (box.right - box.left) - winW;
239
+ }
240
+ hints.style.left = (left = pos.left - overlapX) + "px";
241
+ }
242
+
243
+ cm.addKeyMap(this.keyMap = buildKeyMap(completion, {
244
+ moveFocus: function(n, avoidWrap) { widget.changeActive(widget.selectedHint + n, avoidWrap); },
245
+ setFocus: function(n) { widget.changeActive(n); },
246
+ menuSize: function() { return widget.screenAmount(); },
247
+ length: completions.length,
248
+ close: function() { completion.close(); },
249
+ pick: function() { widget.pick(); },
250
+ data: data
251
+ }));
252
+
253
+ if (completion.options.closeOnUnfocus) {
254
+ var closingOnBlur;
255
+ cm.on("blur", this.onBlur = function() { closingOnBlur = setTimeout(function() { completion.close(); }, 100); });
256
+ cm.on("focus", this.onFocus = function() { clearTimeout(closingOnBlur); });
257
+ }
258
+
259
+ var startScroll = cm.getScrollInfo();
260
+ cm.on("scroll", this.onScroll = function() {
261
+ var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect();
262
+ var newTop = top + startScroll.top - curScroll.top;
263
+ var point = newTop - (window.pageYOffset || (document.documentElement || document.body).scrollTop);
264
+ if (!below) point += hints.offsetHeight;
265
+ if (point <= editor.top || point >= editor.bottom) return completion.close();
266
+ hints.style.top = newTop + "px";
267
+ hints.style.left = (left + startScroll.left - curScroll.left) + "px";
268
+ });
269
+
270
+ CodeMirror.on(hints, "dblclick", function(e) {
271
+ var t = getHintElement(hints, e.target || e.srcElement);
272
+ if (t && t.hintId != null) {widget.changeActive(t.hintId); widget.pick();}
273
+ });
274
+
275
+ CodeMirror.on(hints, "click", function(e) {
276
+ var t = getHintElement(hints, e.target || e.srcElement);
277
+ if (t && t.hintId != null) {
278
+ widget.changeActive(t.hintId);
279
+ if (completion.options.completeOnSingleClick) widget.pick();
280
+ }
281
+ });
282
+
283
+ CodeMirror.on(hints, "mousedown", function() {
284
+ setTimeout(function(){cm.focus();}, 20);
285
+ });
286
+
287
+ CodeMirror.signal(data, "select", completions[0], hints.firstChild);
288
+ return true;
289
+ }
290
+
291
+ Widget.prototype = {
292
+ close: function() {
293
+ if (this.completion.widget != this) return;
294
+ this.completion.widget = null;
295
+ this.hints.parentNode.removeChild(this.hints);
296
+ this.completion.cm.removeKeyMap(this.keyMap);
297
+
298
+ var cm = this.completion.cm;
299
+ if (this.completion.options.closeOnUnfocus) {
300
+ cm.off("blur", this.onBlur);
301
+ cm.off("focus", this.onFocus);
302
+ }
303
+ cm.off("scroll", this.onScroll);
304
+ },
305
+
306
+ disable: function() {
307
+ this.completion.cm.removeKeyMap(this.keyMap);
308
+ var widget = this;
309
+ this.keyMap = {Enter: function() { widget.picked = true; }};
310
+ this.completion.cm.addKeyMap(this.keyMap);
311
+ },
312
+
313
+ pick: function() {
314
+ this.completion.pick(this.data, this.selectedHint);
315
+ },
316
+
317
+ changeActive: function(i, avoidWrap) {
318
+ if (i >= this.data.list.length)
319
+ i = avoidWrap ? this.data.list.length - 1 : 0;
320
+ else if (i < 0)
321
+ i = avoidWrap ? 0 : this.data.list.length - 1;
322
+ if (this.selectedHint == i) return;
323
+ var node = this.hints.childNodes[this.selectedHint];
324
+ node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, "");
325
+ node = this.hints.childNodes[this.selectedHint = i];
326
+ node.className += " " + ACTIVE_HINT_ELEMENT_CLASS;
327
+ if (node.offsetTop < this.hints.scrollTop)
328
+ this.hints.scrollTop = node.offsetTop - 3;
329
+ else if (node.offsetTop + node.offsetHeight > this.hints.scrollTop + this.hints.clientHeight)
330
+ this.hints.scrollTop = node.offsetTop + node.offsetHeight - this.hints.clientHeight + 3;
331
+ CodeMirror.signal(this.data, "select", this.data.list[this.selectedHint], node);
332
+ },
333
+
334
+ screenAmount: function() {
335
+ return Math.floor(this.hints.clientHeight / this.hints.firstChild.offsetHeight) || 1;
336
+ }
337
+ };
338
+
339
+ CodeMirror.registerHelper("hint", "auto", function(cm, options) {
340
+ var helpers = cm.getHelpers(cm.getCursor(), "hint"), words;
341
+ if (helpers.length) {
342
+ for (var i = 0; i < helpers.length; i++) {
343
+ var cur = helpers[i](cm, options);
344
+ if (cur && cur.list.length) return cur;
345
+ }
346
+ } else if (words = cm.getHelper(cm.getCursor(), "hintWords")) {
347
+ if (words) return CodeMirror.hint.fromList(cm, {words: words});
348
+ } else if (CodeMirror.hint.anyword) {
349
+ return CodeMirror.hint.anyword(cm, options);
350
+ }
351
+ });
352
+
353
+ CodeMirror.registerHelper("hint", "fromList", function(cm, options) {
354
+ var cur = cm.getCursor(), token = cm.getTokenAt(cur);
355
+ var to = CodeMirror.Pos(cur.line, token.end);
356
+ if (token.string && /\w/.test(token.string[token.string.length - 1])) {
357
+ var term = token.string, from = CodeMirror.Pos(cur.line, token.start);
358
+ } else {
359
+ var term = "", from = to;
360
+ }
361
+ var found = [];
362
+ for (var i = 0; i < options.words.length; i++) {
363
+ var word = options.words[i];
364
+ if (word.slice(0, term.length) == term)
365
+ found.push(word);
366
+ }
367
+
368
+ if (found.length) return {list: found, from: from, to: to};
369
+ });
370
+
371
+ CodeMirror.commands.autocomplete = CodeMirror.showHint;
372
+
373
+ var defaultOptions = {
374
+ hint: CodeMirror.hint.auto,
375
+ completeSingle: true,
376
+ alignWithWord: true,
377
+ closeCharacters: /[\s()\[\]{};:>,]/,
378
+ closeOnUnfocus: true,
379
+ completeOnSingleClick: false,
380
+ container: null,
381
+ customKeys: null,
382
+ extraKeys: null
383
+ };
384
+
385
+ CodeMirror.defineOption("hintOptions", null);
386
+ });