vapid 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
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,931 @@
1
+ /*!
2
+ * # Semantic UI 2.2.9 - Progress
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
+ var
23
+ global = (typeof window != 'undefined' && window.Math == Math)
24
+ ? window
25
+ : (typeof self != 'undefined' && self.Math == Math)
26
+ ? self
27
+ : Function('return this')()
28
+ ;
29
+
30
+ $.fn.progress = function(parameters) {
31
+ var
32
+ $allModules = $(this),
33
+
34
+ moduleSelector = $allModules.selector || '',
35
+
36
+ time = new Date().getTime(),
37
+ performance = [],
38
+
39
+ query = arguments[0],
40
+ methodInvoked = (typeof query == 'string'),
41
+ queryArguments = [].slice.call(arguments, 1),
42
+
43
+ returnedValue
44
+ ;
45
+
46
+ $allModules
47
+ .each(function() {
48
+ var
49
+ settings = ( $.isPlainObject(parameters) )
50
+ ? $.extend(true, {}, $.fn.progress.settings, parameters)
51
+ : $.extend({}, $.fn.progress.settings),
52
+
53
+ className = settings.className,
54
+ metadata = settings.metadata,
55
+ namespace = settings.namespace,
56
+ selector = settings.selector,
57
+ error = settings.error,
58
+
59
+ eventNamespace = '.' + namespace,
60
+ moduleNamespace = 'module-' + namespace,
61
+
62
+ $module = $(this),
63
+ $bar = $(this).find(selector.bar),
64
+ $progress = $(this).find(selector.progress),
65
+ $label = $(this).find(selector.label),
66
+
67
+ element = this,
68
+ instance = $module.data(moduleNamespace),
69
+
70
+ animating = false,
71
+ transitionEnd,
72
+ module
73
+ ;
74
+
75
+ module = {
76
+
77
+ initialize: function() {
78
+ module.debug('Initializing progress bar', settings);
79
+
80
+ module.set.duration();
81
+ module.set.transitionEvent();
82
+
83
+ module.read.metadata();
84
+ module.read.settings();
85
+
86
+ module.instantiate();
87
+ },
88
+
89
+ instantiate: function() {
90
+ module.verbose('Storing instance of progress', module);
91
+ instance = module;
92
+ $module
93
+ .data(moduleNamespace, module)
94
+ ;
95
+ },
96
+ destroy: function() {
97
+ module.verbose('Destroying previous progress for', $module);
98
+ clearInterval(instance.interval);
99
+ module.remove.state();
100
+ $module.removeData(moduleNamespace);
101
+ instance = undefined;
102
+ },
103
+
104
+ reset: function() {
105
+ module.remove.nextValue();
106
+ module.update.progress(0);
107
+ },
108
+
109
+ complete: function() {
110
+ if(module.percent === undefined || module.percent < 100) {
111
+ module.remove.progressPoll();
112
+ module.set.percent(100);
113
+ }
114
+ },
115
+
116
+ read: {
117
+ metadata: function() {
118
+ var
119
+ data = {
120
+ percent : $module.data(metadata.percent),
121
+ total : $module.data(metadata.total),
122
+ value : $module.data(metadata.value)
123
+ }
124
+ ;
125
+ if(data.percent) {
126
+ module.debug('Current percent value set from metadata', data.percent);
127
+ module.set.percent(data.percent);
128
+ }
129
+ if(data.total) {
130
+ module.debug('Total value set from metadata', data.total);
131
+ module.set.total(data.total);
132
+ }
133
+ if(data.value) {
134
+ module.debug('Current value set from metadata', data.value);
135
+ module.set.value(data.value);
136
+ module.set.progress(data.value);
137
+ }
138
+ },
139
+ settings: function() {
140
+ if(settings.total !== false) {
141
+ module.debug('Current total set in settings', settings.total);
142
+ module.set.total(settings.total);
143
+ }
144
+ if(settings.value !== false) {
145
+ module.debug('Current value set in settings', settings.value);
146
+ module.set.value(settings.value);
147
+ module.set.progress(module.value);
148
+ }
149
+ if(settings.percent !== false) {
150
+ module.debug('Current percent set in settings', settings.percent);
151
+ module.set.percent(settings.percent);
152
+ }
153
+ }
154
+ },
155
+
156
+ bind: {
157
+ transitionEnd: function(callback) {
158
+ var
159
+ transitionEnd = module.get.transitionEnd()
160
+ ;
161
+ $bar
162
+ .one(transitionEnd + eventNamespace, function(event) {
163
+ clearTimeout(module.failSafeTimer);
164
+ callback.call(this, event);
165
+ })
166
+ ;
167
+ module.failSafeTimer = setTimeout(function() {
168
+ $bar.triggerHandler(transitionEnd);
169
+ }, settings.duration + settings.failSafeDelay);
170
+ module.verbose('Adding fail safe timer', module.timer);
171
+ }
172
+ },
173
+
174
+ increment: function(incrementValue) {
175
+ var
176
+ maxValue,
177
+ startValue,
178
+ newValue
179
+ ;
180
+ if( module.has.total() ) {
181
+ startValue = module.get.value();
182
+ incrementValue = incrementValue || 1;
183
+ newValue = startValue + incrementValue;
184
+ }
185
+ else {
186
+ startValue = module.get.percent();
187
+ incrementValue = incrementValue || module.get.randomValue();
188
+
189
+ newValue = startValue + incrementValue;
190
+ maxValue = 100;
191
+ module.debug('Incrementing percentage by', startValue, newValue);
192
+ }
193
+ newValue = module.get.normalizedValue(newValue);
194
+ module.set.progress(newValue);
195
+ },
196
+ decrement: function(decrementValue) {
197
+ var
198
+ total = module.get.total(),
199
+ startValue,
200
+ newValue
201
+ ;
202
+ if(total) {
203
+ startValue = module.get.value();
204
+ decrementValue = decrementValue || 1;
205
+ newValue = startValue - decrementValue;
206
+ module.debug('Decrementing value by', decrementValue, startValue);
207
+ }
208
+ else {
209
+ startValue = module.get.percent();
210
+ decrementValue = decrementValue || module.get.randomValue();
211
+ newValue = startValue - decrementValue;
212
+ module.debug('Decrementing percentage by', decrementValue, startValue);
213
+ }
214
+ newValue = module.get.normalizedValue(newValue);
215
+ module.set.progress(newValue);
216
+ },
217
+
218
+ has: {
219
+ progressPoll: function() {
220
+ return module.progressPoll;
221
+ },
222
+ total: function() {
223
+ return (module.get.total() !== false);
224
+ }
225
+ },
226
+
227
+ get: {
228
+ text: function(templateText) {
229
+ var
230
+ value = module.value || 0,
231
+ total = module.total || 0,
232
+ percent = (animating)
233
+ ? module.get.displayPercent()
234
+ : module.percent || 0,
235
+ left = (module.total > 0)
236
+ ? (total - value)
237
+ : (100 - percent)
238
+ ;
239
+ templateText = templateText || '';
240
+ templateText = templateText
241
+ .replace('{value}', value)
242
+ .replace('{total}', total)
243
+ .replace('{left}', left)
244
+ .replace('{percent}', percent)
245
+ ;
246
+ module.verbose('Adding variables to progress bar text', templateText);
247
+ return templateText;
248
+ },
249
+
250
+ normalizedValue: function(value) {
251
+ if(value < 0) {
252
+ module.debug('Value cannot decrement below 0');
253
+ return 0;
254
+ }
255
+ if(module.has.total()) {
256
+ if(value > module.total) {
257
+ module.debug('Value cannot increment above total', module.total);
258
+ return module.total;
259
+ }
260
+ }
261
+ else if(value > 100 ) {
262
+ module.debug('Value cannot increment above 100 percent');
263
+ return 100;
264
+ }
265
+ return value;
266
+ },
267
+
268
+ updateInterval: function() {
269
+ if(settings.updateInterval == 'auto') {
270
+ return settings.duration;
271
+ }
272
+ return settings.updateInterval;
273
+ },
274
+
275
+ randomValue: function() {
276
+ module.debug('Generating random increment percentage');
277
+ return Math.floor((Math.random() * settings.random.max) + settings.random.min);
278
+ },
279
+
280
+ numericValue: function(value) {
281
+ return (typeof value === 'string')
282
+ ? (value.replace(/[^\d.]/g, '') !== '')
283
+ ? +(value.replace(/[^\d.]/g, ''))
284
+ : false
285
+ : value
286
+ ;
287
+ },
288
+
289
+ transitionEnd: function() {
290
+ var
291
+ element = document.createElement('element'),
292
+ transitions = {
293
+ 'transition' :'transitionend',
294
+ 'OTransition' :'oTransitionEnd',
295
+ 'MozTransition' :'transitionend',
296
+ 'WebkitTransition' :'webkitTransitionEnd'
297
+ },
298
+ transition
299
+ ;
300
+ for(transition in transitions){
301
+ if( element.style[transition] !== undefined ){
302
+ return transitions[transition];
303
+ }
304
+ }
305
+ },
306
+
307
+ // gets current displayed percentage (if animating values this is the intermediary value)
308
+ displayPercent: function() {
309
+ var
310
+ barWidth = $bar.width(),
311
+ totalWidth = $module.width(),
312
+ minDisplay = parseInt($bar.css('min-width'), 10),
313
+ displayPercent = (barWidth > minDisplay)
314
+ ? (barWidth / totalWidth * 100)
315
+ : module.percent
316
+ ;
317
+ return (settings.precision > 0)
318
+ ? Math.round(displayPercent * (10 * settings.precision)) / (10 * settings.precision)
319
+ : Math.round(displayPercent)
320
+ ;
321
+ },
322
+
323
+ percent: function() {
324
+ return module.percent || 0;
325
+ },
326
+ value: function() {
327
+ return module.nextValue || module.value || 0;
328
+ },
329
+ total: function() {
330
+ return module.total || false;
331
+ }
332
+ },
333
+
334
+ create: {
335
+ progressPoll: function() {
336
+ module.progressPoll = setTimeout(function() {
337
+ module.update.toNextValue();
338
+ module.remove.progressPoll();
339
+ }, module.get.updateInterval());
340
+ },
341
+ },
342
+
343
+ is: {
344
+ complete: function() {
345
+ return module.is.success() || module.is.warning() || module.is.error();
346
+ },
347
+ success: function() {
348
+ return $module.hasClass(className.success);
349
+ },
350
+ warning: function() {
351
+ return $module.hasClass(className.warning);
352
+ },
353
+ error: function() {
354
+ return $module.hasClass(className.error);
355
+ },
356
+ active: function() {
357
+ return $module.hasClass(className.active);
358
+ },
359
+ visible: function() {
360
+ return $module.is(':visible');
361
+ }
362
+ },
363
+
364
+ remove: {
365
+ progressPoll: function() {
366
+ module.verbose('Removing progress poll timer');
367
+ if(module.progressPoll) {
368
+ clearTimeout(module.progressPoll);
369
+ delete module.progressPoll;
370
+ }
371
+ },
372
+ nextValue: function() {
373
+ module.verbose('Removing progress value stored for next update');
374
+ delete module.nextValue;
375
+ },
376
+ state: function() {
377
+ module.verbose('Removing stored state');
378
+ delete module.total;
379
+ delete module.percent;
380
+ delete module.value;
381
+ },
382
+ active: function() {
383
+ module.verbose('Removing active state');
384
+ $module.removeClass(className.active);
385
+ },
386
+ success: function() {
387
+ module.verbose('Removing success state');
388
+ $module.removeClass(className.success);
389
+ },
390
+ warning: function() {
391
+ module.verbose('Removing warning state');
392
+ $module.removeClass(className.warning);
393
+ },
394
+ error: function() {
395
+ module.verbose('Removing error state');
396
+ $module.removeClass(className.error);
397
+ }
398
+ },
399
+
400
+ set: {
401
+ barWidth: function(value) {
402
+ if(value > 100) {
403
+ module.error(error.tooHigh, value);
404
+ }
405
+ else if (value < 0) {
406
+ module.error(error.tooLow, value);
407
+ }
408
+ else {
409
+ $bar
410
+ .css('width', value + '%')
411
+ ;
412
+ $module
413
+ .attr('data-percent', parseInt(value, 10))
414
+ ;
415
+ }
416
+ },
417
+ duration: function(duration) {
418
+ duration = duration || settings.duration;
419
+ duration = (typeof duration == 'number')
420
+ ? duration + 'ms'
421
+ : duration
422
+ ;
423
+ module.verbose('Setting progress bar transition duration', duration);
424
+ $bar
425
+ .css({
426
+ 'transition-duration': duration
427
+ })
428
+ ;
429
+ },
430
+ percent: function(percent) {
431
+ percent = (typeof percent == 'string')
432
+ ? +(percent.replace('%', ''))
433
+ : percent
434
+ ;
435
+ // round display percentage
436
+ percent = (settings.precision > 0)
437
+ ? Math.round(percent * (10 * settings.precision)) / (10 * settings.precision)
438
+ : Math.round(percent)
439
+ ;
440
+ module.percent = percent;
441
+ if( !module.has.total() ) {
442
+ module.value = (settings.precision > 0)
443
+ ? Math.round( (percent / 100) * module.total * (10 * settings.precision)) / (10 * settings.precision)
444
+ : Math.round( (percent / 100) * module.total * 10) / 10
445
+ ;
446
+ if(settings.limitValues) {
447
+ module.value = (module.value > 100)
448
+ ? 100
449
+ : (module.value < 0)
450
+ ? 0
451
+ : module.value
452
+ ;
453
+ }
454
+ }
455
+ module.set.barWidth(percent);
456
+ module.set.labelInterval();
457
+ module.set.labels();
458
+ settings.onChange.call(element, percent, module.value, module.total);
459
+ },
460
+ labelInterval: function() {
461
+ var
462
+ animationCallback = function() {
463
+ module.verbose('Bar finished animating, removing continuous label updates');
464
+ clearInterval(module.interval);
465
+ animating = false;
466
+ module.set.labels();
467
+ }
468
+ ;
469
+ clearInterval(module.interval);
470
+ module.bind.transitionEnd(animationCallback);
471
+ animating = true;
472
+ module.interval = setInterval(function() {
473
+ var
474
+ isInDOM = $.contains(document.documentElement, element)
475
+ ;
476
+ if(!isInDOM) {
477
+ clearInterval(module.interval);
478
+ animating = false;
479
+ }
480
+ module.set.labels();
481
+ }, settings.framerate);
482
+ },
483
+ labels: function() {
484
+ module.verbose('Setting both bar progress and outer label text');
485
+ module.set.barLabel();
486
+ module.set.state();
487
+ },
488
+ label: function(text) {
489
+ text = text || '';
490
+ if(text) {
491
+ text = module.get.text(text);
492
+ module.verbose('Setting label to text', text);
493
+ $label.text(text);
494
+ }
495
+ },
496
+ state: function(percent) {
497
+ percent = (percent !== undefined)
498
+ ? percent
499
+ : module.percent
500
+ ;
501
+ if(percent === 100) {
502
+ if(settings.autoSuccess && !(module.is.warning() || module.is.error() || module.is.success())) {
503
+ module.set.success();
504
+ module.debug('Automatically triggering success at 100%');
505
+ }
506
+ else {
507
+ module.verbose('Reached 100% removing active state');
508
+ module.remove.active();
509
+ module.remove.progressPoll();
510
+ }
511
+ }
512
+ else if(percent > 0) {
513
+ module.verbose('Adjusting active progress bar label', percent);
514
+ module.set.active();
515
+ }
516
+ else {
517
+ module.remove.active();
518
+ module.set.label(settings.text.active);
519
+ }
520
+ },
521
+ barLabel: function(text) {
522
+ if(text !== undefined) {
523
+ $progress.text( module.get.text(text) );
524
+ }
525
+ else if(settings.label == 'ratio' && module.total) {
526
+ module.verbose('Adding ratio to bar label');
527
+ $progress.text( module.get.text(settings.text.ratio) );
528
+ }
529
+ else if(settings.label == 'percent') {
530
+ module.verbose('Adding percentage to bar label');
531
+ $progress.text( module.get.text(settings.text.percent) );
532
+ }
533
+ },
534
+ active: function(text) {
535
+ text = text || settings.text.active;
536
+ module.debug('Setting active state');
537
+ if(settings.showActivity && !module.is.active() ) {
538
+ $module.addClass(className.active);
539
+ }
540
+ module.remove.warning();
541
+ module.remove.error();
542
+ module.remove.success();
543
+ text = settings.onLabelUpdate('active', text, module.value, module.total);
544
+ if(text) {
545
+ module.set.label(text);
546
+ }
547
+ module.bind.transitionEnd(function() {
548
+ settings.onActive.call(element, module.value, module.total);
549
+ });
550
+ },
551
+ success : function(text) {
552
+ text = text || settings.text.success || settings.text.active;
553
+ module.debug('Setting success state');
554
+ $module.addClass(className.success);
555
+ module.remove.active();
556
+ module.remove.warning();
557
+ module.remove.error();
558
+ module.complete();
559
+ if(settings.text.success) {
560
+ text = settings.onLabelUpdate('success', text, module.value, module.total);
561
+ module.set.label(text);
562
+ }
563
+ else {
564
+ text = settings.onLabelUpdate('active', text, module.value, module.total);
565
+ module.set.label(text);
566
+ }
567
+ module.bind.transitionEnd(function() {
568
+ settings.onSuccess.call(element, module.total);
569
+ });
570
+ },
571
+ warning : function(text) {
572
+ text = text || settings.text.warning;
573
+ module.debug('Setting warning state');
574
+ $module.addClass(className.warning);
575
+ module.remove.active();
576
+ module.remove.success();
577
+ module.remove.error();
578
+ module.complete();
579
+ text = settings.onLabelUpdate('warning', text, module.value, module.total);
580
+ if(text) {
581
+ module.set.label(text);
582
+ }
583
+ module.bind.transitionEnd(function() {
584
+ settings.onWarning.call(element, module.value, module.total);
585
+ });
586
+ },
587
+ error : function(text) {
588
+ text = text || settings.text.error;
589
+ module.debug('Setting error state');
590
+ $module.addClass(className.error);
591
+ module.remove.active();
592
+ module.remove.success();
593
+ module.remove.warning();
594
+ module.complete();
595
+ text = settings.onLabelUpdate('error', text, module.value, module.total);
596
+ if(text) {
597
+ module.set.label(text);
598
+ }
599
+ module.bind.transitionEnd(function() {
600
+ settings.onError.call(element, module.value, module.total);
601
+ });
602
+ },
603
+ transitionEvent: function() {
604
+ transitionEnd = module.get.transitionEnd();
605
+ },
606
+ total: function(totalValue) {
607
+ module.total = totalValue;
608
+ },
609
+ value: function(value) {
610
+ module.value = value;
611
+ },
612
+ progress: function(value) {
613
+ if(!module.has.progressPoll()) {
614
+ module.debug('First update in progress update interval, immediately updating', value);
615
+ module.update.progress(value);
616
+ module.create.progressPoll();
617
+ }
618
+ else {
619
+ module.debug('Updated within interval, setting next update to use new value', value);
620
+ module.set.nextValue(value);
621
+ }
622
+ },
623
+ nextValue: function(value) {
624
+ module.nextValue = value;
625
+ }
626
+ },
627
+
628
+ update: {
629
+ toNextValue: function() {
630
+ var
631
+ nextValue = module.nextValue
632
+ ;
633
+ if(nextValue) {
634
+ module.debug('Update interval complete using last updated value', nextValue);
635
+ module.update.progress(nextValue);
636
+ module.remove.nextValue();
637
+ }
638
+ },
639
+ progress: function(value) {
640
+ var
641
+ percentComplete
642
+ ;
643
+ value = module.get.numericValue(value);
644
+ if(value === false) {
645
+ module.error(error.nonNumeric, value);
646
+ }
647
+ value = module.get.normalizedValue(value);
648
+ if( module.has.total() ) {
649
+ module.set.value(value);
650
+ percentComplete = (value / module.total) * 100;
651
+ module.debug('Calculating percent complete from total', percentComplete);
652
+ module.set.percent( percentComplete );
653
+ }
654
+ else {
655
+ percentComplete = value;
656
+ module.debug('Setting value to exact percentage value', percentComplete);
657
+ module.set.percent( percentComplete );
658
+ }
659
+ }
660
+ },
661
+
662
+ setting: function(name, value) {
663
+ module.debug('Changing setting', name, value);
664
+ if( $.isPlainObject(name) ) {
665
+ $.extend(true, settings, name);
666
+ }
667
+ else if(value !== undefined) {
668
+ if($.isPlainObject(settings[name])) {
669
+ $.extend(true, settings[name], value);
670
+ }
671
+ else {
672
+ settings[name] = value;
673
+ }
674
+ }
675
+ else {
676
+ return settings[name];
677
+ }
678
+ },
679
+ internal: function(name, value) {
680
+ if( $.isPlainObject(name) ) {
681
+ $.extend(true, module, name);
682
+ }
683
+ else if(value !== undefined) {
684
+ module[name] = value;
685
+ }
686
+ else {
687
+ return module[name];
688
+ }
689
+ },
690
+ debug: function() {
691
+ if(!settings.silent && settings.debug) {
692
+ if(settings.performance) {
693
+ module.performance.log(arguments);
694
+ }
695
+ else {
696
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
697
+ module.debug.apply(console, arguments);
698
+ }
699
+ }
700
+ },
701
+ verbose: function() {
702
+ if(!settings.silent && settings.verbose && settings.debug) {
703
+ if(settings.performance) {
704
+ module.performance.log(arguments);
705
+ }
706
+ else {
707
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
708
+ module.verbose.apply(console, arguments);
709
+ }
710
+ }
711
+ },
712
+ error: function() {
713
+ if(!settings.silent) {
714
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
715
+ module.error.apply(console, arguments);
716
+ }
717
+ },
718
+ performance: {
719
+ log: function(message) {
720
+ var
721
+ currentTime,
722
+ executionTime,
723
+ previousTime
724
+ ;
725
+ if(settings.performance) {
726
+ currentTime = new Date().getTime();
727
+ previousTime = time || currentTime;
728
+ executionTime = currentTime - previousTime;
729
+ time = currentTime;
730
+ performance.push({
731
+ 'Name' : message[0],
732
+ 'Arguments' : [].slice.call(message, 1) || '',
733
+ 'Element' : element,
734
+ 'Execution Time' : executionTime
735
+ });
736
+ }
737
+ clearTimeout(module.performance.timer);
738
+ module.performance.timer = setTimeout(module.performance.display, 500);
739
+ },
740
+ display: function() {
741
+ var
742
+ title = settings.name + ':',
743
+ totalTime = 0
744
+ ;
745
+ time = false;
746
+ clearTimeout(module.performance.timer);
747
+ $.each(performance, function(index, data) {
748
+ totalTime += data['Execution Time'];
749
+ });
750
+ title += ' ' + totalTime + 'ms';
751
+ if(moduleSelector) {
752
+ title += ' \'' + moduleSelector + '\'';
753
+ }
754
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
755
+ console.groupCollapsed(title);
756
+ if(console.table) {
757
+ console.table(performance);
758
+ }
759
+ else {
760
+ $.each(performance, function(index, data) {
761
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
762
+ });
763
+ }
764
+ console.groupEnd();
765
+ }
766
+ performance = [];
767
+ }
768
+ },
769
+ invoke: function(query, passedArguments, context) {
770
+ var
771
+ object = instance,
772
+ maxDepth,
773
+ found,
774
+ response
775
+ ;
776
+ passedArguments = passedArguments || queryArguments;
777
+ context = element || context;
778
+ if(typeof query == 'string' && object !== undefined) {
779
+ query = query.split(/[\. ]/);
780
+ maxDepth = query.length - 1;
781
+ $.each(query, function(depth, value) {
782
+ var camelCaseValue = (depth != maxDepth)
783
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
784
+ : query
785
+ ;
786
+ if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
787
+ object = object[camelCaseValue];
788
+ }
789
+ else if( object[camelCaseValue] !== undefined ) {
790
+ found = object[camelCaseValue];
791
+ return false;
792
+ }
793
+ else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
794
+ object = object[value];
795
+ }
796
+ else if( object[value] !== undefined ) {
797
+ found = object[value];
798
+ return false;
799
+ }
800
+ else {
801
+ module.error(error.method, query);
802
+ return false;
803
+ }
804
+ });
805
+ }
806
+ if ( $.isFunction( found ) ) {
807
+ response = found.apply(context, passedArguments);
808
+ }
809
+ else if(found !== undefined) {
810
+ response = found;
811
+ }
812
+ if($.isArray(returnedValue)) {
813
+ returnedValue.push(response);
814
+ }
815
+ else if(returnedValue !== undefined) {
816
+ returnedValue = [returnedValue, response];
817
+ }
818
+ else if(response !== undefined) {
819
+ returnedValue = response;
820
+ }
821
+ return found;
822
+ }
823
+ };
824
+
825
+ if(methodInvoked) {
826
+ if(instance === undefined) {
827
+ module.initialize();
828
+ }
829
+ module.invoke(query);
830
+ }
831
+ else {
832
+ if(instance !== undefined) {
833
+ instance.invoke('destroy');
834
+ }
835
+ module.initialize();
836
+ }
837
+ })
838
+ ;
839
+
840
+ return (returnedValue !== undefined)
841
+ ? returnedValue
842
+ : this
843
+ ;
844
+ };
845
+
846
+ $.fn.progress.settings = {
847
+
848
+ name : 'Progress',
849
+ namespace : 'progress',
850
+
851
+ silent : false,
852
+ debug : false,
853
+ verbose : false,
854
+ performance : true,
855
+
856
+ random : {
857
+ min : 2,
858
+ max : 5
859
+ },
860
+
861
+ duration : 300,
862
+
863
+ updateInterval : 'auto',
864
+
865
+ autoSuccess : true,
866
+ showActivity : true,
867
+ limitValues : true,
868
+
869
+ label : 'percent',
870
+ precision : 0,
871
+ framerate : (1000 / 30), /// 30 fps
872
+
873
+ percent : false,
874
+ total : false,
875
+ value : false,
876
+
877
+ // delay in ms for fail safe animation callback
878
+ failSafeDelay : 100,
879
+
880
+ onLabelUpdate : function(state, text, value, total){
881
+ return text;
882
+ },
883
+ onChange : function(percent, value, total){},
884
+ onSuccess : function(total){},
885
+ onActive : function(value, total){},
886
+ onError : function(value, total){},
887
+ onWarning : function(value, total){},
888
+
889
+ error : {
890
+ method : 'The method you called is not defined.',
891
+ nonNumeric : 'Progress value is non numeric',
892
+ tooHigh : 'Value specified is above 100%',
893
+ tooLow : 'Value specified is below 0%'
894
+ },
895
+
896
+ regExp: {
897
+ variable: /\{\$*[A-z0-9]+\}/g
898
+ },
899
+
900
+ metadata: {
901
+ percent : 'percent',
902
+ total : 'total',
903
+ value : 'value'
904
+ },
905
+
906
+ selector : {
907
+ bar : '> .bar',
908
+ label : '> .label',
909
+ progress : '.bar > .progress'
910
+ },
911
+
912
+ text : {
913
+ active : false,
914
+ error : false,
915
+ success : false,
916
+ warning : false,
917
+ percent : '{percent}%',
918
+ ratio : '{value} of {total}'
919
+ },
920
+
921
+ className : {
922
+ active : 'active',
923
+ error : 'error',
924
+ success : 'success',
925
+ warning : 'warning'
926
+ }
927
+
928
+ };
929
+
930
+
931
+ })( jQuery, window, document );