integral 1.0.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 (761) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +105 -0
  4. data/Rakefile +22 -0
  5. data/app/assets/images/integral/backend/data-unavailable.png +0 -0
  6. data/app/assets/images/integral/backend/logo.png +0 -0
  7. data/app/assets/images/integral/defaults/no_image_available.jpg +0 -0
  8. data/app/assets/images/integral/defaults/user_avatar.jpg +0 -0
  9. data/app/assets/images/integral/image-not-set.png +0 -0
  10. data/app/assets/images/integral/posts-hero-banner.jpg +0 -0
  11. data/app/assets/javascripts/ckeditor/loader.js.erb +6 -0
  12. data/app/assets/javascripts/ckeditor/my_config.js.erb +154 -0
  13. data/app/assets/javascripts/ckeditor/my_contents.sass +22 -0
  14. data/app/assets/javascripts/ckeditor/my_javascript.js +12 -0
  15. data/app/assets/javascripts/ckeditor/my_styles.js +5 -0
  16. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/az.js +8 -0
  17. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/bg.js +8 -0
  18. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/ca.js +8 -0
  19. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/cs.js +8 -0
  20. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/da.js +8 -0
  21. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/de-ch.js +8 -0
  22. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/de.js +8 -0
  23. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/el.js +8 -0
  24. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/en-au.js +8 -0
  25. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/en.js +8 -0
  26. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/eo.js +8 -0
  27. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/es-mx.js +8 -0
  28. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/es.js +8 -0
  29. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/eu.js +8 -0
  30. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/fr.js +8 -0
  31. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/gl.js +8 -0
  32. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/hr.js +8 -0
  33. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/hu.js +8 -0
  34. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/it.js +8 -0
  35. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/ja.js +8 -0
  36. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/km.js +8 -0
  37. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/ko.js +8 -0
  38. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/ku.js +8 -0
  39. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/mk.js +8 -0
  40. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/nb.js +8 -0
  41. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/nl.js +8 -0
  42. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/oc.js +8 -0
  43. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/pl.js +8 -0
  44. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/pt-br.js +8 -0
  45. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/pt.js +8 -0
  46. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/ro.js +8 -0
  47. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/ru.js +8 -0
  48. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/sk.js +8 -0
  49. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/sq.js +8 -0
  50. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/sv.js +8 -0
  51. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/tr.js +8 -0
  52. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/ug.js +8 -0
  53. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/uk.js +8 -0
  54. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/vi.js +8 -0
  55. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/zh-cn.js +8 -0
  56. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/zh.js +8 -0
  57. data/app/assets/javascripts/ckeditor/plugins/autoembed/plugin.js +218 -0
  58. data/app/assets/javascripts/ckeditor/plugins/autogrow/plugin.js +232 -0
  59. data/app/assets/javascripts/ckeditor/plugins/autogrow/samples/autogrow.html +102 -0
  60. data/app/assets/javascripts/ckeditor/plugins/autolink/plugin.js +69 -0
  61. data/app/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.min.css +1 -0
  62. data/app/assets/javascripts/ckeditor/plugins/codemirror/icons/autocomplete.png +0 -0
  63. data/app/assets/javascripts/ckeditor/plugins/codemirror/icons/autoformat.png +0 -0
  64. data/app/assets/javascripts/ckeditor/plugins/codemirror/icons/commentselectedrange.png +0 -0
  65. data/app/assets/javascripts/ckeditor/plugins/codemirror/icons/searchcode.png +0 -0
  66. data/app/assets/javascripts/ckeditor/plugins/codemirror/icons/uncommentselectedrange.png +0 -0
  67. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/beautify.min.js +2 -0
  68. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.min.js +2 -0
  69. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.search.min.js +1 -0
  70. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.min.js +6 -0
  71. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.bbcode.min.js +1 -0
  72. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.bbcodemixed.min.js +1 -0
  73. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.htmlmixed.min.js +2 -0
  74. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.javascript.min.js +1 -0
  75. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.php.min.js +3 -0
  76. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.twig.min.js +1 -0
  77. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/af.js +12 -0
  78. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/ar.js +12 -0
  79. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/bg.js +12 -0
  80. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/bn.js +12 -0
  81. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/bs.js +12 -0
  82. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/ca.js +12 -0
  83. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/cs.js +12 -0
  84. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/cy.js +12 -0
  85. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/da.js +12 -0
  86. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/de.js +12 -0
  87. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/el.js +12 -0
  88. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/en-au.js +12 -0
  89. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/en-ca.js +12 -0
  90. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/en-gb.js +12 -0
  91. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/en.js +12 -0
  92. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/eo.js +12 -0
  93. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/es.js +12 -0
  94. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/et.js +12 -0
  95. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/eu.js +12 -0
  96. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/fa.js +12 -0
  97. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/fi.js +12 -0
  98. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/fo.js +12 -0
  99. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/fr-ca.js +12 -0
  100. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/fr.js +12 -0
  101. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/gl.js +12 -0
  102. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/gu.js +12 -0
  103. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/he.js +12 -0
  104. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/hi.js +12 -0
  105. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/hr.js +12 -0
  106. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/hu.js +12 -0
  107. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/is.js +12 -0
  108. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/it.js +12 -0
  109. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/ja.js +12 -0
  110. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/ka.js +12 -0
  111. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/km.js +12 -0
  112. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/ko.js +12 -0
  113. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/ku.js +12 -0
  114. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/lt.js +12 -0
  115. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/lv.js +12 -0
  116. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/mk.js +12 -0
  117. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/mn.js +12 -0
  118. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/ms.js +12 -0
  119. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/nb.js +12 -0
  120. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/nl.js +12 -0
  121. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/no.js +12 -0
  122. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/pl.js +12 -0
  123. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/pt-br.js +12 -0
  124. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/pt.js +12 -0
  125. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/ro.js +12 -0
  126. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/ru.js +12 -0
  127. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/sk.js +12 -0
  128. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/sl.js +12 -0
  129. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/sr-latn.js +12 -0
  130. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/sr.js +12 -0
  131. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/sv.js +12 -0
  132. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/th.js +12 -0
  133. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/tr.js +12 -0
  134. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/ug.js +12 -0
  135. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/uk.js +12 -0
  136. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/vi.js +12 -0
  137. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/zh-cn.js +12 -0
  138. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/zh.js +12 -0
  139. data/app/assets/javascripts/ckeditor/plugins/codemirror/plugin.js +1311 -0
  140. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/3024-day.css +41 -0
  141. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/3024-night.css +39 -0
  142. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/abcdef.css +32 -0
  143. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/ambiance-mobile.css +5 -0
  144. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/ambiance.css +74 -0
  145. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/base16-dark.css +38 -0
  146. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/base16-light.css +38 -0
  147. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/bespin.css +34 -0
  148. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/blackboard.css +32 -0
  149. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/cobalt.css +25 -0
  150. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/colorforth.css +33 -0
  151. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/dracula.css +40 -0
  152. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/duotone-dark.css +35 -0
  153. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/duotone-light.css +36 -0
  154. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/eclipse.css +23 -0
  155. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/elegant.css +13 -0
  156. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/erlang-dark.css +34 -0
  157. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/hopscotch.css +34 -0
  158. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/icecoder.css +43 -0
  159. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/isotope.css +34 -0
  160. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/lesser-dark.css +47 -0
  161. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/liquibyte.css +95 -0
  162. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/material.css +53 -0
  163. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/mbo.css +37 -0
  164. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/mdn-like.css +46 -0
  165. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/midnight.css +43 -0
  166. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/monokai.css +36 -0
  167. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/neat.css +12 -0
  168. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/neo.css +43 -0
  169. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/night.css +27 -0
  170. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/panda-syntax.css +85 -0
  171. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/paraiso-dark.css +38 -0
  172. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/paraiso-light.css +38 -0
  173. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/pastel-on-dark.css +52 -0
  174. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/railscasts.css +34 -0
  175. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/rubyblue.css +25 -0
  176. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/seti.css +44 -0
  177. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/solarized.css +168 -0
  178. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/the-matrix.css +30 -0
  179. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/tomorrow-night-bright.css +35 -0
  180. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/tomorrow-night-eighties.css +38 -0
  181. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/ttcn.css +64 -0
  182. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/twilight.css +32 -0
  183. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/vibrant-ink.css +34 -0
  184. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/xq-dark.css +53 -0
  185. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/xq-light.css +43 -0
  186. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/yeti.css +44 -0
  187. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/zenburn.css +37 -0
  188. data/app/assets/javascripts/ckeditor/plugins/embed/icons/embed.png +0 -0
  189. data/app/assets/javascripts/ckeditor/plugins/embed/icons/hidpi/embed.png +0 -0
  190. data/app/assets/javascripts/ckeditor/plugins/embed/plugin.js +105 -0
  191. data/app/assets/javascripts/ckeditor/plugins/embedbase/dialogs/embedbase.js +99 -0
  192. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/az.js +15 -0
  193. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/bg.js +15 -0
  194. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/ca.js +15 -0
  195. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/cs.js +15 -0
  196. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/da.js +15 -0
  197. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/de-ch.js +15 -0
  198. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/de.js +15 -0
  199. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/en-au.js +15 -0
  200. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/en.js +15 -0
  201. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/eo.js +15 -0
  202. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/es-mx.js +15 -0
  203. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/es.js +15 -0
  204. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/eu.js +15 -0
  205. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/fr.js +15 -0
  206. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/gl.js +15 -0
  207. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/hr.js +15 -0
  208. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/hu.js +15 -0
  209. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/id.js +15 -0
  210. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/it.js +15 -0
  211. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/ja.js +15 -0
  212. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/ko.js +15 -0
  213. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/ku.js +15 -0
  214. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/nb.js +15 -0
  215. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/nl.js +15 -0
  216. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/oc.js +15 -0
  217. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/pl.js +15 -0
  218. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/pt-br.js +15 -0
  219. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/pt.js +15 -0
  220. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/ro.js +15 -0
  221. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/ru.js +15 -0
  222. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/sk.js +15 -0
  223. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/sq.js +15 -0
  224. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/sv.js +15 -0
  225. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/tr.js +15 -0
  226. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/ug.js +15 -0
  227. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/uk.js +15 -0
  228. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/zh-cn.js +15 -0
  229. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/zh.js +15 -0
  230. data/app/assets/javascripts/ckeditor/plugins/embedbase/plugin.js +652 -0
  231. data/app/assets/javascripts/ckeditor/plugins/embedjs/plugin.js +110 -0
  232. data/app/assets/javascripts/ckeditor/plugins/lineutils/dev/dnd.html +172 -0
  233. data/app/assets/javascripts/ckeditor/plugins/lineutils/dev/magicfinger.html +285 -0
  234. data/app/assets/javascripts/ckeditor/plugins/lineutils/plugin.js +1018 -0
  235. data/app/assets/javascripts/ckeditor/plugins/notification/lang/cs.js +7 -0
  236. data/app/assets/javascripts/ckeditor/plugins/notification/lang/da.js +7 -0
  237. data/app/assets/javascripts/ckeditor/plugins/notification/lang/de-ch.js +7 -0
  238. data/app/assets/javascripts/ckeditor/plugins/notification/lang/de.js +7 -0
  239. data/app/assets/javascripts/ckeditor/plugins/notification/lang/en.js +7 -0
  240. data/app/assets/javascripts/ckeditor/plugins/notification/lang/eo.js +7 -0
  241. data/app/assets/javascripts/ckeditor/plugins/notification/lang/eu.js +7 -0
  242. data/app/assets/javascripts/ckeditor/plugins/notification/lang/fr.js +7 -0
  243. data/app/assets/javascripts/ckeditor/plugins/notification/lang/gl.js +7 -0
  244. data/app/assets/javascripts/ckeditor/plugins/notification/lang/id.js +7 -0
  245. data/app/assets/javascripts/ckeditor/plugins/notification/lang/it.js +7 -0
  246. data/app/assets/javascripts/ckeditor/plugins/notification/lang/km.js +7 -0
  247. data/app/assets/javascripts/ckeditor/plugins/notification/lang/ko.js +7 -0
  248. data/app/assets/javascripts/ckeditor/plugins/notification/lang/ku.js +7 -0
  249. data/app/assets/javascripts/ckeditor/plugins/notification/lang/nb.js +7 -0
  250. data/app/assets/javascripts/ckeditor/plugins/notification/lang/nl.js +7 -0
  251. data/app/assets/javascripts/ckeditor/plugins/notification/lang/pl.js +7 -0
  252. data/app/assets/javascripts/ckeditor/plugins/notification/lang/pt-br.js +7 -0
  253. data/app/assets/javascripts/ckeditor/plugins/notification/lang/pt.js +7 -0
  254. data/app/assets/javascripts/ckeditor/plugins/notification/lang/ru.js +7 -0
  255. data/app/assets/javascripts/ckeditor/plugins/notification/lang/sv.js +7 -0
  256. data/app/assets/javascripts/ckeditor/plugins/notification/lang/tr.js +7 -0
  257. data/app/assets/javascripts/ckeditor/plugins/notification/lang/ug.js +7 -0
  258. data/app/assets/javascripts/ckeditor/plugins/notification/lang/uk.js +7 -0
  259. data/app/assets/javascripts/ckeditor/plugins/notification/lang/zh-cn.js +7 -0
  260. data/app/assets/javascripts/ckeditor/plugins/notification/lang/zh.js +7 -0
  261. data/app/assets/javascripts/ckeditor/plugins/notification/plugin.js +923 -0
  262. data/app/assets/javascripts/ckeditor/plugins/notificationaggregator/plugin.js +548 -0
  263. data/app/assets/javascripts/ckeditor/plugins/placeholder/dev/placeholder.html +60 -0
  264. data/app/assets/javascripts/ckeditor/plugins/placeholder/dialogs/placeholder.js +49 -0
  265. data/app/assets/javascripts/ckeditor/plugins/placeholder/icons/hidpi/placeholder.png +0 -0
  266. data/app/assets/javascripts/ckeditor/plugins/placeholder/icons/placeholder.png +0 -0
  267. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/af.js +12 -0
  268. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ar.js +12 -0
  269. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/az.js +12 -0
  270. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/bg.js +12 -0
  271. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ca.js +12 -0
  272. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/cs.js +12 -0
  273. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/cy.js +12 -0
  274. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/da.js +12 -0
  275. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/de-ch.js +12 -0
  276. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/de.js +12 -0
  277. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/el.js +12 -0
  278. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/en-gb.js +12 -0
  279. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/en.js +12 -0
  280. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/eo.js +12 -0
  281. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/es-mx.js +12 -0
  282. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/es.js +12 -0
  283. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/et.js +12 -0
  284. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/eu.js +12 -0
  285. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/fa.js +12 -0
  286. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/fi.js +12 -0
  287. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/fr-ca.js +12 -0
  288. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/fr.js +12 -0
  289. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/gl.js +12 -0
  290. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/he.js +12 -0
  291. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/hr.js +12 -0
  292. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/hu.js +12 -0
  293. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/id.js +12 -0
  294. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/it.js +12 -0
  295. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ja.js +12 -0
  296. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/km.js +12 -0
  297. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ko.js +12 -0
  298. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ku.js +12 -0
  299. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/lv.js +12 -0
  300. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/nb.js +12 -0
  301. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/nl.js +12 -0
  302. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/no.js +12 -0
  303. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/oc.js +12 -0
  304. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/pl.js +12 -0
  305. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/pt-br.js +12 -0
  306. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/pt.js +12 -0
  307. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ru.js +12 -0
  308. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/si.js +12 -0
  309. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/sk.js +12 -0
  310. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/sl.js +12 -0
  311. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/sq.js +12 -0
  312. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/sv.js +12 -0
  313. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/th.js +12 -0
  314. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/tr.js +12 -0
  315. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/tt.js +12 -0
  316. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ug.js +12 -0
  317. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/uk.js +12 -0
  318. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/vi.js +12 -0
  319. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/zh-cn.js +12 -0
  320. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/zh.js +12 -0
  321. data/app/assets/javascripts/ckeditor/plugins/placeholder/plugin.js +99 -0
  322. data/app/assets/javascripts/ckeditor/plugins/placeholder/samples/placeholder.html +75 -0
  323. data/app/assets/javascripts/ckeditor/plugins/strinsert/README.md +76 -0
  324. data/app/assets/javascripts/ckeditor/plugins/strinsert/bower.json +16 -0
  325. data/app/assets/javascripts/ckeditor/plugins/strinsert/plugin.js +107 -0
  326. data/app/assets/javascripts/ckeditor/plugins/widget/dev/assets/contents.css +23 -0
  327. data/app/assets/javascripts/ckeditor/plugins/widget/dev/assets/sample.jpg +0 -0
  328. data/app/assets/javascripts/ckeditor/plugins/widget/dev/assets/simplebox/contents.css +36 -0
  329. data/app/assets/javascripts/ckeditor/plugins/widget/dev/assets/simplebox/dialogs/simplebox.js +51 -0
  330. data/app/assets/javascripts/ckeditor/plugins/widget/dev/assets/simplebox/icons/simplebox.png +0 -0
  331. data/app/assets/javascripts/ckeditor/plugins/widget/dev/assets/simplebox/plugin.js +114 -0
  332. data/app/assets/javascripts/ckeditor/plugins/widget/dev/console.js +131 -0
  333. data/app/assets/javascripts/ckeditor/plugins/widget/dev/nestedwidgets.html +134 -0
  334. data/app/assets/javascripts/ckeditor/plugins/widget/dev/widgetstyles.html +144 -0
  335. data/app/assets/javascripts/ckeditor/plugins/widget/images/handle.png +0 -0
  336. data/app/assets/javascripts/ckeditor/plugins/widget/lang/af.js +8 -0
  337. data/app/assets/javascripts/ckeditor/plugins/widget/lang/ar.js +8 -0
  338. data/app/assets/javascripts/ckeditor/plugins/widget/lang/az.js +8 -0
  339. data/app/assets/javascripts/ckeditor/plugins/widget/lang/bg.js +8 -0
  340. data/app/assets/javascripts/ckeditor/plugins/widget/lang/ca.js +8 -0
  341. data/app/assets/javascripts/ckeditor/plugins/widget/lang/cs.js +8 -0
  342. data/app/assets/javascripts/ckeditor/plugins/widget/lang/cy.js +8 -0
  343. data/app/assets/javascripts/ckeditor/plugins/widget/lang/da.js +8 -0
  344. data/app/assets/javascripts/ckeditor/plugins/widget/lang/de-ch.js +8 -0
  345. data/app/assets/javascripts/ckeditor/plugins/widget/lang/de.js +8 -0
  346. data/app/assets/javascripts/ckeditor/plugins/widget/lang/el.js +8 -0
  347. data/app/assets/javascripts/ckeditor/plugins/widget/lang/en-gb.js +8 -0
  348. data/app/assets/javascripts/ckeditor/plugins/widget/lang/en.js +8 -0
  349. data/app/assets/javascripts/ckeditor/plugins/widget/lang/eo.js +8 -0
  350. data/app/assets/javascripts/ckeditor/plugins/widget/lang/es-mx.js +8 -0
  351. data/app/assets/javascripts/ckeditor/plugins/widget/lang/es.js +8 -0
  352. data/app/assets/javascripts/ckeditor/plugins/widget/lang/eu.js +8 -0
  353. data/app/assets/javascripts/ckeditor/plugins/widget/lang/fa.js +8 -0
  354. data/app/assets/javascripts/ckeditor/plugins/widget/lang/fi.js +8 -0
  355. data/app/assets/javascripts/ckeditor/plugins/widget/lang/fr.js +8 -0
  356. data/app/assets/javascripts/ckeditor/plugins/widget/lang/gl.js +8 -0
  357. data/app/assets/javascripts/ckeditor/plugins/widget/lang/he.js +8 -0
  358. data/app/assets/javascripts/ckeditor/plugins/widget/lang/hr.js +8 -0
  359. data/app/assets/javascripts/ckeditor/plugins/widget/lang/hu.js +8 -0
  360. data/app/assets/javascripts/ckeditor/plugins/widget/lang/id.js +8 -0
  361. data/app/assets/javascripts/ckeditor/plugins/widget/lang/it.js +8 -0
  362. data/app/assets/javascripts/ckeditor/plugins/widget/lang/ja.js +8 -0
  363. data/app/assets/javascripts/ckeditor/plugins/widget/lang/km.js +8 -0
  364. data/app/assets/javascripts/ckeditor/plugins/widget/lang/ko.js +8 -0
  365. data/app/assets/javascripts/ckeditor/plugins/widget/lang/ku.js +8 -0
  366. data/app/assets/javascripts/ckeditor/plugins/widget/lang/lv.js +8 -0
  367. data/app/assets/javascripts/ckeditor/plugins/widget/lang/nb.js +8 -0
  368. data/app/assets/javascripts/ckeditor/plugins/widget/lang/nl.js +8 -0
  369. data/app/assets/javascripts/ckeditor/plugins/widget/lang/no.js +8 -0
  370. data/app/assets/javascripts/ckeditor/plugins/widget/lang/oc.js +8 -0
  371. data/app/assets/javascripts/ckeditor/plugins/widget/lang/pl.js +8 -0
  372. data/app/assets/javascripts/ckeditor/plugins/widget/lang/pt-br.js +8 -0
  373. data/app/assets/javascripts/ckeditor/plugins/widget/lang/pt.js +8 -0
  374. data/app/assets/javascripts/ckeditor/plugins/widget/lang/ru.js +8 -0
  375. data/app/assets/javascripts/ckeditor/plugins/widget/lang/sk.js +8 -0
  376. data/app/assets/javascripts/ckeditor/plugins/widget/lang/sl.js +8 -0
  377. data/app/assets/javascripts/ckeditor/plugins/widget/lang/sq.js +8 -0
  378. data/app/assets/javascripts/ckeditor/plugins/widget/lang/sv.js +8 -0
  379. data/app/assets/javascripts/ckeditor/plugins/widget/lang/tr.js +8 -0
  380. data/app/assets/javascripts/ckeditor/plugins/widget/lang/tt.js +8 -0
  381. data/app/assets/javascripts/ckeditor/plugins/widget/lang/ug.js +8 -0
  382. data/app/assets/javascripts/ckeditor/plugins/widget/lang/uk.js +8 -0
  383. data/app/assets/javascripts/ckeditor/plugins/widget/lang/vi.js +8 -0
  384. data/app/assets/javascripts/ckeditor/plugins/widget/lang/zh-cn.js +8 -0
  385. data/app/assets/javascripts/ckeditor/plugins/widget/lang/zh.js +8 -0
  386. data/app/assets/javascripts/ckeditor/plugins/widget/plugin.js +4147 -0
  387. data/app/assets/javascripts/ckeditor/plugins/widgetselection/plugin.js +366 -0
  388. data/app/assets/javascripts/ckeditor/plugins/wordcount/css/wordcount.css +3 -0
  389. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/ar.js +11 -0
  390. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/ca.js +13 -0
  391. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/da.js +13 -0
  392. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/de.js +13 -0
  393. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/el.js +13 -0
  394. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/en.js +13 -0
  395. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/es.js +13 -0
  396. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/fi.js +14 -0
  397. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/fr.js +11 -0
  398. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/he.js +13 -0
  399. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/hr.js +13 -0
  400. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/it.js +14 -0
  401. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/ja.js +14 -0
  402. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/jp.js +13 -0
  403. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/nl.js +13 -0
  404. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/no.js +10 -0
  405. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/pl.js +13 -0
  406. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/pt-br.js +13 -0
  407. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/pt.js +9 -0
  408. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/ru.js +13 -0
  409. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/sv.js +13 -0
  410. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/tr.js +13 -0
  411. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/zh-cn.js +13 -0
  412. data/app/assets/javascripts/ckeditor/plugins/wordcount/plugin.js +407 -0
  413. data/app/assets/javascripts/ckeditor/plugins/wordcount/samples/wordcount.html +61 -0
  414. data/app/assets/javascripts/ckeditor/plugins/wordcount/samples/wordcountWithMaxCount.html +110 -0
  415. data/app/assets/javascripts/integral/backend.js +268 -0
  416. data/app/assets/javascripts/integral/backend/extensions.js +1 -0
  417. data/app/assets/javascripts/integral/backend/support/Chart.bundle.min.js +10 -0
  418. data/app/assets/javascripts/integral/frontend.js +60 -0
  419. data/app/assets/javascripts/integral/support/character_counter.js +67 -0
  420. data/app/assets/javascripts/integral/support/chart_manager.coffee +145 -0
  421. data/app/assets/javascripts/integral/support/click_to_copy.coffee +28 -0
  422. data/app/assets/javascripts/integral/support/confirm_modal.coffee +58 -0
  423. data/app/assets/javascripts/integral/support/date_picker.coffee +83 -0
  424. data/app/assets/javascripts/integral/support/date_picker/picker.date.js +1435 -0
  425. data/app/assets/javascripts/integral/support/date_picker/picker.js +1132 -0
  426. data/app/assets/javascripts/integral/support/gallery.coffee +82 -0
  427. data/app/assets/javascripts/integral/support/google_analytics.coffee +23 -0
  428. data/app/assets/javascripts/integral/support/grid.coffee +92 -0
  429. data/app/assets/javascripts/integral/support/header_anchors.coffee +22 -0
  430. data/app/assets/javascripts/integral/support/image-preview.coffee +14 -0
  431. data/app/assets/javascripts/integral/support/image_selector.coffee +43 -0
  432. data/app/assets/javascripts/integral/support/image_uploader.coffee +59 -0
  433. data/app/assets/javascripts/integral/support/lib/html.sortable.js +691 -0
  434. data/app/assets/javascripts/integral/support/lib/jquery.are-you-sure.js +231 -0
  435. data/app/assets/javascripts/integral/support/lib/jquery_form.js +11 -0
  436. data/app/assets/javascripts/integral/support/lib/js.cookie.js +165 -0
  437. data/app/assets/javascripts/integral/support/lib/materialize-tags.js +758 -0
  438. data/app/assets/javascripts/integral/support/lib/materialize.clockpicker.js +699 -0
  439. data/app/assets/javascripts/integral/support/lib/swiper.js +7719 -0
  440. data/app/assets/javascripts/integral/support/lib/typeahead.js +2451 -0
  441. data/app/assets/javascripts/integral/support/lib/underscore.js +6 -0
  442. data/app/assets/javascripts/integral/support/list.coffee +71 -0
  443. data/app/assets/javascripts/integral/support/list_item.coffee +249 -0
  444. data/app/assets/javascripts/integral/support/notification_manager.coffee +17 -0
  445. data/app/assets/javascripts/integral/support/record_selector.coffee +161 -0
  446. data/app/assets/javascripts/integral/support/remote_form.coffee +87 -0
  447. data/app/assets/javascripts/integral/support/responsive_swiper.coffee +26 -0
  448. data/app/assets/javascripts/integral/support/scroll_to_top.coffee +17 -0
  449. data/app/assets/javascripts/integral/support/slug_generator.coffee +49 -0
  450. data/app/assets/stylesheets/errors.css +1834 -0
  451. data/app/assets/stylesheets/integral/backend.sass +66 -0
  452. data/app/assets/stylesheets/integral/backend/_foundation_settings.scss +867 -0
  453. data/app/assets/stylesheets/integral/backend/dashboard-layout.scss +491 -0
  454. data/app/assets/stylesheets/integral/backend/devise.sass +40 -0
  455. data/app/assets/stylesheets/integral/backend/foundation_and_overrides.scss +56 -0
  456. data/app/assets/stylesheets/integral/backend/materialize-tags.sass +70 -0
  457. data/app/assets/stylesheets/integral/backend/notifications.sass +43 -0
  458. data/app/assets/stylesheets/integral/backend/overrides.sass +1 -0
  459. data/app/assets/stylesheets/integral/backend/shared.sass +770 -0
  460. data/app/assets/stylesheets/integral/emails.scss +19 -0
  461. data/app/assets/stylesheets/integral/emails/colors.sass +3 -0
  462. data/app/assets/stylesheets/integral/frontend.sass +26 -0
  463. data/app/assets/stylesheets/integral/frontend/_foundation_settings.scss +863 -0
  464. data/app/assets/stylesheets/integral/frontend/blog.sass +263 -0
  465. data/app/assets/stylesheets/integral/frontend/demo.sass +158 -0
  466. data/app/assets/stylesheets/integral/frontend/foundation_and_overrides.scss +56 -0
  467. data/app/assets/stylesheets/integral/frontend/layout.sass +66 -0
  468. data/app/assets/stylesheets/integral/frontend/overrides.sass +1 -0
  469. data/app/assets/stylesheets/integral/frontend/share_modal.sass +25 -0
  470. data/app/assets/stylesheets/integral/frontend/shared.sass +73 -0
  471. data/app/assets/stylesheets/integral/support/date-picker.scss +16 -0
  472. data/app/assets/stylesheets/integral/support/date_picker/_default.date.scss +452 -0
  473. data/app/assets/stylesheets/integral/support/date_picker/_default.scss +201 -0
  474. data/app/assets/stylesheets/integral/support/date_picker/_default.time.scss +125 -0
  475. data/app/assets/stylesheets/integral/support/date_picker/materialize_clockpicker.sass +220 -0
  476. data/app/assets/stylesheets/integral/support/gallery.sass +54 -0
  477. data/app/assets/stylesheets/integral/support/media-query-indicator.sass +25 -0
  478. data/app/assets/stylesheets/integral/support/mixins.sass +29 -0
  479. data/app/assets/stylesheets/integral/support/scroll-to-top.sass +19 -0
  480. data/app/assets/stylesheets/integral/support/swiper.css +618 -0
  481. data/app/assets/stylesheets/integral/wysiwyg.sass +13 -0
  482. data/app/controllers/integral/application_controller.rb +130 -0
  483. data/app/controllers/integral/backend/activities_controller.rb +55 -0
  484. data/app/controllers/integral/backend/base_controller.rb +123 -0
  485. data/app/controllers/integral/backend/images_controller.rb +120 -0
  486. data/app/controllers/integral/backend/lists_controller.rb +138 -0
  487. data/app/controllers/integral/backend/pages_controller.rb +142 -0
  488. data/app/controllers/integral/backend/posts_controller.rb +132 -0
  489. data/app/controllers/integral/backend/settings_controller.rb +53 -0
  490. data/app/controllers/integral/backend/static_pages_controller.rb +10 -0
  491. data/app/controllers/integral/backend/users_controller.rb +130 -0
  492. data/app/controllers/integral/blog_controller.rb +19 -0
  493. data/app/controllers/integral/contact_controller.rb +36 -0
  494. data/app/controllers/integral/pages_controller.rb +45 -0
  495. data/app/controllers/integral/posts_controller.rb +71 -0
  496. data/app/controllers/integral/tags_controller.rb +38 -0
  497. data/app/decorators/integral/image_decorator.rb +16 -0
  498. data/app/decorators/integral/list_decorator.rb +21 -0
  499. data/app/decorators/integral/page_decorator.rb +26 -0
  500. data/app/decorators/integral/post_decorator.rb +63 -0
  501. data/app/decorators/integral/user_decorator.rb +21 -0
  502. data/app/decorators/integral/version_decorator.rb +57 -0
  503. data/app/helpers/integral/application_helper.rb +52 -0
  504. data/app/helpers/integral/backend/base_helper.rb +72 -0
  505. data/app/helpers/integral/blog_helper.rb +26 -0
  506. data/app/helpers/integral/gallery_helper.rb +36 -0
  507. data/app/helpers/integral/mail_helper.rb +16 -0
  508. data/app/helpers/integral/social_helper.rb +123 -0
  509. data/app/helpers/integral/support_helper.rb +60 -0
  510. data/app/jobs/integral/application_job.rb +10 -0
  511. data/app/jobs/integral/newsletter_signup_job.rb +28 -0
  512. data/app/mailers/integral/contact_mailer.rb +56 -0
  513. data/app/models/ckeditor/asset.rb +8 -0
  514. data/app/models/ckeditor/attachment_file.rb +9 -0
  515. data/app/models/ckeditor/picture.rb +21 -0
  516. data/app/models/integral/application_record.rb +6 -0
  517. data/app/models/integral/basic.rb +11 -0
  518. data/app/models/integral/enquiry.rb +46 -0
  519. data/app/models/integral/image.rb +67 -0
  520. data/app/models/integral/image_version.rb +8 -0
  521. data/app/models/integral/link.rb +11 -0
  522. data/app/models/integral/list.rb +69 -0
  523. data/app/models/integral/list_item.rb +89 -0
  524. data/app/models/integral/list_version.rb +8 -0
  525. data/app/models/integral/newsletter_signup.rb +22 -0
  526. data/app/models/integral/object.rb +30 -0
  527. data/app/models/integral/page.rb +153 -0
  528. data/app/models/integral/page_version.rb +8 -0
  529. data/app/models/integral/post.rb +149 -0
  530. data/app/models/integral/post_version.rb +8 -0
  531. data/app/models/integral/post_viewing.rb +19 -0
  532. data/app/models/integral/role.rb +14 -0
  533. data/app/models/integral/role_assignment.rb +7 -0
  534. data/app/models/integral/settings.rb +5 -0
  535. data/app/models/integral/user.rb +59 -0
  536. data/app/models/integral/user_version.rb +8 -0
  537. data/app/models/integral/version.rb +31 -0
  538. data/app/models/paper_trail/version.rb +9 -0
  539. data/app/policies/integral/base_policy.rb +50 -0
  540. data/app/policies/integral/image_policy.rb +14 -0
  541. data/app/policies/integral/list_policy.rb +9 -0
  542. data/app/policies/integral/page_policy.rb +45 -0
  543. data/app/policies/integral/post_policy.rb +9 -0
  544. data/app/policies/integral/settings_policy.rb +17 -0
  545. data/app/policies/integral/user_policy.rb +17 -0
  546. data/app/policies/integral/version_policy.rb +19 -0
  547. data/app/uploaders/ckeditor_attachment_file_uploader.rb +34 -0
  548. data/app/uploaders/ckeditor_picture_uploader.rb +55 -0
  549. data/app/uploaders/integral/avatar_uploader.rb +9 -0
  550. data/app/uploaders/integral/image_uploader.rb +114 -0
  551. data/app/views/devise/invitations/edit.haml +17 -0
  552. data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  553. data/app/views/devise/mailer/invitation_instructions.html.erb +13 -0
  554. data/app/views/devise/mailer/invitation_instructions.text.erb +12 -0
  555. data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  556. data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  557. data/app/views/devise/passwords/edit.haml +17 -0
  558. data/app/views/devise/passwords/new.haml +12 -0
  559. data/app/views/devise/sessions/new.haml +18 -0
  560. data/app/views/devise/shared/_links.html.erb +25 -0
  561. data/app/views/integral/backend/activities/_grid.haml +23 -0
  562. data/app/views/integral/backend/activities/index.haml +15 -0
  563. data/app/views/integral/backend/activities/shared/_grid.haml +20 -0
  564. data/app/views/integral/backend/activities/shared/_listing.haml +14 -0
  565. data/app/views/integral/backend/activities/shared/_log.haml +56 -0
  566. data/app/views/integral/backend/activities/show.haml +18 -0
  567. data/app/views/integral/backend/images/_create_modal.haml +17 -0
  568. data/app/views/integral/backend/images/_form.haml +41 -0
  569. data/app/views/integral/backend/images/_grid.haml +16 -0
  570. data/app/views/integral/backend/images/edit.haml +3 -0
  571. data/app/views/integral/backend/images/index.haml +18 -0
  572. data/app/views/integral/backend/images/new.haml +1 -0
  573. data/app/views/integral/backend/lists/_child_fields.haml +26 -0
  574. data/app/views/integral/backend/lists/_form.haml +25 -0
  575. data/app/views/integral/backend/lists/_grid.haml +16 -0
  576. data/app/views/integral/backend/lists/_item_container.haml +26 -0
  577. data/app/views/integral/backend/lists/_item_modal.haml +46 -0
  578. data/app/views/integral/backend/lists/_list_item_fields.haml +26 -0
  579. data/app/views/integral/backend/lists/_manager.haml +14 -0
  580. data/app/views/integral/backend/lists/edit.haml +2 -0
  581. data/app/views/integral/backend/lists/index.haml +18 -0
  582. data/app/views/integral/backend/lists/new.haml +1 -0
  583. data/app/views/integral/backend/lists/show.haml +26 -0
  584. data/app/views/integral/backend/pages/_form.haml +52 -0
  585. data/app/views/integral/backend/pages/_grid.haml +21 -0
  586. data/app/views/integral/backend/pages/activities.haml +2 -0
  587. data/app/views/integral/backend/pages/activity.haml +1 -0
  588. data/app/views/integral/backend/pages/edit.html.haml +15 -0
  589. data/app/views/integral/backend/pages/index.haml +22 -0
  590. data/app/views/integral/backend/pages/new.haml +2 -0
  591. data/app/views/integral/backend/posts/_form.haml +57 -0
  592. data/app/views/integral/backend/posts/_grid.haml +25 -0
  593. data/app/views/integral/backend/posts/activities.haml +3 -0
  594. data/app/views/integral/backend/posts/activity.haml +1 -0
  595. data/app/views/integral/backend/posts/edit.haml +16 -0
  596. data/app/views/integral/backend/posts/index.haml +20 -0
  597. data/app/views/integral/backend/posts/new.haml +2 -0
  598. data/app/views/integral/backend/settings/_input.haml +4 -0
  599. data/app/views/integral/backend/settings/_section.haml +11 -0
  600. data/app/views/integral/backend/settings/index.haml +10 -0
  601. data/app/views/integral/backend/settings/sections/_general.haml +12 -0
  602. data/app/views/integral/backend/settings/sections/_lists.haml +4 -0
  603. data/app/views/integral/backend/settings/sections/_seo.haml +8 -0
  604. data/app/views/integral/backend/settings/sections/_social.haml +16 -0
  605. data/app/views/integral/backend/shared/_breadcrumbs.haml +9 -0
  606. data/app/views/integral/backend/shared/_empty_grid.haml +7 -0
  607. data/app/views/integral/backend/shared/_grid.haml +18 -0
  608. data/app/views/integral/backend/shared/_image_preview.haml +23 -0
  609. data/app/views/integral/backend/shared/_image_selector.haml +4 -0
  610. data/app/views/integral/backend/shared/_pagination.haml +1 -0
  611. data/app/views/integral/backend/shared/cards/_at_a_glance.haml +5 -0
  612. data/app/views/integral/backend/shared/cards/_welcome.haml +29 -0
  613. data/app/views/integral/backend/shared/graphs/_donut.haml +5 -0
  614. data/app/views/integral/backend/shared/graphs/_line.haml +5 -0
  615. data/app/views/integral/backend/shared/graphs/_no_data_available.haml +2 -0
  616. data/app/views/integral/backend/shared/record_selector/_collection.haml +13 -0
  617. data/app/views/integral/backend/shared/record_selector/_modal.haml +42 -0
  618. data/app/views/integral/backend/shared/record_selector/_record.haml +6 -0
  619. data/app/views/integral/backend/static_pages/_card.haml +24 -0
  620. data/app/views/integral/backend/static_pages/dashboard.haml +20 -0
  621. data/app/views/integral/backend/users/_form.haml +58 -0
  622. data/app/views/integral/backend/users/_grid.haml +19 -0
  623. data/app/views/integral/backend/users/edit.haml +3 -0
  624. data/app/views/integral/backend/users/index.haml +18 -0
  625. data/app/views/integral/backend/users/new.haml +2 -0
  626. data/app/views/integral/backend/users/show.haml +36 -0
  627. data/app/views/integral/contact_mailer/auto_reply.html.haml +16 -0
  628. data/app/views/integral/contact_mailer/auto_reply.text.erb +15 -0
  629. data/app/views/integral/contact_mailer/forward_enquiry.haml +12 -0
  630. data/app/views/integral/contact_mailer/forward_enquiry.text.erb +9 -0
  631. data/app/views/integral/pages/_demo.haml +188 -0
  632. data/app/views/integral/pages/templates/default.haml +6 -0
  633. data/app/views/integral/posts/_item.haml +16 -0
  634. data/app/views/integral/posts/index.haml +6 -0
  635. data/app/views/integral/posts/templates/default.haml +38 -0
  636. data/app/views/integral/shared/_blog_layout.haml +15 -0
  637. data/app/views/integral/shared/_blog_sidebar.haml +49 -0
  638. data/app/views/integral/shared/_breadcrumbs.haml +5 -0
  639. data/app/views/integral/shared/_media_query_indicator.haml +2 -0
  640. data/app/views/integral/shared/_scroll_to_top.haml +3 -0
  641. data/app/views/integral/shared/_share_modal.haml +20 -0
  642. data/app/views/integral/shared/_social_list_items.haml +41 -0
  643. data/app/views/integral/shared/_swiper_layout.haml +20 -0
  644. data/app/views/integral/shared/gallery/_placeholder.haml +7 -0
  645. data/app/views/integral/shared/gallery/_slide.haml +5 -0
  646. data/app/views/integral/shared/gallery/_thumb_slide.haml +2 -0
  647. data/app/views/integral/shared/gallery/gallery.haml +7 -0
  648. data/app/views/integral/tags/index.haml +6 -0
  649. data/app/views/integral/tags/show.haml +6 -0
  650. data/app/views/layouts/error.haml +12 -0
  651. data/app/views/layouts/integral/backend.html.haml +93 -0
  652. data/app/views/layouts/integral/backend/_create_dropdown.haml +30 -0
  653. data/app/views/layouts/integral/backend/_head.html.haml +17 -0
  654. data/app/views/layouts/integral/backend/_main_menu_items.haml +91 -0
  655. data/app/views/layouts/integral/frontend.html.haml +36 -0
  656. data/app/views/layouts/integral/frontend/_admin_bar.haml +25 -0
  657. data/app/views/layouts/integral/frontend/_footer.haml +23 -0
  658. data/app/views/layouts/integral/frontend/_header.haml +12 -0
  659. data/app/views/layouts/integral/login.haml +8 -0
  660. data/app/views/layouts/integral/mailer.html.inky-haml +17 -0
  661. data/app/views/layouts/integral/mailer/_footer.html.inky-haml +11 -0
  662. data/app/views/layouts/integral/mailer/_header.html.inky-haml +7 -0
  663. data/config/initializers/acts_as_taggable_on.rb +6 -0
  664. data/config/initializers/ckeditor.rb +51 -0
  665. data/config/initializers/client_side_validations.rb +20 -0
  666. data/config/initializers/compression.rb +46 -0
  667. data/config/initializers/devise.rb +308 -0
  668. data/config/initializers/extensions/ckeditor.rb +31 -0
  669. data/config/initializers/friendly_id.rb +88 -0
  670. data/config/initializers/gaffe.rb +3 -0
  671. data/config/initializers/simple_form.rb +169 -0
  672. data/config/initializers/simple_form/length_component.rb +36 -0
  673. data/config/locales/devise.en.yml +60 -0
  674. data/config/locales/devise_invitable.en.yml +31 -0
  675. data/config/locales/en.yml +477 -0
  676. data/config/locales/simple_form.en.yml +31 -0
  677. data/config/routes.rb +3 -0
  678. data/db/migrate/20160129021044_devise_create_integral_users.rb +42 -0
  679. data/db/migrate/20160130051535_add_name_and_avatar_to_users.rb +6 -0
  680. data/db/migrate/20160201003936_add_roles.rb +13 -0
  681. data/db/migrate/20160302071241_create_integral_images.rb +13 -0
  682. data/db/migrate/20160311092506_create_ckeditor_assets.rb +26 -0
  683. data/db/migrate/20160318004136_create_integral_pages.rb +12 -0
  684. data/db/migrate/20160513033619_create_integral_posts.rb +12 -0
  685. data/db/migrate/20160514063048_add_slug_column_to_post.rb +6 -0
  686. data/db/migrate/20160516084702_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +31 -0
  687. data/db/migrate/20160516084703_add_missing_unique_indices.acts_as_taggable_on_engine.rb +20 -0
  688. data/db/migrate/20160516084704_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +15 -0
  689. data/db/migrate/20160516084705_add_missing_taggable_index.acts_as_taggable_on_engine.rb +10 -0
  690. data/db/migrate/20160516084706_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +10 -0
  691. data/db/migrate/20160519005736_add_image_to_posts.rb +5 -0
  692. data/db/migrate/20160519053329_create_friendly_id_slugs.rb +15 -0
  693. data/db/migrate/20160610021858_add_view_count_to_posts.rb +5 -0
  694. data/db/migrate/20160613035508_add_drafting_to_posts.rb +6 -0
  695. data/db/migrate/20160628050006_create_integral_post_viewings.rb +10 -0
  696. data/db/migrate/20160718011218_add_locale_to_integral_users.rb +5 -0
  697. data/db/migrate/20160722100113_devise_invitable_add_to_integral_users.rb +23 -0
  698. data/db/migrate/20160809115906_add_drafting_to_pages.rb +5 -0
  699. data/db/migrate/20160909124940_add_deleted_at_to_objects.rb +15 -0
  700. data/db/migrate/20161014175823_create_lists.rb +31 -0
  701. data/db/migrate/20161102094859_create_settings.rb +18 -0
  702. data/db/migrate/20170215012231_add_templates_to_pages.rb +5 -0
  703. data/db/migrate/20170425091312_add_image_processing_fields.rb +7 -0
  704. data/db/migrate/20170516033523_add_timestamps_to_lists.rb +6 -0
  705. data/db/migrate/20170608131624_add_file_size_to_images.rb +5 -0
  706. data/db/migrate/20170801182434_add_parent_to_pages.rb +5 -0
  707. data/db/migrate/20170922201940_add_image_id_to_posts.rb +9 -0
  708. data/db/migrate/20171008193414_create_post_versions.rb +21 -0
  709. data/db/migrate/20171030215146_create_page_versions.rb +20 -0
  710. data/db/migrate/20171030215154_create_user_versions.rb +20 -0
  711. data/db/migrate/20171030215202_create_list_versions.rb +20 -0
  712. data/db/migrate/20171123155010_create_integral_enquiries.rb +13 -0
  713. data/db/migrate/20171127141132_add_deleted_at_to_lists.rb +6 -0
  714. data/db/migrate/20171230213848_add_image_to_pages.rb +6 -0
  715. data/db/migrate/20180202010010_add_lock_version_to_integral_objects.rb +9 -0
  716. data/db/migrate/20180202010020_create_image_versions.rb +20 -0
  717. data/db/migrate/20180207174914_add_fields_to_lists.rb +7 -0
  718. data/db/migrate/20180223232512_create_integral_newsletter_signups.rb +11 -0
  719. data/db/migrate/20180306204912_add_admin_to_integral_users.rb +5 -0
  720. data/db/migrate/20180326224500_add_processed_to_enquiries_and_newsletters.rb +6 -0
  721. data/db/migrate/20180509101917_add_context_to_enquiries.rb +6 -0
  722. data/db/migrate/20180920030236_update_posts_and_pages_null.rb +6 -0
  723. data/db/migrate/20181011234446_add_preview_image_to_posts.rb +6 -0
  724. data/db/seeds.rb +53 -0
  725. data/lib/generators/integral/install_generator.rb +19 -0
  726. data/lib/generators/templates/app.yml +24 -0
  727. data/lib/generators/templates/carrierwave.rb +35 -0
  728. data/lib/generators/templates/carrierwave_backgrounder.rb +11 -0
  729. data/lib/generators/templates/integral.rb +129 -0
  730. data/lib/generators/templates/sitemap.rb +41 -0
  731. data/lib/integral.rb +155 -0
  732. data/lib/integral/acts_as_listable.rb +45 -0
  733. data/lib/integral/button_link_renderer.rb +54 -0
  734. data/lib/integral/chart_renderer/base.rb +80 -0
  735. data/lib/integral/chart_renderer/donut.rb +21 -0
  736. data/lib/integral/chart_renderer/line.rb +24 -0
  737. data/lib/integral/content_renderer.rb +78 -0
  738. data/lib/integral/engine.rb +124 -0
  739. data/lib/integral/foundation_builder.rb +33 -0
  740. data/lib/integral/google_tag_manager.rb +33 -0
  741. data/lib/integral/grids/activities_grid.rb +37 -0
  742. data/lib/integral/grids/images_grid.rb +21 -0
  743. data/lib/integral/grids/lists_grid.rb +21 -0
  744. data/lib/integral/grids/pages_grid.rb +27 -0
  745. data/lib/integral/grids/posts_grid.rb +32 -0
  746. data/lib/integral/grids/users_grid.rb +22 -0
  747. data/lib/integral/list_item_renderer.rb +204 -0
  748. data/lib/integral/list_renderer.rb +91 -0
  749. data/lib/integral/middleware/page_router.rb +84 -0
  750. data/lib/integral/partial_list_item_renderer.rb +40 -0
  751. data/lib/integral/router.rb +106 -0
  752. data/lib/integral/slack_bot.rb +45 -0
  753. data/lib/integral/swiper_list_renderer.rb +30 -0
  754. data/lib/integral/version.rb +5 -0
  755. data/lib/integral/widgets/recent_posts.rb +41 -0
  756. data/lib/integral/widgets/swiper_list.rb +40 -0
  757. data/lib/tasks/integral_tasks.rake +57 -0
  758. data/lib/templates/erb/scaffold/_form.html.erb +13 -0
  759. data/spec/factories.rb +114 -0
  760. data/spec/support/image.jpg +0 -0
  761. metadata +1734 -0
