ela 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (300) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/.gitlab-ci.yml +23 -0
  4. data/Gemfile +7 -0
  5. data/Gemfile.lock +139 -0
  6. data/Guardfile +25 -0
  7. data/LICENSE.txt +205 -0
  8. data/README.de.md +195 -0
  9. data/README.md +66 -0
  10. data/Rakefile +96 -0
  11. data/app/css/screen.styl +425 -0
  12. data/app/css/vendor/stackedit.styl +140 -0
  13. data/app/fonts/Roboto-Italic-webfont.eot +0 -0
  14. data/app/fonts/Roboto-Italic-webfont.svg +642 -0
  15. data/app/fonts/Roboto-Italic-webfont.ttf +0 -0
  16. data/app/fonts/Roboto-Italic-webfont.woff +0 -0
  17. data/app/fonts/Roboto-Light-webfont.eot +0 -0
  18. data/app/fonts/Roboto-Light-webfont.svg +641 -0
  19. data/app/fonts/Roboto-Light-webfont.ttf +0 -0
  20. data/app/fonts/Roboto-Light-webfont.woff +0 -0
  21. data/app/fonts/Roboto-LightItalic-webfont.eot +0 -0
  22. data/app/fonts/Roboto-LightItalic-webfont.svg +641 -0
  23. data/app/fonts/Roboto-LightItalic-webfont.ttf +0 -0
  24. data/app/fonts/Roboto-LightItalic-webfont.woff +0 -0
  25. data/app/fonts/Roboto-Medium-webfont.eot +0 -0
  26. data/app/fonts/Roboto-Medium-webfont.svg +593 -0
  27. data/app/fonts/Roboto-Medium-webfont.ttf +0 -0
  28. data/app/fonts/Roboto-Medium-webfont.woff +0 -0
  29. data/app/fonts/Roboto-MediumItalic-webfont.eot +0 -0
  30. data/app/fonts/Roboto-MediumItalic-webfont.svg +642 -0
  31. data/app/fonts/Roboto-MediumItalic-webfont.ttf +0 -0
  32. data/app/fonts/Roboto-MediumItalic-webfont.woff +0 -0
  33. data/app/fonts/Roboto-Regular-webfont.eot +0 -0
  34. data/app/fonts/Roboto-Regular-webfont.svg +621 -0
  35. data/app/fonts/Roboto-Regular-webfont.ttf +0 -0
  36. data/app/fonts/Roboto-Regular-webfont.woff +0 -0
  37. data/app/fonts/Roboto-Thin-webfont.eot +0 -0
  38. data/app/fonts/Roboto-Thin-webfont.svg +631 -0
  39. data/app/fonts/Roboto-Thin-webfont.ttf +0 -0
  40. data/app/fonts/Roboto-Thin-webfont.woff +0 -0
  41. data/app/fonts/Roboto-ThinItalic-webfont.eot +0 -0
  42. data/app/fonts/Roboto-ThinItalic-webfont.svg +631 -0
  43. data/app/fonts/Roboto-ThinItalic-webfont.ttf +0 -0
  44. data/app/fonts/Roboto-ThinItalic-webfont.woff +0 -0
  45. data/app/fonts/droid_sans_regular.typeface.svg +1 -0
  46. data/app/fonts/fontawesome-webfont.eot +0 -0
  47. data/app/fonts/fontawesome-webfont.svg +2671 -0
  48. data/app/fonts/fontawesome-webfont.ttf +0 -0
  49. data/app/fonts/fontawesome-webfont.woff +0 -0
  50. data/app/fonts/fontawesome-webfont.woff2 +0 -0
  51. data/app/js/lib/application.coffee +83 -0
  52. data/app/js/lib/bootstrap_data.coffee +70 -0
  53. data/app/js/lib/collections/00_limited_collection.coffee +85 -0
  54. data/app/js/lib/collections/curves.coffee +3 -0
  55. data/app/js/lib/collections/named_object_collection.coffee +7 -0
  56. data/app/js/lib/mathjaxConfig.coffee +241 -0
  57. data/app/js/lib/models/app.coffee +58 -0
  58. data/app/js/lib/models/base_app.coffee +62 -0
  59. data/app/js/lib/models/base_app_model.coffee +61 -0
  60. data/app/js/lib/models/base_calculator.coffee +212 -0
  61. data/app/js/lib/models/base_subapp_container.coffee +35 -0
  62. data/app/js/lib/models/curve.coffee +179 -0
  63. data/app/js/lib/router.coffee +26 -0
  64. data/app/js/lib/views/app.coffee +56 -0
  65. data/app/js/lib/views/base_app.coffee +274 -0
  66. data/app/js/lib/views/base_aside.coffee +9 -0
  67. data/app/js/lib/views/base_graph.coffee +477 -0
  68. data/app/js/lib/views/base_subapp_container.coffee +44 -0
  69. data/app/js/lib/views/canvas.coffee +73 -0
  70. data/app/js/lib/views/curve_graph.coffee +163 -0
  71. data/app/js/lib/views/curves_aside.coffee +21 -0
  72. data/app/js/lib/views/curves_list_item.coffee +8 -0
  73. data/app/js/lib/views/grouped_parameters_aside.coffee +14 -0
  74. data/app/js/lib/views/headup.coffee +15 -0
  75. data/app/js/lib/views/help.coffee +86 -0
  76. data/app/js/lib/views/interpolated_graph.coffee +281 -0
  77. data/app/js/lib/views/legend.coffee +138 -0
  78. data/app/js/lib/views/legend_handler.coffee +51 -0
  79. data/app/js/lib/views/overview.coffee +85 -0
  80. data/app/js/lib/views/overview_tile.coffee +18 -0
  81. data/app/js/lib/views/parameters_aside.coffee +12 -0
  82. data/app/js/lib/views/three_graph.coffee +92 -0
  83. data/app/js/vendor/Markdown.Converter.js +1519 -0
  84. data/app/js/vendor/Markdown.Extra.js +874 -0
  85. data/app/js/vendor/Markdown.Toc.coffee +79 -0
  86. data/app/js/vendor/backbone-1.3.3.min.js +2 -0
  87. data/app/js/vendor/backbone-validation-0.11.5.js +8 -0
  88. data/app/js/vendor/backbone.poised/form.coffee +156 -0
  89. data/app/js/vendor/backbone.poised/form/anchor.coffee +26 -0
  90. data/app/js/vendor/backbone.poised/form/base_control.coffee +42 -0
  91. data/app/js/vendor/backbone.poised/form/linked_control.coffee +79 -0
  92. data/app/js/vendor/backbone.poised/form/linked_number_control.coffee +27 -0
  93. data/app/js/vendor/backbone.poised/form/linked_range_control.coffee +53 -0
  94. data/app/js/vendor/backbone.poised/form/linked_select_control.coffee +18 -0
  95. data/app/js/vendor/backbone.poised/form/linked_string_control.coffee +27 -0
  96. data/app/js/vendor/backbone.poised/form/number_control.coffee +25 -0
  97. data/app/js/vendor/backbone.poised/form/range_control.coffee +48 -0
  98. data/app/js/vendor/backbone.poised/form/select_control.coffee +16 -0
  99. data/app/js/vendor/backbone.poised/form/selectbox.coffee +78 -0
  100. data/app/js/vendor/backbone.poised/form/slider.coffee +109 -0
  101. data/app/js/vendor/backbone.poised/form/string_control.coffee +23 -0
  102. data/app/js/vendor/backbone.poised/form/submit_control.coffee +39 -0
  103. data/app/js/vendor/backbone.poised/form/textarea.coffee +36 -0
  104. data/app/js/vendor/backbone.poised/form/textfield.coffee +86 -0
  105. data/app/js/vendor/backbone.poised/form/value.coffee +33 -0
  106. data/app/js/vendor/backbone.poised/form/value_control.coffee +15 -0
  107. data/app/js/vendor/backbone.poised/linked_form.coffee +43 -0
  108. data/app/js/vendor/backbone.poised/list.coffee +97 -0
  109. data/app/js/vendor/backbone.poised/list/add_button.coffee +16 -0
  110. data/app/js/vendor/backbone.poised/list/anchor.coffee +32 -0
  111. data/app/js/vendor/backbone.poised/list/item.coffee +68 -0
  112. data/app/js/vendor/backbone.poised/list/searchfield.coffee +26 -0
  113. data/app/js/vendor/backbone.poised/list/selectable_item.coffee +65 -0
  114. data/app/js/vendor/backbone.poised/patches.coffee +6 -0
  115. data/app/js/vendor/backbone.poised/string_mixin.coffee +23 -0
  116. data/app/js/vendor/backbone.poised/underscore_ext.coffee +2 -0
  117. data/app/js/vendor/backbone.poised/view.coffee +59 -0
  118. data/app/js/vendor/gaussianElimination.coffee +40 -0
  119. data/app/js/vendor/hammer-2.0.8.min.js +7 -0
  120. data/app/js/vendor/jquery-3.1.1.min.js +4 -0
  121. data/app/js/vendor/jquery.after-transition.coffee +20 -0
  122. data/app/js/vendor/jquery.backbone-hammer.coffee +28 -0
  123. data/app/js/vendor/jquery.keyboard-modifiers.coffee +22 -0
  124. data/app/js/vendor/jquery.mark-5.2.3.min.js +7 -0
  125. data/app/js/vendor/jquery.scrollTo-2.1.2.min.js +7 -0
  126. data/app/js/vendor/js-yaml-3.4.3.min.js +3 -0
  127. data/app/js/vendor/markup_text.coffee +95 -0
  128. data/app/js/vendor/mathjax/MathJax.js +19 -0
  129. data/app/js/vendor/mathjax/extensions/MathEvents.js +19 -0
  130. data/app/js/vendor/mathjax/extensions/tex2jax.js +19 -0
  131. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_AMS-Regular.eot +0 -0
  132. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Caligraphic-Bold.eot +0 -0
  133. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Caligraphic-Regular.eot +0 -0
  134. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Fraktur-Bold.eot +0 -0
  135. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Fraktur-Regular.eot +0 -0
  136. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Main-Bold.eot +0 -0
  137. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Main-Italic.eot +0 -0
  138. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Main-Regular.eot +0 -0
  139. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Math-BoldItalic.eot +0 -0
  140. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Math-Italic.eot +0 -0
  141. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Math-Regular.eot +0 -0
  142. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_SansSerif-Bold.eot +0 -0
  143. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_SansSerif-Italic.eot +0 -0
  144. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_SansSerif-Regular.eot +0 -0
  145. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Script-Regular.eot +0 -0
  146. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Size1-Regular.eot +0 -0
  147. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Size2-Regular.eot +0 -0
  148. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Size3-Regular.eot +0 -0
  149. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Size4-Regular.eot +0 -0
  150. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Typewriter-Regular.eot +0 -0
  151. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_WinIE6-Regular.eot +0 -0
  152. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_AMS-Regular.otf +0 -0
  153. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Caligraphic-Bold.otf +0 -0
  154. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Caligraphic-Regular.otf +0 -0
  155. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Fraktur-Bold.otf +0 -0
  156. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Fraktur-Regular.otf +0 -0
  157. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Main-Bold.otf +0 -0
  158. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Main-Italic.otf +0 -0
  159. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Main-Regular.otf +0 -0
  160. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Math-BoldItalic.otf +0 -0
  161. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Math-Italic.otf +0 -0
  162. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Math-Regular.otf +0 -0
  163. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_SansSerif-Bold.otf +0 -0
  164. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_SansSerif-Italic.otf +0 -0
  165. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_SansSerif-Regular.otf +0 -0
  166. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Script-Regular.otf +0 -0
  167. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Size1-Regular.otf +0 -0
  168. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Size2-Regular.otf +0 -0
  169. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Size3-Regular.otf +0 -0
  170. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Size4-Regular.otf +0 -0
  171. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Typewriter-Regular.otf +0 -0
  172. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_WinChrome-Regular.otf +0 -0
  173. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_WinIE6-Regular.otf +0 -0
  174. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_AMS-Regular.svg +765 -0
  175. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Caligraphic-Bold.svg +136 -0
  176. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Caligraphic-Regular.svg +134 -0
  177. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Fraktur-Bold.svg +319 -0
  178. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Fraktur-Regular.svg +309 -0
  179. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Main-Bold.svg +656 -0
  180. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Main-Italic.svg +374 -0
  181. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Main-Regular.svg +659 -0
  182. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Math-BoldItalic.svg +331 -0
  183. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Math-Italic.svg +331 -0
  184. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Math-Regular.svg +330 -0
  185. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_SansSerif-Bold.svg +280 -0
  186. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_SansSerif-Italic.svg +245 -0
  187. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_SansSerif-Regular.svg +211 -0
  188. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Script-Regular.svg +160 -0
  189. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Size1-Regular.svg +110 -0
  190. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Size2-Regular.svg +109 -0
  191. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Size3-Regular.svg +49 -0
  192. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Size4-Regular.svg +102 -0
  193. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Typewriter-Regular.svg +322 -0
  194. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_WinChrome-Regular.svg +39 -0
  195. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_AMS-Regular.woff +0 -0
  196. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Caligraphic-Bold.woff +0 -0
  197. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Caligraphic-Regular.woff +0 -0
  198. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Fraktur-Bold.woff +0 -0
  199. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Fraktur-Regular.woff +0 -0
  200. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Main-Bold.woff +0 -0
  201. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Main-Italic.woff +0 -0
  202. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Main-Regular.woff +0 -0
  203. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Math-BoldItalic.woff +0 -0
  204. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Math-Italic.woff +0 -0
  205. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Math-Regular.woff +0 -0
  206. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_SansSerif-Bold.woff +0 -0
  207. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_SansSerif-Italic.woff +0 -0
  208. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_SansSerif-Regular.woff +0 -0
  209. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Script-Regular.woff +0 -0
  210. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Size1-Regular.woff +0 -0
  211. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Size2-Regular.woff +0 -0
  212. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Size3-Regular.woff +0 -0
  213. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Size4-Regular.woff +0 -0
  214. data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Typewriter-Regular.woff +0 -0
  215. data/app/js/vendor/mathjax/jax/element/mml/jax.js +19 -0
  216. data/app/js/vendor/mathjax/jax/element/mml/optable/Arrows.js +19 -0
  217. data/app/js/vendor/mathjax/jax/element/mml/optable/BasicLatin.js +19 -0
  218. data/app/js/vendor/mathjax/jax/element/mml/optable/CombDiacritMarks.js +19 -0
  219. data/app/js/vendor/mathjax/jax/element/mml/optable/CombDiactForSymbols.js +19 -0
  220. data/app/js/vendor/mathjax/jax/element/mml/optable/Dingbats.js +19 -0
  221. data/app/js/vendor/mathjax/jax/element/mml/optable/GeneralPunctuation.js +19 -0
  222. data/app/js/vendor/mathjax/jax/element/mml/optable/GeometricShapes.js +19 -0
  223. data/app/js/vendor/mathjax/jax/element/mml/optable/GreekAndCoptic.js +19 -0
  224. data/app/js/vendor/mathjax/jax/element/mml/optable/Latin1Supplement.js +19 -0
  225. data/app/js/vendor/mathjax/jax/element/mml/optable/LetterlikeSymbols.js +19 -0
  226. data/app/js/vendor/mathjax/jax/element/mml/optable/MathOperators.js +19 -0
  227. data/app/js/vendor/mathjax/jax/element/mml/optable/MiscMathSymbolsA.js +19 -0
  228. data/app/js/vendor/mathjax/jax/element/mml/optable/MiscMathSymbolsB.js +19 -0
  229. data/app/js/vendor/mathjax/jax/element/mml/optable/MiscSymbolsAndArrows.js +19 -0
  230. data/app/js/vendor/mathjax/jax/element/mml/optable/MiscTechnical.js +19 -0
  231. data/app/js/vendor/mathjax/jax/element/mml/optable/SpacingModLetters.js +19 -0
  232. data/app/js/vendor/mathjax/jax/element/mml/optable/SuppMathOperators.js +19 -0
  233. data/app/js/vendor/mathjax/jax/element/mml/optable/SupplementalArrowsA.js +19 -0
  234. data/app/js/vendor/mathjax/jax/element/mml/optable/SupplementalArrowsB.js +19 -0
  235. data/app/js/vendor/mathjax/jax/input/TeX/config.js +19 -0
  236. data/app/js/vendor/mathjax/jax/input/TeX/jax.js +19 -0
  237. data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/annotation-xml.js +19 -0
  238. data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/maction.js +19 -0
  239. data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/menclose.js +19 -0
  240. data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/mglyph.js +19 -0
  241. data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/mmultiscripts.js +19 -0
  242. data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/ms.js +19 -0
  243. data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/mtable.js +19 -0
  244. data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/multiline.js +19 -0
  245. data/app/js/vendor/mathjax/jax/output/CommonHTML/config.js +19 -0
  246. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/AMS-Regular.js +19 -0
  247. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Caligraphic-Bold.js +19 -0
  248. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Fraktur-Bold.js +19 -0
  249. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Fraktur-Regular.js +19 -0
  250. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Main-Bold.js +19 -0
  251. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Math-BoldItalic.js +19 -0
  252. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Bold.js +19 -0
  253. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Italic.js +19 -0
  254. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Regular.js +19 -0
  255. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Script-Regular.js +19 -0
  256. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Typewriter-Regular.js +19 -0
  257. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/fontdata-extra.js +19 -0
  258. data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/fontdata.js +19 -0
  259. data/app/js/vendor/mathjax/jax/output/CommonHTML/jax.js +19 -0
  260. data/app/js/vendor/modernizr-custom-3.3.1.min.js +3 -0
  261. data/app/js/vendor/persistjs-git.js +1136 -0
  262. data/app/js/vendor/poised/poised.general.coffee +21 -0
  263. data/app/js/vendor/poised/poised.tabs.coffee +31 -0
  264. data/app/js/vendor/poised/utils.coffee +11 -0
  265. data/app/js/vendor/request_animation_frame.coffee +19 -0
  266. data/app/js/vendor/three-82.min.js +15 -0
  267. data/app/js/vendor/three-CanvasRenderer-82.js +1118 -0
  268. data/app/js/vendor/three-Projector-82.js +929 -0
  269. data/app/js/vendor/underscore-1.8.3.min.js +6 -0
  270. data/app/js/vendor/webfontloader-1.6.26.min.js +33 -0
  271. data/app/views/aliasing/legend.jst.hamlc +6 -0
  272. data/app/views/composites/composites_list_item_label.jst.hamlc +3 -0
  273. data/app/views/composites/import_composites_aside.jst.hamlc +6 -0
  274. data/app/views/composites/mix_preset_list_item_label.jst.hamlc +8 -0
  275. data/app/views/composites/share_aside.jst.hamlc +7 -0
  276. data/app/views/doc/airplanes_list_item_label.jst.hamlc +3 -0
  277. data/app/views/doc/import_airplanes_aside.jst.hamlc +6 -0
  278. data/app/views/doc/share_aside.jst.hamlc +7 -0
  279. data/app/views/general/app.jst.hamlc +42 -0
  280. data/app/views/general/curves_list_item_label.jst.hamlc +5 -0
  281. data/app/views/general/help.jst.hamlc +7 -0
  282. data/app/views/general/tabs.jst.hamlc +6 -0
  283. data/app/views/index.haml +24 -0
  284. data/app/views/overview/app.jst.hamlc +7 -0
  285. data/app/views/overview/tile.jst.hamlc +4 -0
  286. data/bin/console +14 -0
  287. data/bin/setup +8 -0
  288. data/ela.gemspec +50 -0
  289. data/exe/ela +59 -0
  290. data/lib/ela.rb +8 -0
  291. data/lib/ela/jasmine.rb +87 -0
  292. data/lib/ela/server.rb +136 -0
  293. data/lib/ela/utils.rb +131 -0
  294. data/lib/ela/version.rb +3 -0
  295. data/package-lock.json +899 -0
  296. data/package.json +11 -0
  297. data/support/project/Guardfile +64 -0
  298. data/support/project/jasmine.yml +3 -0
  299. data/support/server.ru +5 -0
  300. metadata +4365 -0
