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,9 @@
1
+ /*!
2
+ * # Semantic UI 2.2.9 - Sticky
3
+ * http://github.com/semantic-org/semantic-ui/
4
+ *
5
+ *
6
+ * Released under the MIT license
7
+ * http://opensource.org/licenses/MIT
8
+ *
9
+ */.ui.sticky{position:static;-webkit-transition:none;transition:none;z-index:800}.ui.sticky.bound{position:absolute;left:auto;right:auto}.ui.sticky.fixed{position:fixed;left:auto;right:auto}.ui.sticky.bound.top,.ui.sticky.fixed.top{top:0;bottom:auto}.ui.sticky.bound.bottom,.ui.sticky.fixed.bottom{top:auto;bottom:0}.ui.native.sticky{position:-webkit-sticky;position:-moz-sticky;position:-ms-sticky;position:-o-sticky;position:sticky}
@@ -0,0 +1,10 @@
1
+ /*!
2
+ * # Semantic UI 2.2.9 - Sticky
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
+ !function(e,t,o,n){"use strict";t="undefined"!=typeof t&&t.Math==Math?t:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),e.fn.sticky=function(i){var s,r=e(this),c=r.selector||"",l=(new Date).getTime(),a=[],f=arguments[0],m="string"==typeof f,u=[].slice.call(arguments,1);return r.each(function(){var r,d,h,g,p,b=e.isPlainObject(i)?e.extend(!0,{},e.fn.sticky.settings,i):e.extend({},e.fn.sticky.settings),v=b.className,x=b.namespace,C=b.error,S="."+x,y="module-"+x,k=e(this),T=e(t),w=e(b.scrollContext),z=(k.selector||"",k.data(y)),B=t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame||function(e){setTimeout(e,0)},P=this;p={initialize:function(){p.determineContainer(),p.determineContext(),p.verbose("Initializing sticky",b,r),p.save.positions(),p.checkErrors(),p.bind.events(),b.observeChanges&&p.observeChanges(),p.instantiate()},instantiate:function(){p.verbose("Storing instance of module",p),z=p,k.data(y,p)},destroy:function(){p.verbose("Destroying previous instance"),p.reset(),h&&h.disconnect(),g&&g.disconnect(),T.off("load"+S,p.event.load).off("resize"+S,p.event.resize),w.off("scrollchange"+S,p.event.scrollchange),k.removeData(y)},observeChanges:function(){"MutationObserver"in t&&(h=new MutationObserver(p.event.documentChanged),g=new MutationObserver(p.event.changed),h.observe(o,{childList:!0,subtree:!0}),g.observe(P,{childList:!0,subtree:!0}),g.observe(d[0],{childList:!0,subtree:!0}),p.debug("Setting up mutation observer",g))},determineContainer:function(){r=b.container?e(b.container):k.offsetParent()},determineContext:function(){if(d=b.context?e(b.context):r,0===d.length)return void p.error(C.invalidContext,b.context,k)},checkErrors:function(){if(p.is.hidden()&&p.error(C.visible,k),p.cache.element.height>p.cache.context.height)return p.reset(),void p.error(C.elementSize,k)},bind:{events:function(){T.on("load"+S,p.event.load).on("resize"+S,p.event.resize),w.off("scroll"+S).on("scroll"+S,p.event.scroll).on("scrollchange"+S,p.event.scrollchange)}},event:{changed:function(e){clearTimeout(p.timer),p.timer=setTimeout(function(){p.verbose("DOM tree modified, updating sticky menu",e),p.refresh()},100)},documentChanged:function(t){[].forEach.call(t,function(t){t.removedNodes&&[].forEach.call(t.removedNodes,function(t){(t==P||e(t).find(P).length>0)&&(p.debug("Element removed from DOM, tearing down events"),p.destroy())})})},load:function(){p.verbose("Page contents finished loading"),B(p.refresh)},resize:function(){p.verbose("Window resized"),B(p.refresh)},scroll:function(){B(function(){w.triggerHandler("scrollchange"+S,w.scrollTop())})},scrollchange:function(e,t){p.stick(t),b.onScroll.call(P)}},refresh:function(e){p.reset(),b.context||p.determineContext(),e&&p.determineContainer(),p.save.positions(),p.stick(),b.onReposition.call(P)},supports:{sticky:function(){var t=e("<div/>");t[0];return t.addClass(v.supported),t.css("position").match("sticky")}},save:{lastScroll:function(e){p.lastScroll=e},elementScroll:function(e){p.elementScroll=e},positions:function(){var e={height:w.height()},t={margin:{top:parseInt(k.css("margin-top"),10),bottom:parseInt(k.css("margin-bottom"),10)},offset:k.offset(),width:k.outerWidth(),height:k.outerHeight()},o={offset:d.offset(),height:d.outerHeight()};({height:r.outerHeight()});p.is.standardScroll()||(p.debug("Non-standard scroll. Removing scroll offset from element offset"),e.top=w.scrollTop(),e.left=w.scrollLeft(),t.offset.top+=e.top,o.offset.top+=e.top,t.offset.left+=e.left,o.offset.left+=e.left),p.cache={fits:t.height<e.height,scrollContext:{height:e.height},element:{margin:t.margin,top:t.offset.top-t.margin.top,left:t.offset.left,width:t.width,height:t.height,bottom:t.offset.top+t.height},context:{top:o.offset.top,height:o.height,bottom:o.offset.top+o.height}},p.set.containerSize(),p.set.size(),p.stick(),p.debug("Caching element positions",p.cache)}},get:{direction:function(e){var t="down";return e=e||w.scrollTop(),p.lastScroll!==n&&(p.lastScroll<e?t="down":p.lastScroll>e&&(t="up")),t},scrollChange:function(e){return e=e||w.scrollTop(),p.lastScroll?e-p.lastScroll:0},currentElementScroll:function(){return p.elementScroll?p.elementScroll:p.is.top()?Math.abs(parseInt(k.css("top"),10))||0:Math.abs(parseInt(k.css("bottom"),10))||0},elementScroll:function(e){e=e||w.scrollTop();var t=p.cache.element,o=p.cache.scrollContext,n=p.get.scrollChange(e),i=t.height-o.height+b.offset,s=p.get.currentElementScroll(),r=s+n;return s=p.cache.fits||r<0?0:r>i?i:r}},remove:{lastScroll:function(){delete p.lastScroll},elementScroll:function(e){delete p.elementScroll},offset:function(){k.css("margin-top","")}},set:{offset:function(){p.verbose("Setting offset on element",b.offset),k.css("margin-top",b.offset)},containerSize:function(){var e=r.get(0).tagName;"HTML"===e||"body"==e?p.determineContainer():Math.abs(r.outerHeight()-p.cache.context.height)>b.jitter&&(p.debug("Context has padding, specifying exact height for container",p.cache.context.height),r.css({height:p.cache.context.height}))},minimumSize:function(){var e=p.cache.element;r.css("min-height",e.height)},scroll:function(e){p.debug("Setting scroll on element",e),p.elementScroll!=e&&(p.is.top()&&k.css("bottom","").css("top",-e),p.is.bottom()&&k.css("top","").css("bottom",e))},size:function(){0!==p.cache.element.height&&0!==p.cache.element.width&&(P.style.setProperty("width",p.cache.element.width+"px","important"),P.style.setProperty("height",p.cache.element.height+"px","important"))}},is:{standardScroll:function(){return w[0]==t},top:function(){return k.hasClass(v.top)},bottom:function(){return k.hasClass(v.bottom)},initialPosition:function(){return!p.is.fixed()&&!p.is.bound()},hidden:function(){return!k.is(":visible")},bound:function(){return k.hasClass(v.bound)},fixed:function(){return k.hasClass(v.fixed)}},stick:function(e){var t=e||w.scrollTop(),o=p.cache,n=o.fits,i=o.element,s=o.scrollContext,r=o.context,c=p.is.bottom()&&b.pushing?b.bottomOffset:b.offset,e={top:t+c,bottom:t+c+s.height},l=(p.get.direction(e.top),n?0:p.get.elementScroll(e.top)),a=!n,f=0!==i.height;f&&(p.is.initialPosition()?e.top>=r.bottom?(p.debug("Initial element position is bottom of container"),p.bindBottom()):e.top>i.top&&(i.height+e.top-l>=r.bottom?(p.debug("Initial element position is bottom of container"),p.bindBottom()):(p.debug("Initial element position is fixed"),p.fixTop())):p.is.fixed()?p.is.top()?e.top<=i.top?(p.debug("Fixed element reached top of container"),p.setInitialPosition()):i.height+e.top-l>=r.bottom?(p.debug("Fixed element reached bottom of container"),p.bindBottom()):a&&(p.set.scroll(l),p.save.lastScroll(e.top),p.save.elementScroll(l)):p.is.bottom()&&(e.bottom-i.height<=i.top?(p.debug("Bottom fixed rail has reached top of container"),p.setInitialPosition()):e.bottom>=r.bottom?(p.debug("Bottom fixed rail has reached bottom of container"),p.bindBottom()):a&&(p.set.scroll(l),p.save.lastScroll(e.top),p.save.elementScroll(l))):p.is.bottom()&&(e.top<=i.top?(p.debug("Jumped from bottom fixed to top fixed, most likely used home/end button"),p.setInitialPosition()):b.pushing?p.is.bound()&&e.bottom<=r.bottom&&(p.debug("Fixing bottom attached element to bottom of browser."),p.fixBottom()):p.is.bound()&&e.top<=r.bottom-i.height&&(p.debug("Fixing bottom attached element to top of browser."),p.fixTop())))},bindTop:function(){p.debug("Binding element to top of parent container"),p.remove.offset(),k.css({left:"",top:"",marginBottom:""}).removeClass(v.fixed).removeClass(v.bottom).addClass(v.bound).addClass(v.top),b.onTop.call(P),b.onUnstick.call(P)},bindBottom:function(){p.debug("Binding element to bottom of parent container"),p.remove.offset(),k.css({left:"",top:""}).removeClass(v.fixed).removeClass(v.top).addClass(v.bound).addClass(v.bottom),b.onBottom.call(P),b.onUnstick.call(P)},setInitialPosition:function(){p.debug("Returning to initial position"),p.unfix(),p.unbind()},fixTop:function(){p.debug("Fixing element to top of page"),p.set.minimumSize(),p.set.offset(),k.css({left:p.cache.element.left,bottom:"",marginBottom:""}).removeClass(v.bound).removeClass(v.bottom).addClass(v.fixed).addClass(v.top),b.onStick.call(P)},fixBottom:function(){p.debug("Sticking element to bottom of page"),p.set.minimumSize(),p.set.offset(),k.css({left:p.cache.element.left,bottom:"",marginBottom:""}).removeClass(v.bound).removeClass(v.top).addClass(v.fixed).addClass(v.bottom),b.onStick.call(P)},unbind:function(){p.is.bound()&&(p.debug("Removing container bound position on element"),p.remove.offset(),k.removeClass(v.bound).removeClass(v.top).removeClass(v.bottom))},unfix:function(){p.is.fixed()&&(p.debug("Removing fixed position on element"),p.remove.offset(),k.removeClass(v.fixed).removeClass(v.top).removeClass(v.bottom),b.onUnstick.call(P))},reset:function(){p.debug("Resetting elements position"),p.unbind(),p.unfix(),p.resetCSS(),p.remove.offset(),p.remove.lastScroll()},resetCSS:function(){k.css({width:"",height:""}),r.css({height:""})},setting:function(t,o){if(e.isPlainObject(t))e.extend(!0,b,t);else{if(o===n)return b[t];b[t]=o}},internal:function(t,o){if(e.isPlainObject(t))e.extend(!0,p,t);else{if(o===n)return p[t];p[t]=o}},debug:function(){!b.silent&&b.debug&&(b.performance?p.performance.log(arguments):(p.debug=Function.prototype.bind.call(console.info,console,b.name+":"),p.debug.apply(console,arguments)))},verbose:function(){!b.silent&&b.verbose&&b.debug&&(b.performance?p.performance.log(arguments):(p.verbose=Function.prototype.bind.call(console.info,console,b.name+":"),p.verbose.apply(console,arguments)))},error:function(){b.silent||(p.error=Function.prototype.bind.call(console.error,console,b.name+":"),p.error.apply(console,arguments))},performance:{log:function(e){var t,o,n;b.performance&&(t=(new Date).getTime(),n=l||t,o=t-n,l=t,a.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:P,"Execution Time":o})),clearTimeout(p.performance.timer),p.performance.timer=setTimeout(p.performance.display,0)},display:function(){var t=b.name+":",o=0;l=!1,clearTimeout(p.performance.timer),e.each(a,function(e,t){o+=t["Execution Time"]}),t+=" "+o+"ms",c&&(t+=" '"+c+"'"),(console.group!==n||console.table!==n)&&a.length>0&&(console.groupCollapsed(t),console.table?console.table(a):e.each(a,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),a=[]}},invoke:function(t,o,i){var r,c,l,a=z;return o=o||u,i=P||i,"string"==typeof t&&a!==n&&(t=t.split(/[\. ]/),r=t.length-1,e.each(t,function(o,i){var s=o!=r?i+t[o+1].charAt(0).toUpperCase()+t[o+1].slice(1):t;if(e.isPlainObject(a[s])&&o!=r)a=a[s];else{if(a[s]!==n)return c=a[s],!1;if(!e.isPlainObject(a[i])||o==r)return a[i]!==n&&(c=a[i],!1);a=a[i]}})),e.isFunction(c)?l=c.apply(i,o):c!==n&&(l=c),e.isArray(s)?s.push(l):s!==n?s=[s,l]:l!==n&&(s=l),c}},m?(z===n&&p.initialize(),p.invoke(f)):(z!==n&&z.invoke("destroy"),p.initialize())}),s!==n?s:this},e.fn.sticky.settings={name:"Sticky",namespace:"sticky",silent:!1,debug:!1,verbose:!0,performance:!0,pushing:!1,context:!1,container:!1,scrollContext:t,offset:0,bottomOffset:0,jitter:5,observeChanges:!1,onReposition:function(){},onScroll:function(){},onStick:function(){},onUnstick:function(){},onTop:function(){},onBottom:function(){},error:{container:"Sticky element must be inside a relative container",visible:"Element is hidden, you must call refresh after element becomes visible. Use silent setting to surpress this warning in production.",method:"The method you called is not defined.",invalidContext:"Context specified does not exist",elementSize:"Sticky element is larger than its container, cannot create sticky."},className:{bound:"bound",fixed:"fixed",supported:"native",top:"top",bottom:"bottom"}}}(jQuery,window,document);
@@ -0,0 +1,91 @@
1
+ /*!
2
+ * # Semantic UI 2.2.9 - Tab
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
+
12
+ /*******************************
13
+ UI Tabs
14
+ *******************************/
15
+
16
+ .ui.tab {
17
+ display: none;
18
+ }
19
+
20
+
21
+ /*******************************
22
+ States
23
+ *******************************/
24
+
25
+
26
+ /*--------------------
27
+ Active
28
+ ---------------------*/
29
+
30
+ .ui.tab.active,
31
+ .ui.tab.open {
32
+ display: block;
33
+ }
34
+
35
+ /*--------------------
36
+ Loading
37
+ ---------------------*/
38
+
39
+ .ui.tab.loading {
40
+ position: relative;
41
+ overflow: hidden;
42
+ display: block;
43
+ min-height: 250px;
44
+ }
45
+ .ui.tab.loading * {
46
+ position: relative !important;
47
+ left: -10000px !important;
48
+ }
49
+ .ui.tab.loading:before,
50
+ .ui.tab.loading.segment:before {
51
+ position: absolute;
52
+ content: '';
53
+ top: 100px;
54
+ left: 50%;
55
+ margin: -1.25em 0em 0em -1.25em;
56
+ width: 2.5em;
57
+ height: 2.5em;
58
+ border-radius: 500rem;
59
+ border: 0.2em solid rgba(0, 0, 0, 0.1);
60
+ }
61
+ .ui.tab.loading:after,
62
+ .ui.tab.loading.segment:after {
63
+ position: absolute;
64
+ content: '';
65
+ top: 100px;
66
+ left: 50%;
67
+ margin: -1.25em 0em 0em -1.25em;
68
+ width: 2.5em;
69
+ height: 2.5em;
70
+ -webkit-animation: button-spin 0.6s linear;
71
+ animation: button-spin 0.6s linear;
72
+ -webkit-animation-iteration-count: infinite;
73
+ animation-iteration-count: infinite;
74
+ border-radius: 500rem;
75
+ border-color: #767676 transparent transparent;
76
+ border-style: solid;
77
+ border-width: 0.2em;
78
+ box-shadow: 0px 0px 0px 1px transparent;
79
+ }
80
+
81
+
82
+ /*******************************
83
+ Tab Overrides
84
+ *******************************/
85
+
86
+
87
+
88
+ /*******************************
89
+ User Overrides
90
+ *******************************/
91
+
@@ -0,0 +1,952 @@
1
+ /*!
2
+ * # Semantic UI 2.2.9 - Tab
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.tab = function(parameters) {
23
+
24
+ var
25
+ // use window context if none specified
26
+ $allModules = $.isFunction(this)
27
+ ? $(window)
28
+ : $(this),
29
+
30
+ moduleSelector = $allModules.selector || '',
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
+ initializedHistory = false,
39
+ returnedValue
40
+ ;
41
+
42
+ $allModules
43
+ .each(function() {
44
+ var
45
+
46
+ settings = ( $.isPlainObject(parameters) )
47
+ ? $.extend(true, {}, $.fn.tab.settings, parameters)
48
+ : $.extend({}, $.fn.tab.settings),
49
+
50
+ className = settings.className,
51
+ metadata = settings.metadata,
52
+ selector = settings.selector,
53
+ error = settings.error,
54
+
55
+ eventNamespace = '.' + settings.namespace,
56
+ moduleNamespace = 'module-' + settings.namespace,
57
+
58
+ $module = $(this),
59
+ $context,
60
+ $tabs,
61
+
62
+ cache = {},
63
+ firstLoad = true,
64
+ recursionDepth = 0,
65
+ element = this,
66
+ instance = $module.data(moduleNamespace),
67
+
68
+ activeTabPath,
69
+ parameterArray,
70
+ module,
71
+
72
+ historyEvent
73
+
74
+ ;
75
+
76
+ module = {
77
+
78
+ initialize: function() {
79
+ module.debug('Initializing tab menu item', $module);
80
+ module.fix.callbacks();
81
+ module.determineTabs();
82
+
83
+ module.debug('Determining tabs', settings.context, $tabs);
84
+ // set up automatic routing
85
+ if(settings.auto) {
86
+ module.set.auto();
87
+ }
88
+ module.bind.events();
89
+
90
+ if(settings.history && !initializedHistory) {
91
+ module.initializeHistory();
92
+ initializedHistory = true;
93
+ }
94
+
95
+ module.instantiate();
96
+ },
97
+
98
+ instantiate: function () {
99
+ module.verbose('Storing instance of module', module);
100
+ instance = module;
101
+ $module
102
+ .data(moduleNamespace, module)
103
+ ;
104
+ },
105
+
106
+ destroy: function() {
107
+ module.debug('Destroying tabs', $module);
108
+ $module
109
+ .removeData(moduleNamespace)
110
+ .off(eventNamespace)
111
+ ;
112
+ },
113
+
114
+ bind: {
115
+ events: function() {
116
+ // if using $.tab don't add events
117
+ if( !$.isWindow( element ) ) {
118
+ module.debug('Attaching tab activation events to element', $module);
119
+ $module
120
+ .on('click' + eventNamespace, module.event.click)
121
+ ;
122
+ }
123
+ }
124
+ },
125
+
126
+ determineTabs: function() {
127
+ var
128
+ $reference
129
+ ;
130
+
131
+ // determine tab context
132
+ if(settings.context === 'parent') {
133
+ if($module.closest(selector.ui).length > 0) {
134
+ $reference = $module.closest(selector.ui);
135
+ module.verbose('Using closest UI element as parent', $reference);
136
+ }
137
+ else {
138
+ $reference = $module;
139
+ }
140
+ $context = $reference.parent();
141
+ module.verbose('Determined parent element for creating context', $context);
142
+ }
143
+ else if(settings.context) {
144
+ $context = $(settings.context);
145
+ module.verbose('Using selector for tab context', settings.context, $context);
146
+ }
147
+ else {
148
+ $context = $('body');
149
+ }
150
+ // find tabs
151
+ if(settings.childrenOnly) {
152
+ $tabs = $context.children(selector.tabs);
153
+ module.debug('Searching tab context children for tabs', $context, $tabs);
154
+ }
155
+ else {
156
+ $tabs = $context.find(selector.tabs);
157
+ module.debug('Searching tab context for tabs', $context, $tabs);
158
+ }
159
+ },
160
+
161
+ fix: {
162
+ callbacks: function() {
163
+ if( $.isPlainObject(parameters) && (parameters.onTabLoad || parameters.onTabInit) ) {
164
+ if(parameters.onTabLoad) {
165
+ parameters.onLoad = parameters.onTabLoad;
166
+ delete parameters.onTabLoad;
167
+ module.error(error.legacyLoad, parameters.onLoad);
168
+ }
169
+ if(parameters.onTabInit) {
170
+ parameters.onFirstLoad = parameters.onTabInit;
171
+ delete parameters.onTabInit;
172
+ module.error(error.legacyInit, parameters.onFirstLoad);
173
+ }
174
+ settings = $.extend(true, {}, $.fn.tab.settings, parameters);
175
+ }
176
+ }
177
+ },
178
+
179
+ initializeHistory: function() {
180
+ module.debug('Initializing page state');
181
+ if( $.address === undefined ) {
182
+ module.error(error.state);
183
+ return false;
184
+ }
185
+ else {
186
+ if(settings.historyType == 'state') {
187
+ module.debug('Using HTML5 to manage state');
188
+ if(settings.path !== false) {
189
+ $.address
190
+ .history(true)
191
+ .state(settings.path)
192
+ ;
193
+ }
194
+ else {
195
+ module.error(error.path);
196
+ return false;
197
+ }
198
+ }
199
+ $.address
200
+ .bind('change', module.event.history.change)
201
+ ;
202
+ }
203
+ },
204
+
205
+ event: {
206
+ click: function(event) {
207
+ var
208
+ tabPath = $(this).data(metadata.tab)
209
+ ;
210
+ if(tabPath !== undefined) {
211
+ if(settings.history) {
212
+ module.verbose('Updating page state', event);
213
+ $.address.value(tabPath);
214
+ }
215
+ else {
216
+ module.verbose('Changing tab', event);
217
+ module.changeTab(tabPath);
218
+ }
219
+ event.preventDefault();
220
+ }
221
+ else {
222
+ module.debug('No tab specified');
223
+ }
224
+ },
225
+ history: {
226
+ change: function(event) {
227
+ var
228
+ tabPath = event.pathNames.join('/') || module.get.initialPath(),
229
+ pageTitle = settings.templates.determineTitle(tabPath) || false
230
+ ;
231
+ module.performance.display();
232
+ module.debug('History change event', tabPath, event);
233
+ historyEvent = event;
234
+ if(tabPath !== undefined) {
235
+ module.changeTab(tabPath);
236
+ }
237
+ if(pageTitle) {
238
+ $.address.title(pageTitle);
239
+ }
240
+ }
241
+ }
242
+ },
243
+
244
+ refresh: function() {
245
+ if(activeTabPath) {
246
+ module.debug('Refreshing tab', activeTabPath);
247
+ module.changeTab(activeTabPath);
248
+ }
249
+ },
250
+
251
+ cache: {
252
+
253
+ read: function(cacheKey) {
254
+ return (cacheKey !== undefined)
255
+ ? cache[cacheKey]
256
+ : false
257
+ ;
258
+ },
259
+ add: function(cacheKey, content) {
260
+ cacheKey = cacheKey || activeTabPath;
261
+ module.debug('Adding cached content for', cacheKey);
262
+ cache[cacheKey] = content;
263
+ },
264
+ remove: function(cacheKey) {
265
+ cacheKey = cacheKey || activeTabPath;
266
+ module.debug('Removing cached content for', cacheKey);
267
+ delete cache[cacheKey];
268
+ }
269
+ },
270
+
271
+ set: {
272
+ auto: function() {
273
+ var
274
+ url = (typeof settings.path == 'string')
275
+ ? settings.path.replace(/\/$/, '') + '/{$tab}'
276
+ : '/{$tab}'
277
+ ;
278
+ module.verbose('Setting up automatic tab retrieval from server', url);
279
+ if($.isPlainObject(settings.apiSettings)) {
280
+ settings.apiSettings.url = url;
281
+ }
282
+ else {
283
+ settings.apiSettings = {
284
+ url: url
285
+ };
286
+ }
287
+ },
288
+ loading: function(tabPath) {
289
+ var
290
+ $tab = module.get.tabElement(tabPath),
291
+ isLoading = $tab.hasClass(className.loading)
292
+ ;
293
+ if(!isLoading) {
294
+ module.verbose('Setting loading state for', $tab);
295
+ $tab
296
+ .addClass(className.loading)
297
+ .siblings($tabs)
298
+ .removeClass(className.active + ' ' + className.loading)
299
+ ;
300
+ if($tab.length > 0) {
301
+ settings.onRequest.call($tab[0], tabPath);
302
+ }
303
+ }
304
+ },
305
+ state: function(state) {
306
+ $.address.value(state);
307
+ }
308
+ },
309
+
310
+ changeTab: function(tabPath) {
311
+ var
312
+ pushStateAvailable = (window.history && window.history.pushState),
313
+ shouldIgnoreLoad = (pushStateAvailable && settings.ignoreFirstLoad && firstLoad),
314
+ remoteContent = (settings.auto || $.isPlainObject(settings.apiSettings) ),
315
+ // only add default path if not remote content
316
+ pathArray = (remoteContent && !shouldIgnoreLoad)
317
+ ? module.utilities.pathToArray(tabPath)
318
+ : module.get.defaultPathArray(tabPath)
319
+ ;
320
+ tabPath = module.utilities.arrayToPath(pathArray);
321
+ $.each(pathArray, function(index, tab) {
322
+ var
323
+ currentPathArray = pathArray.slice(0, index + 1),
324
+ currentPath = module.utilities.arrayToPath(currentPathArray),
325
+
326
+ isTab = module.is.tab(currentPath),
327
+ isLastIndex = (index + 1 == pathArray.length),
328
+
329
+ $tab = module.get.tabElement(currentPath),
330
+ $anchor,
331
+ nextPathArray,
332
+ nextPath,
333
+ isLastTab
334
+ ;
335
+ module.verbose('Looking for tab', tab);
336
+ if(isTab) {
337
+ module.verbose('Tab was found', tab);
338
+ // scope up
339
+ activeTabPath = currentPath;
340
+ parameterArray = module.utilities.filterArray(pathArray, currentPathArray);
341
+
342
+ if(isLastIndex) {
343
+ isLastTab = true;
344
+ }
345
+ else {
346
+ nextPathArray = pathArray.slice(0, index + 2);
347
+ nextPath = module.utilities.arrayToPath(nextPathArray);
348
+ isLastTab = ( !module.is.tab(nextPath) );
349
+ if(isLastTab) {
350
+ module.verbose('Tab parameters found', nextPathArray);
351
+ }
352
+ }
353
+ if(isLastTab && remoteContent) {
354
+ if(!shouldIgnoreLoad) {
355
+ module.activate.navigation(currentPath);
356
+ module.fetch.content(currentPath, tabPath);
357
+ }
358
+ else {
359
+ module.debug('Ignoring remote content on first tab load', currentPath);
360
+ firstLoad = false;
361
+ module.cache.add(tabPath, $tab.html());
362
+ module.activate.all(currentPath);
363
+ settings.onFirstLoad.call($tab[0], currentPath, parameterArray, historyEvent);
364
+ settings.onLoad.call($tab[0], currentPath, parameterArray, historyEvent);
365
+ }
366
+ return false;
367
+ }
368
+ else {
369
+ module.debug('Opened local tab', currentPath);
370
+ module.activate.all(currentPath);
371
+ if( !module.cache.read(currentPath) ) {
372
+ module.cache.add(currentPath, true);
373
+ module.debug('First time tab loaded calling tab init');
374
+ settings.onFirstLoad.call($tab[0], currentPath, parameterArray, historyEvent);
375
+ }
376
+ settings.onLoad.call($tab[0], currentPath, parameterArray, historyEvent);
377
+ }
378
+
379
+ }
380
+ else if(tabPath.search('/') == -1 && tabPath !== '') {
381
+ // look for in page anchor
382
+ $anchor = $('#' + tabPath + ', a[name="' + tabPath + '"]');
383
+ currentPath = $anchor.closest('[data-tab]').data(metadata.tab);
384
+ $tab = module.get.tabElement(currentPath);
385
+ // if anchor exists use parent tab
386
+ if($anchor && $anchor.length > 0 && currentPath) {
387
+ module.debug('Anchor link used, opening parent tab', $tab, $anchor);
388
+ if( !$tab.hasClass(className.active) ) {
389
+ setTimeout(function() {
390
+ module.scrollTo($anchor);
391
+ }, 0);
392
+ }
393
+ module.activate.all(currentPath);
394
+ if( !module.cache.read(currentPath) ) {
395
+ module.cache.add(currentPath, true);
396
+ module.debug('First time tab loaded calling tab init');
397
+ settings.onFirstLoad.call($tab[0], currentPath, parameterArray, historyEvent);
398
+ }
399
+ settings.onLoad.call($tab[0], currentPath, parameterArray, historyEvent);
400
+ return false;
401
+ }
402
+ }
403
+ else {
404
+ module.error(error.missingTab, $module, $context, currentPath);
405
+ return false;
406
+ }
407
+ });
408
+ },
409
+
410
+ scrollTo: function($element) {
411
+ var
412
+ scrollOffset = ($element && $element.length > 0)
413
+ ? $element.offset().top
414
+ : false
415
+ ;
416
+ if(scrollOffset !== false) {
417
+ module.debug('Forcing scroll to an in-page link in a hidden tab', scrollOffset, $element);
418
+ $(document).scrollTop(scrollOffset);
419
+ }
420
+ },
421
+
422
+ update: {
423
+ content: function(tabPath, html, evaluateScripts) {
424
+ var
425
+ $tab = module.get.tabElement(tabPath),
426
+ tab = $tab[0]
427
+ ;
428
+ evaluateScripts = (evaluateScripts !== undefined)
429
+ ? evaluateScripts
430
+ : settings.evaluateScripts
431
+ ;
432
+ if(typeof settings.cacheType == 'string' && settings.cacheType.toLowerCase() == 'dom' && typeof html !== 'string') {
433
+ $tab
434
+ .empty()
435
+ .append($(html).clone(true))
436
+ ;
437
+ }
438
+ else {
439
+ if(evaluateScripts) {
440
+ module.debug('Updating HTML and evaluating inline scripts', tabPath, html);
441
+ $tab.html(html);
442
+ }
443
+ else {
444
+ module.debug('Updating HTML', tabPath, html);
445
+ tab.innerHTML = html;
446
+ }
447
+ }
448
+ }
449
+ },
450
+
451
+ fetch: {
452
+
453
+ content: function(tabPath, fullTabPath) {
454
+ var
455
+ $tab = module.get.tabElement(tabPath),
456
+ apiSettings = {
457
+ dataType : 'html',
458
+ encodeParameters : false,
459
+ on : 'now',
460
+ cache : settings.alwaysRefresh,
461
+ headers : {
462
+ 'X-Remote': true
463
+ },
464
+ onSuccess : function(response) {
465
+ if(settings.cacheType == 'response') {
466
+ module.cache.add(fullTabPath, response);
467
+ }
468
+ module.update.content(tabPath, response);
469
+ if(tabPath == activeTabPath) {
470
+ module.debug('Content loaded', tabPath);
471
+ module.activate.tab(tabPath);
472
+ }
473
+ else {
474
+ module.debug('Content loaded in background', tabPath);
475
+ }
476
+ settings.onFirstLoad.call($tab[0], tabPath, parameterArray, historyEvent);
477
+ settings.onLoad.call($tab[0], tabPath, parameterArray, historyEvent);
478
+
479
+ if(settings.loadOnce) {
480
+ module.cache.add(fullTabPath, true);
481
+ }
482
+ else if(typeof settings.cacheType == 'string' && settings.cacheType.toLowerCase() == 'dom' && $tab.children().length > 0) {
483
+ setTimeout(function() {
484
+ var
485
+ $clone = $tab.children().clone(true)
486
+ ;
487
+ $clone = $clone.not('script');
488
+ module.cache.add(fullTabPath, $clone);
489
+ }, 0);
490
+ }
491
+ else {
492
+ module.cache.add(fullTabPath, $tab.html());
493
+ }
494
+ },
495
+ urlData: {
496
+ tab: fullTabPath
497
+ }
498
+ },
499
+ request = $tab.api('get request') || false,
500
+ existingRequest = ( request && request.state() === 'pending' ),
501
+ requestSettings,
502
+ cachedContent
503
+ ;
504
+
505
+ fullTabPath = fullTabPath || tabPath;
506
+ cachedContent = module.cache.read(fullTabPath);
507
+
508
+
509
+ if(settings.cache && cachedContent) {
510
+ module.activate.tab(tabPath);
511
+ module.debug('Adding cached content', fullTabPath);
512
+ if(!settings.loadOnce) {
513
+ if(settings.evaluateScripts == 'once') {
514
+ module.update.content(tabPath, cachedContent, false);
515
+ }
516
+ else {
517
+ module.update.content(tabPath, cachedContent);
518
+ }
519
+ }
520
+ settings.onLoad.call($tab[0], tabPath, parameterArray, historyEvent);
521
+ }
522
+ else if(existingRequest) {
523
+ module.set.loading(tabPath);
524
+ module.debug('Content is already loading', fullTabPath);
525
+ }
526
+ else if($.api !== undefined) {
527
+ requestSettings = $.extend(true, {}, settings.apiSettings, apiSettings);
528
+ module.debug('Retrieving remote content', fullTabPath, requestSettings);
529
+ module.set.loading(tabPath);
530
+ $tab.api(requestSettings);
531
+ }
532
+ else {
533
+ module.error(error.api);
534
+ }
535
+ }
536
+ },
537
+
538
+ activate: {
539
+ all: function(tabPath) {
540
+ module.activate.tab(tabPath);
541
+ module.activate.navigation(tabPath);
542
+ },
543
+ tab: function(tabPath) {
544
+ var
545
+ $tab = module.get.tabElement(tabPath),
546
+ $deactiveTabs = (settings.deactivate == 'siblings')
547
+ ? $tab.siblings($tabs)
548
+ : $tabs.not($tab),
549
+ isActive = $tab.hasClass(className.active)
550
+ ;
551
+ module.verbose('Showing tab content for', $tab);
552
+ if(!isActive) {
553
+ $tab
554
+ .addClass(className.active)
555
+ ;
556
+ $deactiveTabs
557
+ .removeClass(className.active + ' ' + className.loading)
558
+ ;
559
+ if($tab.length > 0) {
560
+ settings.onVisible.call($tab[0], tabPath);
561
+ }
562
+ }
563
+ },
564
+ navigation: function(tabPath) {
565
+ var
566
+ $navigation = module.get.navElement(tabPath),
567
+ $deactiveNavigation = (settings.deactivate == 'siblings')
568
+ ? $navigation.siblings($allModules)
569
+ : $allModules.not($navigation),
570
+ isActive = $navigation.hasClass(className.active)
571
+ ;
572
+ module.verbose('Activating tab navigation for', $navigation, tabPath);
573
+ if(!isActive) {
574
+ $navigation
575
+ .addClass(className.active)
576
+ ;
577
+ $deactiveNavigation
578
+ .removeClass(className.active + ' ' + className.loading)
579
+ ;
580
+ }
581
+ }
582
+ },
583
+
584
+ deactivate: {
585
+ all: function() {
586
+ module.deactivate.navigation();
587
+ module.deactivate.tabs();
588
+ },
589
+ navigation: function() {
590
+ $allModules
591
+ .removeClass(className.active)
592
+ ;
593
+ },
594
+ tabs: function() {
595
+ $tabs
596
+ .removeClass(className.active + ' ' + className.loading)
597
+ ;
598
+ }
599
+ },
600
+
601
+ is: {
602
+ tab: function(tabName) {
603
+ return (tabName !== undefined)
604
+ ? ( module.get.tabElement(tabName).length > 0 )
605
+ : false
606
+ ;
607
+ }
608
+ },
609
+
610
+ get: {
611
+ initialPath: function() {
612
+ return $allModules.eq(0).data(metadata.tab) || $tabs.eq(0).data(metadata.tab);
613
+ },
614
+ path: function() {
615
+ return $.address.value();
616
+ },
617
+ // adds default tabs to tab path
618
+ defaultPathArray: function(tabPath) {
619
+ return module.utilities.pathToArray( module.get.defaultPath(tabPath) );
620
+ },
621
+ defaultPath: function(tabPath) {
622
+ var
623
+ $defaultNav = $allModules.filter('[data-' + metadata.tab + '^="' + tabPath + '/"]').eq(0),
624
+ defaultTab = $defaultNav.data(metadata.tab) || false
625
+ ;
626
+ if( defaultTab ) {
627
+ module.debug('Found default tab', defaultTab);
628
+ if(recursionDepth < settings.maxDepth) {
629
+ recursionDepth++;
630
+ return module.get.defaultPath(defaultTab);
631
+ }
632
+ module.error(error.recursion);
633
+ }
634
+ else {
635
+ module.debug('No default tabs found for', tabPath, $tabs);
636
+ }
637
+ recursionDepth = 0;
638
+ return tabPath;
639
+ },
640
+ navElement: function(tabPath) {
641
+ tabPath = tabPath || activeTabPath;
642
+ return $allModules.filter('[data-' + metadata.tab + '="' + tabPath + '"]');
643
+ },
644
+ tabElement: function(tabPath) {
645
+ var
646
+ $fullPathTab,
647
+ $simplePathTab,
648
+ tabPathArray,
649
+ lastTab
650
+ ;
651
+ tabPath = tabPath || activeTabPath;
652
+ tabPathArray = module.utilities.pathToArray(tabPath);
653
+ lastTab = module.utilities.last(tabPathArray);
654
+ $fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + tabPath + '"]');
655
+ $simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + lastTab + '"]');
656
+ return ($fullPathTab.length > 0)
657
+ ? $fullPathTab
658
+ : $simplePathTab
659
+ ;
660
+ },
661
+ tab: function() {
662
+ return activeTabPath;
663
+ }
664
+ },
665
+
666
+ utilities: {
667
+ filterArray: function(keepArray, removeArray) {
668
+ return $.grep(keepArray, function(keepValue) {
669
+ return ( $.inArray(keepValue, removeArray) == -1);
670
+ });
671
+ },
672
+ last: function(array) {
673
+ return $.isArray(array)
674
+ ? array[ array.length - 1]
675
+ : false
676
+ ;
677
+ },
678
+ pathToArray: function(pathName) {
679
+ if(pathName === undefined) {
680
+ pathName = activeTabPath;
681
+ }
682
+ return typeof pathName == 'string'
683
+ ? pathName.split('/')
684
+ : [pathName]
685
+ ;
686
+ },
687
+ arrayToPath: function(pathArray) {
688
+ return $.isArray(pathArray)
689
+ ? pathArray.join('/')
690
+ : false
691
+ ;
692
+ }
693
+ },
694
+
695
+ setting: function(name, value) {
696
+ module.debug('Changing setting', name, value);
697
+ if( $.isPlainObject(name) ) {
698
+ $.extend(true, settings, name);
699
+ }
700
+ else if(value !== undefined) {
701
+ if($.isPlainObject(settings[name])) {
702
+ $.extend(true, settings[name], value);
703
+ }
704
+ else {
705
+ settings[name] = value;
706
+ }
707
+ }
708
+ else {
709
+ return settings[name];
710
+ }
711
+ },
712
+ internal: function(name, value) {
713
+ if( $.isPlainObject(name) ) {
714
+ $.extend(true, module, name);
715
+ }
716
+ else if(value !== undefined) {
717
+ module[name] = value;
718
+ }
719
+ else {
720
+ return module[name];
721
+ }
722
+ },
723
+ debug: function() {
724
+ if(!settings.silent && settings.debug) {
725
+ if(settings.performance) {
726
+ module.performance.log(arguments);
727
+ }
728
+ else {
729
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
730
+ module.debug.apply(console, arguments);
731
+ }
732
+ }
733
+ },
734
+ verbose: function() {
735
+ if(!settings.silent && settings.verbose && settings.debug) {
736
+ if(settings.performance) {
737
+ module.performance.log(arguments);
738
+ }
739
+ else {
740
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
741
+ module.verbose.apply(console, arguments);
742
+ }
743
+ }
744
+ },
745
+ error: function() {
746
+ if(!settings.silent) {
747
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
748
+ module.error.apply(console, arguments);
749
+ }
750
+ },
751
+ performance: {
752
+ log: function(message) {
753
+ var
754
+ currentTime,
755
+ executionTime,
756
+ previousTime
757
+ ;
758
+ if(settings.performance) {
759
+ currentTime = new Date().getTime();
760
+ previousTime = time || currentTime;
761
+ executionTime = currentTime - previousTime;
762
+ time = currentTime;
763
+ performance.push({
764
+ 'Name' : message[0],
765
+ 'Arguments' : [].slice.call(message, 1) || '',
766
+ 'Element' : element,
767
+ 'Execution Time' : executionTime
768
+ });
769
+ }
770
+ clearTimeout(module.performance.timer);
771
+ module.performance.timer = setTimeout(module.performance.display, 500);
772
+ },
773
+ display: function() {
774
+ var
775
+ title = settings.name + ':',
776
+ totalTime = 0
777
+ ;
778
+ time = false;
779
+ clearTimeout(module.performance.timer);
780
+ $.each(performance, function(index, data) {
781
+ totalTime += data['Execution Time'];
782
+ });
783
+ title += ' ' + totalTime + 'ms';
784
+ if(moduleSelector) {
785
+ title += ' \'' + moduleSelector + '\'';
786
+ }
787
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
788
+ console.groupCollapsed(title);
789
+ if(console.table) {
790
+ console.table(performance);
791
+ }
792
+ else {
793
+ $.each(performance, function(index, data) {
794
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
795
+ });
796
+ }
797
+ console.groupEnd();
798
+ }
799
+ performance = [];
800
+ }
801
+ },
802
+ invoke: function(query, passedArguments, context) {
803
+ var
804
+ object = instance,
805
+ maxDepth,
806
+ found,
807
+ response
808
+ ;
809
+ passedArguments = passedArguments || queryArguments;
810
+ context = element || context;
811
+ if(typeof query == 'string' && object !== undefined) {
812
+ query = query.split(/[\. ]/);
813
+ maxDepth = query.length - 1;
814
+ $.each(query, function(depth, value) {
815
+ var camelCaseValue = (depth != maxDepth)
816
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
817
+ : query
818
+ ;
819
+ if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
820
+ object = object[camelCaseValue];
821
+ }
822
+ else if( object[camelCaseValue] !== undefined ) {
823
+ found = object[camelCaseValue];
824
+ return false;
825
+ }
826
+ else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
827
+ object = object[value];
828
+ }
829
+ else if( object[value] !== undefined ) {
830
+ found = object[value];
831
+ return false;
832
+ }
833
+ else {
834
+ module.error(error.method, query);
835
+ return false;
836
+ }
837
+ });
838
+ }
839
+ if ( $.isFunction( found ) ) {
840
+ response = found.apply(context, passedArguments);
841
+ }
842
+ else if(found !== undefined) {
843
+ response = found;
844
+ }
845
+ if($.isArray(returnedValue)) {
846
+ returnedValue.push(response);
847
+ }
848
+ else if(returnedValue !== undefined) {
849
+ returnedValue = [returnedValue, response];
850
+ }
851
+ else if(response !== undefined) {
852
+ returnedValue = response;
853
+ }
854
+ return found;
855
+ }
856
+ };
857
+ if(methodInvoked) {
858
+ if(instance === undefined) {
859
+ module.initialize();
860
+ }
861
+ module.invoke(query);
862
+ }
863
+ else {
864
+ if(instance !== undefined) {
865
+ instance.invoke('destroy');
866
+ }
867
+ module.initialize();
868
+ }
869
+ })
870
+ ;
871
+ return (returnedValue !== undefined)
872
+ ? returnedValue
873
+ : this
874
+ ;
875
+
876
+ };
877
+
878
+ // shortcut for tabbed content with no defined navigation
879
+ $.tab = function() {
880
+ $(window).tab.apply(this, arguments);
881
+ };
882
+
883
+ $.fn.tab.settings = {
884
+
885
+ name : 'Tab',
886
+ namespace : 'tab',
887
+
888
+ silent : false,
889
+ debug : false,
890
+ verbose : false,
891
+ performance : true,
892
+
893
+ auto : false, // uses pjax style endpoints fetching content from same url with remote-content headers
894
+ history : false, // use browser history
895
+ historyType : 'hash', // #/ or html5 state
896
+ path : false, // base path of url
897
+
898
+ context : false, // specify a context that tabs must appear inside
899
+ childrenOnly : false, // use only tabs that are children of context
900
+ maxDepth : 25, // max depth a tab can be nested
901
+
902
+ deactivate : 'siblings', // whether tabs should deactivate sibling menu elements or all elements initialized together
903
+
904
+ alwaysRefresh : false, // load tab content new every tab click
905
+ cache : true, // cache the content requests to pull locally
906
+ loadOnce : false, // Whether tab data should only be loaded once when using remote content
907
+ cacheType : 'response', // Whether to cache exact response, or to html cache contents after scripts execute
908
+ ignoreFirstLoad : false, // don't load remote content on first load
909
+
910
+ apiSettings : false, // settings for api call
911
+ evaluateScripts : 'once', // whether inline scripts should be parsed (true/false/once). Once will not re-evaluate on cached content
912
+
913
+ onFirstLoad : function(tabPath, parameterArray, historyEvent) {}, // called first time loaded
914
+ onLoad : function(tabPath, parameterArray, historyEvent) {}, // called on every load
915
+ onVisible : function(tabPath, parameterArray, historyEvent) {}, // called every time tab visible
916
+ onRequest : function(tabPath, parameterArray, historyEvent) {}, // called ever time a tab beings loading remote content
917
+
918
+ templates : {
919
+ determineTitle: function(tabArray) {} // returns page title for path
920
+ },
921
+
922
+ error: {
923
+ api : 'You attempted to load content without API module',
924
+ method : 'The method you called is not defined',
925
+ missingTab : 'Activated tab cannot be found. Tabs are case-sensitive.',
926
+ noContent : 'The tab you specified is missing a content url.',
927
+ path : 'History enabled, but no path was specified',
928
+ recursion : 'Max recursive depth reached',
929
+ legacyInit : 'onTabInit has been renamed to onFirstLoad in 2.0, please adjust your code.',
930
+ legacyLoad : 'onTabLoad has been renamed to onLoad in 2.0. Please adjust your code',
931
+ state : 'History requires Asual\'s Address library <https://github.com/asual/jquery-address>'
932
+ },
933
+
934
+ metadata : {
935
+ tab : 'tab',
936
+ loaded : 'loaded',
937
+ promise: 'promise'
938
+ },
939
+
940
+ className : {
941
+ loading : 'loading',
942
+ active : 'active'
943
+ },
944
+
945
+ selector : {
946
+ tabs : '.ui.tab',
947
+ ui : '.ui'
948
+ }
949
+
950
+ };
951
+
952
+ })( jQuery, window, document );