@@ -0,0 +1,1018 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
3
+ * For licensing, see LICENSE.md or http://ckeditor.com/license
4
+ */
5
+
6
+ /**
7
+ * @fileOverview A set of utilities to find and create horizontal spaces in edited content.
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ ( function() {
13
+
14
+ CKEDITOR.plugins.add( 'lineutils' );
15
+
16
+ /**
17
+ * Determines a position relative to an element in DOM (before).
18
+ *
19
+ * @readonly
20
+ * @property {Number} [=0]
21
+ * @member CKEDITOR
22
+ */
23
+ CKEDITOR.LINEUTILS_BEFORE = 1;
24
+
25
+ /**
26
+ * Determines a position relative to an element in DOM (after).
27
+ *
28
+ * @readonly
29
+ * @property {Number} [=2]
30
+ * @member CKEDITOR
31
+ */
32
+ CKEDITOR.LINEUTILS_AFTER = 2;
33
+
34
+ /**
35
+ * Determines a position relative to an element in DOM (inside).
36
+ *
37
+ * @readonly
38
+ * @property {Number} [=4]
39
+ * @member CKEDITOR
40
+ */
41
+ CKEDITOR.LINEUTILS_INSIDE = 4;
42
+
43
+ /**
44
+ * A utility that traverses the DOM tree and discovers elements
45
+ * (relations) matching user-defined lookups.
46
+ *
47
+ * @private
48
+ * @class CKEDITOR.plugins.lineutils.finder
49
+ * @constructor Creates a Finder class instance.
50
+ * @param {CKEDITOR.editor} editor Editor instance that the Finder belongs to.
51
+ * @param {Object} def Finder's definition.
52
+ * @since 4.3
53
+ */
54
+ function Finder( editor, def ) {
55
+ CKEDITOR.tools.extend( this, {
56
+ editor: editor,
57
+ editable: editor.editable(),
58
+ doc: editor.document,
59
+ win: editor.window
60
+ }, def, true );
61
+
62
+ this.inline = this.editable.isInline();
63
+
64
+ if ( !this.inline ) {
65
+ this.frame = this.win.getFrame();
66
+ }
67
+
68
+ this.target = this[ this.inline ? 'editable' : 'doc' ];
69
+ }
70
+
71
+ Finder.prototype = {
72
+ /**
73
+ * Initializes searching for elements with every mousemove event fired.
74
+ * To stop searching use {@link #stop}.
75
+ *
76
+ * @param {Function} [callback] Function executed on every iteration.
77
+ */
78
+ start: function( callback ) {
79
+ var that = this,
80
+ editor = this.editor,
81
+ doc = this.doc,
82
+ el, elfp, x, y;
83
+
84
+ var moveBuffer = CKEDITOR.tools.eventsBuffer( 50, function() {
85
+ if ( editor.readOnly || editor.mode != 'wysiwyg' )
86
+ return;
87
+
88
+ that.relations = {};
89
+
90
+ // Sometimes it happens that elementFromPoint returns null (especially on IE).
91
+ // Any further traversal makes no sense if there's no start point. Abort.
92
+ // Note: In IE8 elementFromPoint may return zombie nodes of undefined nodeType,
93
+ // so rejecting those as well.
94
+ if ( !( elfp = doc.$.elementFromPoint( x, y ) ) || !elfp.nodeType ) {
95
+ return;
96
+ }
97
+
98
+ el = new CKEDITOR.dom.element( elfp );
99
+
100
+ that.traverseSearch( el );
101
+
102
+ if ( !isNaN( x + y ) ) {
103
+ that.pixelSearch( el, x, y );
104
+ }
105
+
106
+ callback && callback( that.relations, x, y );
107
+ } );
108
+
109
+ // Searching starting from element from point on mousemove.
110
+ this.listener = this.editable.attachListener( this.target, 'mousemove', function( evt ) {
111
+ x = evt.data.$.clientX;
112
+ y = evt.data.$.clientY;
113
+
114
+ moveBuffer.input();
115
+ } );
116
+
117
+ this.editable.attachListener( this.inline ? this.editable : this.frame, 'mouseout', function() {
118
+ moveBuffer.reset();
119
+ } );
120
+ },
121
+
122
+ /**
123
+ * Stops observing mouse events attached by {@link #start}.
124
+ */
125
+ stop: function() {
126
+ if ( this.listener ) {
127
+ this.listener.removeListener();
128
+ }
129
+ },
130
+
131
+ /**
132
+ * Returns a range representing the relation, according to its element
133
+ * and type.
134
+ *
135
+ * @param {Object} location Location containing a unique identifier and type.
136
+ * @returns {CKEDITOR.dom.range} Range representing the relation.
137
+ */
138
+ getRange: ( function() {
139
+ var where = {};
140
+
141
+ where[ CKEDITOR.LINEUTILS_BEFORE ] = CKEDITOR.POSITION_BEFORE_START;
142
+ where[ CKEDITOR.LINEUTILS_AFTER ] = CKEDITOR.POSITION_AFTER_END;
143
+ where[ CKEDITOR.LINEUTILS_INSIDE ] = CKEDITOR.POSITION_AFTER_START;
144
+
145
+ return function( location ) {
146
+ var range = this.editor.createRange();
147
+
148
+ range.moveToPosition( this.relations[ location.uid ].element, where[ location.type ] );
149
+
150
+ return range;
151
+ };
152
+ } )(),
153
+
154
+ /**
155
+ * Stores given relation in a {@link #relations} object. Processes the relation
156
+ * to normalize and avoid duplicates.
157
+ *
158
+ * @param {CKEDITOR.dom.element} el Element of the relation.
159
+ * @param {Number} type Relation, one of `CKEDITOR.LINEUTILS_AFTER`, `CKEDITOR.LINEUTILS_BEFORE`, `CKEDITOR.LINEUTILS_INSIDE`.
160
+ */
161
+ store: ( function() {
162
+ function merge( el, type, relations ) {
163
+ var uid = el.getUniqueId();
164
+
165
+ if ( uid in relations ) {
166
+ relations[ uid ].type |= type;
167
+ } else {
168
+ relations[ uid ] = { element: el, type: type };
169
+ }
170
+ }
171
+
172
+ return function( el, type ) {
173
+ var alt;
174
+
175
+ // Normalization to avoid duplicates:
176
+ // CKEDITOR.LINEUTILS_AFTER becomes CKEDITOR.LINEUTILS_BEFORE of el.getNext().
177
+ if ( is( type, CKEDITOR.LINEUTILS_AFTER ) && isStatic( alt = el.getNext() ) && alt.isVisible() ) {
178
+ merge( alt, CKEDITOR.LINEUTILS_BEFORE, this.relations );
179
+ type ^= CKEDITOR.LINEUTILS_AFTER;
180
+ }
181
+
182
+ // Normalization to avoid duplicates:
183
+ // CKEDITOR.LINEUTILS_INSIDE becomes CKEDITOR.LINEUTILS_BEFORE of el.getFirst().
184
+ if ( is( type, CKEDITOR.LINEUTILS_INSIDE ) && isStatic( alt = el.getFirst() ) && alt.isVisible() ) {
185
+ merge( alt, CKEDITOR.LINEUTILS_BEFORE, this.relations );
186
+ type ^= CKEDITOR.LINEUTILS_INSIDE;
187
+ }
188
+
189
+ merge( el, type, this.relations );
190
+ };
191
+ } )(),
192
+
193
+ /**
194
+ * Traverses the DOM tree towards root, checking all ancestors
195
+ * with lookup rules, avoiding duplicates. Stores positive relations
196
+ * in the {@link #relations} object.
197
+ *
198
+ * @param {CKEDITOR.dom.element} el Element which is the starting point.
199
+ */
200
+ traverseSearch: function( el ) {
201
+ var l, type, uid;
202
+
203
+ // Go down DOM towards root (or limit).
204
+ do {
205
+ uid = el.$[ 'data-cke-expando' ];
206
+
207
+ // This element was already visited and checked.
208
+ if ( uid && uid in this.relations ) {
209
+ continue;
210
+ }
211
+
212
+ if ( el.equals( this.editable ) ) {
213
+ return;
214
+ }
215
+
216
+ if ( isStatic( el ) ) {
217
+ // Collect all addresses yielded by lookups for that element.
218
+ for ( l in this.lookups ) {
219
+
220
+ if ( ( type = this.lookups[ l ]( el ) ) ) {
221
+ this.store( el, type );
222
+ }
223
+ }
224
+ }
225
+ } while ( !isLimit( el ) && ( el = el.getParent() ) );
226
+ },
227
+
228
+ /**
229
+ * Iterates vertically pixel-by-pixel within a given element starting
230
+ * from given coordinates, searching for elements in the neighborhood.
231
+ * Once an element is found it is processed by {@link #traverseSearch}.
232
+ *
233
+ * @param {CKEDITOR.dom.element} el Element which is the starting point.
234
+ * @param {Number} [x] Horizontal mouse coordinate relative to the viewport.
235
+ * @param {Number} [y] Vertical mouse coordinate relative to the viewport.
236
+ */
237
+ pixelSearch: ( function() {
238
+ var contains = CKEDITOR.env.ie || CKEDITOR.env.webkit ?
239
+ function( el, found ) {
240
+ return el.contains( found );
241
+ } : function( el, found ) {
242
+ return !!( el.compareDocumentPosition( found ) & 16 );
243
+ };
244
+
245
+ // Iterates pixel-by-pixel from starting coordinates, moving by defined
246
+ // step and getting elementFromPoint in every iteration. Iteration stops when:
247
+ // * A valid element is found.
248
+ // * Condition function returns `false` (i.e. reached boundaries of viewport).
249
+ // * No element is found (i.e. coordinates out of viewport).
250
+ // * Element found is ascendant of starting element.
251
+ //
252
+ // @param {Object} doc Native DOM document.
253
+ // @param {Object} el Native DOM element.
254
+ // @param {Number} xStart Horizontal starting coordinate to use.
255
+ // @param {Number} yStart Vertical starting coordinate to use.
256
+ // @param {Number} step Step of the algorithm.
257
+ // @param {Function} condition A condition relative to current vertical coordinate.
258
+ function iterate( el, xStart, yStart, step, condition ) {
259
+ var y = yStart,
260
+ tryouts = 0,
261
+ found;
262
+
263
+ while ( condition( y ) ) {
264
+ y += step;
265
+
266
+ // If we try and we try, and still nothing's found, let's end
267
+ // that party.
268
+ if ( ++tryouts == 25 ) {
269
+ return;
270
+ }
271
+
272
+ found = this.doc.$.elementFromPoint( xStart, y );
273
+
274
+ // Nothing found. This is crazy... but...
275
+ // It might be that a line, which is in different document,
276
+ // covers that pixel (elementFromPoint is doc-sensitive).
277
+ // Better let's have another try.
278
+ if ( !found ) {
279
+ continue;
280
+ }
281
+
282
+ // Still in the same element.
283
+ else if ( found == el ) {
284
+ tryouts = 0;
285
+ continue;
286
+ }
287
+
288
+ // Reached the edge of an element and found an ancestor or...
289
+ // A line, that covers that pixel. Better let's have another try.
290
+ else if ( !contains( el, found ) ) {
291
+ continue;
292
+ }
293
+
294
+ tryouts = 0;
295
+
296
+ // Found a valid element. Stop iterating.
297
+ if ( isStatic( ( found = new CKEDITOR.dom.element( found ) ) ) ) {
298
+ return found;
299
+ }
300
+ }
301
+ }
302
+
303
+ return function( el, x, y ) {
304
+ var paneHeight = this.win.getViewPaneSize().height,
305
+
306
+ // Try to find an element iterating *up* from the starting point.
307
+ neg = iterate.call( this, el.$, x, y, -1, function( y ) {
308
+ return y > 0;
309
+ } ),
310
+
311
+ // Try to find an element iterating *down* from the starting point.
312
+ pos = iterate.call( this, el.$, x, y, 1, function( y ) {
313
+ return y < paneHeight;
314
+ } );
315
+
316
+ if ( neg ) {
317
+ this.traverseSearch( neg );
318
+
319
+ // Iterate towards DOM root until neg is a direct child of el.
320
+ while ( !neg.getParent().equals( el ) ) {
321
+ neg = neg.getParent();
322
+ }
323
+ }
324
+
325
+ if ( pos ) {
326
+ this.traverseSearch( pos );
327
+
328
+ // Iterate towards DOM root until pos is a direct child of el.
329
+ while ( !pos.getParent().equals( el ) ) {
330
+ pos = pos.getParent();
331
+ }
332
+ }
333
+
334
+ // Iterate forwards starting from neg and backwards from
335
+ // pos to harvest all children of el between those elements.
336
+ // Stop when neg and pos meet each other or there's none of them.
337
+ // TODO (?) reduce number of hops forwards/backwards.
338
+ while ( neg || pos ) {
339
+ if ( neg ) {
340
+ neg = neg.getNext( isStatic );
341
+ }
342
+
343
+ if ( !neg || neg.equals( pos ) ) {
344
+ break;
345
+ }
346
+
347
+ this.traverseSearch( neg );
348
+
349
+ if ( pos ) {
350
+ pos = pos.getPrevious( isStatic );
351
+ }
352
+
353
+ if ( !pos || pos.equals( neg ) ) {
354
+ break;
355
+ }
356
+
357
+ this.traverseSearch( pos );
358
+ }
359
+ };
360
+ } )(),
361
+
362
+ /**
363
+ * Unlike {@link #traverseSearch}, it collects **all** elements from editable's DOM tree
364
+ * and runs lookups for every one of them, collecting relations.
365
+ *
366
+ * @returns {Object} {@link #relations}.
367
+ */
368
+ greedySearch: function() {
369
+ this.relations = {};
370
+
371
+ var all = this.editable.getElementsByTag( '*' ),
372
+ i = 0,
373
+ el, type, l;
374
+
375
+ while ( ( el = all.getItem( i++ ) ) ) {
376
+ // Don't consider editable, as it might be inline,
377
+ // and i.e. checking it's siblings is pointless.
378
+ if ( el.equals( this.editable ) ) {
379
+ continue;
380
+ }
381
+
382
+ // On IE8 element.getElementsByTagName returns comments... sic! (http://dev.ckeditor.com/ticket/13176)
383
+ if ( el.type != CKEDITOR.NODE_ELEMENT ) {
384
+ continue;
385
+ }
386
+
387
+ // Don't visit non-editable internals, for example widget's
388
+ // guts (above wrapper, below nested). Still check editable limits,
389
+ // as they are siblings with editable contents.
390
+ if ( !el.hasAttribute( 'contenteditable' ) && el.isReadOnly() ) {
391
+ continue;
392
+ }
393
+
394
+ if ( isStatic( el ) && el.isVisible() ) {
395
+ // Collect all addresses yielded by lookups for that element.
396
+ for ( l in this.lookups ) {
397
+ if ( ( type = this.lookups[ l ]( el ) ) ) {
398
+ this.store( el, type );
399
+ }
400
+ }
401
+ }
402
+ }
403
+
404
+ return this.relations;
405
+ }
406
+
407
+ /**
408
+ * Relations express elements in DOM that match user-defined {@link #lookups}.
409
+ * Every relation has its own `type` that determines whether
410
+ * it refers to the space before, after or inside the `element`.
411
+ * This object stores relations found by {@link #traverseSearch} or {@link #greedySearch}, structured
412
+ * in the following way:
413
+ *
414
+ * relations: {
415
+ * // Unique identifier of the element.
416
+ * Number: {
417
+ * // Element of this relation.
418
+ * element: {@link CKEDITOR.dom.element}
419
+ * // Conjunction of CKEDITOR.LINEUTILS_BEFORE, CKEDITOR.LINEUTILS_AFTER and CKEDITOR.LINEUTILS_INSIDE.
420
+ * type: Number
421
+ * },
422
+ * ...
423
+ * }
424
+ *
425
+ * @property {Object} relations
426
+ * @readonly
427
+ */
428
+
429
+ /**
430
+ * A set of user-defined functions used by Finder to check if an element
431
+ * is a valid relation, belonging to {@link #relations}.
432
+ * When the criterion is met, lookup returns a logical conjunction of `CKEDITOR.LINEUTILS_BEFORE`,
433
+ * `CKEDITOR.LINEUTILS_AFTER` or `CKEDITOR.LINEUTILS_INSIDE`.
434
+ *
435
+ * Lookups are passed along with Finder's definition.
436
+ *
437
+ * lookups: {
438
+ * 'some lookup': function( el ) {
439
+ * if ( someCondition )
440
+ * return CKEDITOR.LINEUTILS_BEFORE;
441
+ * },
442
+ * ...
443
+ * }
444
+ *
445
+ * @property {Object} lookups
446
+ */
447
+ };
448
+
449
+
450
+ /**
451
+ * A utility that analyses relations found by
452
+ * CKEDITOR.plugins.lineutils.finder and locates them
453
+ * in the viewport as horizontal lines of specific coordinates.
454
+ *
455
+ * @private
456
+ * @class CKEDITOR.plugins.lineutils.locator
457
+ * @constructor Creates a Locator class instance.
458
+ * @param {CKEDITOR.editor} editor Editor instance that Locator belongs to.
459
+ * @since 4.3
460
+ */
461
+ function Locator( editor, def ) {
462
+ CKEDITOR.tools.extend( this, def, {
463
+ editor: editor
464
+ }, true );
465
+ }
466
+
467
+ Locator.prototype = {
468
+ /**
469
+ * Locates the Y coordinate for all types of every single relation and stores
470
+ * them in an object.
471
+ *
472
+ * @param {Object} relations {@link CKEDITOR.plugins.lineutils.finder#relations}.
473
+ * @returns {Object} {@link #locations}.
474
+ */
475
+ locate: ( function() {
476
+ function locateSibling( rel, type ) {
477
+ var sib = rel.element[ type === CKEDITOR.LINEUTILS_BEFORE ? 'getPrevious' : 'getNext' ]();
478
+
479
+ // Return the middle point between siblings.
480
+ if ( sib && isStatic( sib ) ) {
481
+ rel.siblingRect = sib.getClientRect();
482
+
483
+ if ( type == CKEDITOR.LINEUTILS_BEFORE ) {
484
+ return ( rel.siblingRect.bottom + rel.elementRect.top ) / 2;
485
+ } else {
486
+ return ( rel.elementRect.bottom + rel.siblingRect.top ) / 2;
487
+ }
488
+ }
489
+
490
+ // If there's no sibling, use the edge of an element.
491
+ else {
492
+ if ( type == CKEDITOR.LINEUTILS_BEFORE ) {
493
+ return rel.elementRect.top;
494
+ } else {
495
+ return rel.elementRect.bottom;
496
+ }
497
+ }
498
+ }
499
+
500
+ return function( relations ) {
501
+ var rel;
502
+
503
+ this.locations = {};
504
+
505
+ for ( var uid in relations ) {
506
+ rel = relations[ uid ];
507
+ rel.elementRect = rel.element.getClientRect();
508
+
509
+ if ( is( rel.type, CKEDITOR.LINEUTILS_BEFORE ) ) {
510
+ this.store( uid, CKEDITOR.LINEUTILS_BEFORE, locateSibling( rel, CKEDITOR.LINEUTILS_BEFORE ) );
511
+ }
512
+
513
+ if ( is( rel.type, CKEDITOR.LINEUTILS_AFTER ) ) {
514
+ this.store( uid, CKEDITOR.LINEUTILS_AFTER, locateSibling( rel, CKEDITOR.LINEUTILS_AFTER ) );
515
+ }
516
+
517
+ // The middle point of the element.
518
+ if ( is( rel.type, CKEDITOR.LINEUTILS_INSIDE ) ) {
519
+ this.store( uid, CKEDITOR.LINEUTILS_INSIDE, ( rel.elementRect.top + rel.elementRect.bottom ) / 2 );
520
+ }
521
+ }
522
+
523
+ return this.locations;
524
+ };
525
+ } )(),
526
+
527
+ /**
528
+ * Calculates distances from every location to given vertical coordinate
529
+ * and sorts locations according to that distance.
530
+ *
531
+ * @param {Number} y The vertical coordinate used for sorting, used as a reference.
532
+ * @param {Number} [howMany] Determines the number of "closest locations" to be returned.
533
+ * @returns {Array} Sorted, array representation of {@link #locations}.
534
+ */
535
+ sort: ( function() {
536
+ var locations, sorted,
537
+ dist, i;
538
+
539
+ function distance( y, uid, type ) {
540
+ return Math.abs( y - locations[ uid ][ type ] );
541
+ }
542
+
543
+ return function( y, howMany ) {
544
+ locations = this.locations;
545
+ sorted = [];
546
+
547
+ for ( var uid in locations ) {
548
+ for ( var type in locations[ uid ] ) {
549
+ dist = distance( y, uid, type );
550
+
551
+ // An array is empty.
552
+ if ( !sorted.length ) {
553
+ sorted.push( { uid: +uid, type: type, dist: dist } );
554
+ } else {
555
+ // Sort the array on fly when it's populated.
556
+ for ( i = 0; i < sorted.length; i++ ) {
557
+ if ( dist < sorted[ i ].dist ) {
558
+ sorted.splice( i, 0, { uid: +uid, type: type, dist: dist } );
559
+ break;
560
+ }
561
+ }
562
+
563
+ // Nothing was inserted, so the distance is bigger than
564
+ // any of already calculated: push to the end.
565
+ if ( i == sorted.length ) {
566
+ sorted.push( { uid: +uid, type: type, dist: dist } );
567
+ }
568
+ }
569
+ }
570
+ }
571
+
572
+ if ( typeof howMany != 'undefined' ) {
573
+ return sorted.slice( 0, howMany );
574
+ } else {
575
+ return sorted;
576
+ }
577
+ };
578
+ } )(),
579
+
580
+ /**
581
+ * Stores the location in a collection.
582
+ *
583
+ * @param {Number} uid Unique identifier of the relation.
584
+ * @param {Number} type One of `CKEDITOR.LINEUTILS_BEFORE`, `CKEDITOR.LINEUTILS_AFTER` and `CKEDITOR.LINEUTILS_INSIDE`.
585
+ * @param {Number} y Vertical position of the relation.
586
+ */
587
+ store: function( uid, type, y ) {
588
+ if ( !this.locations[ uid ] ) {
589
+ this.locations[ uid ] = {};
590
+ }
591
+
592
+ this.locations[ uid ][ type ] = y;
593
+ }
594
+
595
+ /**
596
+ * @readonly
597
+ * @property {Object} locations
598
+ */
599
+ };
600
+
601
+ var tipCss = {
602
+ display: 'block',
603
+ width: '0px',
604
+ height: '0px',
605
+ 'border-color': 'transparent',
606
+ 'border-style': 'solid',
607
+ position: 'absolute',
608
+ top: '-6px'
609
+ },
610
+
611
+ lineStyle = {
612
+ height: '0px',
613
+ 'border-top': '1px dashed red',
614
+ position: 'absolute',
615
+ 'z-index': 9999
616
+ },
617
+
618
+ lineTpl =
619
+ '<div data-cke-lineutils-line="1" class="cke_reset_all" style="{lineStyle}">' +
620
+ '<span style="{tipLeftStyle}">&nbsp;</span>' +
621
+ '<span style="{tipRightStyle}">&nbsp;</span>' +
622
+ '</div>';
623
+
624
+ /**
625
+ * A utility that draws horizontal lines in DOM according to locations
626
+ * returned by CKEDITOR.plugins.lineutils.locator.
627
+ *
628
+ * @private
629
+ * @class CKEDITOR.plugins.lineutils.liner
630
+ * @constructor Creates a Liner class instance.
631
+ * @param {CKEDITOR.editor} editor Editor instance that Liner belongs to.
632
+ * @param {Object} def Liner's definition.
633
+ * @since 4.3
634
+ */
635
+ function Liner( editor, def ) {
636
+ var editable = editor.editable();
637
+
638
+ CKEDITOR.tools.extend( this, {
639
+ editor: editor,
640
+ editable: editable,
641
+ inline: editable.isInline(),
642
+ doc: editor.document,
643
+ win: editor.window,
644
+ container: CKEDITOR.document.getBody(),
645
+ winTop: CKEDITOR.document.getWindow()
646
+ }, def, true );
647
+
648
+ this.hidden = {};
649
+ this.visible = {};
650
+
651
+ if ( !this.inline ) {
652
+ this.frame = this.win.getFrame();
653
+ }
654
+
655
+ this.queryViewport();
656
+
657
+ // Callbacks must be wrapped. Otherwise they're not attached
658
+ // to global DOM objects (i.e. topmost window) for every editor
659
+ // because they're treated as duplicates. They belong to the
660
+ // same prototype shared among Liner instances.
661
+ var queryViewport = CKEDITOR.tools.bind( this.queryViewport, this ),
662
+ hideVisible = CKEDITOR.tools.bind( this.hideVisible, this ),
663
+ removeAll = CKEDITOR.tools.bind( this.removeAll, this );
664
+
665
+ editable.attachListener( this.winTop, 'resize', queryViewport );
666
+ editable.attachListener( this.winTop, 'scroll', queryViewport );
667
+
668
+ editable.attachListener( this.winTop, 'resize', hideVisible );
669
+ editable.attachListener( this.win, 'scroll', hideVisible );
670
+
671
+ editable.attachListener( this.inline ? editable : this.frame, 'mouseout', function( evt ) {
672
+ var x = evt.data.$.clientX,
673
+ y = evt.data.$.clientY;
674
+
675
+ this.queryViewport();
676
+
677
+ // Check if mouse is out of the element (iframe/editable).
678
+ if ( x <= this.rect.left || x >= this.rect.right || y <= this.rect.top || y >= this.rect.bottom ) {
679
+ this.hideVisible();
680
+ }
681
+
682
+ // Check if mouse is out of the top-window vieport.
683
+ if ( x <= 0 || x >= this.winTopPane.width || y <= 0 || y >= this.winTopPane.height ) {
684
+ this.hideVisible();
685
+ }
686
+ }, this );
687
+
688
+ editable.attachListener( editor, 'resize', queryViewport );
689
+ editable.attachListener( editor, 'mode', removeAll );
690
+ editor.on( 'destroy', removeAll );
691
+
692
+ this.lineTpl = new CKEDITOR.template( lineTpl ).output( {
693
+ lineStyle: CKEDITOR.tools.writeCssText(
694
+ CKEDITOR.tools.extend( {}, lineStyle, this.lineStyle, true )
695
+ ),
696
+ tipLeftStyle: CKEDITOR.tools.writeCssText(
697
+ CKEDITOR.tools.extend( {}, tipCss, {
698
+ left: '0px',
699
+ 'border-left-color': 'red',
700
+ 'border-width': '6px 0 6px 6px'
701
+ }, this.tipCss, this.tipLeftStyle, true )
702
+ ),
703
+ tipRightStyle: CKEDITOR.tools.writeCssText(
704
+ CKEDITOR.tools.extend( {}, tipCss, {
705
+ right: '0px',
706
+ 'border-right-color': 'red',
707
+ 'border-width': '6px 6px 6px 0'
708
+ }, this.tipCss, this.tipRightStyle, true )
709
+ )
710
+ } );
711
+ }
712
+
713
+ Liner.prototype = {
714
+ /**
715
+ * Permanently removes all lines (both hidden and visible) from DOM.
716
+ */
717
+ removeAll: function() {
718
+ var l;
719
+
720
+ for ( l in this.hidden ) {
721
+ this.hidden[ l ].remove();
722
+ delete this.hidden[ l ];
723
+ }
724
+
725
+ for ( l in this.visible ) {
726
+ this.visible[ l ].remove();
727
+ delete this.visible[ l ];
728
+ }
729
+ },
730
+
731
+ /**
732
+ * Hides a given line.
733
+ *
734
+ * @param {CKEDITOR.dom.element} line The line to be hidden.
735
+ */
736
+ hideLine: function( line ) {
737
+ var uid = line.getUniqueId();
738
+
739
+ line.hide();
740
+
741
+ this.hidden[ uid ] = line;
742
+ delete this.visible[ uid ];
743
+ },
744
+
745
+ /**
746
+ * Shows a given line.
747
+ *
748
+ * @param {CKEDITOR.dom.element} line The line to be shown.
749
+ */
750
+ showLine: function( line ) {
751
+ var uid = line.getUniqueId();
752
+
753
+ line.show();
754
+
755
+ this.visible[ uid ] = line;
756
+ delete this.hidden[ uid ];
757
+ },
758
+
759
+ /**
760
+ * Hides all visible lines.
761
+ */
762
+ hideVisible: function() {
763
+ for ( var l in this.visible ) {
764
+ this.hideLine( this.visible[ l ] );
765
+ }
766
+ },
767
+
768
+ /**
769
+ * Shows a line at given location.
770
+ *
771
+ * @param {Object} location Location object containing the unique identifier of the relation
772
+ * and its type. Usually returned by {@link CKEDITOR.plugins.lineutils.locator#sort}.
773
+ * @param {Function} [callback] A callback to be called once the line is shown.
774
+ */
775
+ placeLine: function( location, callback ) {
776
+ var styles, line, l;
777
+
778
+ // No style means that line would be out of viewport.
779
+ if ( !( styles = this.getStyle( location.uid, location.type ) ) ) {
780
+ return;
781
+ }
782
+
783
+ // Search for any visible line of a different hash first.
784
+ // It's faster to re-position visible line than to show it.
785
+ for ( l in this.visible ) {
786
+ if ( this.visible[ l ].getCustomData( 'hash' ) !== this.hash ) {
787
+ line = this.visible[ l ];
788
+ break;
789
+ }
790
+ }
791
+
792
+ // Search for any hidden line of a different hash.
793
+ if ( !line ) {
794
+ for ( l in this.hidden ) {
795
+ if ( this.hidden[ l ].getCustomData( 'hash' ) !== this.hash ) {
796
+ this.showLine( ( line = this.hidden[ l ] ) );
797
+ break;
798
+ }
799
+ }
800
+ }
801
+
802
+ // If no line available, add the new one.
803
+ if ( !line ) {
804
+ this.showLine( ( line = this.addLine() ) );
805
+ }
806
+
807
+ // Mark the line with current hash.
808
+ line.setCustomData( 'hash', this.hash );
809
+
810
+ // Mark the line as visible.
811
+ this.visible[ line.getUniqueId() ] = line;
812
+
813
+ line.setStyles( styles );
814
+
815
+ callback && callback( line );
816
+ },
817
+
818
+ /**
819
+ * Creates a style set to be used by the line, representing a particular
820
+ * relation (location).
821
+ *
822
+ * @param {Number} uid Unique identifier of the relation.
823
+ * @param {Number} type Type of the relation.
824
+ * @returns {Object} An object containing styles.
825
+ */
826
+ getStyle: function( uid, type ) {
827
+ var rel = this.relations[ uid ],
828
+ loc = this.locations[ uid ][ type ],
829
+ styles = {},
830
+ hdiff;
831
+
832
+ // Line should be between two elements.
833
+ if ( rel.siblingRect ) {
834
+ styles.width = Math.max( rel.siblingRect.width, rel.elementRect.width );
835
+ }
836
+ // Line is relative to a single element.
837
+ else {
838
+ styles.width = rel.elementRect.width;
839
+ }
840
+
841
+ // Let's calculate the vertical position of the line.
842
+ if ( this.inline ) {
843
+ // (http://dev.ckeditor.com/ticket/13155)
844
+ styles.top = loc + this.winTopScroll.y - this.rect.relativeY;
845
+ } else {
846
+ styles.top = this.rect.top + this.winTopScroll.y + loc;
847
+ }
848
+
849
+ // Check if line would be vertically out of the viewport.
850
+ if ( styles.top - this.winTopScroll.y < this.rect.top || styles.top - this.winTopScroll.y > this.rect.bottom ) {
851
+ return false;
852
+ }
853
+
854
+ // Now let's calculate the horizontal alignment (left and width).
855
+ if ( this.inline ) {
856
+ // (http://dev.ckeditor.com/ticket/13155)
857
+ styles.left = rel.elementRect.left - this.rect.relativeX;
858
+ } else {
859
+ if ( rel.elementRect.left > 0 )
860
+ styles.left = this.rect.left + rel.elementRect.left;
861
+
862
+ // H-scroll case. Left edge of element may be out of viewport.
863
+ else {
864
+ styles.width += rel.elementRect.left;
865
+ styles.left = this.rect.left;
866
+ }
867
+
868
+ // H-scroll case. Right edge of element may be out of viewport.
869
+ if ( ( hdiff = styles.left + styles.width - ( this.rect.left + this.winPane.width ) ) > 0 ) {
870
+ styles.width -= hdiff;
871
+ }
872
+ }
873
+
874
+ // Finally include horizontal scroll of the global window.
875
+ styles.left += this.winTopScroll.x;
876
+
877
+ // Append 'px' to style values.
878
+ for ( var style in styles ) {
879
+ styles[ style ] = CKEDITOR.tools.cssLength( styles[ style ] );
880
+ }
881
+
882
+ return styles;
883
+ },
884
+
885
+ /**
886
+ * Adds a new line to DOM.
887
+ *
888
+ * @returns {CKEDITOR.dom.element} A brand-new line.
889
+ */
890
+ addLine: function() {
891
+ var line = CKEDITOR.dom.element.createFromHtml( this.lineTpl );
892
+
893
+ line.appendTo( this.container );
894
+
895
+ return line;
896
+ },
897
+
898
+ /**
899
+ * Assigns a unique hash to the instance that is later used
900
+ * to tell unwanted lines from new ones. This method **must** be called
901
+ * before a new set of relations is to be visualized so {@link #cleanup}
902
+ * eventually hides obsolete lines. This is because lines
903
+ * are re-used between {@link #placeLine} calls and the number of
904
+ * necessary ones may vary depending on the number of relations.
905
+ *
906
+ * @param {Object} relations {@link CKEDITOR.plugins.lineutils.finder#relations}.
907
+ * @param {Object} locations {@link CKEDITOR.plugins.lineutils.locator#locations}.
908
+ */
909
+ prepare: function( relations, locations ) {
910
+ this.relations = relations;
911
+ this.locations = locations;
912
+ this.hash = Math.random();
913
+ },
914
+
915
+ /**
916
+ * Hides all visible lines that do not belong to current hash
917
+ * and no longer represent relations (locations).
918
+ *
919
+ * See also: {@link #prepare}.
920
+ */
921
+ cleanup: function() {
922
+ var line;
923
+
924
+ for ( var l in this.visible ) {
925
+ line = this.visible[ l ];
926
+
927
+ if ( line.getCustomData( 'hash' ) !== this.hash ) {
928
+ this.hideLine( line );
929
+ }
930
+ }
931
+ },
932
+
933
+ /**
934
+ * Queries dimensions of the viewport, editable, frame etc.
935
+ * that are used for correct positioning of the line.
936
+ */
937
+ queryViewport: function() {
938
+ this.winPane = this.win.getViewPaneSize();
939
+ this.winTopScroll = this.winTop.getScrollPosition();
940
+ this.winTopPane = this.winTop.getViewPaneSize();
941
+
942
+ // (http://dev.ckeditor.com/ticket/13155)
943
+ this.rect = this.getClientRect( this.inline ? this.editable : this.frame );
944
+ },
945
+
946
+ /**
947
+ * Returns `boundingClientRect` of an element, shifted by the position
948
+ * of `container` when the container is not `static` (http://dev.ckeditor.com/ticket/13155).
949
+ *
950
+ * See also: {@link CKEDITOR.dom.element#getClientRect}.
951
+ *
952
+ * @param {CKEDITOR.dom.element} el A DOM element.
953
+ * @returns {Object} A shifted rect, extended by `relativeY` and `relativeX` properties.
954
+ */
955
+ getClientRect: function( el ) {
956
+ var rect = el.getClientRect(),
957
+ relativeContainerDocPosition = this.container.getDocumentPosition(),
958
+ relativeContainerComputedPosition = this.container.getComputedStyle( 'position' );
959
+
960
+ // Static or not, those values are used to offset the position of the line so they cannot be undefined.
961
+ rect.relativeX = rect.relativeY = 0;
962
+
963
+ if ( relativeContainerComputedPosition != 'static' ) {
964
+ // Remember the offset used to shift the clientRect.
965
+ rect.relativeY = relativeContainerDocPosition.y;
966
+ rect.relativeX = relativeContainerDocPosition.x;
967
+
968
+ rect.top -= rect.relativeY;
969
+ rect.bottom -= rect.relativeY;
970
+ rect.left -= rect.relativeX;
971
+ rect.right -= rect.relativeX;
972
+ }
973
+
974
+ return rect;
975
+ }
976
+ };
977
+
978
+ function is( type, flag ) {
979
+ return type & flag;
980
+ }
981
+
982
+ var floats = { left: 1, right: 1, center: 1 },
983
+ positions = { absolute: 1, fixed: 1 };
984
+
985
+ function isElement( node ) {
986
+ return node && node.type == CKEDITOR.NODE_ELEMENT;
987
+ }
988
+
989
+ function isFloated( el ) {
990
+ return !!( floats[ el.getComputedStyle( 'float' ) ] || floats[ el.getAttribute( 'align' ) ] );
991
+ }
992
+
993
+ function isPositioned( el ) {
994
+ return !!positions[ el.getComputedStyle( 'position' ) ];
995
+ }
996
+
997
+ function isLimit( node ) {
998
+ return isElement( node ) && node.getAttribute( 'contenteditable' ) == 'true';
999
+ }
1000
+
1001
+ function isStatic( node ) {
1002
+ return isElement( node ) && !isFloated( node ) && !isPositioned( node );
1003
+ }
1004
+
1005
+ /**
1006
+ * Global namespace storing definitions and global helpers for the Line Utilities plugin.
1007
+ *
1008
+ * @private
1009
+ * @class
1010
+ * @singleton
1011
+ * @since 4.3
1012
+ */
1013
+ CKEDITOR.plugins.lineutils = {
1014
+ finder: Finder,
1015
+ locator: Locator,
1016
+ liner: Liner
1017
+ };
1018
+ } )();