vapid 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (433) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.gitmodules +6 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +133 -0
  6. data/.travis.yml +5 -0
  7. data/Gemfile +10 -0
  8. data/README.md +37 -0
  9. data/Rakefile +6 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/exe/vapid +7 -0
  13. data/lib/vapid.rb +24 -0
  14. data/lib/vapid/assets/javascripts/vapid/admin.coffee +2 -0
  15. data/lib/vapid/assets/stylesheets/vapid/admin.scss +72 -0
  16. data/lib/vapid/builder.rb +70 -0
  17. data/lib/vapid/cli.rb +96 -0
  18. data/lib/vapid/controllers/admin_controller.rb +282 -0
  19. data/lib/vapid/controllers/project_controller.rb +41 -0
  20. data/lib/vapid/db/migrate/20170202182310_create_groups.rb +12 -0
  21. data/lib/vapid/db/migrate/20170202183017_create_records.rb +11 -0
  22. data/lib/vapid/db/migrate/20170202185150_create_users.rb +11 -0
  23. data/lib/vapid/directive.rb +168 -0
  24. data/lib/vapid/directives.rb +30 -0
  25. data/lib/vapid/directives/audio.rb +27 -0
  26. data/lib/vapid/directives/group.rb +71 -0
  27. data/lib/vapid/directives/hide.rb +11 -0
  28. data/lib/vapid/directives/href.rb +11 -0
  29. data/lib/vapid/directives/image.rb +14 -0
  30. data/lib/vapid/directives/richtext.rb +15 -0
  31. data/lib/vapid/directives/show.rb +11 -0
  32. data/lib/vapid/directives/text.rb +24 -0
  33. data/lib/vapid/directives/video.rb +28 -0
  34. data/lib/vapid/generator_template/.gitignore +21 -0
  35. data/lib/vapid/generator_template/Gemfile.tt +13 -0
  36. data/lib/vapid/generator_template/README.md +0 -0
  37. data/lib/vapid/generator_template/assets/favicon.ico +0 -0
  38. data/lib/vapid/generator_template/assets/images/.keep +0 -0
  39. data/lib/vapid/generator_template/assets/javascripts/.keep +0 -0
  40. data/lib/vapid/generator_template/assets/stylesheets/.keep +0 -0
  41. data/lib/vapid/generator_template/assets/stylesheets/application.css +120 -0
  42. data/lib/vapid/generator_template/config.ru +3 -0
  43. data/lib/vapid/generator_template/config/database.yml +12 -0
  44. data/lib/vapid/generator_template/config/settings.yml.tt +11 -0
  45. data/lib/vapid/generator_template/templates/index.html.erb +25 -0
  46. data/lib/vapid/generator_template/templates/layouts/default.html.erb +22 -0
  47. data/lib/vapid/models.rb +18 -0
  48. data/lib/vapid/models/group.rb +36 -0
  49. data/lib/vapid/models/record.rb +30 -0
  50. data/lib/vapid/models/user.rb +16 -0
  51. data/lib/vapid/server.rb +93 -0
  52. data/lib/vapid/settings.rb +13 -0
  53. data/lib/vapid/template.rb +79 -0
  54. data/lib/vapid/template/node.rb +91 -0
  55. data/lib/vapid/template/parser.rb +50 -0
  56. data/lib/vapid/vendor/semantic-ui/.versions +4 -0
  57. data/lib/vapid/vendor/semantic-ui/LICENSE +22 -0
  58. data/lib/vapid/vendor/semantic-ui/README.md +7 -0
  59. data/lib/vapid/vendor/semantic-ui/components/accordion.css +252 -0
  60. data/lib/vapid/vendor/semantic-ui/components/accordion.js +610 -0
  61. data/lib/vapid/vendor/semantic-ui/components/accordion.min.css +9 -0
  62. data/lib/vapid/vendor/semantic-ui/components/accordion.min.js +10 -0
  63. data/lib/vapid/vendor/semantic-ui/components/ad.css +275 -0
  64. data/lib/vapid/vendor/semantic-ui/components/ad.min.css +10 -0
  65. data/lib/vapid/vendor/semantic-ui/components/api.js +1167 -0
  66. data/lib/vapid/vendor/semantic-ui/components/api.min.js +10 -0
  67. data/lib/vapid/vendor/semantic-ui/components/breadcrumb.css +124 -0
  68. data/lib/vapid/vendor/semantic-ui/components/breadcrumb.min.css +9 -0
  69. data/lib/vapid/vendor/semantic-ui/components/button.css +3450 -0
  70. data/lib/vapid/vendor/semantic-ui/components/button.min.css +9 -0
  71. data/lib/vapid/vendor/semantic-ui/components/card.css +964 -0
  72. data/lib/vapid/vendor/semantic-ui/components/card.min.css +9 -0
  73. data/lib/vapid/vendor/semantic-ui/components/checkbox.css +625 -0
  74. data/lib/vapid/vendor/semantic-ui/components/checkbox.js +831 -0
  75. data/lib/vapid/vendor/semantic-ui/components/checkbox.min.css +9 -0
  76. data/lib/vapid/vendor/semantic-ui/components/checkbox.min.js +10 -0
  77. data/lib/vapid/vendor/semantic-ui/components/colorize.js +274 -0
  78. data/lib/vapid/vendor/semantic-ui/components/colorize.min.js +11 -0
  79. data/lib/vapid/vendor/semantic-ui/components/comment.css +270 -0
  80. data/lib/vapid/vendor/semantic-ui/components/comment.min.css +9 -0
  81. data/lib/vapid/vendor/semantic-ui/components/container.css +147 -0
  82. data/lib/vapid/vendor/semantic-ui/components/container.min.css +9 -0
  83. data/lib/vapid/vendor/semantic-ui/components/dimmer.css +200 -0
  84. data/lib/vapid/vendor/semantic-ui/components/dimmer.js +708 -0
  85. data/lib/vapid/vendor/semantic-ui/components/dimmer.min.css +9 -0
  86. data/lib/vapid/vendor/semantic-ui/components/dimmer.min.js +10 -0
  87. data/lib/vapid/vendor/semantic-ui/components/divider.css +260 -0
  88. data/lib/vapid/vendor/semantic-ui/components/divider.min.css +9 -0
  89. data/lib/vapid/vendor/semantic-ui/components/dropdown.css +1442 -0
  90. data/lib/vapid/vendor/semantic-ui/components/dropdown.js +3767 -0
  91. data/lib/vapid/vendor/semantic-ui/components/dropdown.min.css +9 -0
  92. data/lib/vapid/vendor/semantic-ui/components/dropdown.min.js +11 -0
  93. data/lib/vapid/vendor/semantic-ui/components/embed.css +166 -0
  94. data/lib/vapid/vendor/semantic-ui/components/embed.js +696 -0
  95. data/lib/vapid/vendor/semantic-ui/components/embed.min.css +9 -0
  96. data/lib/vapid/vendor/semantic-ui/components/embed.min.js +10 -0
  97. data/lib/vapid/vendor/semantic-ui/components/feed.css +296 -0
  98. data/lib/vapid/vendor/semantic-ui/components/feed.min.css +9 -0
  99. data/lib/vapid/vendor/semantic-ui/components/flag.css +1031 -0
  100. data/lib/vapid/vendor/semantic-ui/components/flag.min.css +9 -0
  101. data/lib/vapid/vendor/semantic-ui/components/form.css +1067 -0
  102. data/lib/vapid/vendor/semantic-ui/components/form.js +1603 -0
  103. data/lib/vapid/vendor/semantic-ui/components/form.min.css +9 -0
  104. data/lib/vapid/vendor/semantic-ui/components/form.min.js +10 -0
  105. data/lib/vapid/vendor/semantic-ui/components/grid.css +2002 -0
  106. data/lib/vapid/vendor/semantic-ui/components/grid.min.css +9 -0
  107. data/lib/vapid/vendor/semantic-ui/components/header.css +721 -0
  108. data/lib/vapid/vendor/semantic-ui/components/header.min.css +9 -0
  109. data/lib/vapid/vendor/semantic-ui/components/icon.css +3292 -0
  110. data/lib/vapid/vendor/semantic-ui/components/icon.min.css +9 -0
  111. data/lib/vapid/vendor/semantic-ui/components/image.css +306 -0
  112. data/lib/vapid/vendor/semantic-ui/components/image.min.css +9 -0
  113. data/lib/vapid/vendor/semantic-ui/components/input.css +510 -0
  114. data/lib/vapid/vendor/semantic-ui/components/input.min.css +9 -0
  115. data/lib/vapid/vendor/semantic-ui/components/item.css +486 -0
  116. data/lib/vapid/vendor/semantic-ui/components/item.min.css +9 -0
  117. data/lib/vapid/vendor/semantic-ui/components/label.css +1307 -0
  118. data/lib/vapid/vendor/semantic-ui/components/label.min.css +9 -0
  119. data/lib/vapid/vendor/semantic-ui/components/list.css +951 -0
  120. data/lib/vapid/vendor/semantic-ui/components/list.min.css +9 -0
  121. data/lib/vapid/vendor/semantic-ui/components/loader.css +347 -0
  122. data/lib/vapid/vendor/semantic-ui/components/loader.min.css +9 -0
  123. data/lib/vapid/vendor/semantic-ui/components/menu.css +2002 -0
  124. data/lib/vapid/vendor/semantic-ui/components/menu.min.css +1 -0
  125. data/lib/vapid/vendor/semantic-ui/components/message.css +477 -0
  126. data/lib/vapid/vendor/semantic-ui/components/message.min.css +9 -0
  127. data/lib/vapid/vendor/semantic-ui/components/modal.css +502 -0
  128. data/lib/vapid/vendor/semantic-ui/components/modal.js +913 -0
  129. data/lib/vapid/vendor/semantic-ui/components/modal.min.css +9 -0
  130. data/lib/vapid/vendor/semantic-ui/components/modal.min.js +10 -0
  131. data/lib/vapid/vendor/semantic-ui/components/nag.css +147 -0
  132. data/lib/vapid/vendor/semantic-ui/components/nag.js +507 -0
  133. data/lib/vapid/vendor/semantic-ui/components/nag.min.css +9 -0
  134. data/lib/vapid/vendor/semantic-ui/components/nag.min.js +10 -0
  135. data/lib/vapid/vendor/semantic-ui/components/popup.css +733 -0
  136. data/lib/vapid/vendor/semantic-ui/components/popup.js +1475 -0
  137. data/lib/vapid/vendor/semantic-ui/components/popup.min.css +9 -0
  138. data/lib/vapid/vendor/semantic-ui/components/popup.min.js +10 -0
  139. data/lib/vapid/vendor/semantic-ui/components/progress.css +516 -0
  140. data/lib/vapid/vendor/semantic-ui/components/progress.js +931 -0
  141. data/lib/vapid/vendor/semantic-ui/components/progress.min.css +9 -0
  142. data/lib/vapid/vendor/semantic-ui/components/progress.min.js +10 -0
  143. data/lib/vapid/vendor/semantic-ui/components/rail.css +152 -0
  144. data/lib/vapid/vendor/semantic-ui/components/rail.min.css +9 -0
  145. data/lib/vapid/vendor/semantic-ui/components/rating.css +263 -0
  146. data/lib/vapid/vendor/semantic-ui/components/rating.js +508 -0
  147. data/lib/vapid/vendor/semantic-ui/components/rating.min.css +9 -0
  148. data/lib/vapid/vendor/semantic-ui/components/rating.min.js +10 -0
  149. data/lib/vapid/vendor/semantic-ui/components/reset.css +424 -0
  150. data/lib/vapid/vendor/semantic-ui/components/reset.min.css +9 -0
  151. data/lib/vapid/vendor/semantic-ui/components/reveal.css +284 -0
  152. data/lib/vapid/vendor/semantic-ui/components/reveal.min.css +9 -0
  153. data/lib/vapid/vendor/semantic-ui/components/search.css +408 -0
  154. data/lib/vapid/vendor/semantic-ui/components/search.js +1442 -0
  155. data/lib/vapid/vendor/semantic-ui/components/search.min.css +9 -0
  156. data/lib/vapid/vendor/semantic-ui/components/search.min.js +10 -0
  157. data/lib/vapid/vendor/semantic-ui/components/segment.css +798 -0
  158. data/lib/vapid/vendor/semantic-ui/components/segment.min.css +9 -0
  159. data/lib/vapid/vendor/semantic-ui/components/shape.css +157 -0
  160. data/lib/vapid/vendor/semantic-ui/components/shape.js +921 -0
  161. data/lib/vapid/vendor/semantic-ui/components/shape.min.css +9 -0
  162. data/lib/vapid/vendor/semantic-ui/components/shape.min.js +10 -0
  163. data/lib/vapid/vendor/semantic-ui/components/sidebar.css +634 -0
  164. data/lib/vapid/vendor/semantic-ui/components/sidebar.js +1036 -0
  165. data/lib/vapid/vendor/semantic-ui/components/sidebar.min.css +9 -0
  166. data/lib/vapid/vendor/semantic-ui/components/sidebar.min.js +10 -0
  167. data/lib/vapid/vendor/semantic-ui/components/site.css +160 -0
  168. data/lib/vapid/vendor/semantic-ui/components/site.js +487 -0
  169. data/lib/vapid/vendor/semantic-ui/components/site.min.css +9 -0
  170. data/lib/vapid/vendor/semantic-ui/components/site.min.js +10 -0
  171. data/lib/vapid/vendor/semantic-ui/components/state.js +708 -0
  172. data/lib/vapid/vendor/semantic-ui/components/state.min.js +10 -0
  173. data/lib/vapid/vendor/semantic-ui/components/statistic.css +569 -0
  174. data/lib/vapid/vendor/semantic-ui/components/statistic.min.css +9 -0
  175. data/lib/vapid/vendor/semantic-ui/components/step.css +623 -0
  176. data/lib/vapid/vendor/semantic-ui/components/step.min.css +9 -0
  177. data/lib/vapid/vendor/semantic-ui/components/sticky.css +78 -0
  178. data/lib/vapid/vendor/semantic-ui/components/sticky.js +942 -0
  179. data/lib/vapid/vendor/semantic-ui/components/sticky.min.css +9 -0
  180. data/lib/vapid/vendor/semantic-ui/components/sticky.min.js +10 -0
  181. data/lib/vapid/vendor/semantic-ui/components/tab.css +91 -0
  182. data/lib/vapid/vendor/semantic-ui/components/tab.js +952 -0
  183. data/lib/vapid/vendor/semantic-ui/components/tab.min.css +9 -0
  184. data/lib/vapid/vendor/semantic-ui/components/tab.min.js +10 -0
  185. data/lib/vapid/vendor/semantic-ui/components/table.css +1108 -0
  186. data/lib/vapid/vendor/semantic-ui/components/table.min.css +9 -0
  187. data/lib/vapid/vendor/semantic-ui/components/transition.css +1964 -0
  188. data/lib/vapid/vendor/semantic-ui/components/transition.js +1095 -0
  189. data/lib/vapid/vendor/semantic-ui/components/transition.min.css +9 -0
  190. data/lib/vapid/vendor/semantic-ui/components/transition.min.js +10 -0
  191. data/lib/vapid/vendor/semantic-ui/components/video.css +125 -0
  192. data/lib/vapid/vendor/semantic-ui/components/video.js +532 -0
  193. data/lib/vapid/vendor/semantic-ui/components/video.min.css +10 -0
  194. data/lib/vapid/vendor/semantic-ui/components/video.min.js +11 -0
  195. data/lib/vapid/vendor/semantic-ui/components/visibility.js +1288 -0
  196. data/lib/vapid/vendor/semantic-ui/components/visibility.min.js +10 -0
  197. data/lib/vapid/vendor/semantic-ui/components/visit.js +517 -0
  198. data/lib/vapid/vendor/semantic-ui/components/visit.min.js +11 -0
  199. data/lib/vapid/vendor/semantic-ui/package.js +34 -0
  200. data/lib/vapid/vendor/semantic-ui/package.json +20 -0
  201. data/lib/vapid/vendor/semantic-ui/semantic.css +36844 -0
  202. data/lib/vapid/vendor/semantic-ui/semantic.js +22617 -0
  203. data/lib/vapid/vendor/semantic-ui/semantic.min.css +364 -0
  204. data/lib/vapid/vendor/semantic-ui/semantic.min.js +19 -0
  205. data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.eot +0 -0
  206. data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.otf +0 -0
  207. data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.svg +2671 -0
  208. data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.ttf +0 -0
  209. data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.woff +0 -0
  210. data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.woff2 +0 -0
  211. data/lib/vapid/vendor/semantic-ui/themes/default/assets/images/flags.png +0 -0
  212. data/lib/vapid/vendor/trix/.blade.yml +45 -0
  213. data/lib/vapid/vendor/trix/.github/ISSUE_TEMPLATE.md +13 -0
  214. data/lib/vapid/vendor/trix/.gitignore +3 -0
  215. data/lib/vapid/vendor/trix/.ruby-version +1 -0
  216. data/lib/vapid/vendor/trix/.travis.yml +6 -0
  217. data/lib/vapid/vendor/trix/CONDUCT.md +79 -0
  218. data/lib/vapid/vendor/trix/Gemfile +17 -0
  219. data/lib/vapid/vendor/trix/Gemfile.lock +152 -0
  220. data/lib/vapid/vendor/trix/LICENSE +20 -0
  221. data/lib/vapid/vendor/trix/README.md +382 -0
  222. data/lib/vapid/vendor/trix/assets/index.html +55 -0
  223. data/lib/vapid/vendor/trix/assets/trix-core.coffee +2 -0
  224. data/lib/vapid/vendor/trix/assets/trix.coffee +3 -0
  225. data/lib/vapid/vendor/trix/assets/trix.scss +5 -0
  226. data/lib/vapid/vendor/trix/assets/trix/banner/index.coffee.erb +3 -0
  227. data/lib/vapid/vendor/trix/assets/trix/banner/index.scss.erb +3 -0
  228. data/lib/vapid/vendor/trix/assets/trix/banner/index.txt.erb +3 -0
  229. data/lib/vapid/vendor/trix/assets/trix/images/README.md +6 -0
  230. data/lib/vapid/vendor/trix/assets/trix/images/attach.svg +5 -0
  231. data/lib/vapid/vendor/trix/assets/trix/images/bold.svg +5 -0
  232. data/lib/vapid/vendor/trix/assets/trix/images/bullets.svg +5 -0
  233. data/lib/vapid/vendor/trix/assets/trix/images/code.svg +5 -0
  234. data/lib/vapid/vendor/trix/assets/trix/images/heading_1.svg +5 -0
  235. data/lib/vapid/vendor/trix/assets/trix/images/italic.svg +5 -0
  236. data/lib/vapid/vendor/trix/assets/trix/images/link.svg +6 -0
  237. data/lib/vapid/vendor/trix/assets/trix/images/nesting_level_decrease.svg +5 -0
  238. data/lib/vapid/vendor/trix/assets/trix/images/nesting_level_increase.svg +5 -0
  239. data/lib/vapid/vendor/trix/assets/trix/images/numbers.svg +5 -0
  240. data/lib/vapid/vendor/trix/assets/trix/images/quote.svg +5 -0
  241. data/lib/vapid/vendor/trix/assets/trix/images/redo.svg +5 -0
  242. data/lib/vapid/vendor/trix/assets/trix/images/remove.svg +4 -0
  243. data/lib/vapid/vendor/trix/assets/trix/images/strike.svg +6 -0
  244. data/lib/vapid/vendor/trix/assets/trix/images/trash.svg +5 -0
  245. data/lib/vapid/vendor/trix/assets/trix/images/undo.svg +5 -0
  246. data/lib/vapid/vendor/trix/assets/trix/stylesheets/attachments.scss +112 -0
  247. data/lib/vapid/vendor/trix/assets/trix/stylesheets/content.scss +88 -0
  248. data/lib/vapid/vendor/trix/assets/trix/stylesheets/editor.scss +8 -0
  249. data/lib/vapid/vendor/trix/assets/trix/stylesheets/icons.scss +14 -0
  250. data/lib/vapid/vendor/trix/assets/trix/stylesheets/media-queries.scss +7 -0
  251. data/lib/vapid/vendor/trix/assets/trix/stylesheets/toolbar.scss +194 -0
  252. data/lib/vapid/vendor/trix/bin/blade +16 -0
  253. data/lib/vapid/vendor/trix/bin/ci +21 -0
  254. data/lib/vapid/vendor/trix/bin/rackup +16 -0
  255. data/lib/vapid/vendor/trix/bin/rake +16 -0
  256. data/lib/vapid/vendor/trix/bin/release +139 -0
  257. data/lib/vapid/vendor/trix/bin/setup +69 -0
  258. data/lib/vapid/vendor/trix/bin/update-status-image +100 -0
  259. data/lib/vapid/vendor/trix/bower.json +34 -0
  260. data/lib/vapid/vendor/trix/config.ru +32 -0
  261. data/lib/vapid/vendor/trix/dist/trix-core.js +11 -0
  262. data/lib/vapid/vendor/trix/dist/trix.css +286 -0
  263. data/lib/vapid/vendor/trix/dist/trix.js +20 -0
  264. data/lib/vapid/vendor/trix/package.json +29 -0
  265. data/lib/vapid/vendor/trix/polyfills/polyfills.coffee +3 -0
  266. data/lib/vapid/vendor/trix/polyfills/set.coffee +24 -0
  267. data/lib/vapid/vendor/trix/polyfills/vendor/CustomElements.js +1029 -0
  268. data/lib/vapid/vendor/trix/polyfills/vendor/README.md +2 -0
  269. data/lib/vapid/vendor/trix/polyfills/vendor/promise.js +228 -0
  270. data/lib/vapid/vendor/trix/src/trix/VERSION +1 -0
  271. data/lib/vapid/vendor/trix/src/trix/config/block_attributes.coffee +37 -0
  272. data/lib/vapid/vendor/trix/src/trix/config/css.coffee +12 -0
  273. data/lib/vapid/vendor/trix/src/trix/config/file_size_formatting.coffee +22 -0
  274. data/lib/vapid/vendor/trix/src/trix/config/index.coffee +9 -0
  275. data/lib/vapid/vendor/trix/src/trix/config/lang.coffee +26 -0
  276. data/lib/vapid/vendor/trix/src/trix/config/selection_elements.coffee +26 -0
  277. data/lib/vapid/vendor/trix/src/trix/config/serialization.coffee +63 -0
  278. data/lib/vapid/vendor/trix/src/trix/config/text_attributes.coffee +25 -0
  279. data/lib/vapid/vendor/trix/src/trix/config/toolbar.coffee +41 -0
  280. data/lib/vapid/vendor/trix/src/trix/config/undo_interval.coffee +7 -0
  281. data/lib/vapid/vendor/trix/src/trix/controllers/attachment_editor_controller.coffee +104 -0
  282. data/lib/vapid/vendor/trix/src/trix/controllers/composition_controller.coffee +117 -0
  283. data/lib/vapid/vendor/trix/src/trix/controllers/controller.coffee +3 -0
  284. data/lib/vapid/vendor/trix/src/trix/controllers/editor_controller.coffee +369 -0
  285. data/lib/vapid/vendor/trix/src/trix/controllers/input/composition_input.coffee +57 -0
  286. data/lib/vapid/vendor/trix/src/trix/controllers/input_controller.coffee +473 -0
  287. data/lib/vapid/vendor/trix/src/trix/controllers/toolbar_controller.coffee +173 -0
  288. data/lib/vapid/vendor/trix/src/trix/core/basic_object.coffee +44 -0
  289. data/lib/vapid/vendor/trix/src/trix/core/collections/element_store.coffee +21 -0
  290. data/lib/vapid/vendor/trix/src/trix/core/collections/hash.coffee +98 -0
  291. data/lib/vapid/vendor/trix/src/trix/core/collections/index.coffee +4 -0
  292. data/lib/vapid/vendor/trix/src/trix/core/collections/object_group.coffee +37 -0
  293. data/lib/vapid/vendor/trix/src/trix/core/collections/object_map.coffee +10 -0
  294. data/lib/vapid/vendor/trix/src/trix/core/helpers/arrays.coffee +34 -0
  295. data/lib/vapid/vendor/trix/src/trix/core/helpers/config.coffee +23 -0
  296. data/lib/vapid/vendor/trix/src/trix/core/helpers/custom_elements.coffee +45 -0
  297. data/lib/vapid/vendor/trix/src/trix/core/helpers/dom.coffee +185 -0
  298. data/lib/vapid/vendor/trix/src/trix/core/helpers/extend.coffee +4 -0
  299. data/lib/vapid/vendor/trix/src/trix/core/helpers/functions.coffee +3 -0
  300. data/lib/vapid/vendor/trix/src/trix/core/helpers/global.coffee +23 -0
  301. data/lib/vapid/vendor/trix/src/trix/core/helpers/index.coffee +10 -0
  302. data/lib/vapid/vendor/trix/src/trix/core/helpers/objects.coffee +11 -0
  303. data/lib/vapid/vendor/trix/src/trix/core/helpers/ranges.coffee +33 -0
  304. data/lib/vapid/vendor/trix/src/trix/core/helpers/selection.coffee +25 -0
  305. data/lib/vapid/vendor/trix/src/trix/core/helpers/strings.coffee +46 -0
  306. data/lib/vapid/vendor/trix/src/trix/core/index.coffee +4 -0
  307. data/lib/vapid/vendor/trix/src/trix/core/object.coffee +33 -0
  308. data/lib/vapid/vendor/trix/src/trix/core/utilities/index.coffee +2 -0
  309. data/lib/vapid/vendor/trix/src/trix/core/utilities/operation.coffee +37 -0
  310. data/lib/vapid/vendor/trix/src/trix/core/utilities/utf16_string.coffee +93 -0
  311. data/lib/vapid/vendor/trix/src/trix/elements/trix_editor_element.coffee +166 -0
  312. data/lib/vapid/vendor/trix/src/trix/elements/trix_toolbar_element.coffee +28 -0
  313. data/lib/vapid/vendor/trix/src/trix/index.coffee.erb +14 -0
  314. data/lib/vapid/vendor/trix/src/trix/inspector/control_element.coffee +60 -0
  315. data/lib/vapid/vendor/trix/src/trix/inspector/debugger.coffee +104 -0
  316. data/lib/vapid/vendor/trix/src/trix/inspector/element.coffee +86 -0
  317. data/lib/vapid/vendor/trix/src/trix/inspector/index.coffee +17 -0
  318. data/lib/vapid/vendor/trix/src/trix/inspector/polyfills/vendor/details-element-polyfill.js +5 -0
  319. data/lib/vapid/vendor/trix/src/trix/inspector/templates/debug.jst.eco +17 -0
  320. data/lib/vapid/vendor/trix/src/trix/inspector/templates/document.jst.eco +33 -0
  321. data/lib/vapid/vendor/trix/src/trix/inspector/templates/performance.jst.eco +10 -0
  322. data/lib/vapid/vendor/trix/src/trix/inspector/templates/render.jst.eco +1 -0
  323. data/lib/vapid/vendor/trix/src/trix/inspector/templates/selection.jst.eco +5 -0
  324. data/lib/vapid/vendor/trix/src/trix/inspector/templates/undo.jst.eco +13 -0
  325. data/lib/vapid/vendor/trix/src/trix/inspector/view.coffee +58 -0
  326. data/lib/vapid/vendor/trix/src/trix/inspector/views/debug_view.coffee +33 -0
  327. data/lib/vapid/vendor/trix/src/trix/inspector/views/document_view.coffee +12 -0
  328. data/lib/vapid/vendor/trix/src/trix/inspector/views/performance_view.coffee +51 -0
  329. data/lib/vapid/vendor/trix/src/trix/inspector/views/render_view.coffee +21 -0
  330. data/lib/vapid/vendor/trix/src/trix/inspector/views/selection_view.coffee +33 -0
  331. data/lib/vapid/vendor/trix/src/trix/inspector/views/undo_view.coffee +12 -0
  332. data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/deserializer.coffee +55 -0
  333. data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/index.coffee +5 -0
  334. data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/player.coffee +60 -0
  335. data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_controller.coffee +43 -0
  336. data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_element.coffee +32 -0
  337. data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_view.coffee +133 -0
  338. data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/recorder.coffee +82 -0
  339. data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/recording.coffee +54 -0
  340. data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/serializer.coffee +61 -0
  341. data/lib/vapid/vendor/trix/src/trix/models/attachment.coffee +157 -0
  342. data/lib/vapid/vendor/trix/src/trix/models/attachment_manager.coffee +24 -0
  343. data/lib/vapid/vendor/trix/src/trix/models/attachment_piece.coffee +47 -0
  344. data/lib/vapid/vendor/trix/src/trix/models/block.coffee +230 -0
  345. data/lib/vapid/vendor/trix/src/trix/models/composition.coffee +521 -0
  346. data/lib/vapid/vendor/trix/src/trix/models/document.coffee +538 -0
  347. data/lib/vapid/vendor/trix/src/trix/models/editor.coffee +141 -0
  348. data/lib/vapid/vendor/trix/src/trix/models/html_parser.coffee +335 -0
  349. data/lib/vapid/vendor/trix/src/trix/models/line_break_insertion.coffee +31 -0
  350. data/lib/vapid/vendor/trix/src/trix/models/location_mapper.coffee +156 -0
  351. data/lib/vapid/vendor/trix/src/trix/models/managed_attachment.coffee +28 -0
  352. data/lib/vapid/vendor/trix/src/trix/models/piece.coffee +95 -0
  353. data/lib/vapid/vendor/trix/src/trix/models/point_mapper.coffee +28 -0
  354. data/lib/vapid/vendor/trix/src/trix/models/selection_manager.coffee +129 -0
  355. data/lib/vapid/vendor/trix/src/trix/models/splittable_list.coffee +168 -0
  356. data/lib/vapid/vendor/trix/src/trix/models/string_piece.coffee +49 -0
  357. data/lib/vapid/vendor/trix/src/trix/models/text.coffee +168 -0
  358. data/lib/vapid/vendor/trix/src/trix/models/undo_manager.coffee +40 -0
  359. data/lib/vapid/vendor/trix/src/trix/observers/mutation_observer.coffee +131 -0
  360. data/lib/vapid/vendor/trix/src/trix/observers/selection_change_observer.coffee +56 -0
  361. data/lib/vapid/vendor/trix/src/trix/operations/file_verification_operation.coffee +15 -0
  362. data/lib/vapid/vendor/trix/src/trix/operations/image_preload_operation.coffee +15 -0
  363. data/lib/vapid/vendor/trix/src/trix/views/attachment_view.coffee +99 -0
  364. data/lib/vapid/vendor/trix/src/trix/views/block_view.coffee +37 -0
  365. data/lib/vapid/vendor/trix/src/trix/views/document_view.coffee +68 -0
  366. data/lib/vapid/vendor/trix/src/trix/views/object_group_view.coffee +23 -0
  367. data/lib/vapid/vendor/trix/src/trix/views/object_view.coffee +86 -0
  368. data/lib/vapid/vendor/trix/src/trix/views/piece_view.coffee +97 -0
  369. data/lib/vapid/vendor/trix/src/trix/views/previewable_attachment_view.coffee +49 -0
  370. data/lib/vapid/vendor/trix/src/trix/views/text_view.coffee +30 -0
  371. data/lib/vapid/vendor/trix/test/.gitignore +1 -0
  372. data/lib/vapid/vendor/trix/test/src/system/attachment_test.coffee +70 -0
  373. data/lib/vapid/vendor/trix/test/src/system/basic_input_test.coffee +68 -0
  374. data/lib/vapid/vendor/trix/test/src/system/block_formatting_test.coffee +602 -0
  375. data/lib/vapid/vendor/trix/test/src/system/caching_test.coffee +21 -0
  376. data/lib/vapid/vendor/trix/test/src/system/composition_input_test.coffee +138 -0
  377. data/lib/vapid/vendor/trix/test/src/system/cursor_movement_test.coffee +54 -0
  378. data/lib/vapid/vendor/trix/test/src/system/custom_element_test.coffee +314 -0
  379. data/lib/vapid/vendor/trix/test/src/system/html_loading_test.coffee +62 -0
  380. data/lib/vapid/vendor/trix/test/src/system/html_replacement_test.coffee +101 -0
  381. data/lib/vapid/vendor/trix/test/src/system/installation_process_test.coffee +59 -0
  382. data/lib/vapid/vendor/trix/test/src/system/list_formatting_test.coffee +70 -0
  383. data/lib/vapid/vendor/trix/test/src/system/mutation_input_test.coffee +73 -0
  384. data/lib/vapid/vendor/trix/test/src/system/pasting_test.coffee +215 -0
  385. data/lib/vapid/vendor/trix/test/src/system/text_formatting_test.coffee +151 -0
  386. data/lib/vapid/vendor/trix/test/src/system/undo_test.coffee +48 -0
  387. data/lib/vapid/vendor/trix/test/src/test.coffee +16 -0
  388. data/lib/vapid/vendor/trix/test/src/test_helpers/assertions.coffee +38 -0
  389. data/lib/vapid/vendor/trix/test/src/test_helpers/editor_helpers.coffee +37 -0
  390. data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_empty.jst.eco +1 -0
  391. data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_html.jst.eco +2 -0
  392. data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_in_table.jst.eco +7 -0
  393. data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_block_styles.jst.eco +6 -0
  394. data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_bold_styles.jst.eco +7 -0
  395. data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_image.jst.eco +2 -0
  396. data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_styled_content.jst.eco +7 -0
  397. data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_toolbar_and_input.jst.eco +5 -0
  398. data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/fixtures.coffee +536 -0
  399. data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/logo.png +0 -0
  400. data/lib/vapid/vendor/trix/test/src/test_helpers/index.coffee +18 -0
  401. data/lib/vapid/vendor/trix/test/src/test_helpers/input_helpers.coffee +183 -0
  402. data/lib/vapid/vendor/trix/test/src/test_helpers/selection_helpers.coffee +91 -0
  403. data/lib/vapid/vendor/trix/test/src/test_helpers/test_helpers.coffee +72 -0
  404. data/lib/vapid/vendor/trix/test/src/test_helpers/test_stubs.coffee +31 -0
  405. data/lib/vapid/vendor/trix/test/src/test_helpers/toolbar_helpers.coffee +45 -0
  406. data/lib/vapid/vendor/trix/test/src/unit/attachment_test.coffee +23 -0
  407. data/lib/vapid/vendor/trix/test/src/unit/block_test.coffee +22 -0
  408. data/lib/vapid/vendor/trix/test/src/unit/composition_test.coffee +13 -0
  409. data/lib/vapid/vendor/trix/test/src/unit/document_test.coffee +11 -0
  410. data/lib/vapid/vendor/trix/test/src/unit/document_view_test.coffee +6 -0
  411. data/lib/vapid/vendor/trix/test/src/unit/html_parser_test.coffee +162 -0
  412. data/lib/vapid/vendor/trix/test/src/unit/location_mapper_test.coffee +185 -0
  413. data/lib/vapid/vendor/trix/test/src/unit/mutation_observer_test.coffee +84 -0
  414. data/lib/vapid/vendor/trix/test/src/unit/serialization_test.coffee +7 -0
  415. data/lib/vapid/vendor/trix/test/src/unit/string_change_summary_test.coffee +57 -0
  416. data/lib/vapid/vendor/trix/test/src/unit/text_test.coffee +19 -0
  417. data/lib/vapid/vendor/trix/test/vendor/rangy-core.js +3845 -0
  418. data/lib/vapid/vendor/trix/test/vendor/rangy-textrange.js +1930 -0
  419. data/lib/vapid/version.rb +4 -0
  420. data/lib/vapid/views/admin/install.html.erb +19 -0
  421. data/lib/vapid/views/admin/login.html.erb +11 -0
  422. data/lib/vapid/views/admin/overview/index.html.erb +1 -0
  423. data/lib/vapid/views/admin/records/_form.erb +9 -0
  424. data/lib/vapid/views/admin/records/edit.html.erb +5 -0
  425. data/lib/vapid/views/admin/records/index.html.erb +38 -0
  426. data/lib/vapid/views/admin/records/new.html.erb +3 -0
  427. data/lib/vapid/views/errors/404.html.erb +1 -0
  428. data/lib/vapid/views/errors/500.html.erb +1 -0
  429. data/lib/vapid/views/layouts/admin.html.erb +41 -0
  430. data/lib/vapid/views/layouts/admin_form.html.erb +22 -0
  431. data/lib/vapid/views/layouts/error.html.erb +11 -0
  432. data/vapid.gemspec +48 -0
  433. metadata +811 -0
