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,1036 @@
1
+ /*!
2
+ * # Semantic UI 2.2.9 - Sidebar
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.sidebar = function(parameters) {
23
+ var
24
+ $allModules = $(this),
25
+ $window = $(window),
26
+ $document = $(document),
27
+ $html = $('html'),
28
+ $head = $('head'),
29
+
30
+ moduleSelector = $allModules.selector || '',
31
+
32
+ time = new Date().getTime(),
33
+ performance = [],
34
+
35
+ query = arguments[0],
36
+ methodInvoked = (typeof query == 'string'),
37
+ queryArguments = [].slice.call(arguments, 1),
38
+
39
+ requestAnimationFrame = window.requestAnimationFrame
40
+ || window.mozRequestAnimationFrame
41
+ || window.webkitRequestAnimationFrame
42
+ || window.msRequestAnimationFrame
43
+ || function(callback) { setTimeout(callback, 0); },
44
+
45
+ returnedValue
46
+ ;
47
+
48
+ $allModules
49
+ .each(function() {
50
+ var
51
+ settings = ( $.isPlainObject(parameters) )
52
+ ? $.extend(true, {}, $.fn.sidebar.settings, parameters)
53
+ : $.extend({}, $.fn.sidebar.settings),
54
+
55
+ selector = settings.selector,
56
+ className = settings.className,
57
+ namespace = settings.namespace,
58
+ regExp = settings.regExp,
59
+ error = settings.error,
60
+
61
+ eventNamespace = '.' + namespace,
62
+ moduleNamespace = 'module-' + namespace,
63
+
64
+ $module = $(this),
65
+ $context = $(settings.context),
66
+
67
+ $sidebars = $module.children(selector.sidebar),
68
+ $fixed = $context.children(selector.fixed),
69
+ $pusher = $context.children(selector.pusher),
70
+ $style,
71
+
72
+ element = this,
73
+ instance = $module.data(moduleNamespace),
74
+
75
+ elementNamespace,
76
+ id,
77
+ currentScroll,
78
+ transitionEvent,
79
+
80
+ module
81
+ ;
82
+
83
+ module = {
84
+
85
+ initialize: function() {
86
+ module.debug('Initializing sidebar', parameters);
87
+
88
+ module.create.id();
89
+
90
+ transitionEvent = module.get.transitionEvent();
91
+
92
+ if(module.is.ios()) {
93
+ module.set.ios();
94
+ }
95
+
96
+ // avoids locking rendering if initialized in onReady
97
+ if(settings.delaySetup) {
98
+ requestAnimationFrame(module.setup.layout);
99
+ }
100
+ else {
101
+ module.setup.layout();
102
+ }
103
+
104
+ requestAnimationFrame(function() {
105
+ module.setup.cache();
106
+ });
107
+
108
+ module.instantiate();
109
+ },
110
+
111
+ instantiate: function() {
112
+ module.verbose('Storing instance of module', module);
113
+ instance = module;
114
+ $module
115
+ .data(moduleNamespace, module)
116
+ ;
117
+ },
118
+
119
+ create: {
120
+ id: function() {
121
+ id = (Math.random().toString(16) + '000000000').substr(2,8);
122
+ elementNamespace = '.' + id;
123
+ module.verbose('Creating unique id for element', id);
124
+ }
125
+ },
126
+
127
+ destroy: function() {
128
+ module.verbose('Destroying previous module for', $module);
129
+ $module
130
+ .off(eventNamespace)
131
+ .removeData(moduleNamespace)
132
+ ;
133
+ if(module.is.ios()) {
134
+ module.remove.ios();
135
+ }
136
+ // bound by uuid
137
+ $context.off(elementNamespace);
138
+ $window.off(elementNamespace);
139
+ $document.off(elementNamespace);
140
+ },
141
+
142
+ event: {
143
+ clickaway: function(event) {
144
+ var
145
+ clickedInPusher = ($pusher.find(event.target).length > 0 || $pusher.is(event.target)),
146
+ clickedContext = ($context.is(event.target))
147
+ ;
148
+ if(clickedInPusher) {
149
+ module.verbose('User clicked on dimmed page');
150
+ module.hide();
151
+ }
152
+ if(clickedContext) {
153
+ module.verbose('User clicked on dimmable context (scaled out page)');
154
+ module.hide();
155
+ }
156
+ },
157
+ touch: function(event) {
158
+ //event.stopPropagation();
159
+ },
160
+ containScroll: function(event) {
161
+ if(element.scrollTop <= 0) {
162
+ element.scrollTop = 1;
163
+ }
164
+ if((element.scrollTop + element.offsetHeight) >= element.scrollHeight) {
165
+ element.scrollTop = element.scrollHeight - element.offsetHeight - 1;
166
+ }
167
+ },
168
+ scroll: function(event) {
169
+ if( $(event.target).closest(selector.sidebar).length === 0 ) {
170
+ event.preventDefault();
171
+ }
172
+ }
173
+ },
174
+
175
+ bind: {
176
+ clickaway: function() {
177
+ module.verbose('Adding clickaway events to context', $context);
178
+ if(settings.closable) {
179
+ $context
180
+ .on('click' + elementNamespace, module.event.clickaway)
181
+ .on('touchend' + elementNamespace, module.event.clickaway)
182
+ ;
183
+ }
184
+ },
185
+ scrollLock: function() {
186
+ if(settings.scrollLock) {
187
+ module.debug('Disabling page scroll');
188
+ $window
189
+ .on('DOMMouseScroll' + elementNamespace, module.event.scroll)
190
+ ;
191
+ }
192
+ module.verbose('Adding events to contain sidebar scroll');
193
+ $document
194
+ .on('touchmove' + elementNamespace, module.event.touch)
195
+ ;
196
+ $module
197
+ .on('scroll' + eventNamespace, module.event.containScroll)
198
+ ;
199
+ }
200
+ },
201
+ unbind: {
202
+ clickaway: function() {
203
+ module.verbose('Removing clickaway events from context', $context);
204
+ $context.off(elementNamespace);
205
+ },
206
+ scrollLock: function() {
207
+ module.verbose('Removing scroll lock from page');
208
+ $document.off(elementNamespace);
209
+ $window.off(elementNamespace);
210
+ $module.off('scroll' + eventNamespace);
211
+ }
212
+ },
213
+
214
+ add: {
215
+ inlineCSS: function() {
216
+ var
217
+ width = module.cache.width || $module.outerWidth(),
218
+ height = module.cache.height || $module.outerHeight(),
219
+ isRTL = module.is.rtl(),
220
+ direction = module.get.direction(),
221
+ distance = {
222
+ left : width,
223
+ right : -width,
224
+ top : height,
225
+ bottom : -height
226
+ },
227
+ style
228
+ ;
229
+
230
+ if(isRTL){
231
+ module.verbose('RTL detected, flipping widths');
232
+ distance.left = -width;
233
+ distance.right = width;
234
+ }
235
+
236
+ style = '<style>';
237
+
238
+ if(direction === 'left' || direction === 'right') {
239
+ module.debug('Adding CSS rules for animation distance', width);
240
+ style += ''
241
+ + ' .ui.visible.' + direction + '.sidebar ~ .fixed,'
242
+ + ' .ui.visible.' + direction + '.sidebar ~ .pusher {'
243
+ + ' -webkit-transform: translate3d('+ distance[direction] + 'px, 0, 0);'
244
+ + ' transform: translate3d('+ distance[direction] + 'px, 0, 0);'
245
+ + ' }'
246
+ ;
247
+ }
248
+ else if(direction === 'top' || direction == 'bottom') {
249
+ style += ''
250
+ + ' .ui.visible.' + direction + '.sidebar ~ .fixed,'
251
+ + ' .ui.visible.' + direction + '.sidebar ~ .pusher {'
252
+ + ' -webkit-transform: translate3d(0, ' + distance[direction] + 'px, 0);'
253
+ + ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
254
+ + ' }'
255
+ ;
256
+ }
257
+
258
+ /* IE is only browser not to create context with transforms */
259
+ /* https://www.w3.org/Bugs/Public/show_bug.cgi?id=16328 */
260
+ if( module.is.ie() ) {
261
+ if(direction === 'left' || direction === 'right') {
262
+ module.debug('Adding CSS rules for animation distance', width);
263
+ style += ''
264
+ + ' body.pushable > .ui.visible.' + direction + '.sidebar ~ .pusher:after {'
265
+ + ' -webkit-transform: translate3d('+ distance[direction] + 'px, 0, 0);'
266
+ + ' transform: translate3d('+ distance[direction] + 'px, 0, 0);'
267
+ + ' }'
268
+ ;
269
+ }
270
+ else if(direction === 'top' || direction == 'bottom') {
271
+ style += ''
272
+ + ' body.pushable > .ui.visible.' + direction + '.sidebar ~ .pusher:after {'
273
+ + ' -webkit-transform: translate3d(0, ' + distance[direction] + 'px, 0);'
274
+ + ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
275
+ + ' }'
276
+ ;
277
+ }
278
+ /* opposite sides visible forces content overlay */
279
+ style += ''
280
+ + ' body.pushable > .ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .pusher:after,'
281
+ + ' body.pushable > .ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .pusher:after {'
282
+ + ' -webkit-transform: translate3d(0px, 0, 0);'
283
+ + ' transform: translate3d(0px, 0, 0);'
284
+ + ' }'
285
+ ;
286
+ }
287
+ style += '</style>';
288
+ $style = $(style)
289
+ .appendTo($head)
290
+ ;
291
+ module.debug('Adding sizing css to head', $style);
292
+ }
293
+ },
294
+
295
+ refresh: function() {
296
+ module.verbose('Refreshing selector cache');
297
+ $context = $(settings.context);
298
+ $sidebars = $context.children(selector.sidebar);
299
+ $pusher = $context.children(selector.pusher);
300
+ $fixed = $context.children(selector.fixed);
301
+ module.clear.cache();
302
+ },
303
+
304
+ refreshSidebars: function() {
305
+ module.verbose('Refreshing other sidebars');
306
+ $sidebars = $context.children(selector.sidebar);
307
+ },
308
+
309
+ repaint: function() {
310
+ module.verbose('Forcing repaint event');
311
+ element.style.display = 'none';
312
+ var ignored = element.offsetHeight;
313
+ element.scrollTop = element.scrollTop;
314
+ element.style.display = '';
315
+ },
316
+
317
+ setup: {
318
+ cache: function() {
319
+ module.cache = {
320
+ width : $module.outerWidth(),
321
+ height : $module.outerHeight(),
322
+ rtl : ($module.css('direction') == 'rtl')
323
+ };
324
+ },
325
+ layout: function() {
326
+ if( $context.children(selector.pusher).length === 0 ) {
327
+ module.debug('Adding wrapper element for sidebar');
328
+ module.error(error.pusher);
329
+ $pusher = $('<div class="pusher" />');
330
+ $context
331
+ .children()
332
+ .not(selector.omitted)
333
+ .not($sidebars)
334
+ .wrapAll($pusher)
335
+ ;
336
+ module.refresh();
337
+ }
338
+ if($module.nextAll(selector.pusher).length === 0 || $module.nextAll(selector.pusher)[0] !== $pusher[0]) {
339
+ module.debug('Moved sidebar to correct parent element');
340
+ module.error(error.movedSidebar, element);
341
+ $module.detach().prependTo($context);
342
+ module.refresh();
343
+ }
344
+ module.clear.cache();
345
+ module.set.pushable();
346
+ module.set.direction();
347
+ }
348
+ },
349
+
350
+ attachEvents: function(selector, event) {
351
+ var
352
+ $toggle = $(selector)
353
+ ;
354
+ event = $.isFunction(module[event])
355
+ ? module[event]
356
+ : module.toggle
357
+ ;
358
+ if($toggle.length > 0) {
359
+ module.debug('Attaching sidebar events to element', selector, event);
360
+ $toggle
361
+ .on('click' + eventNamespace, event)
362
+ ;
363
+ }
364
+ else {
365
+ module.error(error.notFound, selector);
366
+ }
367
+ },
368
+
369
+ show: function(callback) {
370
+ callback = $.isFunction(callback)
371
+ ? callback
372
+ : function(){}
373
+ ;
374
+ if(module.is.hidden()) {
375
+ module.refreshSidebars();
376
+ if(settings.overlay) {
377
+ module.error(error.overlay);
378
+ settings.transition = 'overlay';
379
+ }
380
+ module.refresh();
381
+ if(module.othersActive()) {
382
+ module.debug('Other sidebars currently visible');
383
+ if(settings.exclusive) {
384
+ // if not overlay queue animation after hide
385
+ if(settings.transition != 'overlay') {
386
+ module.hideOthers(module.show);
387
+ return;
388
+ }
389
+ else {
390
+ module.hideOthers();
391
+ }
392
+ }
393
+ else {
394
+ settings.transition = 'overlay';
395
+ }
396
+ }
397
+ module.pushPage(function() {
398
+ callback.call(element);
399
+ settings.onShow.call(element);
400
+ });
401
+ settings.onChange.call(element);
402
+ settings.onVisible.call(element);
403
+ }
404
+ else {
405
+ module.debug('Sidebar is already visible');
406
+ }
407
+ },
408
+
409
+ hide: function(callback) {
410
+ callback = $.isFunction(callback)
411
+ ? callback
412
+ : function(){}
413
+ ;
414
+ if(module.is.visible() || module.is.animating()) {
415
+ module.debug('Hiding sidebar', callback);
416
+ module.refreshSidebars();
417
+ module.pullPage(function() {
418
+ callback.call(element);
419
+ settings.onHidden.call(element);
420
+ });
421
+ settings.onChange.call(element);
422
+ settings.onHide.call(element);
423
+ }
424
+ },
425
+
426
+ othersAnimating: function() {
427
+ return ($sidebars.not($module).filter('.' + className.animating).length > 0);
428
+ },
429
+ othersVisible: function() {
430
+ return ($sidebars.not($module).filter('.' + className.visible).length > 0);
431
+ },
432
+ othersActive: function() {
433
+ return(module.othersVisible() || module.othersAnimating());
434
+ },
435
+
436
+ hideOthers: function(callback) {
437
+ var
438
+ $otherSidebars = $sidebars.not($module).filter('.' + className.visible),
439
+ sidebarCount = $otherSidebars.length,
440
+ callbackCount = 0
441
+ ;
442
+ callback = callback || function(){};
443
+ $otherSidebars
444
+ .sidebar('hide', function() {
445
+ callbackCount++;
446
+ if(callbackCount == sidebarCount) {
447
+ callback();
448
+ }
449
+ })
450
+ ;
451
+ },
452
+
453
+ toggle: function() {
454
+ module.verbose('Determining toggled direction');
455
+ if(module.is.hidden()) {
456
+ module.show();
457
+ }
458
+ else {
459
+ module.hide();
460
+ }
461
+ },
462
+
463
+ pushPage: function(callback) {
464
+ var
465
+ transition = module.get.transition(),
466
+ $transition = (transition === 'overlay' || module.othersActive())
467
+ ? $module
468
+ : $pusher,
469
+ animate,
470
+ dim,
471
+ transitionEnd
472
+ ;
473
+ callback = $.isFunction(callback)
474
+ ? callback
475
+ : function(){}
476
+ ;
477
+ if(settings.transition == 'scale down') {
478
+ module.scrollToTop();
479
+ }
480
+ module.set.transition(transition);
481
+ module.repaint();
482
+ animate = function() {
483
+ module.bind.clickaway();
484
+ module.add.inlineCSS();
485
+ module.set.animating();
486
+ module.set.visible();
487
+ };
488
+ dim = function() {
489
+ module.set.dimmed();
490
+ };
491
+ transitionEnd = function(event) {
492
+ if( event.target == $transition[0] ) {
493
+ $transition.off(transitionEvent + elementNamespace, transitionEnd);
494
+ module.remove.animating();
495
+ module.bind.scrollLock();
496
+ callback.call(element);
497
+ }
498
+ };
499
+ $transition.off(transitionEvent + elementNamespace);
500
+ $transition.on(transitionEvent + elementNamespace, transitionEnd);
501
+ requestAnimationFrame(animate);
502
+ if(settings.dimPage && !module.othersVisible()) {
503
+ requestAnimationFrame(dim);
504
+ }
505
+ },
506
+
507
+ pullPage: function(callback) {
508
+ var
509
+ transition = module.get.transition(),
510
+ $transition = (transition == 'overlay' || module.othersActive())
511
+ ? $module
512
+ : $pusher,
513
+ animate,
514
+ transitionEnd
515
+ ;
516
+ callback = $.isFunction(callback)
517
+ ? callback
518
+ : function(){}
519
+ ;
520
+ module.verbose('Removing context push state', module.get.direction());
521
+
522
+ module.unbind.clickaway();
523
+ module.unbind.scrollLock();
524
+
525
+ animate = function() {
526
+ module.set.transition(transition);
527
+ module.set.animating();
528
+ module.remove.visible();
529
+ if(settings.dimPage && !module.othersVisible()) {
530
+ $pusher.removeClass(className.dimmed);
531
+ }
532
+ };
533
+ transitionEnd = function(event) {
534
+ if( event.target == $transition[0] ) {
535
+ $transition.off(transitionEvent + elementNamespace, transitionEnd);
536
+ module.remove.animating();
537
+ module.remove.transition();
538
+ module.remove.inlineCSS();
539
+ if(transition == 'scale down' || (settings.returnScroll && module.is.mobile()) ) {
540
+ module.scrollBack();
541
+ }
542
+ callback.call(element);
543
+ }
544
+ };
545
+ $transition.off(transitionEvent + elementNamespace);
546
+ $transition.on(transitionEvent + elementNamespace, transitionEnd);
547
+ requestAnimationFrame(animate);
548
+ },
549
+
550
+ scrollToTop: function() {
551
+ module.verbose('Scrolling to top of page to avoid animation issues');
552
+ currentScroll = $(window).scrollTop();
553
+ $module.scrollTop(0);
554
+ window.scrollTo(0, 0);
555
+ },
556
+
557
+ scrollBack: function() {
558
+ module.verbose('Scrolling back to original page position');
559
+ window.scrollTo(0, currentScroll);
560
+ },
561
+
562
+ clear: {
563
+ cache: function() {
564
+ module.verbose('Clearing cached dimensions');
565
+ module.cache = {};
566
+ }
567
+ },
568
+
569
+ set: {
570
+
571
+ // ios only (scroll on html not document). This prevent auto-resize canvas/scroll in ios
572
+ ios: function() {
573
+ $html.addClass(className.ios);
574
+ },
575
+
576
+ // container
577
+ pushed: function() {
578
+ $context.addClass(className.pushed);
579
+ },
580
+ pushable: function() {
581
+ $context.addClass(className.pushable);
582
+ },
583
+
584
+ // pusher
585
+ dimmed: function() {
586
+ $pusher.addClass(className.dimmed);
587
+ },
588
+
589
+ // sidebar
590
+ active: function() {
591
+ $module.addClass(className.active);
592
+ },
593
+ animating: function() {
594
+ $module.addClass(className.animating);
595
+ },
596
+ transition: function(transition) {
597
+ transition = transition || module.get.transition();
598
+ $module.addClass(transition);
599
+ },
600
+ direction: function(direction) {
601
+ direction = direction || module.get.direction();
602
+ $module.addClass(className[direction]);
603
+ },
604
+ visible: function() {
605
+ $module.addClass(className.visible);
606
+ },
607
+ overlay: function() {
608
+ $module.addClass(className.overlay);
609
+ }
610
+ },
611
+ remove: {
612
+
613
+ inlineCSS: function() {
614
+ module.debug('Removing inline css styles', $style);
615
+ if($style && $style.length > 0) {
616
+ $style.remove();
617
+ }
618
+ },
619
+
620
+ // ios scroll on html not document
621
+ ios: function() {
622
+ $html.removeClass(className.ios);
623
+ },
624
+
625
+ // context
626
+ pushed: function() {
627
+ $context.removeClass(className.pushed);
628
+ },
629
+ pushable: function() {
630
+ $context.removeClass(className.pushable);
631
+ },
632
+
633
+ // sidebar
634
+ active: function() {
635
+ $module.removeClass(className.active);
636
+ },
637
+ animating: function() {
638
+ $module.removeClass(className.animating);
639
+ },
640
+ transition: function(transition) {
641
+ transition = transition || module.get.transition();
642
+ $module.removeClass(transition);
643
+ },
644
+ direction: function(direction) {
645
+ direction = direction || module.get.direction();
646
+ $module.removeClass(className[direction]);
647
+ },
648
+ visible: function() {
649
+ $module.removeClass(className.visible);
650
+ },
651
+ overlay: function() {
652
+ $module.removeClass(className.overlay);
653
+ }
654
+ },
655
+
656
+ get: {
657
+ direction: function() {
658
+ if($module.hasClass(className.top)) {
659
+ return className.top;
660
+ }
661
+ else if($module.hasClass(className.right)) {
662
+ return className.right;
663
+ }
664
+ else if($module.hasClass(className.bottom)) {
665
+ return className.bottom;
666
+ }
667
+ return className.left;
668
+ },
669
+ transition: function() {
670
+ var
671
+ direction = module.get.direction(),
672
+ transition
673
+ ;
674
+ transition = ( module.is.mobile() )
675
+ ? (settings.mobileTransition == 'auto')
676
+ ? settings.defaultTransition.mobile[direction]
677
+ : settings.mobileTransition
678
+ : (settings.transition == 'auto')
679
+ ? settings.defaultTransition.computer[direction]
680
+ : settings.transition
681
+ ;
682
+ module.verbose('Determined transition', transition);
683
+ return transition;
684
+ },
685
+ transitionEvent: function() {
686
+ var
687
+ element = document.createElement('element'),
688
+ transitions = {
689
+ 'transition' :'transitionend',
690
+ 'OTransition' :'oTransitionEnd',
691
+ 'MozTransition' :'transitionend',
692
+ 'WebkitTransition' :'webkitTransitionEnd'
693
+ },
694
+ transition
695
+ ;
696
+ for(transition in transitions){
697
+ if( element.style[transition] !== undefined ){
698
+ return transitions[transition];
699
+ }
700
+ }
701
+ }
702
+ },
703
+
704
+ is: {
705
+
706
+ ie: function() {
707
+ var
708
+ isIE11 = (!(window.ActiveXObject) && 'ActiveXObject' in window),
709
+ isIE = ('ActiveXObject' in window)
710
+ ;
711
+ return (isIE11 || isIE);
712
+ },
713
+
714
+ ios: function() {
715
+ var
716
+ userAgent = navigator.userAgent,
717
+ isIOS = userAgent.match(regExp.ios),
718
+ isMobileChrome = userAgent.match(regExp.mobileChrome)
719
+ ;
720
+ if(isIOS && !isMobileChrome) {
721
+ module.verbose('Browser was found to be iOS', userAgent);
722
+ return true;
723
+ }
724
+ else {
725
+ return false;
726
+ }
727
+ },
728
+ mobile: function() {
729
+ var
730
+ userAgent = navigator.userAgent,
731
+ isMobile = userAgent.match(regExp.mobile)
732
+ ;
733
+ if(isMobile) {
734
+ module.verbose('Browser was found to be mobile', userAgent);
735
+ return true;
736
+ }
737
+ else {
738
+ module.verbose('Browser is not mobile, using regular transition', userAgent);
739
+ return false;
740
+ }
741
+ },
742
+ hidden: function() {
743
+ return !module.is.visible();
744
+ },
745
+ visible: function() {
746
+ return $module.hasClass(className.visible);
747
+ },
748
+ // alias
749
+ open: function() {
750
+ return module.is.visible();
751
+ },
752
+ closed: function() {
753
+ return module.is.hidden();
754
+ },
755
+ vertical: function() {
756
+ return $module.hasClass(className.top);
757
+ },
758
+ animating: function() {
759
+ return $context.hasClass(className.animating);
760
+ },
761
+ rtl: function () {
762
+ if(module.cache.rtl === undefined) {
763
+ module.cache.rtl = ($module.css('direction') == 'rtl');
764
+ }
765
+ return module.cache.rtl;
766
+ }
767
+ },
768
+
769
+ setting: function(name, value) {
770
+ module.debug('Changing setting', name, value);
771
+ if( $.isPlainObject(name) ) {
772
+ $.extend(true, settings, name);
773
+ }
774
+ else if(value !== undefined) {
775
+ if($.isPlainObject(settings[name])) {
776
+ $.extend(true, settings[name], value);
777
+ }
778
+ else {
779
+ settings[name] = value;
780
+ }
781
+ }
782
+ else {
783
+ return settings[name];
784
+ }
785
+ },
786
+ internal: function(name, value) {
787
+ if( $.isPlainObject(name) ) {
788
+ $.extend(true, module, name);
789
+ }
790
+ else if(value !== undefined) {
791
+ module[name] = value;
792
+ }
793
+ else {
794
+ return module[name];
795
+ }
796
+ },
797
+ debug: function() {
798
+ if(!settings.silent && settings.debug) {
799
+ if(settings.performance) {
800
+ module.performance.log(arguments);
801
+ }
802
+ else {
803
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
804
+ module.debug.apply(console, arguments);
805
+ }
806
+ }
807
+ },
808
+ verbose: function() {
809
+ if(!settings.silent && settings.verbose && settings.debug) {
810
+ if(settings.performance) {
811
+ module.performance.log(arguments);
812
+ }
813
+ else {
814
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
815
+ module.verbose.apply(console, arguments);
816
+ }
817
+ }
818
+ },
819
+ error: function() {
820
+ if(!settings.silent) {
821
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
822
+ module.error.apply(console, arguments);
823
+ }
824
+ },
825
+ performance: {
826
+ log: function(message) {
827
+ var
828
+ currentTime,
829
+ executionTime,
830
+ previousTime
831
+ ;
832
+ if(settings.performance) {
833
+ currentTime = new Date().getTime();
834
+ previousTime = time || currentTime;
835
+ executionTime = currentTime - previousTime;
836
+ time = currentTime;
837
+ performance.push({
838
+ 'Name' : message[0],
839
+ 'Arguments' : [].slice.call(message, 1) || '',
840
+ 'Element' : element,
841
+ 'Execution Time' : executionTime
842
+ });
843
+ }
844
+ clearTimeout(module.performance.timer);
845
+ module.performance.timer = setTimeout(module.performance.display, 500);
846
+ },
847
+ display: function() {
848
+ var
849
+ title = settings.name + ':',
850
+ totalTime = 0
851
+ ;
852
+ time = false;
853
+ clearTimeout(module.performance.timer);
854
+ $.each(performance, function(index, data) {
855
+ totalTime += data['Execution Time'];
856
+ });
857
+ title += ' ' + totalTime + 'ms';
858
+ if(moduleSelector) {
859
+ title += ' \'' + moduleSelector + '\'';
860
+ }
861
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
862
+ console.groupCollapsed(title);
863
+ if(console.table) {
864
+ console.table(performance);
865
+ }
866
+ else {
867
+ $.each(performance, function(index, data) {
868
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
869
+ });
870
+ }
871
+ console.groupEnd();
872
+ }
873
+ performance = [];
874
+ }
875
+ },
876
+ invoke: function(query, passedArguments, context) {
877
+ var
878
+ object = instance,
879
+ maxDepth,
880
+ found,
881
+ response
882
+ ;
883
+ passedArguments = passedArguments || queryArguments;
884
+ context = element || context;
885
+ if(typeof query == 'string' && object !== undefined) {
886
+ query = query.split(/[\. ]/);
887
+ maxDepth = query.length - 1;
888
+ $.each(query, function(depth, value) {
889
+ var camelCaseValue = (depth != maxDepth)
890
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
891
+ : query
892
+ ;
893
+ if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
894
+ object = object[camelCaseValue];
895
+ }
896
+ else if( object[camelCaseValue] !== undefined ) {
897
+ found = object[camelCaseValue];
898
+ return false;
899
+ }
900
+ else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
901
+ object = object[value];
902
+ }
903
+ else if( object[value] !== undefined ) {
904
+ found = object[value];
905
+ return false;
906
+ }
907
+ else {
908
+ module.error(error.method, query);
909
+ return false;
910
+ }
911
+ });
912
+ }
913
+ if ( $.isFunction( found ) ) {
914
+ response = found.apply(context, passedArguments);
915
+ }
916
+ else if(found !== undefined) {
917
+ response = found;
918
+ }
919
+ if($.isArray(returnedValue)) {
920
+ returnedValue.push(response);
921
+ }
922
+ else if(returnedValue !== undefined) {
923
+ returnedValue = [returnedValue, response];
924
+ }
925
+ else if(response !== undefined) {
926
+ returnedValue = response;
927
+ }
928
+ return found;
929
+ }
930
+ }
931
+ ;
932
+
933
+ if(methodInvoked) {
934
+ if(instance === undefined) {
935
+ module.initialize();
936
+ }
937
+ module.invoke(query);
938
+ }
939
+ else {
940
+ if(instance !== undefined) {
941
+ module.invoke('destroy');
942
+ }
943
+ module.initialize();
944
+ }
945
+ });
946
+
947
+ return (returnedValue !== undefined)
948
+ ? returnedValue
949
+ : this
950
+ ;
951
+ };
952
+
953
+ $.fn.sidebar.settings = {
954
+
955
+ name : 'Sidebar',
956
+ namespace : 'sidebar',
957
+
958
+ silent : false,
959
+ debug : false,
960
+ verbose : false,
961
+ performance : true,
962
+
963
+ transition : 'auto',
964
+ mobileTransition : 'auto',
965
+
966
+ defaultTransition : {
967
+ computer: {
968
+ left : 'uncover',
969
+ right : 'uncover',
970
+ top : 'overlay',
971
+ bottom : 'overlay'
972
+ },
973
+ mobile: {
974
+ left : 'uncover',
975
+ right : 'uncover',
976
+ top : 'overlay',
977
+ bottom : 'overlay'
978
+ }
979
+ },
980
+
981
+ context : 'body',
982
+ exclusive : false,
983
+ closable : true,
984
+ dimPage : true,
985
+ scrollLock : false,
986
+ returnScroll : false,
987
+ delaySetup : false,
988
+
989
+ duration : 500,
990
+
991
+ onChange : function(){},
992
+ onShow : function(){},
993
+ onHide : function(){},
994
+
995
+ onHidden : function(){},
996
+ onVisible : function(){},
997
+
998
+ className : {
999
+ active : 'active',
1000
+ animating : 'animating',
1001
+ dimmed : 'dimmed',
1002
+ ios : 'ios',
1003
+ pushable : 'pushable',
1004
+ pushed : 'pushed',
1005
+ right : 'right',
1006
+ top : 'top',
1007
+ left : 'left',
1008
+ bottom : 'bottom',
1009
+ visible : 'visible'
1010
+ },
1011
+
1012
+ selector: {
1013
+ fixed : '.fixed',
1014
+ omitted : 'script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed',
1015
+ pusher : '.pusher',
1016
+ sidebar : '.ui.sidebar'
1017
+ },
1018
+
1019
+ regExp: {
1020
+ ios : /(iPad|iPhone|iPod)/g,
1021
+ mobileChrome : /(CriOS)/g,
1022
+ mobile : /Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/g
1023
+ },
1024
+
1025
+ error : {
1026
+ method : 'The method you called is not defined.',
1027
+ pusher : 'Had to add pusher element. For optimal performance make sure body content is inside a pusher element',
1028
+ movedSidebar : 'Had to move sidebar. For optimal performance make sure sidebar and pusher are direct children of your body tag',
1029
+ overlay : 'The overlay setting is no longer supported, use animation: overlay',
1030
+ notFound : 'There were no elements that matched the specified selector'
1031
+ }
1032
+
1033
+ };
1034
+
1035
+
1036
+ })( jQuery, window, document );