@@ -0,0 +1,79 @@
1
+ utils =
2
+ slugify: (text) ->
3
+ text.toLowerCase().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace /-+$/, ""
4
+
5
+ Markdown.Toc = (->
6
+ toc = {}
7
+
8
+ TocElement = (tagName, anchor, text) ->
9
+ @tagName = tagName
10
+ @anchor = anchor
11
+ @text = text
12
+ @children = []
13
+ return
14
+
15
+ TocElement::childrenToString = ->
16
+ return "" if @children.length is 0
17
+ result = "<ul>\n"
18
+ result += child.toString() for child in @children
19
+
20
+ result += "</ul>\n"
21
+ result
22
+
23
+ TocElement::toString = ->
24
+ result = "<li>"
25
+ result += "<a href=\"#" + @anchor + "\">" + @text + "</a>" if @anchor and @text
26
+ result += @childrenToString() + "</li>\n"
27
+ result
28
+
29
+ groupTags = (array, level) ->
30
+ pushCurrentElement = ->
31
+ if currentElement isnt `undefined`
32
+ currentElement.children = groupTags(currentElement.children, level + 1) if currentElement.children.length > 0
33
+ result.push currentElement
34
+
35
+ level = level or 1
36
+ tagName = "H" + level
37
+ result = []
38
+ currentElement = undefined
39
+ for element in array
40
+ unless element.tagName is tagName
41
+ if level isnt 6
42
+ currentElement = new TocElement() if currentElement is `undefined`
43
+ currentElement.children.push element
44
+ else
45
+ pushCurrentElement()
46
+ currentElement = element
47
+
48
+ pushCurrentElement()
49
+ result
50
+
51
+ buildToc = ($el) ->
52
+ createAnchor = (el) ->
53
+ id = el.id or utils.slugify(el.textContent) or "title"
54
+ anchor = id
55
+ index = 0
56
+ anchor = id + "-" + (++index) while _.has(anchorList, anchor)
57
+ anchorList[anchor] = true
58
+
59
+ el.id = anchor
60
+ anchor
61
+
62
+ anchorList = {}
63
+ elementList = []
64
+
65
+ $el.find("h1, h2, h3, h4, h5, h6").each (index, elt) ->
66
+ elementList.push new TocElement(elt.tagName, createAnchor(elt), elt.textContent)
67
+
68
+ elementList = groupTags(elementList)
69
+ "<div class=\"toc\">\n<ul>\n" + elementList.join("") + "</ul>\n</div>\n"
70
+
71
+ toc.apply = ($el) ->
72
+ marker = "\\[(TOC|toc)\\]"
73
+ tocExp = new RegExp('^'+marker+'$')
74
+ htmlToc = buildToc($el)
75
+
76
+ $el.find("p").each (index, elt) ->
77
+ elt.innerHTML = htmlToc if tocExp.test(elt.innerHTML)
78
+
79
+ toc)()
@@ -0,0 +1,2 @@
1
+ (function(t){var e=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global;if(typeof define==="function"&&define.amd){define(["underscore","jquery","exports"],function(i,r,n){e.Backbone=t(e,n,i,r)})}else if(typeof exports!=="undefined"){var i=require("underscore"),r;try{r=require("jquery")}catch(n){}t(e,exports,i,r)}else{e.Backbone=t(e,{},e._,e.jQuery||e.Zepto||e.ender||e.$)}})(function(t,e,i,r){var n=t.Backbone;var s=Array.prototype.slice;e.VERSION="1.3.3";e.$=r;e.noConflict=function(){t.Backbone=n;return this};e.emulateHTTP=false;e.emulateJSON=false;var a=function(t,e,r){switch(t){case 1:return function(){return i[e](this[r])};case 2:return function(t){return i[e](this[r],t)};case 3:return function(t,n){return i[e](this[r],o(t,this),n)};case 4:return function(t,n,s){return i[e](this[r],o(t,this),n,s)};default:return function(){var t=s.call(arguments);t.unshift(this[r]);return i[e].apply(i,t)}}};var h=function(t,e,r){i.each(e,function(e,n){if(i[n])t.prototype[n]=a(e,n,r)})};var o=function(t,e){if(i.isFunction(t))return t;if(i.isObject(t)&&!e._isModel(t))return l(t);if(i.isString(t))return function(e){return e.get(t)};return t};var l=function(t){var e=i.matches(t);return function(t){return e(t.attributes)}};var u=e.Events={};var c=/\s+/;var f=function(t,e,r,n,s){var a=0,h;if(r&&typeof r==="object"){if(n!==void 0&&"context"in s&&s.context===void 0)s.context=n;for(h=i.keys(r);a<h.length;a++){e=f(t,e,h[a],r[h[a]],s)}}else if(r&&c.test(r)){for(h=r.split(c);a<h.length;a++){e=t(e,h[a],n,s)}}else{e=t(e,r,n,s)}return e};u.on=function(t,e,i){return d(this,t,e,i)};var d=function(t,e,i,r,n){t._events=f(v,t._events||{},e,i,{context:r,ctx:t,listening:n});if(n){var s=t._listeners||(t._listeners={});s[n.id]=n}return t};u.listenTo=function(t,e,r){if(!t)return this;var n=t._listenId||(t._listenId=i.uniqueId("l"));var s=this._listeningTo||(this._listeningTo={});var a=s[n];if(!a){var h=this._listenId||(this._listenId=i.uniqueId("l"));a=s[n]={obj:t,objId:n,id:h,listeningTo:s,count:0}}d(t,e,r,this,a);return this};var v=function(t,e,i,r){if(i){var n=t[e]||(t[e]=[]);var s=r.context,a=r.ctx,h=r.listening;if(h)h.count++;n.push({callback:i,context:s,ctx:s||a,listening:h})}return t};u.off=function(t,e,i){if(!this._events)return this;this._events=f(g,this._events,t,e,{context:i,listeners:this._listeners});return this};u.stopListening=function(t,e,r){var n=this._listeningTo;if(!n)return this;var s=t?[t._listenId]:i.keys(n);for(var a=0;a<s.length;a++){var h=n[s[a]];if(!h)break;h.obj.off(e,r,this)}return this};var g=function(t,e,r,n){if(!t)return;var s=0,a;var h=n.context,o=n.listeners;if(!e&&!r&&!h){var l=i.keys(o);for(;s<l.length;s++){a=o[l[s]];delete o[a.id];delete a.listeningTo[a.objId]}return}var u=e?[e]:i.keys(t);for(;s<u.length;s++){e=u[s];var c=t[e];if(!c)break;var f=[];for(var d=0;d<c.length;d++){var v=c[d];if(r&&r!==v.callback&&r!==v.callback._callback||h&&h!==v.context){f.push(v)}else{a=v.listening;if(a&&--a.count===0){delete o[a.id];delete a.listeningTo[a.objId]}}}if(f.length){t[e]=f}else{delete t[e]}}return t};u.once=function(t,e,r){var n=f(p,{},t,e,i.bind(this.off,this));if(typeof t==="string"&&r==null)e=void 0;return this.on(n,e,r)};u.listenToOnce=function(t,e,r){var n=f(p,{},e,r,i.bind(this.stopListening,this,t));return this.listenTo(t,n)};var p=function(t,e,r,n){if(r){var s=t[e]=i.once(function(){n(e,s);r.apply(this,arguments)});s._callback=r}return t};u.trigger=function(t){if(!this._events)return this;var e=Math.max(0,arguments.length-1);var i=Array(e);for(var r=0;r<e;r++)i[r]=arguments[r+1];f(m,this._events,t,void 0,i);return this};var m=function(t,e,i,r){if(t){var n=t[e];var s=t.all;if(n&&s)s=s.slice();if(n)_(n,r);if(s)_(s,[e].concat(r))}return t};var _=function(t,e){var i,r=-1,n=t.length,s=e[0],a=e[1],h=e[2];switch(e.length){case 0:while(++r<n)(i=t[r]).callback.call(i.ctx);return;case 1:while(++r<n)(i=t[r]).callback.call(i.ctx,s);return;case 2:while(++r<n)(i=t[r]).callback.call(i.ctx,s,a);return;case 3:while(++r<n)(i=t[r]).callback.call(i.ctx,s,a,h);return;default:while(++r<n)(i=t[r]).callback.apply(i.ctx,e);return}};u.bind=u.on;u.unbind=u.off;i.extend(e,u);var y=e.Model=function(t,e){var r=t||{};e||(e={});this.cid=i.uniqueId(this.cidPrefix);this.attributes={};if(e.collection)this.collection=e.collection;if(e.parse)r=this.parse(r,e)||{};var n=i.result(this,"defaults");r=i.defaults(i.extend({},n,r),n);this.set(r,e);this.changed={};this.initialize.apply(this,arguments)};i.extend(y.prototype,u,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",initialize:function(){},toJSON:function(t){return i.clone(this.attributes)},sync:function(){return e.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return i.escape(this.get(t))},has:function(t){return this.get(t)!=null},matches:function(t){return!!i.iteratee(t,this)(this.attributes)},set:function(t,e,r){if(t==null)return this;var n;if(typeof t==="object"){n=t;r=e}else{(n={})[t]=e}r||(r={});if(!this._validate(n,r))return false;var s=r.unset;var a=r.silent;var h=[];var o=this._changing;this._changing=true;if(!o){this._previousAttributes=i.clone(this.attributes);this.changed={}}var l=this.attributes;var u=this.changed;var c=this._previousAttributes;for(var f in n){e=n[f];if(!i.isEqual(l[f],e))h.push(f);if(!i.isEqual(c[f],e)){u[f]=e}else{delete u[f]}s?delete l[f]:l[f]=e}if(this.idAttribute in n)this.id=this.get(this.idAttribute);if(!a){if(h.length)this._pending=r;for(var d=0;d<h.length;d++){this.trigger("change:"+h[d],this,l[h[d]],r)}}if(o)return this;if(!a){while(this._pending){r=this._pending;this._pending=false;this.trigger("change",this,r)}}this._pending=false;this._changing=false;return this},unset:function(t,e){return this.set(t,void 0,i.extend({},e,{unset:true}))},clear:function(t){var e={};for(var r in this.attributes)e[r]=void 0;return this.set(e,i.extend({},t,{unset:true}))},hasChanged:function(t){if(t==null)return!i.isEmpty(this.changed);return i.has(this.changed,t)},changedAttributes:function(t){if(!t)return this.hasChanged()?i.clone(this.changed):false;var e=this._changing?this._previousAttributes:this.attributes;var r={};for(var n in t){var s=t[n];if(i.isEqual(e[n],s))continue;r[n]=s}return i.size(r)?r:false},previous:function(t){if(t==null||!this._previousAttributes)return null;return this._previousAttributes[t]},previousAttributes:function(){return i.clone(this._previousAttributes)},fetch:function(t){t=i.extend({parse:true},t);var e=this;var r=t.success;t.success=function(i){var n=t.parse?e.parse(i,t):i;if(!e.set(n,t))return false;if(r)r.call(t.context,e,i,t);e.trigger("sync",e,i,t)};B(this,t);return this.sync("read",this,t)},save:function(t,e,r){var n;if(t==null||typeof t==="object"){n=t;r=e}else{(n={})[t]=e}r=i.extend({validate:true,parse:true},r);var s=r.wait;if(n&&!s){if(!this.set(n,r))return false}else if(!this._validate(n,r)){return false}var a=this;var h=r.success;var o=this.attributes;r.success=function(t){a.attributes=o;var e=r.parse?a.parse(t,r):t;if(s)e=i.extend({},n,e);if(e&&!a.set(e,r))return false;if(h)h.call(r.context,a,t,r);a.trigger("sync",a,t,r)};B(this,r);if(n&&s)this.attributes=i.extend({},o,n);var l=this.isNew()?"create":r.patch?"patch":"update";if(l==="patch"&&!r.attrs)r.attrs=n;var u=this.sync(l,this,r);this.attributes=o;return u},destroy:function(t){t=t?i.clone(t):{};var e=this;var r=t.success;var n=t.wait;var s=function(){e.stopListening();e.trigger("destroy",e,e.collection,t)};t.success=function(i){if(n)s();if(r)r.call(t.context,e,i,t);if(!e.isNew())e.trigger("sync",e,i,t)};var a=false;if(this.isNew()){i.defer(t.success)}else{B(this,t);a=this.sync("delete",this,t)}if(!n)s();return a},url:function(){var t=i.result(this,"urlRoot")||i.result(this.collection,"url")||F();if(this.isNew())return t;var e=this.get(this.idAttribute);return t.replace(/[^\/]$/,"$&/")+encodeURIComponent(e)},parse:function(t,e){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(t){return this._validate({},i.extend({},t,{validate:true}))},_validate:function(t,e){if(!e.validate||!this.validate)return true;t=i.extend({},this.attributes,t);var r=this.validationError=this.validate(t,e)||null;if(!r)return true;this.trigger("invalid",this,r,i.extend(e,{validationError:r}));return false}});var b={keys:1,values:1,pairs:1,invert:1,pick:0,omit:0,chain:1,isEmpty:1};h(y,b,"attributes");var x=e.Collection=function(t,e){e||(e={});if(e.model)this.model=e.model;if(e.comparator!==void 0)this.comparator=e.comparator;this._reset();this.initialize.apply(this,arguments);if(t)this.reset(t,i.extend({silent:true},e))};var w={add:true,remove:true,merge:true};var E={add:true,remove:false};var I=function(t,e,i){i=Math.min(Math.max(i,0),t.length);var r=Array(t.length-i);var n=e.length;var s;for(s=0;s<r.length;s++)r[s]=t[s+i];for(s=0;s<n;s++)t[s+i]=e[s];for(s=0;s<r.length;s++)t[s+n+i]=r[s]};i.extend(x.prototype,u,{model:y,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return e.sync.apply(this,arguments)},add:function(t,e){return this.set(t,i.extend({merge:false},e,E))},remove:function(t,e){e=i.extend({},e);var r=!i.isArray(t);t=r?[t]:t.slice();var n=this._removeModels(t,e);if(!e.silent&&n.length){e.changes={added:[],merged:[],removed:n};this.trigger("update",this,e)}return r?n[0]:n},set:function(t,e){if(t==null)return;e=i.extend({},w,e);if(e.parse&&!this._isModel(t)){t=this.parse(t,e)||[]}var r=!i.isArray(t);t=r?[t]:t.slice();var n=e.at;if(n!=null)n=+n;if(n>this.length)n=this.length;if(n<0)n+=this.length+1;var s=[];var a=[];var h=[];var o=[];var l={};var u=e.add;var c=e.merge;var f=e.remove;var d=false;var v=this.comparator&&n==null&&e.sort!==false;var g=i.isString(this.comparator)?this.comparator:null;var p,m;for(m=0;m<t.length;m++){p=t[m];var _=this.get(p);if(_){if(c&&p!==_){var y=this._isModel(p)?p.attributes:p;if(e.parse)y=_.parse(y,e);_.set(y,e);h.push(_);if(v&&!d)d=_.hasChanged(g)}if(!l[_.cid]){l[_.cid]=true;s.push(_)}t[m]=_}else if(u){p=t[m]=this._prepareModel(p,e);if(p){a.push(p);this._addReference(p,e);l[p.cid]=true;s.push(p)}}}if(f){for(m=0;m<this.length;m++){p=this.models[m];if(!l[p.cid])o.push(p)}if(o.length)this._removeModels(o,e)}var b=false;var x=!v&&u&&f;if(s.length&&x){b=this.length!==s.length||i.some(this.models,function(t,e){return t!==s[e]});this.models.length=0;I(this.models,s,0);this.length=this.models.length}else if(a.length){if(v)d=true;I(this.models,a,n==null?this.length:n);this.length=this.models.length}if(d)this.sort({silent:true});if(!e.silent){for(m=0;m<a.length;m++){if(n!=null)e.index=n+m;p=a[m];p.trigger("add",p,this,e)}if(d||b)this.trigger("sort",this,e);if(a.length||o.length||h.length){e.changes={added:a,removed:o,merged:h};this.trigger("update",this,e)}}return r?t[0]:t},reset:function(t,e){e=e?i.clone(e):{};for(var r=0;r<this.models.length;r++){this._removeReference(this.models[r],e)}e.previousModels=this.models;this._reset();t=this.add(t,i.extend({silent:true},e));if(!e.silent)this.trigger("reset",this,e);return t},push:function(t,e){return this.add(t,i.extend({at:this.length},e))},pop:function(t){var e=this.at(this.length-1);return this.remove(e,t)},unshift:function(t,e){return this.add(t,i.extend({at:0},e))},shift:function(t){var e=this.at(0);return this.remove(e,t)},slice:function(){return s.apply(this.models,arguments)},get:function(t){if(t==null)return void 0;return this._byId[t]||this._byId[this.modelId(t.attributes||t)]||t.cid&&this._byId[t.cid]},has:function(t){return this.get(t)!=null},at:function(t){if(t<0)t+=this.length;return this.models[t]},where:function(t,e){return this[e?"find":"filter"](t)},findWhere:function(t){return this.where(t,true)},sort:function(t){var e=this.comparator;if(!e)throw new Error("Cannot sort a set without a comparator");t||(t={});var r=e.length;if(i.isFunction(e))e=i.bind(e,this);if(r===1||i.isString(e)){this.models=this.sortBy(e)}else{this.models.sort(e)}if(!t.silent)this.trigger("sort",this,t);return this},pluck:function(t){return this.map(t+"")},fetch:function(t){t=i.extend({parse:true},t);var e=t.success;var r=this;t.success=function(i){var n=t.reset?"reset":"set";r[n](i,t);if(e)e.call(t.context,r,i,t);r.trigger("sync",r,i,t)};B(this,t);return this.sync("read",this,t)},create:function(t,e){e=e?i.clone(e):{};var r=e.wait;t=this._prepareModel(t,e);if(!t)return false;if(!r)this.add(t,e);var n=this;var s=e.success;e.success=function(t,e,i){if(r)n.add(t,i);if(s)s.call(i.context,t,e,i)};t.save(null,e);return t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(t){return t[this.model.prototype.idAttribute||"id"]},_reset:function(){this.length=0;this.models=[];this._byId={}},_prepareModel:function(t,e){if(this._isModel(t)){if(!t.collection)t.collection=this;return t}e=e?i.clone(e):{};e.collection=this;var r=new this.model(t,e);if(!r.validationError)return r;this.trigger("invalid",this,r.validationError,e);return false},_removeModels:function(t,e){var i=[];for(var r=0;r<t.length;r++){var n=this.get(t[r]);if(!n)continue;var s=this.indexOf(n);this.models.splice(s,1);this.length--;delete this._byId[n.cid];var a=this.modelId(n.attributes);if(a!=null)delete this._byId[a];if(!e.silent){e.index=s;n.trigger("remove",n,this,e)}i.push(n);this._removeReference(n,e)}return i},_isModel:function(t){return t instanceof y},_addReference:function(t,e){this._byId[t.cid]=t;var i=this.modelId(t.attributes);if(i!=null)this._byId[i]=t;t.on("all",this._onModelEvent,this)},_removeReference:function(t,e){delete this._byId[t.cid];var i=this.modelId(t.attributes);if(i!=null)delete this._byId[i];if(this===t.collection)delete t.collection;t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,i,r){if(e){if((t==="add"||t==="remove")&&i!==this)return;if(t==="destroy")this.remove(e,r);if(t==="change"){var n=this.modelId(e.previousAttributes());var s=this.modelId(e.attributes);if(n!==s){if(n!=null)delete this._byId[n];if(s!=null)this._byId[s]=e}}}this.trigger.apply(this,arguments)}});var S={forEach:3,each:3,map:3,collect:3,reduce:0,foldl:0,inject:0,reduceRight:0,foldr:0,find:3,detect:3,filter:3,select:3,reject:3,every:3,all:3,some:3,any:3,include:3,includes:3,contains:3,invoke:0,max:3,min:3,toArray:1,size:1,first:3,head:3,take:3,initial:3,rest:3,tail:3,drop:3,last:3,without:0,difference:0,indexOf:3,shuffle:1,lastIndexOf:3,isEmpty:1,chain:1,sample:3,partition:3,groupBy:3,countBy:3,sortBy:3,indexBy:3,findIndex:3,findLastIndex:3};h(x,S,"models");var k=e.View=function(t){this.cid=i.uniqueId("view");i.extend(this,i.pick(t,P));this._ensureElement();this.initialize.apply(this,arguments)};var T=/^(\S+)\s*(.*)$/;var P=["model","collection","el","id","attributes","className","tagName","events"];i.extend(k.prototype,u,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){this._removeElement();this.stopListening();return this},_removeElement:function(){this.$el.remove()},setElement:function(t){this.undelegateEvents();this._setElement(t);this.delegateEvents();return this},_setElement:function(t){this.$el=t instanceof e.$?t:e.$(t);this.el=this.$el[0]},delegateEvents:function(t){t||(t=i.result(this,"events"));if(!t)return this;this.undelegateEvents();for(var e in t){var r=t[e];if(!i.isFunction(r))r=this[r];if(!r)continue;var n=e.match(T);this.delegate(n[1],n[2],i.bind(r,this))}return this},delegate:function(t,e,i){this.$el.on(t+".delegateEvents"+this.cid,e,i);return this},undelegateEvents:function(){if(this.$el)this.$el.off(".delegateEvents"+this.cid);return this},undelegate:function(t,e,i){this.$el.off(t+".delegateEvents"+this.cid,e,i);return this},_createElement:function(t){return document.createElement(t)},_ensureElement:function(){if(!this.el){var t=i.extend({},i.result(this,"attributes"));if(this.id)t.id=i.result(this,"id");if(this.className)t["class"]=i.result(this,"className");this.setElement(this._createElement(i.result(this,"tagName")));this._setAttributes(t)}else{this.setElement(i.result(this,"el"))}},_setAttributes:function(t){this.$el.attr(t)}});e.sync=function(t,r,n){var s=H[t];i.defaults(n||(n={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var a={type:s,dataType:"json"};if(!n.url){a.url=i.result(r,"url")||F()}if(n.data==null&&r&&(t==="create"||t==="update"||t==="patch")){a.contentType="application/json";a.data=JSON.stringify(n.attrs||r.toJSON(n))}if(n.emulateJSON){a.contentType="application/x-www-form-urlencoded";a.data=a.data?{model:a.data}:{}}if(n.emulateHTTP&&(s==="PUT"||s==="DELETE"||s==="PATCH")){a.type="POST";if(n.emulateJSON)a.data._method=s;var h=n.beforeSend;n.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",s);if(h)return h.apply(this,arguments)}}if(a.type!=="GET"&&!n.emulateJSON){a.processData=false}var o=n.error;n.error=function(t,e,i){n.textStatus=e;n.errorThrown=i;if(o)o.call(n.context,t,e,i)};var l=n.xhr=e.ajax(i.extend(a,n));r.trigger("request",r,l,n);return l};var H={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var $=e.Router=function(t){t||(t={});if(t.routes)this.routes=t.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var A=/\((.*?)\)/g;var C=/(\(\?)?:\w+/g;var R=/\*\w+/g;var j=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend($.prototype,u,{initialize:function(){},route:function(t,r,n){if(!i.isRegExp(t))t=this._routeToRegExp(t);if(i.isFunction(r)){n=r;r=""}if(!n)n=this[r];var s=this;e.history.route(t,function(i){var a=s._extractParameters(t,i);if(s.execute(n,a,r)!==false){s.trigger.apply(s,["route:"+r].concat(a));s.trigger("route",r,a);e.history.trigger("route",s,r,a)}});return this},execute:function(t,e,i){if(t)t.apply(this,e)},navigate:function(t,i){e.history.navigate(t,i);return this},_bindRoutes:function(){if(!this.routes)return;this.routes=i.result(this,"routes");var t,e=i.keys(this.routes);while((t=e.pop())!=null){this.route(t,this.routes[t])}},_routeToRegExp:function(t){t=t.replace(j,"\\$&").replace(A,"(?:$1)?").replace(C,function(t,e){return e?t:"([^/?]+)"}).replace(R,"([^?]*?)");return new RegExp("^"+t+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(t,e){var r=t.exec(e).slice(1);return i.map(r,function(t,e){if(e===r.length-1)return t||null;return t?decodeURIComponent(t):null})}});var N=e.History=function(){this.handlers=[];this.checkUrl=i.bind(this.checkUrl,this);if(typeof window!=="undefined"){this.location=window.location;this.history=window.history}};var M=/^[#\/]|\s+$/g;var O=/^\/+|\/+$/g;var U=/#.*$/;N.started=false;i.extend(N.prototype,u,{interval:50,atRoot:function(){var t=this.location.pathname.replace(/[^\/]$/,"$&/");return t===this.root&&!this.getSearch()},matchRoot:function(){var t=this.decodeFragment(this.location.pathname);var e=t.slice(0,this.root.length-1)+"/";return e===this.root},decodeFragment:function(t){return decodeURI(t.replace(/%25/g,"%2525"))},getSearch:function(){var t=this.location.href.replace(/#.*/,"").match(/\?.+/);return t?t[0]:""},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getPath:function(){var t=this.decodeFragment(this.location.pathname+this.getSearch()).slice(this.root.length-1);return t.charAt(0)==="/"?t.slice(1):t},getFragment:function(t){if(t==null){if(this._usePushState||!this._wantsHashChange){t=this.getPath()}else{t=this.getHash()}}return t.replace(M,"")},start:function(t){if(N.started)throw new Error("Backbone.history has already been started");N.started=true;this.options=i.extend({root:"/"},this.options,t);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._hasHashChange="onhashchange"in window&&(document.documentMode===void 0||document.documentMode>7);this._useHashChange=this._wantsHashChange&&this._hasHashChange;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.history&&this.history.pushState);this._usePushState=this._wantsPushState&&this._hasPushState;this.fragment=this.getFragment();this.root=("/"+this.root+"/").replace(O,"/");if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var e=this.root.slice(0,-1)||"/";this.location.replace(e+"#"+this.getPath());return true}else if(this._hasPushState&&this.atRoot()){this.navigate(this.getHash(),{replace:true})}}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe");this.iframe.src="javascript:0";this.iframe.style.display="none";this.iframe.tabIndex=-1;var r=document.body;var n=r.insertBefore(this.iframe,r.firstChild).contentWindow;n.document.open();n.document.close();n.location.hash="#"+this.fragment}var s=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};if(this._usePushState){s("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){s("hashchange",this.checkUrl,false)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}if(!this.options.silent)return this.loadUrl()},stop:function(){var t=window.removeEventListener||function(t,e){return detachEvent("on"+t,e)};if(this._usePushState){t("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){t("hashchange",this.checkUrl,false)}if(this.iframe){document.body.removeChild(this.iframe);this.iframe=null}if(this._checkUrlInterval)clearInterval(this._checkUrlInterval);N.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getHash(this.iframe.contentWindow)}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()},loadUrl:function(t){if(!this.matchRoot())return false;t=this.fragment=this.getFragment(t);return i.some(this.handlers,function(e){if(e.route.test(t)){e.callback(t);return true}})},navigate:function(t,e){if(!N.started)return false;if(!e||e===true)e={trigger:!!e};t=this.getFragment(t||"");var i=this.root;if(t===""||t.charAt(0)==="?"){i=i.slice(0,-1)||"/"}var r=i+t;t=this.decodeFragment(t.replace(U,""));if(this.fragment===t)return;this.fragment=t;if(this._usePushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,r)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var n=this.iframe.contentWindow;if(!e.replace){n.document.open();n.document.close()}this._updateHash(n.location,t,e.replace)}}else{return this.location.assign(r)}if(e.trigger)return this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else{t.hash="#"+e}}});e.history=new N;var q=function(t,e){var r=this;var n;if(t&&i.has(t,"constructor")){n=t.constructor}else{n=function(){return r.apply(this,arguments)}}i.extend(n,r,e);n.prototype=i.create(r.prototype,t);n.prototype.constructor=n;n.__super__=r.prototype;return n};y.extend=x.extend=$.extend=k.extend=N.extend=q;var F=function(){throw new Error('A "url" property or function must be specified')};var B=function(t,e){var i=e.error;e.error=function(r){if(i)i.call(e.context,t,r,e);t.trigger("error",t,r,e)}};return e});
2
+ //# sourceMappingURL=backbone-min.map
@@ -0,0 +1,8 @@
1
+ /*! Backbone.Validation v0.11.5
2
+
3
+ Copyright (c) 2011-2015 Thomas Pedersen
4
+ Distributed under MIT License
5
+
6
+ Documentation and full license available at:
7
+ http://thedersen.com/projects/backbone-validation */
8
+ Backbone.Validation=function(a){"use strict";var b={forceUpdate:!1,selector:"name",labelFormatter:"sentenceCase",valid:Function.prototype,invalid:Function.prototype},c={formatLabel:function(a,c){return i[b.labelFormatter](a,c)},format:function(){var a=Array.prototype.slice.call(arguments),b=a.shift();return b.replace(/\{(\d+)\}/g,function(b,c){return"undefined"!=typeof a[c]?a[c]:b})}},d=function(b,c,e){return c=c||{},e=e||"",a.each(b,function(f,g){b.hasOwnProperty(g)&&(f&&a.isArray(f)?a.forEach(f,function(a,b){d(a,c,e+g+"."+b+"."),c[e+g+"."+b]=a}):f&&"object"==typeof f&&f.constructor===Object&&d(f,c,e+g+"."),c[e+g]=f)}),c},e=function(){var e=function(b,c){return c=c||a.keys(a.result(b,"validation")||{}),a.reduce(c,function(a,b){return a[b]=void 0,a},{})},g=function(b,c){var d=b.attributes;return a.isFunction(d)?d=d(c):a.isString(d)&&a.isFunction(j[d])&&(d=j[d](c)),a.isArray(d)?d:void 0},h=function(b,c){var d=b.validation?a.result(b,"validation")[c]||{}:{};return(a.isFunction(d)||a.isString(d))&&(d={fn:d}),a.isArray(d)||(d=[d]),a.reduce(d,function(b,c){return a.each(a.without(a.keys(c),"msg"),function(a){b.push({fn:k[a],val:c[a],msg:c.msg})}),b},[])},i=function(b,d,e,f){return a.reduce(h(b,d),function(g,h){var i=a.extend({},c,k),j=h.fn.call(i,e,d,h.val,b,f);return j===!1||g===!1?!1:j&&!g?a.result(h,"msg")||j:g},"")},l=function(b,c,d){var e,f={},g=!0,h=a.clone(c);return a.each(d,function(a,c){e=i(b,c,a,h),e&&(f[c]=e,g=!1)}),{invalidAttrs:f,isValid:g}},m=function(b,c){return{preValidate:function(b,c){var d,e=this,f={};return a.isObject(b)?(a.each(b,function(a,b){d=e.preValidate(b,a),d&&(f[b]=d)}),a.isEmpty(f)?void 0:f):i(this,b,c,a.extend({},this.attributes))},isValid:function(e){var f,h,j,k;return e=e||g(c,b),a.isString(e)?h=[e]:a.isArray(e)&&(h=e),h&&(f=d(this.attributes),a.each(this.associatedViews,function(b){a.each(h,function(d){j=i(this,d,f[d],a.extend({},this.attributes)),j?(c.invalid(b,d,j,c.selector),k=k||{},k[d]=j):c.valid(b,d,c.selector)},this)},this)),e===!0&&(k=this.validate()),k&&this.trigger("invalid",this,k,{validationError:k}),h?!k:this.validation?this._isValid:!0},validate:function(f,h){var i=this,j=!f,k=a.extend({},c,h),m=e(i,g(c,b)),n=a.extend({},m,i.attributes,f),o=d(n),p=f?d(f):o,q=l(i,n,a.pick(o,a.keys(m)));return i._isValid=q.isValid,a.each(i.associatedViews,function(b){a.each(m,function(a,c){var d=q.invalidAttrs.hasOwnProperty(c),e=p.hasOwnProperty(c);d||k.valid(b,c,k.selector),d&&(e||j)&&k.invalid(b,c,q.invalidAttrs[c],k.selector)})}),a.defer(function(){i.trigger("validated",i._isValid,i,q.invalidAttrs),i.trigger("validated:"+(i._isValid?"valid":"invalid"),i,q.invalidAttrs)}),!k.forceUpdate&&a.intersection(a.keys(q.invalidAttrs),a.keys(p)).length>0?q.invalidAttrs:void 0}}},n=function(b,c,d){c.associatedViews?c.associatedViews.push(b):c.associatedViews=[b],a.extend(c,m(b,d))},o=function(b,c){c&&b.associatedViews&&b.associatedViews.length>1?b.associatedViews=a.without(b.associatedViews,c):(delete b.validate,delete b.preValidate,delete b.isValid,delete b.associatedViews)},p=function(a){n(this.view,a,this.options)},q=function(a){o(a)};return{version:"0.11.3",configure:function(c){a.extend(b,c)},bind:function(c,d){d=a.extend({},b,f,d);var e=d.model||c.model,g=d.collection||c.collection;if("undefined"==typeof e&&"undefined"==typeof g)throw"Before you execute the binding your view must have a model or a collection.\nSee http://thedersen.com/projects/backbone-validation/#using-form-model-validation for more information.";e?n(c,e,d):g&&(g.each(function(a){n(c,a,d)}),g.bind("add",p,{view:c,options:d}),g.bind("remove",q))},unbind:function(b,c){c=a.extend({},c);var d=c.model||b.model,e=c.collection||b.collection;d?o(d,b):e&&(e.each(function(a){o(a,b)}),e.unbind("add",p),e.unbind("remove",q))},mixin:m(null,b)}}(),f=e.callbacks={valid:function(a,b,c){a.$("["+c+'~="'+b+'"]').removeClass("invalid").removeAttr("data-error")},invalid:function(a,b,c,d){a.$("["+d+'~="'+b+'"]').addClass("invalid").attr("data-error",c)}},g=e.patterns={digits:/^\d+$/,number:/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/,email:/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i,url:/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i},h=e.messages={required:"{0} is required",acceptance:"{0} must be accepted",min:"{0} must be greater than or equal to {1}",max:"{0} must be less than or equal to {1}",range:"{0} must be between {1} and {2}",length:"{0} must be {1} characters",minLength:"{0} must be at least {1} characters",maxLength:"{0} must be at most {1} characters",rangeLength:"{0} must be between {1} and {2} characters",oneOf:"{0} must be one of: {1}",equalTo:"{0} must be the same as {1}",digits:"{0} must only contain digits",number:"{0} must be a number",email:"{0} must be a valid email",url:"{0} must be a valid url",inlinePattern:"{0} is invalid"},i=e.labelFormatters={none:function(a){return a},sentenceCase:function(a){return a.replace(/(?:^\w|[A-Z]|\b\w)/g,function(a,b){return 0===b?a.toUpperCase():" "+a.toLowerCase()}).replace(/_/g," ")},label:function(a,b){return b.labels&&b.labels[a]||i.sentenceCase(a,b)}},j=e.attributeLoaders={inputNames:function(a){var b=[];return a&&a.$("form [name]").each(function(){/^(?:input|select|textarea)$/i.test(this.nodeName)&&this.name&&"submit"!==this.type&&-1===b.indexOf(this.name)&&b.push(this.name)}),b}},k=e.validators=function(){var b=String.prototype.trim?function(a){return null===a?"":String.prototype.trim.call(a)}:function(a){var b=/^\s+/,c=/\s+$/;return null===a?"":a.toString().replace(b,"").replace(c,"")},c=function(b){return a.isNumber(b)||a.isString(b)&&b.match(g.number)},d=function(c){return!(a.isNull(c)||a.isUndefined(c)||a.isString(c)&&""===b(c)||a.isArray(c)&&a.isEmpty(c))};return{fn:function(b,c,d,e,f){return a.isString(d)&&(d=e[d]),d.call(e,b,c,f)},required:function(b,c,e,f,g){var i=a.isFunction(e)?e.call(f,b,c,g):e;return i||d(b)?i&&!d(b)?this.format(h.required,this.formatLabel(c,f)):void 0:!1},acceptance:function(b,c,d,e){return"true"===b||a.isBoolean(b)&&b!==!1?void 0:this.format(h.acceptance,this.formatLabel(c,e))},min:function(a,b,d,e){return!c(a)||d>a?this.format(h.min,this.formatLabel(b,e),d):void 0},max:function(a,b,d,e){return!c(a)||a>d?this.format(h.max,this.formatLabel(b,e),d):void 0},range:function(a,b,d,e){return!c(a)||a<d[0]||a>d[1]?this.format(h.range,this.formatLabel(b,e),d[0],d[1]):void 0},length:function(b,c,d,e){return a.isString(b)&&b.length===d?void 0:this.format(h.length,this.formatLabel(c,e),d)},minLength:function(b,c,d,e){return!a.isString(b)||b.length<d?this.format(h.minLength,this.formatLabel(c,e),d):void 0},maxLength:function(b,c,d,e){return!a.isString(b)||b.length>d?this.format(h.maxLength,this.formatLabel(c,e),d):void 0},rangeLength:function(b,c,d,e){return!a.isString(b)||b.length<d[0]||b.length>d[1]?this.format(h.rangeLength,this.formatLabel(c,e),d[0],d[1]):void 0},oneOf:function(b,c,d,e){return a.include(d,b)?void 0:this.format(h.oneOf,this.formatLabel(c,e),d.join(", "))},equalTo:function(a,b,c,d,e){return a!==e[c]?this.format(h.equalTo,this.formatLabel(b,d),this.formatLabel(c,d)):void 0},pattern:function(a,b,c,e){return d(a)&&a.toString().match(g[c]||c)?void 0:this.format(h[c]||h.inlinePattern,this.formatLabel(b,e),c)}}}();return a.each(k,function(b,d){k[d]=a.bind(k[d],a.extend({},c,k))}),e}(_);
@@ -0,0 +1,156 @@
1
+ Backbone.Poised ||= {}
2
+ class Backbone.Poised.Form extends Backbone.Poised.View
3
+ tagName: 'form'
4
+ className: 'poised'
5
+
6
+ events:
7
+ 'submit': 'preventOriginalSubmit'
8
+
9
+ preventOriginalSubmit: (e) -> e.preventDefault()
10
+
11
+ extractGroupOptions: (options = {}) ->
12
+ @options.group = _.chain(options)
13
+ .pick('by', 'collapsible', 'collapsed')
14
+ .defaults
15
+ collapsible: false
16
+ collapsed: []
17
+ .value()
18
+
19
+ extractOptions: (options = {}) ->
20
+ # TODO: Maybe default titles should use the name of the model or
21
+ # the localisation for models...
22
+ @options = _.chain(options)
23
+ .pick('cancelable', 'resetable', 'title', 'creationTitle', 'editingTitle', 'liveForm', 'validate')
24
+ .defaults
25
+ cancelable: false
26
+ resetable: false
27
+ liveForm: false
28
+ validate: @model.__proto__.validation?
29
+ .value()
30
+
31
+ @extractGroupOptions(options.group)
32
+
33
+ extractFields: (options = {}) ->
34
+ if options.fields
35
+ @fields = options.fields
36
+ else if @model.formFields?
37
+ @fields = @model.formFields
38
+ else
39
+ @fields = []
40
+
41
+ initialize: (options = {}) ->
42
+ throw new Error('Missing `model` option') unless options.model?
43
+
44
+ @extractOptions(options)
45
+ @extractFields(options)
46
+
47
+ validateSubmit: =>
48
+ errors = @model.validate()
49
+ if _.isEmpty(errors)
50
+ @trigger('validSubmit', @model)
51
+ else
52
+ @trigger('invalidSubmit', @model)
53
+ # Refocus the first invalid input control, causing the browser to
54
+ # scroll to this element automatically.
55
+ @$('.invalid input').first().blur()
56
+ @$('.invalid input').first().focus()
57
+
58
+ submit: =>
59
+ @trigger('submit', @model)
60
+ @validateSubmit() if @options.validate
61
+
62
+ cancel: =>
63
+ @trigger('cancel', @model)
64
+
65
+ appendGroup: (group, fields) =>
66
+ $grp = $('<div>', class: 'poised control-group')
67
+ @appendItem(field, $grp) for field in fields
68
+ @$el.append($grp)
69
+
70
+ appendItem: (field, $el = @$el) =>
71
+ # Make sure we do not override defaults by cloning the field defaults
72
+ f = _.clone(field)
73
+
74
+ f.type = 'anchor' if f.anchor?
75
+ f.type = 'range' if f.range?
76
+ f.type = 'select' if f.options?
77
+ f.type ||= 'text'
78
+
79
+ f.locale = @locale
80
+ f.localePrefix = @localePrefix
81
+
82
+ @subviews[f.attribute] = @controlView(f)
83
+
84
+ $el.append(@subviews[f.attribute].render().el)
85
+
86
+ # Instantiates the correct form control view for the given field
87
+ # object. Eventually sets default values for needed options (e.g.
88
+ # models, the parent view, etc.) and sets the correct validation
89
+ # function.
90
+ #
91
+ # @param [Object] field The field
92
+ #
93
+ # @returns [Backbone.Poised.LinkedControl] view The view for the control
94
+ controlView: (field) ->
95
+ field = _.defaults field,
96
+ model: @model
97
+ parentView: this
98
+ field.validate = @model.__proto__.validation and _.has(@model.__proto__.validation, field.attribute)
99
+ switch field.type
100
+ when 'text' then new Backbone.Poised.StringControl(field)
101
+ when 'range' then new Backbone.Poised.RangeControl(field)
102
+ when 'number' then new Backbone.Poised.NumberControl(field)
103
+ when 'select' then new Backbone.Poised.SelectControl(field)
104
+ when 'value' then new Backbone.Poised.ValueControl(field)
105
+ when 'anchor' then new Backbone.Poised.Anchor(field)
106
+
107
+ # Binds Backbone.Validations to the respective view and model.
108
+ bindValidation: ->
109
+ Backbone.Validation.bind(this) if @options.validate
110
+
111
+ # Returns the string for the title in the form template.
112
+ # If a localisation exists, this is used.
113
+ title: ->
114
+ if @model.isNew()
115
+ @loadLocale 'formTitles.create', 'formTitle',
116
+ defaultValue: @options.creationTitle or @options.title
117
+ returnNull: true
118
+ else
119
+ @loadLocale 'formTitles.edit', 'formTitle',
120
+ defaultValue: @options.editingTitle or @options.title
121
+ returnNull: true
122
+
123
+ render: =>
124
+ @$el.html()
125
+
126
+ title = @title()
127
+ @$el.append($('<h2 />', text: title)) if title
128
+
129
+ if @options.group.by
130
+ groups = _.chain(@fields)
131
+ .pluck(@options.group.by)
132
+ .compact()
133
+ .unique()
134
+ .value()
135
+ for group in groups
136
+ @appendItem
137
+ type: 'anchor'
138
+ anchor: group.toCamel()
139
+ collapsible: $.ematch(group, @options.group.collapsible)
140
+ collapsed: $.ematch(group, @options.group.collapsed)
141
+ @appendGroup(group, _.filter(@fields, (f) => f[@options.group.by] is group))
142
+ else
143
+ @appendItem(field) for field in @fields
144
+
145
+ unless @options.liveForm
146
+ @subviews.buttons = new Backbone.Poised.SubmitControl
147
+ parentView: this
148
+ cancelable: @options.cancelable
149
+ resetable: @options.resetable
150
+ @listenTo @subviews.buttons, 'submit', @submit
151
+ @listenTo @subviews.buttons, 'cancel', @cancel
152
+ @$el.append(@subviews.buttons.render().el)
153
+
154
+ @bindValidation()
155
+
156
+ this
@@ -0,0 +1,26 @@
1
+ class Backbone.Poised.Anchor extends Backbone.Poised.View
2
+ tagName: 'div'
3
+ className: 'poised anchor'
4
+
5
+ initialize: (options = {}) =>
6
+ throw new Error('Missing `anchor` option') unless options.anchor?
7
+
8
+ @anchor = options.anchor
9
+ @label = options.label
10
+
11
+ @collapsible = options.collapsible is true
12
+ @collapsed = options.collapsed isnt false if @collapsible
13
+
14
+ toggleCollapse: =>
15
+ @$el.toggleClass('collapsed')
16
+
17
+ render: =>
18
+ @$el.html @label or @loadLocale "formAnchor.#{@anchor}.label",
19
+ defaultValue: @anchor.toLabel()
20
+
21
+ if @collapsible
22
+ @$el.addClass('collapsible')
23
+ @toggleCollapse() if @collapsed
24
+ @$el.on('tap', @toggleCollapse)
25
+
26
+ this
@@ -0,0 +1,42 @@
1
+ class Backbone.Poised.BaseControl extends Backbone.Poised.View
2
+ template: _.template('<div class="info"><label><%= label %></label><div class="hint"></div></div>')
3
+
4
+ initialize: (options = {}) =>
5
+ @initOptions = options
6
+ throw new Error('Missing `model` option') unless options.model?
7
+ throw new Error('Missing `attribute` option') unless options.attribute?
8
+
9
+ @attribute = options.attribute
10
+
11
+ @label = options.label
12
+
13
+ @options = _.omit(options, 'el')
14
+
15
+ if @options.validate
16
+ @model.on 'validated', @hintValidation
17
+
18
+ @on 'liveChangeStart', =>
19
+ @parentView.trigger('controlLiveChangeStart', this) if @parentView?
20
+ @on 'liveChange', =>
21
+ @parentView.trigger('controlLiveChange', this) if @parentView?
22
+ @on 'liveChangeEnd', =>
23
+ @parentView.trigger('controlLiveChangeEnd', this) if @parentView?
24
+
25
+ hintValidation: (isValid, model, errors) =>
26
+ attributeValid = @model.isValid(@attribute)
27
+ if errors isnt @lastErrors
28
+ @$el.toggleClass('invalid', !attributeValid)
29
+ @$hint = @$('.hint')
30
+ @$hint.attr 'data-error': errors[@attribute]
31
+ @lastErrors = errors
32
+
33
+ render: =>
34
+ @$el.attr('class', "poised control #{@attribute}")
35
+ @$el.html @template
36
+ label: @label or @loadLocale "formFields.#{@attribute}.label",
37
+ defaultValue: @attribute.toLabel()
38
+ @$info = @$el.find('.info')
39
+ this
40
+
41
+ clone: (options = {}) =>
42
+ new this.__proto__.constructor(_.defaults(options, @initOptions))
@@ -0,0 +1,79 @@
1
+ class Backbone.Poised.LinkedControl extends Backbone.Poised.View
2
+ template: _.template("<div class=\"info\"><label><%= label %></label></div><div class=\"first control\"><div class=\"hint\"></div></div><div class=\"link icon\"></div><div class=\"second control\"><div class=\"hint\"></div></div>")
3
+
4
+ events:
5
+ 'tap .link.icon': 'toggleLinkState'
6
+
7
+ initialize: (options = {}) ->
8
+ @initOptions = options
9
+ throw new Error('Missing `model1` option') unless options.model1?
10
+ throw new Error('Missing `model2` option') unless options.model2?
11
+ throw new Error('Missing `attribute` option') unless options.attribute?
12
+
13
+ @attribute = options.attribute
14
+ @model1 = options.model1
15
+ @model2 = options.model2
16
+
17
+ @label = options.label
18
+
19
+ @stateDefaults = _.chain(options)
20
+ .pick('isLinked')
21
+ .defaults
22
+ isLinked: true
23
+ .value()
24
+
25
+ @listenTo @model1, 'validated', @hintValidation if options.validate?
26
+
27
+ @listenTo @model1, "change:#{@attribute}", @updateLinkedAttribute(@model2)
28
+ @listenTo @model2, "change:#{@attribute}", @updateLinkedAttribute(@model1)
29
+
30
+ @linkState = new Backbone.Model(@stateDefaults)
31
+ @linkState.on 'change:isLinked', @updateLinkIcon
32
+
33
+ @on 'liveChangeStart', =>
34
+ @parentView.trigger('controlLiveChangeStart', this) if @parentView?
35
+ @on 'liveChange', =>
36
+ @parentView.trigger('controlLiveChange', this) if @parentView?
37
+ @on 'liveChangeEnd', =>
38
+ @parentView.trigger('controlLiveChangeEnd', this) if @parentView?
39
+
40
+ hintValidation: (isValid, model, errors) =>
41
+ attributeValid = @model.isValid(@attribute)
42
+ if errors isnt @lastErrors
43
+ @$el.toggleClass('invalid', !attributeValid)
44
+ @$hint = @$('.hint')
45
+ @$hint.attr 'data-error': errors[@attribute]
46
+ @lastErrors = errors
47
+
48
+ isLinked: ->
49
+ @linkState.get('isLinked')
50
+
51
+ toggleLinkState: =>
52
+ @linkState.set(isLinked: !@isLinked())
53
+
54
+ updateLinkedAttribute: (linkedModel) ->
55
+ (model, value) =>
56
+ linkedModel.set(@attribute, value) if @isLinked()
57
+
58
+ updateLinkIcon: =>
59
+ @$link?.toggleClass('unlinked', !@isLinked())
60
+
61
+ render: =>
62
+ @$el.attr('class', "poised linked-control #{@attribute}")
63
+ @$el.html @template
64
+ label: @label or @loadLocale "formFields.#{@attribute}.label",
65
+ defaultValue: @attribute.toLabel()
66
+ @$link = @$('.link.icon')
67
+ @$control1 = @$('.first.control')
68
+ @$control1.toggleClass(@attribute)
69
+ @$control2 = @$('.second.control')
70
+ @$control2.toggleClass(@attribute)
71
+ @updateLinkIcon()
72
+ this
73
+
74
+ clone: (options = {}) =>
75
+ options = _.chain(options)
76
+ .defaults isLinked: @isLinked()
77
+ .defaults @initOptions
78
+ .value()
79
+ new @__proto__.constructor(options)
@@ -0,0 +1,27 @@
1
+ class Backbone.Poised.LinkedNumberControl extends Backbone.Poised.LinkedControl
2
+ initialize: (options = {}) =>
3
+ super
4
+
5
+ @options = _.chain(options)
6
+ .pick('clearOnFocus', 'stepSize', 'precision', 'range', 'attribute', 'unit', 'minValue', 'maxValue')
7
+ .defaults
8
+ clearOnFocus: true
9
+ type: 'number'
10
+ minValue: _.firstDefined(options.minValue, options.range?[0])
11
+ maxValue: _.firstDefined(options.maxValue, options.range?[1])
12
+ parentView: this
13
+ .value()
14
+
15
+ if @options.stepSize? and not @options.precision?
16
+ @options.precision = _.find([0..3], (i) =>
17
+ @options.stepSize * Math.pow(10, i) >= 1)
18
+
19
+ render: =>
20
+ super
21
+
22
+ @subviews.spinner1 = new Backbone.Poised.Textfield(_.defaults(model: @model1, @options))
23
+ @$control1.append(@subviews.spinner1.render().el)
24
+ @subviews.spinner2 = new Backbone.Poised.Textfield(_.defaults(model: @model2, @options))
25
+ @$control2.append(@subviews.spinner2.render().el)
26
+
27
+ this
@@ -0,0 +1,53 @@
1
+ class Backbone.Poised.LinkedRangeControl extends Backbone.Poised.LinkedControl
2
+ initialize: (options = {}) =>
3
+ super
4
+
5
+ @options = _.chain(options)
6
+ .pick('renderSpinner', 'clearOnFocus', 'stepSize', 'precision', 'range', 'attribute', 'unit', 'sliderMinValue', 'sliderMaxValue', 'spinnerMinValue', 'spinnerMaxValue')
7
+ .defaults
8
+ renderSpinner: true
9
+ clearOnFocus: true
10
+ stepSize: 1
11
+ precision: _.find([0..3], (i) ->
12
+ options.stepSize * Math.pow(10, i) >= 1)
13
+ type: 'number'
14
+ .value()
15
+
16
+ # A spinner field is a textfield of type number.
17
+ if @options.renderSpinner
18
+ @spinnerOptions = _.chain(@options)
19
+ .pick('attribute', 'type', 'clearOnFocus', 'unit', 'precision', 'stepSize')
20
+ .defaults
21
+ minValue: _.firstDefined(@options.spinnerMinValue, @options.range?[0], @options.range?.spinner?[0])
22
+ maxValue: _.firstDefined(@options.spinnerMaxValue, @options.range?[1], @options.range?.spinner?[1])
23
+ parentView: this
24
+ .value()
25
+
26
+ @sliderOptions = _.chain(@options)
27
+ .pick('attribute', 'stepSize')
28
+ .defaults
29
+ minValue: _.firstDefined(@options.sliderMinValue, @options.range?[0], @options.range?.slider?[0])
30
+ maxValue: _.firstDefined(@options.sliderMaxValue, @options.range?[1], @options.range?.slider?[1])
31
+ parentView: this
32
+ .value()
33
+
34
+ render: =>
35
+ super
36
+
37
+ if @options.renderSpinner
38
+ @subviews.spinner1 = new Backbone.Poised.Textfield(_.defaults(model: @model1, @spinnerOptions))
39
+ @$control1.append(@subviews.spinner1.render().el)
40
+ @subviews.spinner2 = new Backbone.Poised.Textfield(_.defaults(model: @model2, @spinnerOptions))
41
+ @$control2.append(@subviews.spinner2.render().el)
42
+ else
43
+ @subviews.value1 = new Backbone.Poised.Value(_.defaults(model: @model1, @options))
44
+ @$control1.append(@subviews.value1.render().el)
45
+ @subviews.value2 = new Backbone.Poised.Value(_.defaults(model: @model2, @options))
46
+ @$control2.append(@subviews.value2.render().el)
47
+
48
+ @subviews.slider1 = new Backbone.Poised.Slider(_.defaults(model: @model1, @spinnerOptions))
49
+ @$control1.append(@subviews.slider1.render().el)
50
+ @subviews.slider2 = new Backbone.Poised.Slider(_.defaults(model: @model2, @spinnerOptions))
51
+ @$control2.append(@subviews.slider2.render().el)
52
+
53
+ this