@@ -0,0 +1,913 @@
1
+ /*!
2
+ * # Semantic UI 2.2.9 - Modal
3
+ * http://github.com/semantic-org/semantic-ui/
4
+ *
5
+ *
6
+ * Released under the MIT license
7
+ * http://opensource.org/licenses/MIT
8
+ *
9
+ */
10
+
11
+ ;(function ($, window, document, undefined) {
12
+
13
+ "use strict";
14
+
15
+ window = (typeof window != 'undefined' && window.Math == Math)
16
+ ? window
17
+ : (typeof self != 'undefined' && self.Math == Math)
18
+ ? self
19
+ : Function('return this')()
20
+ ;
21
+
22
+ $.fn.modal = function(parameters) {
23
+ var
24
+ $allModules = $(this),
25
+ $window = $(window),
26
+ $document = $(document),
27
+ $body = $('body'),
28
+
29
+ moduleSelector = $allModules.selector || '',
30
+
31
+ time = new Date().getTime(),
32
+ performance = [],
33
+
34
+ query = arguments[0],
35
+ methodInvoked = (typeof query == 'string'),
36
+ queryArguments = [].slice.call(arguments, 1),
37
+
38
+ requestAnimationFrame = window.requestAnimationFrame
39
+ || window.mozRequestAnimationFrame
40
+ || window.webkitRequestAnimationFrame
41
+ || window.msRequestAnimationFrame
42
+ || function(callback) { setTimeout(callback, 0); },
43
+
44
+ returnedValue
45
+ ;
46
+
47
+ $allModules
48
+ .each(function() {
49
+ var
50
+ settings = ( $.isPlainObject(parameters) )
51
+ ? $.extend(true, {}, $.fn.modal.settings, parameters)
52
+ : $.extend({}, $.fn.modal.settings),
53
+
54
+ selector = settings.selector,
55
+ className = settings.className,
56
+ namespace = settings.namespace,
57
+ error = settings.error,
58
+
59
+ eventNamespace = '.' + namespace,
60
+ moduleNamespace = 'module-' + namespace,
61
+
62
+ $module = $(this),
63
+ $context = $(settings.context),
64
+ $close = $module.find(selector.close),
65
+
66
+ $allModals,
67
+ $otherModals,
68
+ $focusedElement,
69
+ $dimmable,
70
+ $dimmer,
71
+
72
+ element = this,
73
+ instance = $module.data(moduleNamespace),
74
+
75
+ elementEventNamespace,
76
+ id,
77
+ observer,
78
+ module
79
+ ;
80
+ module = {
81
+
82
+ initialize: function() {
83
+ module.verbose('Initializing dimmer', $context);
84
+
85
+ module.create.id();
86
+ module.create.dimmer();
87
+ module.refreshModals();
88
+
89
+ module.bind.events();
90
+ if(settings.observeChanges) {
91
+ module.observeChanges();
92
+ }
93
+ module.instantiate();
94
+ },
95
+
96
+ instantiate: function() {
97
+ module.verbose('Storing instance of modal');
98
+ instance = module;
99
+ $module
100
+ .data(moduleNamespace, instance)
101
+ ;
102
+ },
103
+
104
+ create: {
105
+ dimmer: function() {
106
+ var
107
+ defaultSettings = {
108
+ debug : settings.debug,
109
+ dimmerName : 'modals',
110
+ duration : {
111
+ show : settings.duration,
112
+ hide : settings.duration
113
+ }
114
+ },
115
+ dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings)
116
+ ;
117
+ if(settings.inverted) {
118
+ dimmerSettings.variation = (dimmerSettings.variation !== undefined)
119
+ ? dimmerSettings.variation + ' inverted'
120
+ : 'inverted'
121
+ ;
122
+ }
123
+ if($.fn.dimmer === undefined) {
124
+ module.error(error.dimmer);
125
+ return;
126
+ }
127
+ module.debug('Creating dimmer with settings', dimmerSettings);
128
+ $dimmable = $context.dimmer(dimmerSettings);
129
+ if(settings.detachable) {
130
+ module.verbose('Modal is detachable, moving content into dimmer');
131
+ $dimmable.dimmer('add content', $module);
132
+ }
133
+ else {
134
+ module.set.undetached();
135
+ }
136
+ if(settings.blurring) {
137
+ $dimmable.addClass(className.blurring);
138
+ }
139
+ $dimmer = $dimmable.dimmer('get dimmer');
140
+ },
141
+ id: function() {
142
+ id = (Math.random().toString(16) + '000000000').substr(2,8);
143
+ elementEventNamespace = '.' + id;
144
+ module.verbose('Creating unique id for element', id);
145
+ }
146
+ },
147
+
148
+ destroy: function() {
149
+ module.verbose('Destroying previous modal');
150
+ $module
151
+ .removeData(moduleNamespace)
152
+ .off(eventNamespace)
153
+ ;
154
+ $window.off(elementEventNamespace);
155
+ $dimmer.off(elementEventNamespace);
156
+ $close.off(eventNamespace);
157
+ $context.dimmer('destroy');
158
+ },
159
+
160
+ observeChanges: function() {
161
+ if('MutationObserver' in window) {
162
+ observer = new MutationObserver(function(mutations) {
163
+ module.debug('DOM tree modified, refreshing');
164
+ module.refresh();
165
+ });
166
+ observer.observe(element, {
167
+ childList : true,
168
+ subtree : true
169
+ });
170
+ module.debug('Setting up mutation observer', observer);
171
+ }
172
+ },
173
+
174
+ refresh: function() {
175
+ module.remove.scrolling();
176
+ module.cacheSizes();
177
+ module.set.screenHeight();
178
+ module.set.type();
179
+ module.set.position();
180
+ },
181
+
182
+ refreshModals: function() {
183
+ $otherModals = $module.siblings(selector.modal);
184
+ $allModals = $otherModals.add($module);
185
+ },
186
+
187
+ attachEvents: function(selector, event) {
188
+ var
189
+ $toggle = $(selector)
190
+ ;
191
+ event = $.isFunction(module[event])
192
+ ? module[event]
193
+ : module.toggle
194
+ ;
195
+ if($toggle.length > 0) {
196
+ module.debug('Attaching modal events to element', selector, event);
197
+ $toggle
198
+ .off(eventNamespace)
199
+ .on('click' + eventNamespace, event)
200
+ ;
201
+ }
202
+ else {
203
+ module.error(error.notFound, selector);
204
+ }
205
+ },
206
+
207
+ bind: {
208
+ events: function() {
209
+ module.verbose('Attaching events');
210
+ $module
211
+ .on('click' + eventNamespace, selector.close, module.event.close)
212
+ .on('click' + eventNamespace, selector.approve, module.event.approve)
213
+ .on('click' + eventNamespace, selector.deny, module.event.deny)
214
+ ;
215
+ $window
216
+ .on('resize' + elementEventNamespace, module.event.resize)
217
+ ;
218
+ }
219
+ },
220
+
221
+ get: {
222
+ id: function() {
223
+ return (Math.random().toString(16) + '000000000').substr(2,8);
224
+ }
225
+ },
226
+
227
+ event: {
228
+ approve: function() {
229
+ if(settings.onApprove.call(element, $(this)) === false) {
230
+ module.verbose('Approve callback returned false cancelling hide');
231
+ return;
232
+ }
233
+ module.hide();
234
+ },
235
+ deny: function() {
236
+ if(settings.onDeny.call(element, $(this)) === false) {
237
+ module.verbose('Deny callback returned false cancelling hide');
238
+ return;
239
+ }
240
+ module.hide();
241
+ },
242
+ close: function() {
243
+ module.hide();
244
+ },
245
+ click: function(event) {
246
+ var
247
+ $target = $(event.target),
248
+ isInModal = ($target.closest(selector.modal).length > 0),
249
+ isInDOM = $.contains(document.documentElement, event.target)
250
+ ;
251
+ if(!isInModal && isInDOM) {
252
+ module.debug('Dimmer clicked, hiding all modals');
253
+ if( module.is.active() ) {
254
+ module.remove.clickaway();
255
+ if(settings.allowMultiple) {
256
+ module.hide();
257
+ }
258
+ else {
259
+ module.hideAll();
260
+ }
261
+ }
262
+ }
263
+ },
264
+ debounce: function(method, delay) {
265
+ clearTimeout(module.timer);
266
+ module.timer = setTimeout(method, delay);
267
+ },
268
+ keyboard: function(event) {
269
+ var
270
+ keyCode = event.which,
271
+ escapeKey = 27
272
+ ;
273
+ if(keyCode == escapeKey) {
274
+ if(settings.closable) {
275
+ module.debug('Escape key pressed hiding modal');
276
+ module.hide();
277
+ }
278
+ else {
279
+ module.debug('Escape key pressed, but closable is set to false');
280
+ }
281
+ event.preventDefault();
282
+ }
283
+ },
284
+ resize: function() {
285
+ if( $dimmable.dimmer('is active') ) {
286
+ requestAnimationFrame(module.refresh);
287
+ }
288
+ }
289
+ },
290
+
291
+ toggle: function() {
292
+ if( module.is.active() || module.is.animating() ) {
293
+ module.hide();
294
+ }
295
+ else {
296
+ module.show();
297
+ }
298
+ },
299
+
300
+ show: function(callback) {
301
+ callback = $.isFunction(callback)
302
+ ? callback
303
+ : function(){}
304
+ ;
305
+ module.refreshModals();
306
+ module.showModal(callback);
307
+ },
308
+
309
+ hide: function(callback) {
310
+ callback = $.isFunction(callback)
311
+ ? callback
312
+ : function(){}
313
+ ;
314
+ module.refreshModals();
315
+ module.hideModal(callback);
316
+ },
317
+
318
+ showModal: function(callback) {
319
+ callback = $.isFunction(callback)
320
+ ? callback
321
+ : function(){}
322
+ ;
323
+ if( module.is.animating() || !module.is.active() ) {
324
+
325
+ module.showDimmer();
326
+ module.cacheSizes();
327
+ module.set.position();
328
+ module.set.screenHeight();
329
+ module.set.type();
330
+ module.set.clickaway();
331
+
332
+ if( !settings.allowMultiple && module.others.active() ) {
333
+ module.hideOthers(module.showModal);
334
+ }
335
+ else {
336
+ settings.onShow.call(element);
337
+ if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
338
+ module.debug('Showing modal with css animations');
339
+ $module
340
+ .transition({
341
+ debug : settings.debug,
342
+ animation : settings.transition + ' in',
343
+ queue : settings.queue,
344
+ duration : settings.duration,
345
+ useFailSafe : true,
346
+ onComplete : function() {
347
+ settings.onVisible.apply(element);
348
+ if(settings.keyboardShortcuts) {
349
+ module.add.keyboardShortcuts();
350
+ }
351
+ module.save.focus();
352
+ module.set.active();
353
+ if(settings.autofocus) {
354
+ module.set.autofocus();
355
+ }
356
+ callback();
357
+ }
358
+ })
359
+ ;
360
+ }
361
+ else {
362
+ module.error(error.noTransition);
363
+ }
364
+ }
365
+ }
366
+ else {
367
+ module.debug('Modal is already visible');
368
+ }
369
+ },
370
+
371
+ hideModal: function(callback, keepDimmed) {
372
+ callback = $.isFunction(callback)
373
+ ? callback
374
+ : function(){}
375
+ ;
376
+ module.debug('Hiding modal');
377
+ if(settings.onHide.call(element, $(this)) === false) {
378
+ module.verbose('Hide callback returned false cancelling hide');
379
+ return;
380
+ }
381
+
382
+ if( module.is.animating() || module.is.active() ) {
383
+ if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
384
+ module.remove.active();
385
+ $module
386
+ .transition({
387
+ debug : settings.debug,
388
+ animation : settings.transition + ' out',
389
+ queue : settings.queue,
390
+ duration : settings.duration,
391
+ useFailSafe : true,
392
+ onStart : function() {
393
+ if(!module.others.active() && !keepDimmed) {
394
+ module.hideDimmer();
395
+ }
396
+ if(settings.keyboardShortcuts) {
397
+ module.remove.keyboardShortcuts();
398
+ }
399
+ },
400
+ onComplete : function() {
401
+ settings.onHidden.call(element);
402
+ module.restore.focus();
403
+ callback();
404
+ }
405
+ })
406
+ ;
407
+ }
408
+ else {
409
+ module.error(error.noTransition);
410
+ }
411
+ }
412
+ },
413
+
414
+ showDimmer: function() {
415
+ if($dimmable.dimmer('is animating') || !$dimmable.dimmer('is active') ) {
416
+ module.debug('Showing dimmer');
417
+ $dimmable.dimmer('show');
418
+ }
419
+ else {
420
+ module.debug('Dimmer already visible');
421
+ }
422
+ },
423
+
424
+ hideDimmer: function() {
425
+ if( $dimmable.dimmer('is animating') || ($dimmable.dimmer('is active')) ) {
426
+ $dimmable.dimmer('hide', function() {
427
+ module.remove.clickaway();
428
+ module.remove.screenHeight();
429
+ });
430
+ }
431
+ else {
432
+ module.debug('Dimmer is not visible cannot hide');
433
+ return;
434
+ }
435
+ },
436
+
437
+ hideAll: function(callback) {
438
+ var
439
+ $visibleModals = $allModals.filter('.' + className.active + ', .' + className.animating)
440
+ ;
441
+ callback = $.isFunction(callback)
442
+ ? callback
443
+ : function(){}
444
+ ;
445
+ if( $visibleModals.length > 0 ) {
446
+ module.debug('Hiding all visible modals');
447
+ module.hideDimmer();
448
+ $visibleModals
449
+ .modal('hide modal', callback)
450
+ ;
451
+ }
452
+ },
453
+
454
+ hideOthers: function(callback) {
455
+ var
456
+ $visibleModals = $otherModals.filter('.' + className.active + ', .' + className.animating)
457
+ ;
458
+ callback = $.isFunction(callback)
459
+ ? callback
460
+ : function(){}
461
+ ;
462
+ if( $visibleModals.length > 0 ) {
463
+ module.debug('Hiding other modals', $otherModals);
464
+ $visibleModals
465
+ .modal('hide modal', callback, true)
466
+ ;
467
+ }
468
+ },
469
+
470
+ others: {
471
+ active: function() {
472
+ return ($otherModals.filter('.' + className.active).length > 0);
473
+ },
474
+ animating: function() {
475
+ return ($otherModals.filter('.' + className.animating).length > 0);
476
+ }
477
+ },
478
+
479
+
480
+ add: {
481
+ keyboardShortcuts: function() {
482
+ module.verbose('Adding keyboard shortcuts');
483
+ $document
484
+ .on('keyup' + eventNamespace, module.event.keyboard)
485
+ ;
486
+ }
487
+ },
488
+
489
+ save: {
490
+ focus: function() {
491
+ $focusedElement = $(document.activeElement).blur();
492
+ }
493
+ },
494
+
495
+ restore: {
496
+ focus: function() {
497
+ if($focusedElement && $focusedElement.length > 0) {
498
+ $focusedElement.focus();
499
+ }
500
+ }
501
+ },
502
+
503
+ remove: {
504
+ active: function() {
505
+ $module.removeClass(className.active);
506
+ },
507
+ clickaway: function() {
508
+ if(settings.closable) {
509
+ $dimmer
510
+ .off('click' + elementEventNamespace)
511
+ ;
512
+ }
513
+ },
514
+ bodyStyle: function() {
515
+ if($body.attr('style') === '') {
516
+ module.verbose('Removing style attribute');
517
+ $body.removeAttr('style');
518
+ }
519
+ },
520
+ screenHeight: function() {
521
+ module.debug('Removing page height');
522
+ $body
523
+ .css('height', '')
524
+ ;
525
+ },
526
+ keyboardShortcuts: function() {
527
+ module.verbose('Removing keyboard shortcuts');
528
+ $document
529
+ .off('keyup' + eventNamespace)
530
+ ;
531
+ },
532
+ scrolling: function() {
533
+ $dimmable.removeClass(className.scrolling);
534
+ $module.removeClass(className.scrolling);
535
+ }
536
+ },
537
+
538
+ cacheSizes: function() {
539
+ var
540
+ modalHeight = $module.outerHeight()
541
+ ;
542
+ if(module.cache === undefined || modalHeight !== 0) {
543
+ module.cache = {
544
+ pageHeight : $(document).outerHeight(),
545
+ height : modalHeight + settings.offset,
546
+ contextHeight : (settings.context == 'body')
547
+ ? $(window).height()
548
+ : $dimmable.height()
549
+ };
550
+ }
551
+ module.debug('Caching modal and container sizes', module.cache);
552
+ },
553
+
554
+ can: {
555
+ fit: function() {
556
+ return ( ( module.cache.height + (settings.padding * 2) ) < module.cache.contextHeight);
557
+ }
558
+ },
559
+
560
+ is: {
561
+ active: function() {
562
+ return $module.hasClass(className.active);
563
+ },
564
+ animating: function() {
565
+ return $module.transition('is supported')
566
+ ? $module.transition('is animating')
567
+ : $module.is(':visible')
568
+ ;
569
+ },
570
+ scrolling: function() {
571
+ return $dimmable.hasClass(className.scrolling);
572
+ },
573
+ modernBrowser: function() {
574
+ // appName for IE11 reports 'Netscape' can no longer use
575
+ return !(window.ActiveXObject || "ActiveXObject" in window);
576
+ }
577
+ },
578
+
579
+ set: {
580
+ autofocus: function() {
581
+ var
582
+ $inputs = $module.find('[tabindex], :input').filter(':visible'),
583
+ $autofocus = $inputs.filter('[autofocus]'),
584
+ $input = ($autofocus.length > 0)
585
+ ? $autofocus.first()
586
+ : $inputs.first()
587
+ ;
588
+ if($input.length > 0) {
589
+ $input.focus();
590
+ }
591
+ },
592
+ clickaway: function() {
593
+ if(settings.closable) {
594
+ $dimmer
595
+ .on('click' + elementEventNamespace, module.event.click)
596
+ ;
597
+ }
598
+ },
599
+ screenHeight: function() {
600
+ if( module.can.fit() ) {
601
+ $body.css('height', '');
602
+ }
603
+ else {
604
+ module.debug('Modal is taller than page content, resizing page height');
605
+ $body
606
+ .css('height', module.cache.height + (settings.padding * 2) )
607
+ ;
608
+ }
609
+ },
610
+ active: function() {
611
+ $module.addClass(className.active);
612
+ },
613
+ scrolling: function() {
614
+ $dimmable.addClass(className.scrolling);
615
+ $module.addClass(className.scrolling);
616
+ },
617
+ type: function() {
618
+ if(module.can.fit()) {
619
+ module.verbose('Modal fits on screen');
620
+ if(!module.others.active() && !module.others.animating()) {
621
+ module.remove.scrolling();
622
+ }
623
+ }
624
+ else {
625
+ module.verbose('Modal cannot fit on screen setting to scrolling');
626
+ module.set.scrolling();
627
+ }
628
+ },
629
+ position: function() {
630
+ module.verbose('Centering modal on page', module.cache);
631
+ if(module.can.fit()) {
632
+ $module
633
+ .css({
634
+ top: '',
635
+ marginTop: -(module.cache.height / 2)
636
+ })
637
+ ;
638
+ }
639
+ else {
640
+ $module
641
+ .css({
642
+ marginTop : '',
643
+ top : $document.scrollTop()
644
+ })
645
+ ;
646
+ }
647
+ },
648
+ undetached: function() {
649
+ $dimmable.addClass(className.undetached);
650
+ }
651
+ },
652
+
653
+ setting: function(name, value) {
654
+ module.debug('Changing setting', name, value);
655
+ if( $.isPlainObject(name) ) {
656
+ $.extend(true, settings, name);
657
+ }
658
+ else if(value !== undefined) {
659
+ if($.isPlainObject(settings[name])) {
660
+ $.extend(true, settings[name], value);
661
+ }
662
+ else {
663
+ settings[name] = value;
664
+ }
665
+ }
666
+ else {
667
+ return settings[name];
668
+ }
669
+ },
670
+ internal: function(name, value) {
671
+ if( $.isPlainObject(name) ) {
672
+ $.extend(true, module, name);
673
+ }
674
+ else if(value !== undefined) {
675
+ module[name] = value;
676
+ }
677
+ else {
678
+ return module[name];
679
+ }
680
+ },
681
+ debug: function() {
682
+ if(!settings.silent && settings.debug) {
683
+ if(settings.performance) {
684
+ module.performance.log(arguments);
685
+ }
686
+ else {
687
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
688
+ module.debug.apply(console, arguments);
689
+ }
690
+ }
691
+ },
692
+ verbose: function() {
693
+ if(!settings.silent && settings.verbose && settings.debug) {
694
+ if(settings.performance) {
695
+ module.performance.log(arguments);
696
+ }
697
+ else {
698
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
699
+ module.verbose.apply(console, arguments);
700
+ }
701
+ }
702
+ },
703
+ error: function() {
704
+ if(!settings.silent) {
705
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
706
+ module.error.apply(console, arguments);
707
+ }
708
+ },
709
+ performance: {
710
+ log: function(message) {
711
+ var
712
+ currentTime,
713
+ executionTime,
714
+ previousTime
715
+ ;
716
+ if(settings.performance) {
717
+ currentTime = new Date().getTime();
718
+ previousTime = time || currentTime;
719
+ executionTime = currentTime - previousTime;
720
+ time = currentTime;
721
+ performance.push({
722
+ 'Name' : message[0],
723
+ 'Arguments' : [].slice.call(message, 1) || '',
724
+ 'Element' : element,
725
+ 'Execution Time' : executionTime
726
+ });
727
+ }
728
+ clearTimeout(module.performance.timer);
729
+ module.performance.timer = setTimeout(module.performance.display, 500);
730
+ },
731
+ display: function() {
732
+ var
733
+ title = settings.name + ':',
734
+ totalTime = 0
735
+ ;
736
+ time = false;
737
+ clearTimeout(module.performance.timer);
738
+ $.each(performance, function(index, data) {
739
+ totalTime += data['Execution Time'];
740
+ });
741
+ title += ' ' + totalTime + 'ms';
742
+ if(moduleSelector) {
743
+ title += ' \'' + moduleSelector + '\'';
744
+ }
745
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
746
+ console.groupCollapsed(title);
747
+ if(console.table) {
748
+ console.table(performance);
749
+ }
750
+ else {
751
+ $.each(performance, function(index, data) {
752
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
753
+ });
754
+ }
755
+ console.groupEnd();
756
+ }
757
+ performance = [];
758
+ }
759
+ },
760
+ invoke: function(query, passedArguments, context) {
761
+ var
762
+ object = instance,
763
+ maxDepth,
764
+ found,
765
+ response
766
+ ;
767
+ passedArguments = passedArguments || queryArguments;
768
+ context = element || context;
769
+ if(typeof query == 'string' && object !== undefined) {
770
+ query = query.split(/[\. ]/);
771
+ maxDepth = query.length - 1;
772
+ $.each(query, function(depth, value) {
773
+ var camelCaseValue = (depth != maxDepth)
774
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
775
+ : query
776
+ ;
777
+ if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
778
+ object = object[camelCaseValue];
779
+ }
780
+ else if( object[camelCaseValue] !== undefined ) {
781
+ found = object[camelCaseValue];
782
+ return false;
783
+ }
784
+ else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
785
+ object = object[value];
786
+ }
787
+ else if( object[value] !== undefined ) {
788
+ found = object[value];
789
+ return false;
790
+ }
791
+ else {
792
+ return false;
793
+ }
794
+ });
795
+ }
796
+ if ( $.isFunction( found ) ) {
797
+ response = found.apply(context, passedArguments);
798
+ }
799
+ else if(found !== undefined) {
800
+ response = found;
801
+ }
802
+ if($.isArray(returnedValue)) {
803
+ returnedValue.push(response);
804
+ }
805
+ else if(returnedValue !== undefined) {
806
+ returnedValue = [returnedValue, response];
807
+ }
808
+ else if(response !== undefined) {
809
+ returnedValue = response;
810
+ }
811
+ return found;
812
+ }
813
+ };
814
+
815
+ if(methodInvoked) {
816
+ if(instance === undefined) {
817
+ module.initialize();
818
+ }
819
+ module.invoke(query);
820
+ }
821
+ else {
822
+ if(instance !== undefined) {
823
+ instance.invoke('destroy');
824
+ }
825
+ module.initialize();
826
+ }
827
+ })
828
+ ;
829
+
830
+ return (returnedValue !== undefined)
831
+ ? returnedValue
832
+ : this
833
+ ;
834
+ };
835
+
836
+ $.fn.modal.settings = {
837
+
838
+ name : 'Modal',
839
+ namespace : 'modal',
840
+
841
+ silent : false,
842
+ debug : false,
843
+ verbose : false,
844
+ performance : true,
845
+
846
+ observeChanges : false,
847
+
848
+ allowMultiple : false,
849
+ detachable : true,
850
+ closable : true,
851
+ autofocus : true,
852
+
853
+ inverted : false,
854
+ blurring : false,
855
+
856
+ dimmerSettings : {
857
+ closable : false,
858
+ useCSS : true
859
+ },
860
+
861
+ // whether to use keyboard shortcuts
862
+ keyboardShortcuts: true,
863
+
864
+ context : 'body',
865
+
866
+ queue : false,
867
+ duration : 500,
868
+ offset : 0,
869
+ transition : 'scale',
870
+
871
+ // padding with edge of page
872
+ padding : 50,
873
+
874
+ // called before show animation
875
+ onShow : function(){},
876
+
877
+ // called after show animation
878
+ onVisible : function(){},
879
+
880
+ // called before hide animation
881
+ onHide : function(){ return true; },
882
+
883
+ // called after hide animation
884
+ onHidden : function(){},
885
+
886
+ // called after approve selector match
887
+ onApprove : function(){ return true; },
888
+
889
+ // called after deny selector match
890
+ onDeny : function(){ return true; },
891
+
892
+ selector : {
893
+ close : '> .close',
894
+ approve : '.actions .positive, .actions .approve, .actions .ok',
895
+ deny : '.actions .negative, .actions .deny, .actions .cancel',
896
+ modal : '.ui.modal'
897
+ },
898
+ error : {
899
+ dimmer : 'UI Dimmer, a required component is not included in this page',
900
+ method : 'The method you called is not defined.',
901
+ notFound : 'The element you specified could not be found'
902
+ },
903
+ className : {
904
+ active : 'active',
905
+ animating : 'animating',
906
+ blurring : 'blurring',
907
+ scrolling : 'scrolling',
908
+ undetached : 'undetached'
909
+ }
910
+ };
911
+
912
+
913
+ })( jQuery, window, document );