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,831 @@
1
+ /*!
2
+ * # Semantic UI 2.2.9 - Checkbox
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.checkbox = function(parameters) {
23
+ var
24
+ $allModules = $(this),
25
+ moduleSelector = $allModules.selector || '',
26
+
27
+ time = new Date().getTime(),
28
+ performance = [],
29
+
30
+ query = arguments[0],
31
+ methodInvoked = (typeof query == 'string'),
32
+ queryArguments = [].slice.call(arguments, 1),
33
+ returnedValue
34
+ ;
35
+
36
+ $allModules
37
+ .each(function() {
38
+ var
39
+ settings = $.extend(true, {}, $.fn.checkbox.settings, parameters),
40
+
41
+ className = settings.className,
42
+ namespace = settings.namespace,
43
+ selector = settings.selector,
44
+ error = settings.error,
45
+
46
+ eventNamespace = '.' + namespace,
47
+ moduleNamespace = 'module-' + namespace,
48
+
49
+ $module = $(this),
50
+ $label = $(this).children(selector.label),
51
+ $input = $(this).children(selector.input),
52
+ input = $input[0],
53
+
54
+ initialLoad = false,
55
+ shortcutPressed = false,
56
+ instance = $module.data(moduleNamespace),
57
+
58
+ observer,
59
+ element = this,
60
+ module
61
+ ;
62
+
63
+ module = {
64
+
65
+ initialize: function() {
66
+ module.verbose('Initializing checkbox', settings);
67
+
68
+ module.create.label();
69
+ module.bind.events();
70
+
71
+ module.set.tabbable();
72
+ module.hide.input();
73
+
74
+ module.observeChanges();
75
+ module.instantiate();
76
+ module.setup();
77
+ },
78
+
79
+ instantiate: function() {
80
+ module.verbose('Storing instance of module', module);
81
+ instance = module;
82
+ $module
83
+ .data(moduleNamespace, module)
84
+ ;
85
+ },
86
+
87
+ destroy: function() {
88
+ module.verbose('Destroying module');
89
+ module.unbind.events();
90
+ module.show.input();
91
+ $module.removeData(moduleNamespace);
92
+ },
93
+
94
+ fix: {
95
+ reference: function() {
96
+ if( $module.is(selector.input) ) {
97
+ module.debug('Behavior called on <input> adjusting invoked element');
98
+ $module = $module.closest(selector.checkbox);
99
+ module.refresh();
100
+ }
101
+ }
102
+ },
103
+
104
+ setup: function() {
105
+ module.set.initialLoad();
106
+ if( module.is.indeterminate() ) {
107
+ module.debug('Initial value is indeterminate');
108
+ module.indeterminate();
109
+ }
110
+ else if( module.is.checked() ) {
111
+ module.debug('Initial value is checked');
112
+ module.check();
113
+ }
114
+ else {
115
+ module.debug('Initial value is unchecked');
116
+ module.uncheck();
117
+ }
118
+ module.remove.initialLoad();
119
+ },
120
+
121
+ refresh: function() {
122
+ $label = $module.children(selector.label);
123
+ $input = $module.children(selector.input);
124
+ input = $input[0];
125
+ },
126
+
127
+ hide: {
128
+ input: function() {
129
+ module.verbose('Modifying <input> z-index to be unselectable');
130
+ $input.addClass(className.hidden);
131
+ }
132
+ },
133
+ show: {
134
+ input: function() {
135
+ module.verbose('Modifying <input> z-index to be selectable');
136
+ $input.removeClass(className.hidden);
137
+ }
138
+ },
139
+
140
+ observeChanges: function() {
141
+ if('MutationObserver' in window) {
142
+ observer = new MutationObserver(function(mutations) {
143
+ module.debug('DOM tree modified, updating selector cache');
144
+ module.refresh();
145
+ });
146
+ observer.observe(element, {
147
+ childList : true,
148
+ subtree : true
149
+ });
150
+ module.debug('Setting up mutation observer', observer);
151
+ }
152
+ },
153
+
154
+ attachEvents: function(selector, event) {
155
+ var
156
+ $element = $(selector)
157
+ ;
158
+ event = $.isFunction(module[event])
159
+ ? module[event]
160
+ : module.toggle
161
+ ;
162
+ if($element.length > 0) {
163
+ module.debug('Attaching checkbox events to element', selector, event);
164
+ $element
165
+ .on('click' + eventNamespace, event)
166
+ ;
167
+ }
168
+ else {
169
+ module.error(error.notFound);
170
+ }
171
+ },
172
+
173
+ event: {
174
+ click: function(event) {
175
+ var
176
+ $target = $(event.target)
177
+ ;
178
+ if( $target.is(selector.input) ) {
179
+ module.verbose('Using default check action on initialized checkbox');
180
+ return;
181
+ }
182
+ if( $target.is(selector.link) ) {
183
+ module.debug('Clicking link inside checkbox, skipping toggle');
184
+ return;
185
+ }
186
+ module.toggle();
187
+ $input.focus();
188
+ event.preventDefault();
189
+ },
190
+ keydown: function(event) {
191
+ var
192
+ key = event.which,
193
+ keyCode = {
194
+ enter : 13,
195
+ space : 32,
196
+ escape : 27
197
+ }
198
+ ;
199
+ if(key == keyCode.escape) {
200
+ module.verbose('Escape key pressed blurring field');
201
+ $input.blur();
202
+ shortcutPressed = true;
203
+ }
204
+ else if(!event.ctrlKey && ( key == keyCode.space || key == keyCode.enter) ) {
205
+ module.verbose('Enter/space key pressed, toggling checkbox');
206
+ module.toggle();
207
+ shortcutPressed = true;
208
+ }
209
+ else {
210
+ shortcutPressed = false;
211
+ }
212
+ },
213
+ keyup: function(event) {
214
+ if(shortcutPressed) {
215
+ event.preventDefault();
216
+ }
217
+ }
218
+ },
219
+
220
+ check: function() {
221
+ if( !module.should.allowCheck() ) {
222
+ return;
223
+ }
224
+ module.debug('Checking checkbox', $input);
225
+ module.set.checked();
226
+ if( !module.should.ignoreCallbacks() ) {
227
+ settings.onChecked.call(input);
228
+ settings.onChange.call(input);
229
+ }
230
+ },
231
+
232
+ uncheck: function() {
233
+ if( !module.should.allowUncheck() ) {
234
+ return;
235
+ }
236
+ module.debug('Unchecking checkbox');
237
+ module.set.unchecked();
238
+ if( !module.should.ignoreCallbacks() ) {
239
+ settings.onUnchecked.call(input);
240
+ settings.onChange.call(input);
241
+ }
242
+ },
243
+
244
+ indeterminate: function() {
245
+ if( module.should.allowIndeterminate() ) {
246
+ module.debug('Checkbox is already indeterminate');
247
+ return;
248
+ }
249
+ module.debug('Making checkbox indeterminate');
250
+ module.set.indeterminate();
251
+ if( !module.should.ignoreCallbacks() ) {
252
+ settings.onIndeterminate.call(input);
253
+ settings.onChange.call(input);
254
+ }
255
+ },
256
+
257
+ determinate: function() {
258
+ if( module.should.allowDeterminate() ) {
259
+ module.debug('Checkbox is already determinate');
260
+ return;
261
+ }
262
+ module.debug('Making checkbox determinate');
263
+ module.set.determinate();
264
+ if( !module.should.ignoreCallbacks() ) {
265
+ settings.onDeterminate.call(input);
266
+ settings.onChange.call(input);
267
+ }
268
+ },
269
+
270
+ enable: function() {
271
+ if( module.is.enabled() ) {
272
+ module.debug('Checkbox is already enabled');
273
+ return;
274
+ }
275
+ module.debug('Enabling checkbox');
276
+ module.set.enabled();
277
+ settings.onEnable.call(input);
278
+ // preserve legacy callbacks
279
+ settings.onEnabled.call(input);
280
+ },
281
+
282
+ disable: function() {
283
+ if( module.is.disabled() ) {
284
+ module.debug('Checkbox is already disabled');
285
+ return;
286
+ }
287
+ module.debug('Disabling checkbox');
288
+ module.set.disabled();
289
+ settings.onDisable.call(input);
290
+ // preserve legacy callbacks
291
+ settings.onDisabled.call(input);
292
+ },
293
+
294
+ get: {
295
+ radios: function() {
296
+ var
297
+ name = module.get.name()
298
+ ;
299
+ return $('input[name="' + name + '"]').closest(selector.checkbox);
300
+ },
301
+ otherRadios: function() {
302
+ return module.get.radios().not($module);
303
+ },
304
+ name: function() {
305
+ return $input.attr('name');
306
+ }
307
+ },
308
+
309
+ is: {
310
+ initialLoad: function() {
311
+ return initialLoad;
312
+ },
313
+ radio: function() {
314
+ return ($input.hasClass(className.radio) || $input.attr('type') == 'radio');
315
+ },
316
+ indeterminate: function() {
317
+ return $input.prop('indeterminate') !== undefined && $input.prop('indeterminate');
318
+ },
319
+ checked: function() {
320
+ return $input.prop('checked') !== undefined && $input.prop('checked');
321
+ },
322
+ disabled: function() {
323
+ return $input.prop('disabled') !== undefined && $input.prop('disabled');
324
+ },
325
+ enabled: function() {
326
+ return !module.is.disabled();
327
+ },
328
+ determinate: function() {
329
+ return !module.is.indeterminate();
330
+ },
331
+ unchecked: function() {
332
+ return !module.is.checked();
333
+ }
334
+ },
335
+
336
+ should: {
337
+ allowCheck: function() {
338
+ if(module.is.determinate() && module.is.checked() && !module.should.forceCallbacks() ) {
339
+ module.debug('Should not allow check, checkbox is already checked');
340
+ return false;
341
+ }
342
+ if(settings.beforeChecked.apply(input) === false) {
343
+ module.debug('Should not allow check, beforeChecked cancelled');
344
+ return false;
345
+ }
346
+ return true;
347
+ },
348
+ allowUncheck: function() {
349
+ if(module.is.determinate() && module.is.unchecked() && !module.should.forceCallbacks() ) {
350
+ module.debug('Should not allow uncheck, checkbox is already unchecked');
351
+ return false;
352
+ }
353
+ if(settings.beforeUnchecked.apply(input) === false) {
354
+ module.debug('Should not allow uncheck, beforeUnchecked cancelled');
355
+ return false;
356
+ }
357
+ return true;
358
+ },
359
+ allowIndeterminate: function() {
360
+ if(module.is.indeterminate() && !module.should.forceCallbacks() ) {
361
+ module.debug('Should not allow indeterminate, checkbox is already indeterminate');
362
+ return false;
363
+ }
364
+ if(settings.beforeIndeterminate.apply(input) === false) {
365
+ module.debug('Should not allow indeterminate, beforeIndeterminate cancelled');
366
+ return false;
367
+ }
368
+ return true;
369
+ },
370
+ allowDeterminate: function() {
371
+ if(module.is.determinate() && !module.should.forceCallbacks() ) {
372
+ module.debug('Should not allow determinate, checkbox is already determinate');
373
+ return false;
374
+ }
375
+ if(settings.beforeDeterminate.apply(input) === false) {
376
+ module.debug('Should not allow determinate, beforeDeterminate cancelled');
377
+ return false;
378
+ }
379
+ return true;
380
+ },
381
+ forceCallbacks: function() {
382
+ return (module.is.initialLoad() && settings.fireOnInit);
383
+ },
384
+ ignoreCallbacks: function() {
385
+ return (initialLoad && !settings.fireOnInit);
386
+ }
387
+ },
388
+
389
+ can: {
390
+ change: function() {
391
+ return !( $module.hasClass(className.disabled) || $module.hasClass(className.readOnly) || $input.prop('disabled') || $input.prop('readonly') );
392
+ },
393
+ uncheck: function() {
394
+ return (typeof settings.uncheckable === 'boolean')
395
+ ? settings.uncheckable
396
+ : !module.is.radio()
397
+ ;
398
+ }
399
+ },
400
+
401
+ set: {
402
+ initialLoad: function() {
403
+ initialLoad = true;
404
+ },
405
+ checked: function() {
406
+ module.verbose('Setting class to checked');
407
+ $module
408
+ .removeClass(className.indeterminate)
409
+ .addClass(className.checked)
410
+ ;
411
+ if( module.is.radio() ) {
412
+ module.uncheckOthers();
413
+ }
414
+ if(!module.is.indeterminate() && module.is.checked()) {
415
+ module.debug('Input is already checked, skipping input property change');
416
+ return;
417
+ }
418
+ module.verbose('Setting state to checked', input);
419
+ $input
420
+ .prop('indeterminate', false)
421
+ .prop('checked', true)
422
+ ;
423
+ module.trigger.change();
424
+ },
425
+ unchecked: function() {
426
+ module.verbose('Removing checked class');
427
+ $module
428
+ .removeClass(className.indeterminate)
429
+ .removeClass(className.checked)
430
+ ;
431
+ if(!module.is.indeterminate() && module.is.unchecked() ) {
432
+ module.debug('Input is already unchecked');
433
+ return;
434
+ }
435
+ module.debug('Setting state to unchecked');
436
+ $input
437
+ .prop('indeterminate', false)
438
+ .prop('checked', false)
439
+ ;
440
+ module.trigger.change();
441
+ },
442
+ indeterminate: function() {
443
+ module.verbose('Setting class to indeterminate');
444
+ $module
445
+ .addClass(className.indeterminate)
446
+ ;
447
+ if( module.is.indeterminate() ) {
448
+ module.debug('Input is already indeterminate, skipping input property change');
449
+ return;
450
+ }
451
+ module.debug('Setting state to indeterminate');
452
+ $input
453
+ .prop('indeterminate', true)
454
+ ;
455
+ module.trigger.change();
456
+ },
457
+ determinate: function() {
458
+ module.verbose('Removing indeterminate class');
459
+ $module
460
+ .removeClass(className.indeterminate)
461
+ ;
462
+ if( module.is.determinate() ) {
463
+ module.debug('Input is already determinate, skipping input property change');
464
+ return;
465
+ }
466
+ module.debug('Setting state to determinate');
467
+ $input
468
+ .prop('indeterminate', false)
469
+ ;
470
+ },
471
+ disabled: function() {
472
+ module.verbose('Setting class to disabled');
473
+ $module
474
+ .addClass(className.disabled)
475
+ ;
476
+ if( module.is.disabled() ) {
477
+ module.debug('Input is already disabled, skipping input property change');
478
+ return;
479
+ }
480
+ module.debug('Setting state to disabled');
481
+ $input
482
+ .prop('disabled', 'disabled')
483
+ ;
484
+ module.trigger.change();
485
+ },
486
+ enabled: function() {
487
+ module.verbose('Removing disabled class');
488
+ $module.removeClass(className.disabled);
489
+ if( module.is.enabled() ) {
490
+ module.debug('Input is already enabled, skipping input property change');
491
+ return;
492
+ }
493
+ module.debug('Setting state to enabled');
494
+ $input
495
+ .prop('disabled', false)
496
+ ;
497
+ module.trigger.change();
498
+ },
499
+ tabbable: function() {
500
+ module.verbose('Adding tabindex to checkbox');
501
+ if( $input.attr('tabindex') === undefined) {
502
+ $input.attr('tabindex', 0);
503
+ }
504
+ }
505
+ },
506
+
507
+ remove: {
508
+ initialLoad: function() {
509
+ initialLoad = false;
510
+ }
511
+ },
512
+
513
+ trigger: {
514
+ change: function() {
515
+ var
516
+ events = document.createEvent('HTMLEvents'),
517
+ inputElement = $input[0]
518
+ ;
519
+ if(inputElement) {
520
+ module.verbose('Triggering native change event');
521
+ events.initEvent('change', true, false);
522
+ inputElement.dispatchEvent(events);
523
+ }
524
+ }
525
+ },
526
+
527
+
528
+ create: {
529
+ label: function() {
530
+ if($input.prevAll(selector.label).length > 0) {
531
+ $input.prev(selector.label).detach().insertAfter($input);
532
+ module.debug('Moving existing label', $label);
533
+ }
534
+ else if( !module.has.label() ) {
535
+ $label = $('<label>').insertAfter($input);
536
+ module.debug('Creating label', $label);
537
+ }
538
+ }
539
+ },
540
+
541
+ has: {
542
+ label: function() {
543
+ return ($label.length > 0);
544
+ }
545
+ },
546
+
547
+ bind: {
548
+ events: function() {
549
+ module.verbose('Attaching checkbox events');
550
+ $module
551
+ .on('click' + eventNamespace, module.event.click)
552
+ .on('keydown' + eventNamespace, selector.input, module.event.keydown)
553
+ .on('keyup' + eventNamespace, selector.input, module.event.keyup)
554
+ ;
555
+ }
556
+ },
557
+
558
+ unbind: {
559
+ events: function() {
560
+ module.debug('Removing events');
561
+ $module
562
+ .off(eventNamespace)
563
+ ;
564
+ }
565
+ },
566
+
567
+ uncheckOthers: function() {
568
+ var
569
+ $radios = module.get.otherRadios()
570
+ ;
571
+ module.debug('Unchecking other radios', $radios);
572
+ $radios.removeClass(className.checked);
573
+ },
574
+
575
+ toggle: function() {
576
+ if( !module.can.change() ) {
577
+ if(!module.is.radio()) {
578
+ module.debug('Checkbox is read-only or disabled, ignoring toggle');
579
+ }
580
+ return;
581
+ }
582
+ if( module.is.indeterminate() || module.is.unchecked() ) {
583
+ module.debug('Currently unchecked');
584
+ module.check();
585
+ }
586
+ else if( module.is.checked() && module.can.uncheck() ) {
587
+ module.debug('Currently checked');
588
+ module.uncheck();
589
+ }
590
+ },
591
+ setting: function(name, value) {
592
+ module.debug('Changing setting', name, value);
593
+ if( $.isPlainObject(name) ) {
594
+ $.extend(true, settings, name);
595
+ }
596
+ else if(value !== undefined) {
597
+ if($.isPlainObject(settings[name])) {
598
+ $.extend(true, settings[name], value);
599
+ }
600
+ else {
601
+ settings[name] = value;
602
+ }
603
+ }
604
+ else {
605
+ return settings[name];
606
+ }
607
+ },
608
+ internal: function(name, value) {
609
+ if( $.isPlainObject(name) ) {
610
+ $.extend(true, module, name);
611
+ }
612
+ else if(value !== undefined) {
613
+ module[name] = value;
614
+ }
615
+ else {
616
+ return module[name];
617
+ }
618
+ },
619
+ debug: function() {
620
+ if(!settings.silent && settings.debug) {
621
+ if(settings.performance) {
622
+ module.performance.log(arguments);
623
+ }
624
+ else {
625
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
626
+ module.debug.apply(console, arguments);
627
+ }
628
+ }
629
+ },
630
+ verbose: function() {
631
+ if(!settings.silent && settings.verbose && settings.debug) {
632
+ if(settings.performance) {
633
+ module.performance.log(arguments);
634
+ }
635
+ else {
636
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
637
+ module.verbose.apply(console, arguments);
638
+ }
639
+ }
640
+ },
641
+ error: function() {
642
+ if(!settings.silent) {
643
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
644
+ module.error.apply(console, arguments);
645
+ }
646
+ },
647
+ performance: {
648
+ log: function(message) {
649
+ var
650
+ currentTime,
651
+ executionTime,
652
+ previousTime
653
+ ;
654
+ if(settings.performance) {
655
+ currentTime = new Date().getTime();
656
+ previousTime = time || currentTime;
657
+ executionTime = currentTime - previousTime;
658
+ time = currentTime;
659
+ performance.push({
660
+ 'Name' : message[0],
661
+ 'Arguments' : [].slice.call(message, 1) || '',
662
+ 'Element' : element,
663
+ 'Execution Time' : executionTime
664
+ });
665
+ }
666
+ clearTimeout(module.performance.timer);
667
+ module.performance.timer = setTimeout(module.performance.display, 500);
668
+ },
669
+ display: function() {
670
+ var
671
+ title = settings.name + ':',
672
+ totalTime = 0
673
+ ;
674
+ time = false;
675
+ clearTimeout(module.performance.timer);
676
+ $.each(performance, function(index, data) {
677
+ totalTime += data['Execution Time'];
678
+ });
679
+ title += ' ' + totalTime + 'ms';
680
+ if(moduleSelector) {
681
+ title += ' \'' + moduleSelector + '\'';
682
+ }
683
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
684
+ console.groupCollapsed(title);
685
+ if(console.table) {
686
+ console.table(performance);
687
+ }
688
+ else {
689
+ $.each(performance, function(index, data) {
690
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
691
+ });
692
+ }
693
+ console.groupEnd();
694
+ }
695
+ performance = [];
696
+ }
697
+ },
698
+ invoke: function(query, passedArguments, context) {
699
+ var
700
+ object = instance,
701
+ maxDepth,
702
+ found,
703
+ response
704
+ ;
705
+ passedArguments = passedArguments || queryArguments;
706
+ context = element || context;
707
+ if(typeof query == 'string' && object !== undefined) {
708
+ query = query.split(/[\. ]/);
709
+ maxDepth = query.length - 1;
710
+ $.each(query, function(depth, value) {
711
+ var camelCaseValue = (depth != maxDepth)
712
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
713
+ : query
714
+ ;
715
+ if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
716
+ object = object[camelCaseValue];
717
+ }
718
+ else if( object[camelCaseValue] !== undefined ) {
719
+ found = object[camelCaseValue];
720
+ return false;
721
+ }
722
+ else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
723
+ object = object[value];
724
+ }
725
+ else if( object[value] !== undefined ) {
726
+ found = object[value];
727
+ return false;
728
+ }
729
+ else {
730
+ module.error(error.method, query);
731
+ return false;
732
+ }
733
+ });
734
+ }
735
+ if ( $.isFunction( found ) ) {
736
+ response = found.apply(context, passedArguments);
737
+ }
738
+ else if(found !== undefined) {
739
+ response = found;
740
+ }
741
+ if($.isArray(returnedValue)) {
742
+ returnedValue.push(response);
743
+ }
744
+ else if(returnedValue !== undefined) {
745
+ returnedValue = [returnedValue, response];
746
+ }
747
+ else if(response !== undefined) {
748
+ returnedValue = response;
749
+ }
750
+ return found;
751
+ }
752
+ };
753
+
754
+ if(methodInvoked) {
755
+ if(instance === undefined) {
756
+ module.initialize();
757
+ }
758
+ module.invoke(query);
759
+ }
760
+ else {
761
+ if(instance !== undefined) {
762
+ instance.invoke('destroy');
763
+ }
764
+ module.initialize();
765
+ }
766
+ })
767
+ ;
768
+
769
+ return (returnedValue !== undefined)
770
+ ? returnedValue
771
+ : this
772
+ ;
773
+ };
774
+
775
+ $.fn.checkbox.settings = {
776
+
777
+ name : 'Checkbox',
778
+ namespace : 'checkbox',
779
+
780
+ silent : false,
781
+ debug : false,
782
+ verbose : true,
783
+ performance : true,
784
+
785
+ // delegated event context
786
+ uncheckable : 'auto',
787
+ fireOnInit : false,
788
+
789
+ onChange : function(){},
790
+
791
+ beforeChecked : function(){},
792
+ beforeUnchecked : function(){},
793
+ beforeDeterminate : function(){},
794
+ beforeIndeterminate : function(){},
795
+
796
+ onChecked : function(){},
797
+ onUnchecked : function(){},
798
+
799
+ onDeterminate : function() {},
800
+ onIndeterminate : function() {},
801
+
802
+ onEnable : function(){},
803
+ onDisable : function(){},
804
+
805
+ // preserve misspelled callbacks (will be removed in 3.0)
806
+ onEnabled : function(){},
807
+ onDisabled : function(){},
808
+
809
+ className : {
810
+ checked : 'checked',
811
+ indeterminate : 'indeterminate',
812
+ disabled : 'disabled',
813
+ hidden : 'hidden',
814
+ radio : 'radio',
815
+ readOnly : 'read-only'
816
+ },
817
+
818
+ error : {
819
+ method : 'The method you called is not defined'
820
+ },
821
+
822
+ selector : {
823
+ checkbox : '.ui.checkbox',
824
+ label : 'label, .box',
825
+ input : 'input[type="checkbox"], input[type="radio"]',
826
+ link : 'a[href]'
827
+ }
828
+
829
+ };
830
+
831
+ })( jQuery, window, document );